A Discrete-Event Network Simulator
API
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 
33 namespace ns3
34 {
35 
36 class MobilityModel;
37 
48 {
49  public:
54 
58  ~ThreeGppChannelModel() override;
59 
60  void DoDispose() override;
61 
66  static TypeId GetTypeId();
67 
73 
79 
84  void SetFrequency(double f);
85 
90  double GetFrequency() const;
91 
96  void SetScenario(const std::string& scenario);
97 
102  std::string GetScenario() const;
103 
119  Ptr<const PhasedArrayModel> bAntenna) override;
120 
130  Ptr<const MobilityModel> bMob) const override;
138  int64_t AssignStreams(int64_t stream);
139 
140  protected:
154  static std::pair<double, double> WrapAngles(double azimuthRad, double inclinationRad);
155 
161  void Shuffle(double* first, double* last) const;
162 
168  {
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;
179  Vector m_locUT;
184  double m_DS;
185  double m_K_factor;
198  Vector m_speed;
199  double m_dis2D;
200  double m_dis3D;
203  uint8_t m_cluster1st;
204  uint8_t m_cluster2nd;
205  };
206 
211  struct ParamsTable : public SimpleRefCount<ParamsTable>
212  {
213  uint8_t m_numOfCluster = 0;
214  uint8_t m_raysPerCluster = 0;
215  double m_uLgDS = 0;
216  double m_sigLgDS = 0;
217  double m_uLgASD =
218  0;
219  double m_sigLgASD =
220  0;
221  double m_uLgASA = 0;
222  double m_sigLgASA =
223  0;
224  double m_uLgZSA = 0;
225  double m_sigLgZSA =
226  0;
227  double m_uLgZSD =
228  0;
229  double m_sigLgZSD =
230  0;
231  double m_offsetZOD = 0;
232  double m_cDS = 0;
233  double m_cASD = 0;
234  double m_cASA = 0;
235  double m_cZSA = 0;
236  double m_uK = 0;
237  double m_sigK = 0;
238  double m_rTau = 0;
239  double m_uXpr = 0;
240  double m_sigXpr = 0;
242  double m_sqrtC[7][7];
244  };
245 
255  double hBS,
256  double hUT,
257  double distance2D) const;
258 
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 
302  Ptr<const ParamsTable> table3gpp,
303  const Ptr<const MobilityModel> sMob,
304  const Ptr<const MobilityModel> uMob,
306  Ptr<const PhasedArrayModel> uAntenna) const;
316  const DoubleVector& clusterAOA,
317  const DoubleVector& clusterZOA) const;
318 
326  Ptr<const ChannelCondition> channelCondition) const;
327 
336  Ptr<const ChannelMatrix> channelMatrix);
337 
338  std::unordered_map<uint64_t, Ptr<ChannelMatrix>>
342  std::unordered_map<uint64_t, Ptr<ThreeGppChannelParams>>
347  double m_frequency;
348  std::string m_scenario;
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;
361 
362  // parameters for the blockage model
363  bool m_blockage;
366  double m_blockerSpeed;
367 
368  static const uint8_t PHI_INDEX = 0;
369  static const uint8_t X_INDEX = 1;
370  static const uint8_t THETA_INDEX =
371  2;
372  static const uint8_t Y_INDEX = 3;
373  static const uint8_t R_INDEX = 4;
374 };
375 } // namespace ns3
376 
377 #endif /* THREE_GPP_CHANNEL_H */
double f(double x, void *params)
Definition: 80211b.c:70
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