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 
74 
80 
85  void SetFrequency (double f);
86 
91  double GetFrequency (void) const;
92 
97  void SetScenario (const std::string &scenario);
98 
103  std::string GetScenario (void) const;
104 
120  Ptr<const PhasedArrayModel> bAntenna) override;
121 
122 
132  Ptr<const MobilityModel> bMob) const override;
140  int64_t AssignStreams (int64_t stream);
141 
142 protected:
156  static std::pair<double, double> WrapAngles (double azimuthRad, double inclinationRad);
157 
163  void Shuffle (double * first, double * last) const;
164 
170  {
173  // TODO these are not currently used, they have to be correctly set when including the spatial consistent update procedure
174  /*The following parameters are stored for spatial consistent updating. The notation is
175  that of 3GPP technical reports, but it can apply also to other channel realizations*/
177  Vector m_preLocUT;
178  Vector m_locUT;
180  double m_DS;
181  double m_K_factor;
189  Vector m_speed;
190  double m_dis2D;
191  double m_dis3D;
194  uint8_t m_cluster1st;
195  uint8_t m_cluster2nd;
196 
197  };
198 
203  struct ParamsTable : public SimpleRefCount<ParamsTable>
204  {
205  uint8_t m_numOfCluster = 0;
206  uint8_t m_raysPerCluster = 0;
207  double m_uLgDS = 0;
208  double m_sigLgDS = 0;
209  double m_uLgASD = 0;
210  double m_sigLgASD = 0;
211  double m_uLgASA = 0;
212  double m_sigLgASA = 0;
213  double m_uLgZSA = 0;
214  double m_sigLgZSA = 0;
215  double m_uLgZSD = 0;
216  double m_sigLgZSD = 0;
217  double m_offsetZOD = 0;
218  double m_cDS = 0;
219  double m_cASD = 0;
220  double m_cASA = 0;
221  double m_cZSA = 0;
222  double m_uK = 0;
223  double m_sigK = 0;
224  double m_rTau = 0;
225  double m_uXpr = 0;
226  double m_sigXpr = 0;
228  double m_sqrtC[7][7];
229  };
230 
239  virtual Ptr<const ParamsTable> GetThreeGppTable (Ptr<const ChannelCondition> channelCondition, double hBS, double hUT, double distance2D) const;
240 
263  const Ptr<const ParamsTable> table3gpp,
264  const Ptr<const MobilityModel> aMob,
265  const Ptr<const MobilityModel> bMob) const;
266 
281  Ptr<const ParamsTable> table3gpp,
282  const Ptr<const MobilityModel> sMob,
283  const Ptr<const MobilityModel> uMob,
285  Ptr<const PhasedArrayModel> uAntenna) const;
294  const DoubleVector &clusterAOA,
295  const DoubleVector &clusterZOA) const;
296 
304  Ptr<const ChannelCondition> channelCondition) const;
305 
314 
315  std::unordered_map<uint64_t, Ptr<ChannelMatrix> > m_channelMatrixMap;
316  std::unordered_map<uint64_t, Ptr<ThreeGppChannelParams> > m_channelParamsMap;
318  double m_frequency;
319  std::string m_scenario;
324 
325  // Variable used to compute the additional Doppler contribution for the delayed
326  // (reflected) paths, as described in 3GPP TR 37.885 v15.3.0, Sec. 6.2.3.
327  double m_vScatt;
329 
330  // parameters for the blockage model
331  bool m_blockage;
334  double m_blockerSpeed;
335 
336  static const uint8_t PHI_INDEX = 0;
337  static const uint8_t X_INDEX = 1;
338  static const uint8_t THETA_INDEX = 2;
339  static const uint8_t Y_INDEX = 3;
340  static const uint8_t R_INDEX = 4;
341 };
342 } // namespace ns3
343 
344 #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< DoubleVector > Double2DVector
type definition for matrices of doubles
std::vector< double > DoubleVector
type definition for vectors of doubles
std::vector< Double2DVector > Double3DVector
type definition for 3D matrices of doubles
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
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 potrait 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.
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
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
std::string GetScenario(void) const
Returns the propagation scenario.
static const uint8_t R_INDEX
index of the R value in the m_nonSelfBlocking array
double GetFrequency(void) const
Returns the center frequency.
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.
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:103
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....
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
ChannelCondition::LosConditionValue m_losCondition
contains the information about the LOS state of the channel
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