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 */
This is an interface for a channel model that can be described by a channel matrix, e.g., the 3GPP Spatial Channel Models, which is generally used in combination with antenna arrays.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
std::unordered_map< uint32_t, Ptr< ThreeGppChannelMatrix > > m_channelMap
map containing the channel realizations
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Vector m_preLocUT
location of UT when generating the previous channel
void DoDispose() override
Destructor implementation.
static const uint8_t THETA_INDEX
index of the THETA value in the m_nonSelfBlocking array
Ptr< NormalRandomVariable > m_normalRv
normal random variable
std::string GetScenario(void) const
Returns the propagation scenario.
Ptr< UniformRandomVariable > m_uniformRvShuffle
uniform random variable used to shuffle array in GetNewChannel
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
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...
std::vector< double > DoubleVector
type definition for vectors of doubles
static const uint8_t R_INDEX
index of the R value in the m_nonSelfBlocking array
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model.
Ptr< ChannelConditionModel > m_channelConditionModel
the channel condition model
std::string m_scenario
the 3GPP scenario
static std::pair< double, double > WrapAngles(double azimuthRad, double inclinationRad)
Wrap an (azimuth, inclination) angle pair in a valid range.
static const uint8_t X_INDEX
index of the X value in the m_nonSelfBlocking array
void SetFrequency(double f)
Sets the center frequency of the model.
double GetFrequency(void) const
Returns the center frequency.
uint16_t m_numNonSelfBlocking
number of non-self-blocking regions
Time m_updatePeriod
the channel update period
MatrixBasedChannelModel::Double2DVector m_norRvAngles
stores the normal variable for random angles angle[cluster][id] generated for equation (7...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Channel Matrix Generation following 3GPP TR 38.901.
bool m_portraitMode
true if potrait mode, false if landscape
Ptr< const ChannelCondition > m_channelCondition
the channel condition
MatrixBasedChannelModel::Double3DVector m_clusterPhase
the initial random phases
double m_blockerSpeed
the blocker speed
Data structure that stores the parameters of 3GPP TR 38.901, Table 7.5-6, for a certain scenario...
double f(double x, void *params)
Definition: 80211b.c:70
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< UniformRandomVariable > m_uniformRv
uniform random variable
std::vector< DoubleVector > Double2DVector
type definition for matrices of doubles
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.
std::vector< Double2DVector > Double3DVector
type definition for 3D matrices of doubles
void SetScenario(const std::string &scenario)
Sets the propagation scenario.
Extends the struct ChannelMatrix by including information that are used within the class ThreeGppChan...
static const uint8_t PHI_INDEX
index of the PHI value in the m_nonSelfBlocking array
bool m_blockage
enables the blockage model A
static TypeId GetTypeId()
Get the type ID.
bool ChannelMatrixNeedsUpdate(Ptr< const ThreeGppChannelMatrix > channelMatrix, Ptr< const ChannelCondition > channelCondition) const
Check if the channel matrix has to be updated.
MatrixBasedChannelModel::Double2DVector m_nonSelfBlocking
store the blockages
void Shuffle(double *first, double *last) const
Shuffle the elements of a simple sequence container of type double.
Data structure that stores a channel realization.
Definition: first.py:1
Ptr< ChannelConditionModel > GetChannelConditionModel() const
Get the associated channel condition model.
static const uint8_t Y_INDEX
index of the Y value in the m_nonSelfBlocking array
A template-based reference counting class.
a unique identifier for an interface.
Definition: type-id.h:58
DoubleVector CalcAttenuationOfBlockage(Ptr< ThreeGppChannelMatrix > params, const DoubleVector &clusterAOA, const DoubleVector &clusterZOA) const
Applies the blockage model A described in 3GPP TR 38.901.
double m_frequency
the operating frequency