A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
three-gpp-spectrum-propagation-loss-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015, NYU WIRELESS, Tandon School of Engineering,
3 * New York University
4 * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering,
5 * University of Padova
6 *
7 * SPDX-License-Identifier: GPL-2.0-only
8 */
9
10#ifndef THREE_GPP_SPECTRUM_PROPAGATION_LOSS_H
11#define THREE_GPP_SPECTRUM_PROPAGATION_LOSS_H
12
15
16#include "ns3/random-variable-stream.h"
17
18#include <complex.h>
19#include <unordered_map>
20
23
24namespace ns3
25{
26
27class NetDevice;
28
29/**
30 * @ingroup spectrum
31 * @brief 3GPP Spectrum Propagation Loss Model
32 *
33 * This class models the frequency dependent propagation phenomena in the way
34 * described by 3GPP TR 38.901 document. The main method is DoCalcRxPowerSpectralDensity,
35 * which takes as input the power spectral density (PSD) of the transmitted signal,
36 * the mobility models of the transmitting node and receiving node, and
37 * returns the PSD of the received signal.
38 *
39 * @see MatrixBasedChannelModel
40 * @see PhasedArrayModel
41 * @see ChannelCondition
42 */
44{
45 friend class ::ThreeGppCalcLongTermMultiPortTest;
46 friend class ::ThreeGppMimoPolarizationTest;
47
48 public:
49 /**
50 * Constructor
51 */
53
54 /**
55 * Destructor
56 */
58
59 void DoDispose() override;
60
61 /**
62 * Get the type ID.
63 * @return the object TypeId
64 */
65 static TypeId GetTypeId();
66
67 /**
68 * Set the channel model object
69 * @param channel a pointer to an object implementing the MatrixBasedChannelModel interface
70 */
72
73 /**
74 * Get the channel model object
75 * @return a pointer to the object implementing the MatrixBasedChannelModel interface
76 */
78
79 /**
80 * Sets the value of an attribute belonging to the associated
81 * MatrixBasedChannelModel instance
82 * @param name name of the attribute
83 * @param value the attribute value
84 */
85 void SetChannelModelAttribute(const std::string& name, const AttributeValue& value);
86
87 /**
88 * Returns the value of an attribute belonging to the associated
89 * MatrixBasedChannelModel instance
90 * @param name name of the attribute
91 * @param value where the result should be stored
92 */
93 void GetChannelModelAttribute(const std::string& name, AttributeValue& value) const;
94
95 /**
96 * @brief Computes the received PSD.
97 *
98 * This function computes the received PSD by applying the 3GPP fast fading
99 * model and the beamforming gain.
100 * In particular, it retrieves the matrix representing the channel between
101 * node a and node b, computes the corresponding long term component, i.e.,
102 * the product between the cluster matrices and the TX and RX beamforming
103 * vectors (w_rx^T H^n_ab w_tx), and accounts for the Doppler component and
104 * the propagation delay.
105 * To reduce the computational load, the long term component associated with
106 * a certain channel is cached and recomputed only when the channel realization
107 * is updated, or when the beamforming vectors change.
108 *
109 * @param spectrumSignalParams spectrum signal tx parameters
110 * @param a first node mobility model
111 * @param b second node mobility model
112 * @param aPhasedArrayModel the antenna array of the first node
113 * @param bPhasedArrayModel the antenna array of the second node
114 * @return the received PSD
115 */
117 Ptr<const SpectrumSignalParameters> spectrumSignalParams,
120 Ptr<const PhasedArrayModel> aPhasedArrayModel,
121 Ptr<const PhasedArrayModel> bPhasedArrayModel) const override;
122
123 protected:
124 /**
125 * Data structure that stores the long term component for a tx-rx pair
126 */
127 struct LongTerm : SimpleRefCount<LongTerm>
128 {
130 m_longTerm; //!< vector containing the long term component for each cluster
132 m_channel; //!< pointer to the channel matrix used to compute the long term
134 m_sW; //!< the beamforming vector for the node s used to compute the long term
136 m_uW; //!< the beamforming vector for the node u used to compute the long term
137 };
138
139 /**
140 * Computes the frequency-domain channel matrix with the dimensions numRxPorts*numTxPorts*numRBs
141 * @param inPsd the input PSD
142 * @param longTerm the long term component
143 * @param channelMatrix the channel matrix structure
144 * @param channelParams the channel parameters, including delays
145 * @param doppler the doppler for each cluster
146 * @param numTxPorts the number of antenna ports at the transmitter
147 * @param numRxPorts the number of antenna ports at the receiver
148 * @param isReverse true if params and longTerm were computed with RX->TX switched
149 * @return 3D spectrum channel matrix with dimensions numRxPorts * numTxPorts * numRBs
150 */
152 Ptr<SpectrumValue> inPsd,
157 const uint8_t numTxPorts,
158 const uint8_t numRxPorts,
159 const bool isReverse);
160
161 /**
162 * Get the operating frequency
163 * @return the operating frequency in Hz
164 */
165 double GetFrequency() const;
166
167 /**
168 * Looks for the long term component in m_longTermMap. If found, checks
169 * whether it has to be updated. If not found or if it has to be updated,
170 * calls the method CalcLongTerm to compute it.
171 * @param channelMatrix the channel matrix
172 * @param aPhasedArrayModel the antenna array of the tx device
173 * @param bPhasedArrayModel the antenna array of the rx device
174 * @return vector containing the long term component for each cluster
175 */
178 Ptr<const PhasedArrayModel> aPhasedArrayModel,
179 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
180 /**
181 * Computes the long term component
182 * @param channelMatrix the channel matrix H
183 * @param sAnt the pointer to the antenna of the s device
184 * @param uAnt the pointer to the antenna of the u device
185 * @return the long term component
186 */
190 Ptr<const PhasedArrayModel> uAnt) const;
191
192 /**
193 * @brief Computes a longTerm component from a specific port of s device to the
194 * specific port of u device and for a specific cluster index
195 *
196 * The beamformed (long-term) effective channel coefficient:
197 * \f$ h_{\rm eff} = \mathbf{w}_{\rm rx}^H \mathbf{H} \mathbf{w}_{\rm tx} \f$.
198 *
199 * @note The RX beamforming vector is stored on the antenna as \f$\mathbf{w}_{\rm rx}\f$.
200 * This function applies it as a Hermitian inner product (i.e., uses the complex
201 * conjugate of the RX weights) when forming \f$\mathbf{w}_{\rm rx}^H\f$.
202 * @param params The params that include the channel matrix
203 * @param sAnt pointer to first antenna
204 * @param uAnt uAnt pointer to second antenna
205 * @param sPortIdx the port index of the s device
206 * @param uPortIdx the port index of the u device
207 * @param cIndex the cluster index
208 * @return longTerm component for port pair and for a specific cluster index
209 */
210 std::complex<double> CalculateLongTermComponent(
214 const uint16_t sPortIdx,
215 const uint16_t uPortIdx,
216 const uint16_t cIndex) const;
217
218 /**
219 * @brief Computes the beamforming gain and applies it to the TX PSD
220 * @param params SpectrumSignalParameters holding TX PSD
221 * @param longTerm the long term component
222 * @param channelMatrix the channel matrix structure
223 * @param channelParams the channel params structure
224 * @param sSpeed the speed of the first node
225 * @param uSpeed the speed of the second node
226 * @param numTxPorts the number of the ports of the first node
227 * @param numRxPorts the number of the ports of the second node
228 * @param isReverse indicator that tells whether the channel matrix is reverse
229 * @return
230 */
236 const Vector& sSpeed,
237 const Vector& uSpeed,
238 const uint8_t numTxPorts,
239 const uint8_t numRxPorts,
240 const bool isReverse) const;
241
242 int64_t DoAssignStreams(int64_t stream) override;
243
244 //! map containing the long-term components
245 mutable std::unordered_map<uint64_t, Ptr<const LongTerm>> m_longTermMap;
246 //! the model to generate the channel matrix
248};
249} // namespace ns3
250
251#endif /* THREE_GPP_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
void GetChannelModelAttribute(const std::string &name, AttributeValue &value) const
Returns the value of an attribute belonging to the associated MatrixBasedChannelModel instance.
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.
Ptr< MatrixBasedChannelModel > m_channelModel
the model to generate the channel matrix
std::complex< double > CalculateLongTermComponent(Ptr< const MatrixBasedChannelModel::ChannelMatrix > params, Ptr< const PhasedArrayModel > sAnt, Ptr< const PhasedArrayModel > uAnt, const uint16_t sPortIdx, const uint16_t uPortIdx, const 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 > GetLongTerm(Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, Ptr< const PhasedArrayModel > aPhasedArrayModel, Ptr< const PhasedArrayModel > bPhasedArrayModel) const
Looks for the long term component in m_longTermMap.
void SetChannelModel(Ptr< MatrixBasedChannelModel > channel)
Set the channel model object.
Ptr< const MatrixBasedChannelModel::Complex3DVector > CalcLongTerm(Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, Ptr< const PhasedArrayModel > sAnt, Ptr< const PhasedArrayModel > uAnt) const
Computes the long term component.
std::unordered_map< uint64_t, Ptr< const LongTerm > > m_longTermMap
map containing the long-term components
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
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< 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, const uint8_t numTxPorts, const uint8_t numRxPorts, const bool isReverse) const
Computes the beamforming gain and applies it to the TX PSD.
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.
a unique identifier for an interface.
Definition type-id.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Data structure that stores the long term component for a tx-rx pair.
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
PhasedArrayModel::ComplexVector m_sW
the beamforming vector for the node s used to compute the long term