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 ThreeGppAntennaArrayModel> bAntenna) override;
129  int64_t AssignStreams (int64_t stream);
130 
131 private:
137  void Shuffle (double * first, double * last) const;
143  {
144  bool m_los;
145 
146  // TODO these are not currently used, they have to be correctly set when including the spatial consistent update procedure
147  /*The following parameters are stored for spatial consistent updating. The notation is
148  that of 3GPP technical reports, but it can apply also to other channel realizations*/
150  Vector m_preLocUT;
151  Vector m_locUT;
153  double m_DS;
154  double m_K;
155  uint8_t m_numCluster;
157  bool m_o2i;
158  Vector m_speed;
159  double m_dis2D;
160  double m_dis3D;
161  };
162 
167  struct ParamsTable : public SimpleRefCount<ParamsTable>
168  {
169  uint8_t m_numOfCluster = 0;
170  uint8_t m_raysPerCluster = 0;
171  double m_uLgDS = 0;
172  double m_sigLgDS = 0;
173  double m_uLgASD = 0;
174  double m_sigLgASD = 0;
175  double m_uLgASA = 0;
176  double m_sigLgASA = 0;
177  double m_uLgZSA = 0;
178  double m_sigLgZSA = 0;
179  double m_uLgZSD = 0;
180  double m_sigLgZSD = 0;
181  double m_offsetZOD = 0;
182  double m_cDS = 0;
183  double m_cASD = 0;
184  double m_cASA = 0;
185  double m_cZSA = 0;
186  double m_uK = 0;
187  double m_sigK = 0;
188  double m_rTau = 0;
189  double m_uXpr = 0;
190  double m_sigXpr = 0;
192 
193  double m_sqrtC[7][7];
194  };
195 
205  Ptr<const ParamsTable> GetThreeGppTable (bool los, bool o2i, double hBS, double hUT, double distance2D) const;
206 
222  Ptr<ThreeGppChannelMatrix> GetNewChannel (Vector locUT, bool los, bool o2i,
225  Angles &uAngle, Angles &sAngle,
226  double dis2D, double hBS, double hUT) const;
227 
236  const DoubleVector &clusterAOA,
237  const DoubleVector &clusterZOA) const;
238 
245  bool ChannelMatrixNeedsUpdate (Ptr<const ThreeGppChannelMatrix> channelMatrix, bool isLos) const;
246 
247  std::unordered_map<uint32_t, Ptr<ThreeGppChannelMatrix> > m_channelMap;
249  double m_frequency;
250  std::string m_scenario;
255 
256  // parameters for the blockage model
257  bool m_blockage;
260  double m_blockerSpeed;
261 
262  static const uint8_t PHI_INDEX = 0;
263  static const uint8_t X_INDEX = 1;
264  static const uint8_t THETA_INDEX = 2;
265  static const uint8_t Y_INDEX = 3;
266  static const uint8_t R_INDEX = 4;
267 };
268 } // namespace ns3
269 
270 #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
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 const uint8_t X_INDEX
index of the X value in the m_nonSelfBlocking array
Ptr< const ParamsTable > GetThreeGppTable(bool los, bool o2i, double hBS, double hUT, double distance2D) const
Get the parameters needed to apply the channel generation procedure.
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...
Ptr< const ChannelMatrix > GetChannel(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const ThreeGppAntennaArrayModel > aAntenna, Ptr< const ThreeGppAntennaArrayModel > bAntenna) override
Looks for the channel matrix associated to the aMob and bMob pair in m_channelMap.
Channel Matrix Generation following 3GPP TR 38.901.
bool m_portraitMode
true if potrait mode, false if landscape
bool ChannelMatrixNeedsUpdate(Ptr< const ThreeGppChannelMatrix > channelMatrix, bool isLos) const
Check if the channel matrix has to be updated.
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
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
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.
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.
struct holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:71
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
Ptr< ThreeGppChannelMatrix > GetNewChannel(Vector locUT, bool los, bool o2i, Ptr< const ThreeGppAntennaArrayModel > sAntenna, Ptr< const ThreeGppAntennaArrayModel > 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...
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