A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sionna-rt-spectrum-propagation-loss-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 * Author: Amir Ashtari <aashtari@cttc.es>
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#ifndef SIONNA_RT_SPECTRUM_PROPAGATION_LOSS_H
8#define SIONNA_RT_SPECTRUM_PROPAGATION_LOSS_H
9
13
14#include "ns3/random-variable-stream.h"
15
16#include <complex.h>
17#include <map>
18#include <unordered_map>
19
22
23namespace ns3
24{
25
26class NetDevice;
27
28/**
29 * @ingroup spectrum
30 * @brief 3GPP Spectrum Propagation Loss Model
31 *
32 * This class models the frequency dependent propagation phenomena in the way
33 * described by 3GPP TR 38.901 document. The main method is DoCalcRxPowerSpectralDensity,
34 * which takes as input the power spectral density (PSD) of the transmitted signal,
35 * the mobility models of the transmitting node and receiving node, and
36 * returns the PSD of the received signal.
37 *
38 * @see MatrixBasedChannelModel
39 * @see PhasedArrayModel
40 * @see ChannelCondition
41 */
43{
44 friend class ::ThreeGppCalcLongTermMultiPortTest;
45 friend class ::ThreeGppMimoPolarizationTest;
46
47 public:
48 /**
49 * Constructor
50 */
52
53 /**
54 * Destructor
55 */
57
58 void DoDispose() override;
59
60 /**
61 * Get the type ID.
62 * @return the object TypeId
63 */
64 static TypeId GetTypeId();
65
66 /**
67 * Set the channel model object
68 * @param channel a pointer to an object implementing the MatrixBasedChannelModel interface
69 */
71
72 /**
73 * Get the channel model object
74 * @return a pointer to the object implementing the MatrixBasedChannelModel interface
75 */
77
78 /**
79 * Sets the value of an attribute belonging to the associated
80 * MatrixBasedChannelModel instance
81 * @param name name of the attribute
82 * @param value the attribute value
83 */
84 void SetChannelModelAttribute(const std::string& name, const AttributeValue& value);
85
86 /**
87 * Returns the value of an attribute belonging to the associated
88 * MatrixBasedChannelModel instance
89 * @param name name of the attribute
90 * @param value where the result should be stored
91 */
92 void GetChannelModelAttribute(const std::string& name, AttributeValue& value) const;
93
94 /**
95 * @brief Computes the received PSD.
96 *
97 * This function computes the received PSD by applying the 3GPP fast fading
98 * model and the beamforming gain.
99 * In particular, it retrieves the matrix representing the channel between
100 * node a and node b, computes the corresponding long term component, i.e.,
101 * the product between the cluster matrices and the TX and RX beamforming
102 * vectors (w_rx^T H^n_ab w_tx), and accounts for the Doppler component and
103 * the propagation delay.
104 * To reduce the computational load, the long term component associated with
105 * a certain channel is cached and recomputed only when the channel realization
106 * is updated, or when the beamforming vectors change.
107 *
108 * @param spectrumSignalParams spectrum signal tx parameters
109 * @param a first node mobility model
110 * @param b second node mobility model
111 * @param aPhasedArrayModel the antenna array of the first node
112 * @param bPhasedArrayModel the antenna array of the second node
113 * @return the received PSD
114 */
116 Ptr<const SpectrumSignalParameters> spectrumSignalParams,
119 Ptr<const PhasedArrayModel> aPhasedArrayModel,
120 Ptr<const PhasedArrayModel> bPhasedArrayModel) const override;
121
122 /**
123 * Set the ray-tracing path solver configurations
124 * @param configs the configuration structure
125 */
127
128 protected:
129 /**
130 * Data structure that stores the long term component for a tx-rx pair
131 */
132 struct LongTerm : public SimpleRefCount<LongTerm>
133 {
135 m_longTerm; //!< vector containing the long term component for each cluster
137 m_channel; //!< pointer to the channel matrix used to compute the long term
139 m_sW; //!< the beamforming vector for the node s used to compute the long term
141 m_uW; //!< the beamforming vector for the node u used to compute the long term
142 };
143
144 /**
145 * Computes the frequency-domain channel matrix with the dimensions numRxPorts*numTxPorts*numRBs
146 * @param inPsd the input PSD
147 * @param longTerm the long term component
148 * @param channelMatrix the channel matrix structure
149 * @param channelParams the channel parameters, including delays
150 * @param doppler the doppler for each cluster
151 * @param numTxPorts the number of antenna ports at the transmitter
152 * @param numRxPorts the number of antenna ports at the receiver
153 * @param isReverse true if params and longTerm were computed with RX->TX switched
154 * @return 3D spectrum channel matrix with dimensions numRxPorts * numTxPorts * numRBs
155 */
157 Ptr<SpectrumValue> inPsd,
162 const uint8_t numTxPorts,
163 const uint8_t numRxPorts,
164 const bool isReverse);
165
166 /**
167 * Get the operating frequency
168 * @return the operating frequency in Hz
169 */
170 double GetFrequency() const;
171
172 /**
173 * Looks for the long term component in m_longTermMap. If found, checks
174 * whether it has to be updated. If not found or if it has to be updated,
175 * calls the method CalcLongTerm to compute it.
176 * @param channelMatrix the channel matrix
177 * @param aPhasedArrayModel the antenna array of the tx device
178 * @param bPhasedArrayModel the antenna array of the rx device
179 * @return vector containing the long term component for each cluster
180 */
183 Ptr<const PhasedArrayModel> aPhasedArrayModel,
184 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
185 /**
186 * Computes the long term component
187 * @param channelMatrix the channel matrix H
188 * @param sAnt the pointer to the antenna of the s device
189 * @param uAnt the pointer to the antenna of the u device
190 * @return the long term component
191 */
195 Ptr<const PhasedArrayModel> uAnt) const;
196
197 /**
198 * @brief Computes a longTerm component from a specific port of s device to the
199 * specific port of u device and for a specific cluster index
200 * @param params The params that include the channel matrix
201 * @param sAnt pointer to first antenna
202 * @param uAnt uAnt pointer to second antenna
203 * @param sPortIdx the port index of the s device
204 * @param uPortIdx the port index of the u device
205 * @param cIndex the cluster index
206 * @return longTerm component for port pair and for a specific cluster index
207 */
208 std::complex<double> CalculateLongTermComponent(
212 uint16_t sPortIdx,
213 uint16_t uPortIdx,
214 uint16_t cIndex) const;
215
216 /**
217 * @brief Computes the beamforming gain and applies it to the TX PSD
218 * @param params SpectrumSignalParameters holding TX PSD
219 * @param longTerm the long term component
220 * @param channelMatrix the channel matrix structure
221 * @param channelParams the channel params structure
222 * @param sSpeed the speed of the first node
223 * @param uSpeed the speed of the second node
224 * @param numTxPorts the number of the ports of the first node
225 * @param numRxPorts the number of the porst of the second node
226 * @param isReverse indicator that tells whether the channel matrix is reverse
227 * @return
228 */
234 const Vector& sSpeed,
235 const Vector& uSpeed,
236 uint8_t numTxPorts,
237 uint8_t numRxPorts,
238 bool isReverse) const;
239
240 int64_t DoAssignStreams(int64_t stream) override;
241
242 mutable std::unordered_map<uint64_t, Ptr<const LongTerm>>
243 m_longTermMap; //!< map containing the long term components
244 Ptr<MatrixBasedChannelModel> m_channelModel; //!< the model to generate the channel matrix
245};
246} // namespace ns3
247
248#endif /* SIONNA_RT_SPECTRUM_PROPAGATION_LOSS_H */
Test case that test the correct use of the multi-port antennas in spectrum.
This test tests that the channel matrix is correctly generated when dual-polarized antennas are being...
Hold a value for an Attribute.
Definition attribute.h:59
Network layer to device interface.
Definition net-device.h:87
ComplexMatrixArray ComplexVector
the underlying Valarray
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
std::complex< double > CalculateLongTermComponent(Ptr< const MatrixBasedChannelModel::ChannelMatrix > params, Ptr< const PhasedArrayModel > sAnt, Ptr< const PhasedArrayModel > uAnt, uint16_t sPortIdx, uint16_t uPortIdx, uint16_t cIndex) const
Computes a longTerm component from a specific port of s device to the specific port of u device and f...
Ptr< const MatrixBasedChannelModel::Complex3DVector > CalcLongTerm(Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, Ptr< const PhasedArrayModel > sAnt, Ptr< const PhasedArrayModel > uAnt) const
Computes the long term component.
void GetChannelModelAttribute(const std::string &name, AttributeValue &value) const
Returns the value of an attribute belonging to the associated MatrixBasedChannelModel instance.
Ptr< const MatrixBasedChannelModel::Complex3DVector > GetLongTerm(Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, Ptr< const PhasedArrayModel > aPhasedArrayModel, Ptr< const PhasedArrayModel > bPhasedArrayModel) const
Looks for the long term component in m_longTermMap.
static Ptr< MatrixBasedChannelModel::Complex3DVector > GenSpectrumChannelMatrix(Ptr< SpectrumValue > inPsd, Ptr< const MatrixBasedChannelModel::Complex3DVector > longTerm, Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, Ptr< const MatrixBasedChannelModel::ChannelParams > channelParams, PhasedArrayModel::ComplexVector doppler, const uint8_t numTxPorts, const uint8_t numRxPorts, const bool isReverse)
Computes the frequency-domain channel matrix with the dimensions numRxPorts*numTxPorts*numRBs.
Ptr< SpectrumSignalParameters > DoCalcRxPowerSpectralDensity(Ptr< const SpectrumSignalParameters > spectrumSignalParams, Ptr< const MobilityModel > a, Ptr< const MobilityModel > b, Ptr< const PhasedArrayModel > aPhasedArrayModel, Ptr< const PhasedArrayModel > bPhasedArrayModel) const override
Computes the received PSD.
void SetChannelModel(Ptr< MatrixBasedChannelModel > channel)
Set the channel model object.
Ptr< SpectrumSignalParameters > CalcBeamformingGain(Ptr< const SpectrumSignalParameters > params, Ptr< const MatrixBasedChannelModel::Complex3DVector > longTerm, Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, Ptr< const MatrixBasedChannelModel::ChannelParams > channelParams, const Vector &sSpeed, const Vector &uSpeed, uint8_t numTxPorts, uint8_t numRxPorts, bool isReverse) const
Computes the beamforming gain and applies it to the TX PSD.
void SetChannelModelAttribute(const std::string &name, const AttributeValue &value)
Sets the value of an attribute belonging to the associated MatrixBasedChannelModel instance.
Ptr< MatrixBasedChannelModel > GetChannelModel() const
Get the channel model object.
Ptr< MatrixBasedChannelModel > m_channelModel
the model to generate the channel matrix
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::unordered_map< uint64_t, Ptr< const LongTerm > > m_longTermMap
map containing the long term components
void SetRtPathSolverConfig(SionnaRtChannelModel::RtPathSolverConfig configs)
Set the ray-tracing path solver configurations.
a unique identifier for an interface.
Definition type-id.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Configuration for the Sionna RT PathSolver.
Data structure that stores the long term component for a tx-rx pair.
PhasedArrayModel::ComplexVector m_sW
the beamforming vector for the node s used to compute the long term
Ptr< const MatrixBasedChannelModel::Complex3DVector > m_longTerm
vector containing the long term component for each cluster
PhasedArrayModel::ComplexVector m_uW
the beamforming vector for the node u used to compute the long term
Ptr< const MatrixBasedChannelModel::ChannelMatrix > m_channel
pointer to the channel matrix used to compute the long term