A Discrete-Event Network Simulator
API
three-gpp-propagation-loss-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 THREE_GPP_PROPAGATION_LOSS_MODEL_H
20 #define THREE_GPP_PROPAGATION_LOSS_MODEL_H
21 
22 #include "ns3/channel-condition-model.h"
23 #include "ns3/propagation-loss-model.h"
24 
25 namespace ns3
26 {
27 
34 {
35  public:
40  static TypeId GetTypeId();
41 
46 
51 
52  // Delete copy constructor and assignment operator to avoid misuse
55 
62 
68 
73  void SetFrequency(double f);
74 
79  double GetFrequency() const;
80 
81  private:
91  double DoCalcRxPower(double txPowerDbm,
93  Ptr<MobilityModel> b) const override;
94 
95  int64_t DoAssignStreams(int64_t stream) override;
96 
106  double GetLoss(Ptr<ChannelCondition> cond,
107  double distance2D,
108  double distance3D,
109  double hUt,
110  double hBs) const;
111 
121  virtual double GetLossLos(double distance2D,
122  double distance3D,
123  double hUt,
124  double hBs) const = 0;
125 
138  virtual double GetO2iDistance2dIn() const = 0;
139 
157 
175 
185  virtual double GetLossNlos(double distance2D,
186  double distance3D,
187  double hUt,
188  double hBs) const = 0;
189 
200  virtual double GetLossNlosv(double distance2D, double distance3D, double hUt, double hBs) const;
201 
210  virtual std::pair<double, double> GetUtAndBsHeights(double za, double zb) const;
211 
226 
236  ChannelCondition::LosConditionValue cond) const = 0;
237 
244  ChannelCondition::LosConditionValue cond) const = 0;
245 
257  static uint32_t GetKey(Ptr<MobilityModel> a, Ptr<MobilityModel> b);
258 
270 
271  protected:
272  void DoDispose() override;
273 
280  static double Calculate2dDistance(Vector a, Vector b);
281 
283  double m_frequency;
288 
291  {
292  double m_shadowing;
294  Vector m_distance;
295  };
296 
297  mutable std::unordered_map<uint32_t, ShadowingMapItem>
299 
302  {
303  double m_o2iLoss;
305  };
306 
307  mutable std::unordered_map<uint32_t, O2iLossMapItem>
309 
320 };
321 
329 {
330  public:
335  static TypeId GetTypeId();
336 
341 
346 
347  // Delete copy constructor and assignment operator to avoid misuse
350 
351  private:
361  double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override;
362 
375  double GetO2iDistance2dIn() const override;
376 
386  double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override;
387 
397  ChannelCondition::LosConditionValue cond) const override;
398 
405 
414  static double Pl1(double frequency, double distance3D, double h, double w);
415 
423  static double GetBpDistance(double frequency, double hA, double hB);
424 
425  double m_h;
426  double m_w;
427 };
428 
436 {
437  public:
442  static TypeId GetTypeId();
443 
448 
453 
454  // Delete copy constructor and assignment operator to avoid misuse
457 
458  private:
459  int64_t DoAssignStreams(int64_t stream) override;
460 
470  double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override;
471 
484  double GetO2iDistance2dIn() const override;
485 
495  double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override;
496 
506  ChannelCondition::LosConditionValue cond) const override;
507 
514 
522  double GetBpDistance(double hUt, double hBs, double distance2D) const;
523 
526 };
527 
535 {
536  public:
541  static TypeId GetTypeId();
542 
547 
552 
553  // Delete copy constructor and assignment operator to avoid misuse
558 
559  private:
569  double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override;
570 
583  double GetO2iDistance2dIn() const override;
584 
594  double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override;
595 
605  ChannelCondition::LosConditionValue cond) const override;
606 
613 
621  double GetBpDistance(double hUt, double hBs, double distance2D) const;
622 
629  std::pair<double, double> GetUtAndBsHeights(double za, double zb) const override;
630 };
631 
639 {
640  public:
645  static TypeId GetTypeId();
646 
651 
656 
657  // Delete copy constructor and assignment operator to avoid misuse
659  delete;
662 
663  private:
673  double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override;
674 
687  double GetO2iDistance2dIn() const override;
688 
698  double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override;
699 
709  ChannelCondition::LosConditionValue cond) const override;
710 
717 };
718 
719 } // namespace ns3
720 
721 #endif /* THREE_GPP_PROPAGATION_LOSS_MODEL_H */
double f(double x, void *params)
Definition: 80211b.c:71
LosConditionValue
Possible values for Line-of-Sight condition.
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the Indoor Office scenario...
ThreeGppIndoorOfficePropagationLossModel(const ThreeGppIndoorOfficePropagationLossModel &)=delete
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
ThreeGppIndoorOfficePropagationLossModel & operator=(const ThreeGppIndoorOfficePropagationLossModel &)=delete
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
Base class for the 3GPP propagation models.
Ptr< ChannelConditionModel > GetChannelConditionModel() const
Returns the associated channel condition model.
virtual double GetO2iLowPenetrationLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the o2i building penetration loss value by looking at m_o2iLossMap.
double GetLoss(Ptr< ChannelCondition > cond, double distance2D, double distance3D, double hUt, double hBs) const
Computes the pathloss between a and b.
Ptr< UniformRandomVariable > m_randomO2iVar2
a uniform random variable for the calculation of the indoor loss, see TR38.901 Table 7....
double GetFrequency() const
Return the current central frequency.
Ptr< UniformRandomVariable > m_randomO2iVar1
a uniform random variable for the calculation of the indoor loss, see TR38.901 Table 7....
virtual double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const =0
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetShadowing(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the shadowing value by looking at m_shadowingMap.
static double Calculate2dDistance(Vector a, Vector b)
Computes the 2D distance between two 3D vectors.
void SetChannelConditionModel(Ptr< ChannelConditionModel > model)
Set the channel condition model used to determine the channel state (e.g., the LOS/NLOS condition)
std::unordered_map< uint32_t, ShadowingMapItem > m_shadowingMap
map to store the shadowing values
virtual double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const =0
Computes the pathloss between a and b considering that the line of sight is not obstructed.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
ThreeGppPropagationLossModel & operator=(const ThreeGppPropagationLossModel &)=delete
virtual double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const =0
Returns the shadow fading correlation distance.
ThreeGppPropagationLossModel(const ThreeGppPropagationLossModel &)=delete
Ptr< NormalRandomVariable > m_normRandomVariable
normal random variable
Ptr< ChannelConditionModel > m_channelConditionModel
pointer to the channel condition model
std::unordered_map< uint32_t, O2iLossMapItem > m_o2iLossMap
map to store the o2i Loss values
virtual double GetO2iDistance2dIn() const =0
Returns the minimum of the two independently generated distances according to the uniform distributio...
virtual double GetO2iHighPenetrationLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const
Retrieves the o2i building penetration loss value by looking at m_o2iLossMap.
void SetFrequency(double f)
Set the central frequency of the model.
void DoDispose() override
Destructor implementation.
static uint32_t GetKey(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Returns an unique key for the channel between a and b.
Ptr< NormalRandomVariable > m_normalO2iLowLossVar
a normal random variable for the calculation of 02i low loss, see TR38.901 Table 7....
bool m_enforceRanges
strictly enforce TR 38.901 parameter ranges
virtual double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const =0
Returns the shadow fading standard deviation.
virtual double GetLossNlosv(double distance2D, double distance3D, double hUt, double hBs) const
Computes the pathloss between a and b considering that the line of sight is obstructed by a vehicle.
Ptr< NormalRandomVariable > m_normalO2iHighLossVar
a normal random variable for the calculation of 02i high loss, see TR38.901 Table 7....
virtual std::pair< double, double > GetUtAndBsHeights(double za, double zb) const
Determines hUT and hBS.
double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Computes the received power by applying the pathloss model described in 3GPP TR 38....
static Vector GetVectorDifference(Ptr< MobilityModel > a, Ptr< MobilityModel > b)
Get the difference between the node position.
bool m_buildingPenLossesEnabled
enable/disable building penetration losses
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the RMa scenario.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
static double Pl1(double frequency, double distance3D, double h, double w)
Computes the PL1 formula for the RMa scenario.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
ThreeGppRmaPropagationLossModel & operator=(const ThreeGppRmaPropagationLossModel &)=delete
ThreeGppRmaPropagationLossModel(const ThreeGppRmaPropagationLossModel &)=delete
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
double m_h
average building height in meters
static double GetBpDistance(double frequency, double hA, double hB)
Computes the breakpoint distance for the RMa scenario.
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the UMa scenario.
double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
ThreeGppUmaPropagationLossModel & operator=(const ThreeGppUmaPropagationLossModel &)=delete
double GetBpDistance(double hUt, double hBs, double distance2D) const
Computes the breakpoint distance.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
ThreeGppUmaPropagationLossModel(const ThreeGppUmaPropagationLossModel &)=delete
double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
Ptr< UniformRandomVariable > m_uniformVar
a uniform random variable used for the computation of the breakpoint distance
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
Implements the pathloss model defined in 3GPP TR 38.901, Table 7.4.1-1 for the UMi-Street Canyon scen...
std::pair< double, double > GetUtAndBsHeights(double za, double zb) const override
Determines hUT and hBS.
ThreeGppUmiStreetCanyonPropagationLossModel & operator=(const ThreeGppUmiStreetCanyonPropagationLossModel &)=delete
double GetLossNlos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is obstructed.
double GetShadowingStd(Ptr< MobilityModel > a, Ptr< MobilityModel > b, ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading standard deviation.
double GetBpDistance(double hUt, double hBs, double distance2D) const
Computes the breakpoint distance.
double GetO2iDistance2dIn() const override
Returns the minimum of the two independently generated distances according to the uniform distributio...
double GetLossLos(double distance2D, double distance3D, double hUt, double hBs) const override
Computes the pathloss between a and b considering that the line of sight is not obstructed.
ThreeGppUmiStreetCanyonPropagationLossModel(const ThreeGppUmiStreetCanyonPropagationLossModel &)=delete
double GetShadowingCorrelationDistance(ChannelCondition::LosConditionValue cond) const override
Returns the shadow fading correlation distance.
a unique identifier for an interface.
Definition: type-id.h:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ChannelCondition::LosConditionValue m_condition
the LOS/NLOS condition
ChannelCondition::LosConditionValue m_condition
the LOS/NLOS condition