A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
three-gpp-channel-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_CHANNEL_H
22#define THREE_GPP_CHANNEL_H
23
25
26#include "ns3/angles.h"
27#include <ns3/boolean.h>
28#include <ns3/channel-condition-model.h>
29
30#include <complex.h>
31#include <unordered_map>
32
33namespace ns3
34{
35
36class MobilityModel;
37
38/**
39 * \ingroup spectrum
40 * \brief Channel Matrix Generation following 3GPP TR 38.901
41 *
42 * The class implements the channel matrix generation procedure
43 * described in 3GPP TR 38.901.
44 *
45 * \see GetChannel
46 */
48{
49 public:
50 /**
51 * Constructor
52 */
54
55 /**
56 * Destructor
57 */
58 ~ThreeGppChannelModel() override;
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 condition model
70 * \param model a pointer to the ChannelConditionModel object
71 */
73
74 /**
75 * Get the associated channel condition model
76 * \return a pointer to the ChannelConditionModel object
77 */
79
80 /**
81 * Sets the center frequency of the model
82 * \param f the center frequency in Hz
83 */
84 void SetFrequency(double f);
85
86 /**
87 * Returns the center frequency
88 * \return the center frequency in Hz
89 */
90 double GetFrequency() const;
91
92 /**
93 * Sets the propagation scenario
94 * \param scenario the propagation scenario
95 */
96 void SetScenario(const std::string& scenario);
97
98 /**
99 * Returns the propagation scenario
100 * \return the propagation scenario
101 */
102 std::string GetScenario() const;
103
104 /**
105 * Looks for the channel matrix associated to the aMob and bMob pair in m_channelMatrixMap.
106 * If found, it checks if it has to be updated. If not found or if it has to
107 * be updated, it generates a new uncorrelated channel matrix using the
108 * method GetNewChannel and updates m_channelMap.
109 *
110 * \param aMob mobility model of the a device
111 * \param bMob mobility model of the b device
112 * \param aAntenna antenna of the a device
113 * \param bAntenna antenna of the b device
114 * \return the channel matrix
115 */
119 Ptr<const PhasedArrayModel> bAntenna) override;
120
121 /**
122 * Looks for the channel params associated to the aMob and bMob pair in
123 * m_channelParamsMap. If not found it will return a nullptr.
124 *
125 * \param aMob mobility model of the a device
126 * \param bMob mobility model of the b device
127 * \return the channel params
128 */
130 Ptr<const MobilityModel> bMob) const override;
131 /**
132 * \brief Assign a fixed random variable stream number to the random variables
133 * used by this model.
134 *
135 * \param stream first stream index to use
136 * \return the number of stream indices assigned by this model
137 */
138 int64_t AssignStreams(int64_t stream);
139
140 protected:
141 /**
142 * Wrap an (azimuth, inclination) angle pair in a valid range.
143 * Specifically, inclination must be in [0, M_PI] and azimuth in [0, 2*M_PI).
144 * If the inclination angle is outside of its range, the azimuth angle is
145 * rotated by M_PI.
146 * This methods aims specifically at solving the problem of generating angles at
147 * the boundaries of the angle domain, specifically, generating angle distributions
148 * close to inclinationRad=0 and inclinationRad=M_PI.
149 *
150 * \param azimuthRad the azimuth angle in radians
151 * \param inclinationRad the inclination angle in radians
152 * \return the wrapped (azimuth, inclination) angle pair in radians
153 */
154 static std::pair<double, double> WrapAngles(double azimuthRad, double inclinationRad);
155
156 /**
157 * \brief Shuffle the elements of a simple sequence container of type double
158 * \param first Pointer to the first element among the elements to be shuffled
159 * \param last Pointer to the last element among the elements to be shuffled
160 */
161 void Shuffle(double* first, double* last) const;
162
163 /**
164 * Extends the struct ChannelParams by including information that is used
165 * within the ThreeGppChannelModel class
166 */
168 {
170 m_losCondition; //!< contains the information about the LOS state of the channel
172 m_o2iCondition; //!< contains the information about the O2I state of the channel
173 // TODO these are not currently used, they have to be correctly set when including the
174 // spatial consistent update procedure
175 /*The following parameters are stored for spatial consistent updating. The notation is
176 that of 3GPP technical reports, but it can apply also to other channel realizations*/
178 Vector m_preLocUT; //!< location of UT when generating the previous channel
179 Vector m_locUT; //!< location of UT
181 m_norRvAngles; //!< stores the normal variable for random angles angle[cluster][id]
182 //!< generated for equation (7.6-11)-(7.6-14), where id =
183 //!< 0(aoa),1(zoa),2(aod),3(zod)
184 double m_DS; //!< delay spread
185 double m_K_factor; //!< K factor
186 uint8_t m_reducedClusterNumber; //!< reduced cluster number;
188 m_rayAodRadian; //!< the vector containing AOD angles
190 m_rayAoaRadian; //!< the vector containing AOA angles
192 m_rayZodRadian; //!< the vector containing ZOD angles
194 m_rayZoaRadian; //!< the vector containing ZOA angles
197 m_crossPolarizationPowerRatios; //!< cross polarization power ratios
198 Vector m_speed; //!< velocity
199 double m_dis2D; //!< 2D distance between tx and rx
200 double m_dis3D; //!< 3D distance between tx and rx
201 DoubleVector m_clusterPower; //!< cluster powers
202 DoubleVector m_attenuation_dB; //!< vector that stores the attenuation of the blockage
203 uint8_t m_cluster1st; //!< index of the first strongest cluster
204 uint8_t m_cluster2nd; //!< index of the second strongest cluster
205 };
206
207 /**
208 * Data structure that stores the parameters of 3GPP TR 38.901, Table 7.5-6,
209 * for a certain scenario
210 */
211 struct ParamsTable : public SimpleRefCount<ParamsTable>
212 {
213 uint8_t m_numOfCluster = 0; //!< Number of clusters
214 uint8_t m_raysPerCluster = 0; //!< Number of rays per cluster
215 double m_uLgDS = 0; //!< Mean value of 10-base logarithm of delay spread
216 double m_sigLgDS = 0; //!< Standard deviation value of 10-base logarithm of delay spread
217 double m_uLgASD =
218 0; //!< Mean value of 10-base logarithm of azimuth angle spread of departure
219 double m_sigLgASD =
220 0; //!< Standard deviation of 10-base logarithm of azimuth angle spread of departure
221 double m_uLgASA = 0; //!< Mean value of 10-base logarithm of azimuth angle spread of arrival
222 double m_sigLgASA =
223 0; //!< Standard deviation of 10-base logarithm of azimuth angle spread of arrival
224 double m_uLgZSA = 0; //!< Mean value of 10-base logarithm of zenith angle spread of arrival
225 double m_sigLgZSA =
226 0; //!< Standard deviation of 10-base logarithm of zenith angle spread of arrival
227 double m_uLgZSD =
228 0; //!< Mean value of 10-base logarithm of zenith angle spread of departure
229 double m_sigLgZSD =
230 0; //!< Standard deviation of 10-base logarithm of zenith angle spread of departure
231 double m_offsetZOD = 0; //!< Offset of zenith angle of departure
232 double m_cDS = 0; //!< Cluster DS
233 double m_cASD = 0; //!< Cluster ASD (Azimuth angle Spread of Departure)
234 double m_cASA = 0; //!< Cluster ASA (Azimuth angle Spread of Arrival)
235 double m_cZSA = 0; //!< Cluster ZSA (Zenith angle Spread of Arrival)
236 double m_uK = 0; //!< Mean of K-factor
237 double m_sigK = 0; //!< Standard deviation of K-factor
238 double m_rTau = 0; //!< Delay scaling parameter
239 double m_uXpr = 0; //!< Mean of Cross-Polarization Ratio
240 double m_sigXpr = 0; //!< Standard deviation of Cross-Polarization Ratio
241 double m_perClusterShadowingStd = 0; //!< Per cluster shadowing standard deviation
242 double m_sqrtC[7][7]; //!< The square root matrix and follows the order of [SF, K, DS, ASD,
243 //!< ASA, ZSD, ZSA]
244 };
245
246 /**
247 * Get the parameters needed to apply the channel generation procedure
248 * \param channelCondition the channel condition
249 * \param hBS the height of the BS
250 * \param hUT the height of the UT
251 * \param distance2D the 2D distance between tx and rx
252 * \return the parameters table
253 */
255 double hBS,
256 double hUT,
257 double distance2D) const;
258
259 /**
260 * Prepare 3gpp channel parameters among the nodes a and b.
261 * The function does the following steps described in 3GPP 38.901:
262 *
263 * Step 4: Generate large scale parameters. All LSPS are uncorrelated.
264 * Step 5: Generate Delays.
265 * Step 6: Generate cluster powers.
266 * Step 7: Generate arrival and departure angles for both azimuth and elevation.
267 * Step 8: Coupling of rays within a cluster for both azimuth and elevation
268 * shuffle all the arrays to perform random coupling
269 * Step 9: Generate the cross polarization power ratios
270 * Step 10: Draw initial phases
271 *
272 * All relevant generated parameters are added then to ThreeGppChannelParams
273 * which is the return value of this function.
274 * \param channelCondition the channel condition
275 * \param table3gpp the 3gpp parameters from the table
276 * \param aMob the a node mobility model
277 * \param bMob the b node mobility model
278 * \return ThreeGppChannelParams structure with all the channel parameters generated
279 * according 38.901 steps from 4 to 10.
280 */
282 const Ptr<const ChannelCondition> channelCondition,
283 const Ptr<const ParamsTable> table3gpp,
284 const Ptr<const MobilityModel> aMob,
285 const Ptr<const MobilityModel> bMob) const;
286
287 /**
288 * Compute the channel matrix between two nodes a and b, and their
289 * antenna arrays aAntenna and bAntenna using the procedure
290 * described in 3GPP TR 38.901
291 * \param channelParams the channel parameters previously generated for the pair of
292 * nodes a and b
293 * \param table3gpp the 3gpp parameters table
294 * \param sMob the mobility model of node s
295 * \param uMob the mobility model of node u
296 * \param sAntenna the antenna array of node s
297 * \param uAntenna the antenna array of node u
298 * \return the channel realization
299 */
300
302 Ptr<const ParamsTable> table3gpp,
303 const Ptr<const MobilityModel> sMob,
304 const Ptr<const MobilityModel> uMob,
306 Ptr<const PhasedArrayModel> uAntenna) const;
307 /**
308 * Applies the blockage model A described in 3GPP TR 38.901
309 * \param channelParams the channel parameters structure
310 * \param clusterAOA vector containing the azimuth angle of arrival for each cluster
311 * \param clusterZOA vector containing the zenith angle of arrival for each cluster
312 * \return vector containing the power attenuation for each cluster
313 */
316 const DoubleVector& clusterAOA,
317 const DoubleVector& clusterZOA) const;
318
319 /**
320 * Check if the channel params has to be updated
321 * \param channelParams channel params
322 * \param channelCondition the channel condition
323 * \return true if the channel params has to be updated, false otherwise
324 */
326 Ptr<const ChannelCondition> channelCondition) const;
327
328 /**
329 * Check if the channel matrix has to be updated (it needs update when the channel params
330 * generation time is more recent than channel matrix generation time
331 * \param channelParams channel params structure
332 * \param channelMatrix channel matrix structure
333 * \return true if the channel matrix has to be updated, false otherwise
334 */
336 Ptr<const ChannelMatrix> channelMatrix);
337
338 std::unordered_map<uint64_t, Ptr<ChannelMatrix>>
339 m_channelMatrixMap; //!< map containing the channel realizations per pair of
340 //!< PhasedAntennaArray instances, the key of this map is reciprocal
341 //!< uniquely identifies a pair of PhasedAntennaArrays
342 std::unordered_map<uint64_t, Ptr<ThreeGppChannelParams>>
343 m_channelParamsMap; //!< map containing the common channel parameters per pair of nodes, the
344 //!< key of this map is reciprocal and uniquely identifies a pair of
345 //!< nodes
346 Time m_updatePeriod; //!< the channel update period
347 double m_frequency; //!< the operating frequency
348 std::string m_scenario; //!< the 3GPP scenario
349 Ptr<ChannelConditionModel> m_channelConditionModel; //!< the channel condition model
350 Ptr<UniformRandomVariable> m_uniformRv; //!< uniform random variable
351 Ptr<NormalRandomVariable> m_normalRv; //!< normal random variable
353 m_uniformRvShuffle; //!< uniform random variable used to shuffle array in GetNewChannel
354
355 // Variable used to compute the additional Doppler contribution for the delayed
356 // (reflected) paths, as described in 3GPP TR 37.885 v15.3.0, Sec. 6.2.3.
357 double m_vScatt; //!< value used to compute the additional Doppler contribution for the delayed
358 //!< paths
359 Ptr<UniformRandomVariable> m_uniformRvDoppler; //!< uniform random variable, used to compute the
360 //!< additional Doppler contribution
361
362 // parameters for the blockage model
363 bool m_blockage; //!< enables the blockage model A
364 uint16_t m_numNonSelfBlocking; //!< number of non-self-blocking regions
365 bool m_portraitMode; //!< true if portrait mode, false if landscape
366 double m_blockerSpeed; //!< the blocker speed
367
368 static const uint8_t PHI_INDEX = 0; //!< index of the PHI value in the m_nonSelfBlocking array
369 static const uint8_t X_INDEX = 1; //!< index of the X value in the m_nonSelfBlocking array
370 static const uint8_t THETA_INDEX =
371 2; //!< index of the THETA value in the m_nonSelfBlocking array
372 static const uint8_t Y_INDEX = 3; //!< index of the Y value in the m_nonSelfBlocking array
373 static const uint8_t R_INDEX = 4; //!< index of the R value in the m_nonSelfBlocking array
374};
375} // namespace ns3
376
377#endif /* THREE_GPP_CHANNEL_H */
O2iConditionValue
Possible values for Outdoor to Indoor condition.
LosConditionValue
Possible values for Line-of-Sight condition.
This is an interface for a channel model that can be described by a channel matrix,...
std::vector< double > DoubleVector
Type definition for vectors of doubles.
std::vector< Double2DVector > Double3DVector
Type definition for 3D matrices of doubles.
std::vector< DoubleVector > Double2DVector
Type definition for matrices of doubles.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
A template-based reference counting class.
Channel Matrix Generation following 3GPP TR 38.901.
DoubleVector CalcAttenuationOfBlockage(const Ptr< ThreeGppChannelModel::ThreeGppChannelParams > channelParams, const DoubleVector &clusterAOA, const DoubleVector &clusterZOA) const
Applies the blockage model A described in 3GPP TR 38.901.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
bool m_portraitMode
true if portrait mode, false if landscape
bool ChannelParamsNeedsUpdate(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const ChannelCondition > channelCondition) const
Check if the channel params has to be updated.
virtual Ptr< const ParamsTable > GetThreeGppTable(Ptr< const ChannelCondition > channelCondition, double hBS, double hUT, double distance2D) const
Get the parameters needed to apply the channel generation procedure.
Ptr< NormalRandomVariable > m_normalRv
normal random variable
static const uint8_t Y_INDEX
index of the Y value in the m_nonSelfBlocking array
bool m_blockage
enables the blockage model A
Ptr< const ChannelParams > GetParams(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const override
Looks for the channel params associated to the aMob and bMob pair in m_channelParamsMap.
~ThreeGppChannelModel() override
Destructor.
bool ChannelMatrixNeedsUpdate(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const ChannelMatrix > channelMatrix)
Check if the channel matrix has to be updated (it needs update when the channel params generation tim...
static const uint8_t THETA_INDEX
index of the THETA value in the m_nonSelfBlocking array
std::unordered_map< uint64_t, Ptr< ThreeGppChannelParams > > m_channelParamsMap
map containing the common channel parameters per pair of nodes, the key of this map is reciprocal and...
static std::pair< double, double > WrapAngles(double azimuthRad, double inclinationRad)
Wrap an (azimuth, inclination) angle pair in a valid range.
double m_blockerSpeed
the blocker speed
Ptr< const ChannelMatrix > GetChannel(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const PhasedArrayModel > aAntenna, Ptr< const PhasedArrayModel > bAntenna) override
Looks for the channel matrix associated to the aMob and bMob pair in m_channelMatrixMap.
void SetFrequency(double f)
Sets the center frequency of the model.
std::unordered_map< uint64_t, Ptr< ChannelMatrix > > m_channelMatrixMap
map containing the channel realizations per pair of PhasedAntennaArray instances, the key of this map...
Ptr< UniformRandomVariable > m_uniformRv
uniform random variable
void DoDispose() override
Destructor implementation.
void SetScenario(const std::string &scenario)
Sets the propagation scenario.
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model.
Ptr< UniformRandomVariable > m_uniformRvDoppler
uniform random variable, used to compute the additional Doppler contribution
uint16_t m_numNonSelfBlocking
number of non-self-blocking regions
std::string GetScenario() const
Returns the propagation scenario.
virtual Ptr< ChannelMatrix > GetNewChannel(Ptr< const ThreeGppChannelParams > channelParams, Ptr< const ParamsTable > table3gpp, const Ptr< const MobilityModel > sMob, const Ptr< const MobilityModel > uMob, Ptr< const PhasedArrayModel > sAntenna, Ptr< const PhasedArrayModel > uAntenna) const
Compute the channel matrix between two nodes a and b, and their antenna arrays aAntenna and bAntenna ...
static const uint8_t PHI_INDEX
index of the PHI value in the m_nonSelfBlocking array
double m_frequency
the operating frequency
double m_vScatt
value used to compute the additional Doppler contribution for the delayed paths
Ptr< ChannelConditionModel > GetChannelConditionModel() const
Get the associated channel condition model.
Ptr< ChannelConditionModel > m_channelConditionModel
the channel condition model
std::string m_scenario
the 3GPP scenario
static const uint8_t R_INDEX
index of the R value in the m_nonSelfBlocking array
static TypeId GetTypeId()
Get the type ID.
void Shuffle(double *first, double *last) const
Shuffle the elements of a simple sequence container of type double.
Ptr< ThreeGppChannelParams > GenerateChannelParameters(const Ptr< const ChannelCondition > channelCondition, const Ptr< const ParamsTable > table3gpp, const Ptr< const MobilityModel > aMob, const Ptr< const MobilityModel > bMob) const
Prepare 3gpp channel parameters among the nodes a and b.
double GetFrequency() const
Returns the center frequency.
Time m_updatePeriod
the channel update period
static const uint8_t X_INDEX
index of the X value in the m_nonSelfBlocking array
Ptr< UniformRandomVariable > m_uniformRvShuffle
uniform random variable used to shuffle array in GetNewChannel
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Definition: first.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Data structure that stores channel parameters.
Data structure that stores the parameters of 3GPP TR 38.901, Table 7.5-6, for a certain scenario.
double m_sqrtC[7][7]
The square root matrix and follows the order of [SF, K, DS, ASD, ASA, ZSD, ZSA].
double m_sigLgZSD
Standard deviation of 10-base logarithm of zenith angle spread of departure.
double m_cASD
Cluster ASD (Azimuth angle Spread of Departure)
double m_uLgZSD
Mean value of 10-base logarithm of zenith angle spread of departure.
double m_uLgASA
Mean value of 10-base logarithm of azimuth angle spread of arrival.
double m_sigXpr
Standard deviation of Cross-Polarization Ratio.
double m_uLgASD
Mean value of 10-base logarithm of azimuth angle spread of departure.
double m_cASA
Cluster ASA (Azimuth angle Spread of Arrival)
uint8_t m_raysPerCluster
Number of rays per cluster.
double m_sigK
Standard deviation of K-factor.
double m_perClusterShadowingStd
Per cluster shadowing standard deviation.
double m_sigLgASD
Standard deviation of 10-base logarithm of azimuth angle spread of departure.
double m_offsetZOD
Offset of zenith angle of departure.
double m_uLgDS
Mean value of 10-base logarithm of delay spread.
double m_sigLgASA
Standard deviation of 10-base logarithm of azimuth angle spread of arrival.
double m_uLgZSA
Mean value of 10-base logarithm of zenith angle spread of arrival.
double m_cZSA
Cluster ZSA (Zenith angle Spread of Arrival)
double m_sigLgZSA
Standard deviation of 10-base logarithm of zenith angle spread of arrival.
double m_uXpr
Mean of Cross-Polarization Ratio.
double m_sigLgDS
Standard deviation value of 10-base logarithm of delay spread.
Extends the struct ChannelParams by including information that is used within the ThreeGppChannelMode...
MatrixBasedChannelModel::Double2DVector m_rayAoaRadian
the vector containing AOA angles
MatrixBasedChannelModel::Double3DVector m_clusterPhase
the initial random phases
MatrixBasedChannelModel::Double2DVector m_norRvAngles
stores the normal variable for random angles angle[cluster][id] generated for equation (7....
ChannelCondition::LosConditionValue m_losCondition
contains the information about the LOS state of the channel
MatrixBasedChannelModel::Double2DVector m_rayZodRadian
the vector containing ZOD angles
ChannelCondition::O2iConditionValue m_o2iCondition
contains the information about the O2I state of the channel
MatrixBasedChannelModel::Double2DVector m_rayAodRadian
the vector containing AOD angles
DoubleVector m_attenuation_dB
vector that stores the attenuation of the blockage
Vector m_preLocUT
location of UT when generating the previous channel
MatrixBasedChannelModel::Double2DVector m_rayZoaRadian
the vector containing ZOA angles
MatrixBasedChannelModel::Double2DVector m_nonSelfBlocking
store the blockages
uint8_t m_cluster1st
index of the first strongest cluster
MatrixBasedChannelModel::Double2DVector m_crossPolarizationPowerRatios
cross polarization power ratios
uint8_t m_cluster2nd
index of the second strongest cluster