A Discrete-Event Network Simulator
API
channel-condition-model.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering,
3  * University of Padova
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */
18 
19 #ifndef CHANNEL_CONDITION_MODEL_H
20 #define CHANNEL_CONDITION_MODEL_H
21 
22 #include "ns3/nstime.h"
23 #include "ns3/object.h"
24 #include "ns3/random-variable-stream.h"
25 #include "ns3/vector.h"
26 
27 #include <unordered_map>
28 
29 namespace ns3
30 {
31 
32 class MobilityModel;
33 
42 class ChannelCondition : public Object
43 {
44  public:
49  {
50  LOS,
51  NLOS,
53  LC_ND
54  };
55 
60  {
61  O2O,
62  O2I,
63  I2I,
64  O2I_ND
65  };
66 
71  {
72  LOW,
73  HIGH,
74  LH_O2I_ND
75  };
76 
82  static TypeId GetTypeId();
83 
88 
97  O2iConditionValue o2iCondition = O2O,
98  O2iLowHighConditionValue o2iLowHighCondition = LOW);
99 
103  ~ChannelCondition() override;
104 
112 
119  void SetLosCondition(LosConditionValue losCondition);
120 
128 
135  void SetO2iCondition(O2iConditionValue o2iCondition);
136 
144 
151  void SetO2iLowHighCondition(O2iLowHighConditionValue o2iLowHighCondition);
152 
158  bool IsLos() const;
159 
169  bool IsNlos() const;
170 
176  bool IsNlosv() const;
177 
183  bool IsO2i() const;
184 
190  bool IsO2o() const;
191 
197  bool IsI2i() const;
198 
207  bool IsEqual(LosConditionValue losCondition, O2iConditionValue o2iCondition) const;
208 
209  private:
216 
224  friend std::ostream& operator<<(std::ostream& os, LosConditionValue cond);
225 };
226 
236 {
237  public:
243  static TypeId GetTypeId();
244 
249 
253  ~ChannelConditionModel() override;
254 
255  // Delete copy constructor and assignment operator to avoid misuse
258 
267  Ptr<const MobilityModel> b) const = 0;
268 
278  virtual int64_t AssignStreams(int64_t stream) = 0;
279 };
280 
287 {
288  public:
294  static TypeId GetTypeId();
295 
300 
305 
306  // Delete copy constructor and assignment operator to avoid misuse
309 
318  Ptr<const MobilityModel> b) const override;
319 
329  int64_t AssignStreams(int64_t stream) override;
330 };
331 
338 {
339  public:
345  static TypeId GetTypeId();
346 
351 
356 
357  // Delete copy constructor and assignment operator to avoid misuse
360 
369  Ptr<const MobilityModel> b) const override;
370 
380  int64_t AssignStreams(int64_t stream) override;
381 };
382 
389 {
390  public:
396  static TypeId GetTypeId();
397 
402 
407 
408  // Delete copy constructor and assignment operator to avoid misuse
411  delete;
412 
421  Ptr<const MobilityModel> b) const override;
422 
432  int64_t AssignStreams(int64_t stream) override;
433 };
434 
442 {
443  public:
449  static TypeId GetTypeId();
450 
455 
460 
473  Ptr<const MobilityModel> b) const override;
474 
484  int64_t AssignStreams(int64_t stream) override;
485 
486  protected:
487  void DoDispose() override;
488 
493  {
497  INVALID
498  };
499 
506  static double Calculate2dDistance(const Vector& a, const Vector& b);
507 
509 
510  private:
520  Ptr<const MobilityModel> b) const;
521 
530 
539  Ptr<const MobilityModel> b) const;
540 
549 
557 
561  struct Item
562  {
565  };
566 
567  std::unordered_map<uint32_t, Item>
570 
572  0};
576  false};
583 };
584 
594 {
595  public:
601  static TypeId GetTypeId();
602 
607 
612 
613  private:
623 };
624 
634 {
635  public:
641  static TypeId GetTypeId();
642 
647 
652 
653  private:
663 };
664 
674 {
675  public:
681  static TypeId GetTypeId();
682 
687 
692 
693  private:
703 };
704 
714 {
715  public:
721  static TypeId GetTypeId();
722 
727 
732 
733  private:
743 };
744 
754 {
755  public:
761  static TypeId GetTypeId();
762 
767 
772 
773  private:
783 };
784 
785 } // namespace ns3
786 
787 #endif /* CHANNEL_CONDITION_MODEL_H */
Models an always in-LoS condition model.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
AlwaysLosChannelConditionModel(const AlwaysLosChannelConditionModel &)=delete
static TypeId GetTypeId()
Get the type ID.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always LoS.
AlwaysLosChannelConditionModel & operator=(const AlwaysLosChannelConditionModel &)=delete
Carries information about the LOS/NLOS channel state.
LosConditionValue m_losCondition
contains the information about the LOS state of the channel
O2iLowHighConditionValue m_o2iLowHighCondition
contains the information about the O2I low-high building penetration losses
bool IsO2i() const
Return true if the channel is outdoor-to-indoor.
ChannelCondition()
Constructor for the ChannelCondition class.
void SetLosCondition(LosConditionValue losCondition)
Set the LosConditionValue with the information about the LOS/NLOS state of the channel.
LosConditionValue GetLosCondition() const
Get the LosConditionValue containing the information about the LOS/NLOS state of the channel.
bool IsNlos() const
Return true if the channel condition is NLOS.
bool IsEqual(LosConditionValue losCondition, O2iConditionValue o2iCondition) const
Return true if this instance is equivalent to the one passed as argument.
O2iConditionValue m_o2iCondition
contains the information about the O2I state of the channel
bool IsNlosv() const
Return true if the channel condition is NLOSv.
friend std::ostream & operator<<(std::ostream &os, LosConditionValue cond)
Prints a LosConditionValue to output.
bool IsLos() const
Return true if the channel condition is LOS.
void SetO2iCondition(O2iConditionValue o2iCondition)
Set the O2iConditionValue containing the information about the O2I state of the channel.
~ChannelCondition() override
Destructor for the ChannelCondition class.
O2iLowHighConditionValue GetO2iLowHighCondition() const
Get the O2iLowHighConditionValue containing the information about the O2I building penetration losses...
bool IsO2o() const
Return true if the channel is outdoor-to-outdoor.
bool IsI2i() const
Return true if the channel is indoor-to-indoor.
static TypeId GetTypeId()
Get the type ID.
O2iConditionValue
Possible values for Outdoor to Indoor condition.
@ O2I_ND
Outdoor to Indoor condition not defined.
@ O2O
Outdoor to Outdoor.
O2iLowHighConditionValue
Possible values for Low-High Penetration Loss condition.
@ LOW
Low Penetration Losses.
@ LH_O2I_ND
Low-High Penetration Losses not defined.
@ HIGH
High Penetration Losses.
void SetO2iLowHighCondition(O2iLowHighConditionValue o2iLowHighCondition)
Set the O2iLowHighConditionValue containing the information about the O2I building penetration losses...
O2iConditionValue GetO2iCondition() const
Get the O2iConditionValue containing the information about the O2I state of the channel.
LosConditionValue
Possible values for Line-of-Sight condition.
@ NLOSv
Non Line of Sight due to a vehicle.
@ LC_ND
Los condition not defined.
Models the channel condition.
static TypeId GetTypeId()
Get the type ID.
virtual int64_t AssignStreams(int64_t stream)=0
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
ChannelConditionModel(const ChannelConditionModel &)=delete
ChannelConditionModel()
Constructor for the ChannelConditionModel class.
ChannelConditionModel & operator=(const ChannelConditionModel &)=delete
~ChannelConditionModel() override
Destructor for the ChannelConditionModel class.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Computes the condition of the channel between a and b.
Models a never in-LoS condition model.
static TypeId GetTypeId()
Get the type ID.
~NeverLosChannelConditionModel() override
Destructor.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always non-LoS.
NeverLosChannelConditionModel(const NeverLosChannelConditionModel &)=delete
NeverLosChannelConditionModel & operator=(const NeverLosChannelConditionModel &)=delete
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Models a never in-LoS condition model caused by a blocking vehicle.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always NLOSv.
NeverLosVehicleChannelConditionModel(const NeverLosVehicleChannelConditionModel &)=delete
NeverLosVehicleChannelConditionModel & operator=(const NeverLosVehicleChannelConditionModel &)=delete
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Base class for the 3GPP channel condition models.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
void DoDispose() override
Destructor implementation.
Ptr< UniformRandomVariable > m_uniformVarO2i
uniform random variable that is used for the generation of the O2i conditions
virtual ChannelCondition::O2iConditionValue ComputeO2i(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Determines whether the channel condition is O2I or O2O.
static uint32_t GetKey(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b)
Returns a unique and reciprocal key for the channel between a and b.
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
~ThreeGppChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
Ptr< UniformRandomVariable > m_uniformO2iLowHighLossVar
a uniform random variable for the calculation of the low/high losses, see TR38.901 Table 7....
VehicleDensity
Determine the density of vehicles in a V2V scenario.
double m_o2iLowLossThreshold
the threshold for determining what is the ratio of low - high O2I building penetration losses
static double Calculate2dDistance(const Vector &a, const Vector &b)
Computes the 2D distance between two 3D vectors.
virtual double ComputePnlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Compute the NLOS probability.
double m_o2iThreshold
the threshold for determining what is the ratio of channels with O2I
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Compute the LOS probability.
std::unordered_map< uint32_t, Item > m_channelConditionMap
map to store the channel conditions
Ptr< UniformRandomVariable > m_uniformVar
uniform random variable
ThreeGppChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
Ptr< ChannelCondition > ComputeChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
This method computes the channel condition based on a probabilistic model that is specific for the sc...
bool m_linkO2iConditionToAntennaHeight
the indicator that determines whether the O2I/O2O condition is determined based on the UE height
Time m_updatePeriod
the update period for the channel condition
static TypeId GetTypeId()
Get the type ID.
Computes the channel condition for the Indoor Mixed Office scenario.
ThreeGppIndoorMixedOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
~ThreeGppIndoorMixedOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Mixed Offi...
Computes the channel condition for the Indoor Open Office scenario.
ThreeGppIndoorOpenOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Open Offic...
~ThreeGppIndoorOpenOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
Computes the channel condition for the RMa scenario.
~ThreeGppRmaChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the RMa scenario.
ThreeGppRmaChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
static TypeId GetTypeId()
Get the type ID.
Computes the channel condition for the UMa scenario.
static TypeId GetTypeId()
Get the type ID.
ThreeGppUmaChannelConditionModel()
Constructor for the ThreeGppUmaChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMa scenario.
~ThreeGppUmaChannelConditionModel() override
Destructor for the ThreeGppUmaChannelConditionModel class.
Computes the channel condition for the UMi-Street canyon scenario.
ThreeGppUmiStreetCanyonChannelConditionModel()
Constructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
~ThreeGppUmiStreetCanyonChannelConditionModel() override
Destructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMi-Street Canyon...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Struct to store the channel condition in the m_channelConditionMap.
Ptr< ChannelCondition > m_condition
the channel condition
Time m_generatedTime
the time when the condition was generated