A Discrete-Event Network Simulator
API
three-gpp-channel-model.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015, NYU WIRELESS, Tandon School of Engineering,
4  * New York University
5  * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering,
6  * University of Padova
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation;
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21 
22 #ifndef THREE_GPP_CHANNEL_H
23 #define THREE_GPP_CHANNEL_H
24 
25 #include <complex.h>
26 #include "ns3/angles.h"
27 #include <ns3/object.h>
28 #include <ns3/nstime.h>
29 #include <ns3/random-variable-stream.h>
30 #include <ns3/boolean.h>
31 #include <unordered_map>
32 #include <ns3/channel-condition-model.h>
33 #include <ns3/matrix-based-channel-model.h>
34 
35 namespace ns3 {
36 
37 class MobilityModel;
38 
49 {
50 public:
55 
60 
61  void DoDispose () override;
62 
67  static TypeId GetTypeId ();
68 
69 
75 
81 
86  void SetFrequency (double f);
87 
92  double GetFrequency (void) const;
93 
98  void SetScenario (const std::string &scenario);
99 
104  std::string GetScenario (void) const;
105 
121  Ptr<const PhasedArrayModel> bAntenna) override;
129  int64_t AssignStreams (int64_t stream);
130 
131 private:
145  static std::pair<double, double> WrapAngles (double azimuthRad, double inclinationRad);
151  void Shuffle (double * first, double * last) const;
157  {
159 
160  // TODO these are not currently used, they have to be correctly set when including the spatial consistent update procedure
161  /*The following parameters are stored for spatial consistent updating. The notation is
162  that of 3GPP technical reports, but it can apply also to other channel realizations*/
164  Vector m_preLocUT;
165  Vector m_locUT;
167  double m_DS;
168  double m_K;
169  uint8_t m_numCluster;
171  Vector m_speed;
172  double m_dis2D;
173  double m_dis3D;
174  };
175 
180  struct ParamsTable : public SimpleRefCount<ParamsTable>
181  {
182  uint8_t m_numOfCluster = 0;
183  uint8_t m_raysPerCluster = 0;
184  double m_uLgDS = 0;
185  double m_sigLgDS = 0;
186  double m_uLgASD = 0;
187  double m_sigLgASD = 0;
188  double m_uLgASA = 0;
189  double m_sigLgASA = 0;
190  double m_uLgZSA = 0;
191  double m_sigLgZSA = 0;
192  double m_uLgZSD = 0;
193  double m_sigLgZSD = 0;
194  double m_offsetZOD = 0;
195  double m_cDS = 0;
196  double m_cASD = 0;
197  double m_cASA = 0;
198  double m_cZSA = 0;
199  double m_uK = 0;
200  double m_sigK = 0;
201  double m_rTau = 0;
202  double m_uXpr = 0;
203  double m_sigXpr = 0;
205 
206  double m_sqrtC[7][7];
207  };
208 
217  virtual Ptr<const ParamsTable> GetThreeGppTable (Ptr<const ChannelCondition> channelCondition, double hBS, double hUT, double distance2D) const;
218 
236  Angles &uAngle, Angles &sAngle,
237  double dis2D, double hBS, double hUT) const;
238 
247  const DoubleVector &clusterAOA,
248  const DoubleVector &clusterZOA) const;
249 
257 
258  std::unordered_map<uint32_t, Ptr<ThreeGppChannelMatrix> > m_channelMap;
260  double m_frequency;
261  std::string m_scenario;
266 
267  // parameters for the blockage model
268  bool m_blockage;
271  double m_blockerSpeed;
272 
273  static const uint8_t PHI_INDEX = 0;
274  static const uint8_t X_INDEX = 1;
275  static const uint8_t THETA_INDEX = 2;
276  static const uint8_t Y_INDEX = 3;
277  static const uint8_t R_INDEX = 4;
278 };
279 } // namespace ns3
280 
281 #endif /* THREE_GPP_CHANNEL_H */
ns3::ThreeGppChannelModel::ParamsTable::m_rTau
double m_rTau
Definition: three-gpp-channel-model.h:201
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_preLocUT
Vector m_preLocUT
location of UT when generating the previous channel
Definition: three-gpp-channel-model.h:164
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::ThreeGppChannelModel::ParamsTable::m_cASA
double m_cASA
Definition: three-gpp-channel-model.h:197
ns3::ThreeGppChannelModel::ParamsTable
Data structure that stores the parameters of 3GPP TR 38.901, Table 7.5-6, for a certain scenario.
Definition: three-gpp-channel-model.h:181
ns3::ThreeGppChannelModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition: three-gpp-channel-model.cc:192
ns3::ThreeGppChannelModel::GetChannelConditionModel
Ptr< ChannelConditionModel > GetChannelConditionModel() const
Get the associated channel condition model.
Definition: three-gpp-channel-model.cc:255
ns3::ThreeGppChannelModel::ParamsTable::m_sigLgZSA
double m_sigLgZSA
Definition: three-gpp-channel-model.h:191
ns3::ThreeGppChannelModel::~ThreeGppChannelModel
~ThreeGppChannelModel()
Destructor.
Definition: three-gpp-channel-model.cc:174
ns3::ThreeGppChannelModel::ParamsTable::m_sigLgASD
double m_sigLgASD
Definition: three-gpp-channel-model.h:187
first
Definition: first.py:1
ns3::ThreeGppChannelModel::ParamsTable::m_offsetZOD
double m_offsetZOD
Definition: three-gpp-channel-model.h:194
ns3::ThreeGppChannelModel::GetThreeGppTable
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.
Definition: three-gpp-channel-model.cc:296
ns3::ThreeGppChannelModel::GetChannel
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_channelMap.
Definition: three-gpp-channel-model.cc:975
ns3::ThreeGppChannelModel::m_scenario
std::string m_scenario
the 3GPP scenario
Definition: three-gpp-channel-model.h:261
ns3::ThreeGppChannelModel::ParamsTable::m_sigLgDS
double m_sigLgDS
Definition: three-gpp-channel-model.h:185
ns3::ThreeGppChannelModel::ChannelMatrixNeedsUpdate
bool ChannelMatrixNeedsUpdate(Ptr< const ThreeGppChannelMatrix > channelMatrix, Ptr< const ChannelCondition > channelCondition) const
Check if the channel matrix has to be updated.
Definition: three-gpp-channel-model.cc:951
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ThreeGppChannelModel::ParamsTable::m_cZSA
double m_cZSA
Definition: three-gpp-channel-model.h:198
ns3::ThreeGppChannelModel
Channel Matrix Generation following 3GPP TR 38.901.
Definition: three-gpp-channel-model.h:49
ns3::ThreeGppChannelModel::Shuffle
void Shuffle(double *first, double *last) const
Shuffle the elements of a simple sequence container of type double.
Definition: three-gpp-channel-model.cc:2010
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix
Extends the struct ChannelMatrix by including information that are used within the class ThreeGppChan...
Definition: three-gpp-channel-model.h:157
ns3::ThreeGppChannelModel::ParamsTable::m_numOfCluster
uint8_t m_numOfCluster
Definition: three-gpp-channel-model.h:182
ns3::ThreeGppChannelModel::ParamsTable::m_uLgZSD
double m_uLgZSD
Definition: three-gpp-channel-model.h:192
ns3::ThreeGppChannelModel::SetScenario
void SetScenario(const std::string &scenario)
Sets the propagation scenario.
Definition: three-gpp-channel-model.cc:277
ns3::SimpleRefCount
A template-based reference counting class.
Definition: simple-ref-count.h:74
ns3::MatrixBasedChannelModel::Double2DVector
std::vector< DoubleVector > Double2DVector
type definition for matrices of doubles
Definition: matrix-based-channel-model.h:52
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_K
double m_K
K factor.
Definition: three-gpp-channel-model.h:168
ns3::ThreeGppChannelModel::ParamsTable::m_uK
double m_uK
Definition: three-gpp-channel-model.h:199
ns3::ThreeGppChannelModel::PHI_INDEX
static const uint8_t PHI_INDEX
index of the PHI value in the m_nonSelfBlocking array
Definition: three-gpp-channel-model.h:273
ns3::MatrixBasedChannelModel::Double3DVector
std::vector< Double2DVector > Double3DVector
type definition for 3D matrices of doubles
Definition: matrix-based-channel-model.h:53
ns3::ThreeGppChannelModel::m_blockage
bool m_blockage
enables the blockage model A
Definition: three-gpp-channel-model.h:268
ns3::ThreeGppChannelModel::X_INDEX
static const uint8_t X_INDEX
index of the X value in the m_nonSelfBlocking array
Definition: three-gpp-channel-model.h:274
ns3::ThreeGppChannelModel::m_portraitMode
bool m_portraitMode
true if potrait mode, false if landscape
Definition: three-gpp-channel-model.h:270
ns3::ThreeGppChannelModel::m_frequency
double m_frequency
the operating frequency
Definition: three-gpp-channel-model.h:260
ns3::MatrixBasedChannelModel
This is an interface for a channel model that can be described by a channel matrix,...
Definition: matrix-based-channel-model.h:44
ns3::ThreeGppChannelModel::ParamsTable::m_uLgASA
double m_uLgASA
Definition: three-gpp-channel-model.h:188
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_numCluster
uint8_t m_numCluster
reduced cluster number;
Definition: three-gpp-channel-model.h:169
ns3::ThreeGppChannelModel::SetChannelConditionModel
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model.
Definition: three-gpp-channel-model.cc:248
ns3::ThreeGppChannelModel::ParamsTable::m_raysPerCluster
uint8_t m_raysPerCluster
Definition: three-gpp-channel-model.h:183
ns3::ThreeGppChannelModel::ParamsTable::m_sigLgASA
double m_sigLgASA
Definition: three-gpp-channel-model.h:189
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_norRvAngles
MatrixBasedChannelModel::Double2DVector m_norRvAngles
stores the normal variable for random angles angle[cluster][id] generated for equation (7....
Definition: three-gpp-channel-model.h:166
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_nonSelfBlocking
MatrixBasedChannelModel::Double2DVector m_nonSelfBlocking
store the blockages
Definition: three-gpp-channel-model.h:163
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_channelCondition
Ptr< const ChannelCondition > m_channelCondition
the channel condition
Definition: three-gpp-channel-model.h:158
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_DS
double m_DS
delay spread
Definition: three-gpp-channel-model.h:167
ns3::ThreeGppChannelModel::ParamsTable::m_uLgASD
double m_uLgASD
Definition: three-gpp-channel-model.h:186
ns3::ThreeGppChannelModel::ParamsTable::m_uXpr
double m_uXpr
Definition: three-gpp-channel-model.h:202
ns3::ThreeGppChannelModel::ParamsTable::m_uLgDS
double m_uLgDS
Definition: three-gpp-channel-model.h:184
ns3::ThreeGppChannelModel::GetScenario
std::string GetScenario(void) const
Returns the propagation scenario.
Definition: three-gpp-channel-model.cc:289
ns3::ThreeGppChannelModel::m_blockerSpeed
double m_blockerSpeed
the blocker speed
Definition: three-gpp-channel-model.h:271
ns3::ThreeGppChannelModel::m_normalRv
Ptr< NormalRandomVariable > m_normalRv
normal random variable
Definition: three-gpp-channel-model.h:264
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_clusterPhase
MatrixBasedChannelModel::Double3DVector m_clusterPhase
the initial random phases
Definition: three-gpp-channel-model.h:170
ns3::ThreeGppChannelModel::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: three-gpp-channel-model.cc:2019
ns3::ThreeGppChannelModel::CalcAttenuationOfBlockage
DoubleVector CalcAttenuationOfBlockage(Ptr< ThreeGppChannelMatrix > params, const DoubleVector &clusterAOA, const DoubleVector &clusterZOA) const
Applies the blockage model A described in 3GPP TR 38.901.
Definition: three-gpp-channel-model.cc:1789
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::ThreeGppChannelModel::m_uniformRv
Ptr< UniformRandomVariable > m_uniformRv
uniform random variable
Definition: three-gpp-channel-model.h:263
ns3::ThreeGppChannelModel::SetFrequency
void SetFrequency(double f)
Sets the center frequency of the model.
Definition: three-gpp-channel-model.cc:262
ns3::ThreeGppChannelModel::GetFrequency
double GetFrequency(void) const
Returns the center frequency.
Definition: three-gpp-channel-model.cc:270
ns3::ThreeGppChannelModel::m_updatePeriod
Time m_updatePeriod
the channel update period
Definition: three-gpp-channel-model.h:259
ns3::MatrixBasedChannelModel::DoubleVector
std::vector< double > DoubleVector
type definition for vectors of doubles
Definition: matrix-based-channel-model.h:51
ns3::ThreeGppChannelModel::ParamsTable::m_uLgZSA
double m_uLgZSA
Definition: three-gpp-channel-model.h:190
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_dis2D
double m_dis2D
2D distance between tx and rx
Definition: three-gpp-channel-model.h:172
ns3::Angles
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:119
ns3::ThreeGppChannelModel::Y_INDEX
static const uint8_t Y_INDEX
index of the Y value in the m_nonSelfBlocking array
Definition: three-gpp-channel-model.h:276
ns3::ThreeGppChannelModel::ParamsTable::m_perClusterShadowingStd
double m_perClusterShadowingStd
Definition: three-gpp-channel-model.h:204
f
double f(double x, void *params)
Definition: 80211b.c:70
ns3::ThreeGppChannelModel::m_numNonSelfBlocking
uint16_t m_numNonSelfBlocking
number of non-self-blocking regions
Definition: three-gpp-channel-model.h:269
ns3::MatrixBasedChannelModel::ChannelMatrix
Data structure that stores a channel realization.
Definition: matrix-based-channel-model.h:62
ns3::ThreeGppChannelModel::m_channelConditionModel
Ptr< ChannelConditionModel > m_channelConditionModel
the channel condition model
Definition: three-gpp-channel-model.h:262
ns3::ThreeGppChannelModel::ParamsTable::m_sigXpr
double m_sigXpr
Definition: three-gpp-channel-model.h:203
ns3::ThreeGppChannelModel::m_channelMap
std::unordered_map< uint32_t, Ptr< ThreeGppChannelMatrix > > m_channelMap
map containing the channel realizations
Definition: three-gpp-channel-model.h:258
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_dis3D
double m_dis3D
3D distance between tx and rx
Definition: three-gpp-channel-model.h:173
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_locUT
Vector m_locUT
location of UT
Definition: three-gpp-channel-model.h:165
ns3::ThreeGppChannelModel::ParamsTable::m_sigK
double m_sigK
Definition: three-gpp-channel-model.h:200
ns3::ThreeGppChannelModel::ParamsTable::m_cDS
double m_cDS
Definition: three-gpp-channel-model.h:195
ns3::ThreeGppChannelModel::m_uniformRvShuffle
Ptr< UniformRandomVariable > m_uniformRvShuffle
uniform random variable used to shuffle array in GetNewChannel
Definition: three-gpp-channel-model.h:265
ns3::ThreeGppChannelModel::R_INDEX
static const uint8_t R_INDEX
index of the R value in the m_nonSelfBlocking array
Definition: three-gpp-channel-model.h:277
ns3::ThreeGppChannelModel::GetNewChannel
Ptr< ThreeGppChannelMatrix > GetNewChannel(Vector locUT, Ptr< const ChannelCondition > channelCondition, Ptr< const PhasedArrayModel > sAntenna, Ptr< const PhasedArrayModel > uAntenna, Angles &uAngle, Angles &sAngle, double dis2D, double hBS, double hUT) const
Compute the channel matrix between two devices using the procedure described in 3GPP TR 38....
Definition: three-gpp-channel-model.cc:1044
ns3::ThreeGppChannelModel::THETA_INDEX
static const uint8_t THETA_INDEX
index of the THETA value in the m_nonSelfBlocking array
Definition: three-gpp-channel-model.h:275
ns3::ThreeGppChannelModel::ParamsTable::m_cASD
double m_cASD
Definition: three-gpp-channel-model.h:196
ns3::ThreeGppChannelModel::ThreeGppChannelModel
ThreeGppChannelModel()
Constructor.
Definition: three-gpp-channel-model.cc:163
ns3::ThreeGppChannelModel::ParamsTable::m_sqrtC
double m_sqrtC[7][7]
Definition: three-gpp-channel-model.h:206
ns3::ThreeGppChannelModel::DoDispose
void DoDispose() override
Destructor implementation.
Definition: three-gpp-channel-model.cc:180
ns3::ThreeGppChannelModel::WrapAngles
static std::pair< double, double > WrapAngles(double azimuthRad, double inclinationRad)
Wrap an (azimuth, inclination) angle pair in a valid range.
Definition: three-gpp-channel-model.cc:1768
ns3::ThreeGppChannelModel::ThreeGppChannelMatrix::m_speed
Vector m_speed
velocity
Definition: three-gpp-channel-model.h:171
ns3::ThreeGppChannelModel::ParamsTable::m_sigLgZSD
double m_sigLgZSD
Definition: three-gpp-channel-model.h:193