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 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation;
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef THREE_GPP_SPECTRUM_PROPAGATION_LOSS_H
22#define THREE_GPP_SPECTRUM_PROPAGATION_LOSS_H
23
26
27#include "ns3/random-variable-stream.h"
28
29#include <complex.h>
30#include <map>
31#include <unordered_map>
32
35
36namespace ns3
37{
38
39class NetDevice;
40
41/**
42 * \ingroup spectrum
43 * \brief 3GPP Spectrum Propagation Loss Model
44 *
45 * This class models the frequency dependent propagation phenomena in the way
46 * described by 3GPP TR 38.901 document. The main method is DoCalcRxPowerSpectralDensity,
47 * which takes as input the power spectral density (PSD) of the transmitted signal,
48 * the mobility models of the transmitting node and receiving node, and
49 * returns the PSD of the received signal.
50 *
51 * \see MatrixBasedChannelModel
52 * \see PhasedArrayModel
53 * \see ChannelCondition
54 */
56{
57 friend class ::ThreeGppCalcLongTermMultiPortTest;
58 friend class ::ThreeGppMimoPolarizationTest;
59
60 public:
61 /**
62 * Constructor
63 */
65
66 /**
67 * Destructor
68 */
70
71 void DoDispose() override;
72
73 /**
74 * Get the type ID.
75 * \return the object TypeId
76 */
77 static TypeId GetTypeId();
78
79 /**
80 * Set the channel model object
81 * \param channel a pointer to an object implementing the MatrixBasedChannelModel interface
82 */
84
85 /**
86 * Get the channel model object
87 * \return a pointer to the object implementing the MatrixBasedChannelModel interface
88 */
90
91 /**
92 * Sets the value of an attribute belonging to the associated
93 * MatrixBasedChannelModel instance
94 * \param name name of the attribute
95 * \param value the attribute value
96 */
97 void SetChannelModelAttribute(const std::string& name, const AttributeValue& value);
98
99 /**
100 * Returns the value of an attribute belonging to the associated
101 * MatrixBasedChannelModel instance
102 * \param name name of the attribute
103 * \param value where the result should be stored
104 */
105 void GetChannelModelAttribute(const std::string& name, AttributeValue& value) const;
106
107 /**
108 * \brief Computes the received PSD.
109 *
110 * This function computes the received PSD by applying the 3GPP fast fading
111 * model and the beamforming gain.
112 * In particular, it retrieves the matrix representing the channel between
113 * node a and node b, computes the corresponding long term component, i.e.,
114 * the product between the cluster matrices and the TX and RX beamforming
115 * vectors (w_rx^T H^n_ab w_tx), and accounts for the Doppler component and
116 * the propagation delay.
117 * To reduce the computational load, the long term component associated with
118 * a certain channel is cached and recomputed only when the channel realization
119 * is updated, or when the beamforming vectors change.
120 *
121 * \param spectrumSignalParams spectrum signal tx parameters
122 * \param a first node mobility model
123 * \param b second node mobility model
124 * \param aPhasedArrayModel the antenna array of the first node
125 * \param bPhasedArrayModel the antenna array of the second node
126 * \return the received PSD
127 */
129 Ptr<const SpectrumSignalParameters> spectrumSignalParams,
132 Ptr<const PhasedArrayModel> aPhasedArrayModel,
133 Ptr<const PhasedArrayModel> bPhasedArrayModel) const override;
134
135 protected:
136 /**
137 * Data structure that stores the long term component for a tx-rx pair
138 */
139 struct LongTerm : public SimpleRefCount<LongTerm>
140 {
142 m_longTerm; //!< vector containing the long term component for each cluster
144 m_channel; //!< pointer to the channel matrix used to compute the long term
146 m_sW; //!< the beamforming vector for the node s used to compute the long term
148 m_uW; //!< the beamforming vector for the node u used to compute the long term
149 };
150
151 /**
152 * Computes the frequency-domain channel matrix with the dimensions numRxPorts*numTxPorts*numRBs
153 * \param inPsd the input PSD
154 * \param longTerm the long term component
155 * \param channelMatrix the channel matrix structure
156 * \param channelParams the channel parameters, including delays
157 * \param doppler the doppler for each cluster
158 * \param numTxPorts the number of antenna ports at the transmitter
159 * \param numRxPorts the number of antenna ports at the receiver
160 * \param isReverse true if params and longTerm were computed with RX->TX switched
161 * \return 3D spectrum channel matrix with dimensions numRxPorts * numTxPorts * numRBs
162 */
164 Ptr<SpectrumValue> inPsd,
169 uint8_t numTxPorts,
170 uint8_t numRxPorts,
171 bool isReverse) const;
172
173 /**
174 * Get the operating frequency
175 * \return the operating frequency in Hz
176 */
177 double GetFrequency() const;
178
179 /**
180 * Looks for the long term component in m_longTermMap. If found, checks
181 * whether it has to be updated. If not found or if it has to be updated,
182 * calls the method CalcLongTerm to compute it.
183 * \param channelMatrix the channel matrix
184 * \param aPhasedArrayModel the antenna array of the tx device
185 * \param bPhasedArrayModel the antenna array of the rx device
186 * \return vector containing the long term component for each cluster
187 */
190 Ptr<const PhasedArrayModel> aPhasedArrayModel,
191 Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
192 /**
193 * Computes the long term component
194 * \param channelMatrix the channel matrix H
195 * \param sAnt the pointer to the antenna of the s device
196 * \param uAnt the pointer to the antenna of the u device
197 * \return the long term component
198 */
202 Ptr<const PhasedArrayModel> uAnt) const;
203
204 /**
205 * \brief Computes a longTerm component from a specific port of s device to the
206 * specific port of u device and for a specific cluster index
207 * \param params The params that include the channel matrix
208 * \param sAnt pointer to first antenna
209 * \param uAnt uAnt pointer to second antenna
210 * \param sPortIdx the port index of the s device
211 * \param uPortIdx the port index of the u device
212 * \param cIndex the cluster index
213 * \return longTerm component for port pair and for a specific cluster index
214 */
215 std::complex<double> CalculateLongTermComponent(
219 uint16_t sPortIdx,
220 uint16_t uPortIdx,
221 uint16_t cIndex) const;
222
223 /**
224 * \brief Computes the beamforming gain and applies it to the TX PSD
225 * \param params SpectrumSignalParameters holding TX PSD
226 * \param longTerm the long term component
227 * \param channelMatrix the channel matrix structure
228 * \param channelParams the channel params structure
229 * \param sSpeed the speed of the first node
230 * \param uSpeed the speed of the second node
231 * \param numTxPorts the number of the ports of the first node
232 * \param numRxPorts the number of the porst of the second node
233 * \param isReverse indicator that tells whether the channel matrix is reverse
234 * \return
235 */
241 const Vector& sSpeed,
242 const Vector& uSpeed,
243 uint8_t numTxPorts,
244 uint8_t numRxPorts,
245 bool isReverse) const;
246
247 int64_t DoAssignStreams(int64_t stream) override;
248
249 mutable std::unordered_map<uint64_t, Ptr<const LongTerm>>
250 m_longTermMap; //!< map containing the long term components
251 Ptr<MatrixBasedChannelModel> m_channelModel; //!< the model to generate the channel matrix
252};
253} // namespace ns3
254
255#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:70
spectrum-aware propagation loss model that is compatible with PhasedArrayModel type of ns-3 antenna
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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:59
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