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 <map>
20#include <unordered_map>
21
24
25namespace ns3
26{
27
28class NetDevice;
29
30/**
31 * \ingroup spectrum
32 * \brief 3GPP Spectrum Propagation Loss Model
33 *
34 * This class models the frequency dependent propagation phenomena in the way
35 * described by 3GPP TR 38.901 document. The main method is DoCalcRxPowerSpectralDensity,
36 * which takes as input the power spectral density (PSD) of the transmitted signal,
37 * the mobility models of the transmitting node and receiving node, and
38 * returns the PSD of the received signal.
39 *
40 * \see MatrixBasedChannelModel
41 * \see PhasedArrayModel
42 * \see ChannelCondition
43 */
45{
46 friend class ::ThreeGppCalcLongTermMultiPortTest;
47 friend class ::ThreeGppMimoPolarizationTest;
48
49 public:
50 /**
51 * Constructor
52 */
54
55 /**
56 * Destructor
57 */
59
60 void DoDispose() override;
61
62 /**
63 * Get the type ID.
64 * \return the object TypeId
65 */
66 static TypeId GetTypeId();
67
68 /**
69 * Set the channel model object
70 * \param channel a pointer to an object implementing the MatrixBasedChannelModel interface
71 */
73
74 /**
75 * Get the channel model object
76 * \return a pointer to the object implementing the MatrixBasedChannelModel interface
77 */
79
80 /**
81 * Sets the value of an attribute belonging to the associated
82 * MatrixBasedChannelModel instance
83 * \param name name of the attribute
84 * \param value the attribute value
85 */
86 void SetChannelModelAttribute(const std::string& name, const AttributeValue& value);
87
88 /**
89 * Returns the value of an attribute belonging to the associated
90 * MatrixBasedChannelModel instance
91 * \param name name of the attribute
92 * \param value where the result should be stored
93 */
94 void GetChannelModelAttribute(const std::string& name, AttributeValue& value) const;
95
96 /**
97 * \brief Computes the received PSD.
98 *
99 * This function computes the received PSD by applying the 3GPP fast fading
100 * model and the beamforming gain.
101 * In particular, it retrieves the matrix representing the channel between
102 * node a and node b, computes the corresponding long term component, i.e.,
103 * the product between the cluster matrices and the TX and RX beamforming
104 * vectors (w_rx^T H^n_ab w_tx), and accounts for the Doppler component and
105 * the propagation delay.
106 * To reduce the computational load, the long term component associated with
107 * a certain channel is cached and recomputed only when the channel realization
108 * is updated, or when the beamforming vectors change.
109 *
110 * \param spectrumSignalParams spectrum signal tx parameters
111 * \param a first node mobility model
112 * \param b second node mobility model
113 * \param aPhasedArrayModel the antenna array of the first node
114 * \param bPhasedArrayModel the antenna array of the second node
115 * \return the received PSD
116 */
118 Ptr<const SpectrumSignalParameters> spectrumSignalParams,
121 Ptr<const PhasedArrayModel> aPhasedArrayModel,
122 Ptr<const PhasedArrayModel> bPhasedArrayModel) const override;
123
124 protected:
125 /**
126 * Data structure that stores the long term component for a tx-rx pair
127 */
128 struct LongTerm : public SimpleRefCount<LongTerm>
129 {
131 m_longTerm; //!< vector containing the long term component for each cluster
133 m_channel; //!< pointer to the channel matrix used to compute the long term
135 m_sW; //!< the beamforming vector for the node s used to compute the long term
137 m_uW; //!< the beamforming vector for the node u used to compute the long term
138 };
139
140 /**
141 * Computes the frequency-domain channel matrix with the dimensions numRxPorts*numTxPorts*numRBs
142 * \param inPsd the input PSD
143 * \param longTerm the long term component
144 * \param channelMatrix the channel matrix structure
145 * \param channelParams the channel parameters, including delays
146 * \param doppler the doppler for each cluster
147 * \param numTxPorts the number of antenna ports at the transmitter
148 * \param numRxPorts the number of antenna ports at the receiver
149 * \param isReverse true if params and longTerm were computed with RX->TX switched
150 * \return 3D spectrum channel matrix with dimensions numRxPorts * numTxPorts * numRBs
151 */
153 Ptr<SpectrumValue> inPsd,
158 uint8_t numTxPorts,
159 uint8_t numRxPorts,
160 bool isReverse) const;
161
162 /**
163 * Get the operating frequency
164 * \return the operating frequency in Hz
165 */
166 double GetFrequency() const;
167
168 /**
169 * Looks for the long term component in m_longTermMap. If found, checks
170 * whether it has to be updated. If not found or if it has to be updated,
171 * calls the method CalcLongTerm to compute it.
172 * \param channelMatrix the channel matrix
173 * \param aPhasedArrayModel the antenna array of the tx device
174 * \param bPhasedArrayModel the antenna array of the rx device
175 * \return vector containing the long term component for each cluster
176 */
179 Ptr<const PhasedArrayModel> aPhasedArrayModel,
180 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
181 /**
182 * Computes the long term component
183 * \param channelMatrix the channel matrix H
184 * \param sAnt the pointer to the antenna of the s device
185 * \param uAnt the pointer to the antenna of the u device
186 * \return the long term component
187 */
191 Ptr<const PhasedArrayModel> uAnt) const;
192
193 /**
194 * \brief Computes a longTerm component from a specific port of s device to the
195 * specific port of u device and for a specific cluster index
196 * \param params The params that include the channel matrix
197 * \param sAnt pointer to first antenna
198 * \param uAnt uAnt pointer to second antenna
199 * \param sPortIdx the port index of the s device
200 * \param uPortIdx the port index of the u device
201 * \param cIndex the cluster index
202 * \return longTerm component for port pair and for a specific cluster index
203 */
204 std::complex<double> CalculateLongTermComponent(
208 uint16_t sPortIdx,
209 uint16_t uPortIdx,
210 uint16_t cIndex) const;
211
212 /**
213 * \brief Computes the beamforming gain and applies it to the TX PSD
214 * \param params SpectrumSignalParameters holding TX PSD
215 * \param longTerm the long term component
216 * \param channelMatrix the channel matrix structure
217 * \param channelParams the channel params structure
218 * \param sSpeed the speed of the first node
219 * \param uSpeed the speed of the second node
220 * \param numTxPorts the number of the ports of the first node
221 * \param numRxPorts the number of the porst of the second node
222 * \param isReverse indicator that tells whether the channel matrix is reverse
223 * \return
224 */
230 const Vector& sSpeed,
231 const Vector& uSpeed,
232 uint8_t numTxPorts,
233 uint8_t numRxPorts,
234 bool isReverse) const;
235
236 int64_t DoAssignStreams(int64_t stream) override;
237
238 mutable std::unordered_map<uint64_t, Ptr<const LongTerm>>
239 m_longTermMap; //!< map containing the long term components
240 Ptr<MatrixBasedChannelModel> m_channelModel; //!< the model to generate the channel matrix
241};
242} // namespace ns3
243
244#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
spectrum-aware propagation loss model that is compatible with PhasedArrayModel type of ns-3 antenna
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
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
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, uint8_t numTxPorts, uint8_t numRxPorts, bool isReverse) const
Computes the frequency-domain channel matrix with the dimensions numRxPorts*numTxPorts*numRBs.
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, uint8_t numTxPorts, uint8_t numRxPorts, bool isReverse) const
Computes the beamforming gain and applies it to the TX PSD.
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...
a unique identifier for an interface.
Definition type-id.h:48
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