INET Framework for OMNeT++/OMNEST
inet::physicallayer::BreakpointPathLoss Class Reference

Implementation of a breakpoint path loss model. More...

#include <BreakpointPathLoss.h>

Inheritance diagram for inet::physicallayer::BreakpointPathLoss:
inet::physicallayer::PathLossBase inet::physicallayer::IPathLoss inet::IPrintableObject

Public Member Functions

 BreakpointPathLoss ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints this object to the provided output stream. More...
 
virtual double computePathLoss (mps propagationSpeed, Hz frequency, m distance) const override
 Returns the loss factor as a function of propagation speed, carrier frequency and distance. More...
 
virtual m computeRange (mps propagationSpeed, Hz frequency, double loss) const override
 Returns the range for the given loss factor. More...
 
- Public Member Functions inherited from inet::physicallayer::PathLossBase
virtual double computePathLoss (const ITransmission *transmission, const IArrival *arrival) const override
 Returns the loss factor for the provided transmission and arrival. More...
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Protected Member Functions

virtual void initialize (int stage) override
 

Protected Attributes

double l01
 initial path loss More...
 
double l02
 
double alpha1
 pathloss exponents More...
 
double alpha2
 
m breakpointDistance
 Breakpoint distance squared. More...
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 

Detailed Description

Implementation of a breakpoint path loss model.

Constructor & Destructor Documentation

◆ BreakpointPathLoss()

inet::physicallayer::BreakpointPathLoss::BreakpointPathLoss ( )
13  :
14  l01(NaN),
15  l02(NaN),
16  alpha1(NaN),
17  alpha2(NaN),
19 {
20 }

Member Function Documentation

◆ computePathLoss()

double inet::physicallayer::BreakpointPathLoss::computePathLoss ( mps  propagationSpeed,
Hz  frequency,
m  distance 
) const
overridevirtual

Returns the loss factor as a function of propagation speed, carrier frequency and distance.

The value is in the range [0, 1] where 1 means no loss at all and 0 means all power is lost.

Implements inet::physicallayer::PathLossBase.

46 {
47  // PL(d) = PL0 + 10 alpha log10 (d/d0)
48  // 10 ^ { PL(d)/10 } = 10 ^{PL0 + 10 alpha log10 (d/d0)}/10
49  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * 10 ^ { 10 log10 (d/d0)^alpha }/10
50  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * 10 ^ { log10 (d/d0)^alpha }
51  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * (d/d0)^alpha
52  if (distance < breakpointDistance)
53  return 1 / (l01 * pow(distance.get(), alpha1));
54  else
55  return 1 / (l02 * pow(unit(distance / breakpointDistance).get(), alpha2));
56 }

◆ computeRange()

m inet::physicallayer::BreakpointPathLoss::computeRange ( mps  propagationSpeed,
Hz  frequency,
double  loss 
) const
overridevirtual

Returns the range for the given loss factor.

The value is in the range [0, +infinity) or NaN if unspecified.

Implements inet::physicallayer::IPathLoss.

59 {
60  // this assumes the path loss is a continuous function
61  // the result should be the same for the second case including l02 and alpha2
62  double breakpointPathLoss = 1 / (l01 * pow(breakpointDistance.get(), alpha1));
63 
64  if (loss < breakpointPathLoss) {
65  // the allowed loss factor is smaller than the one faced at the breakpoint distance
66  // -> range is higher than breakpointDistance
67  // loss = 1 / (l02 * (d / d0)^alpha2)
68  // (d / d0)^alpha2 = 1 / (loss * l02)
69  // (d / d0) = 1 / ((loss * l02)^(1/alpha2))
70  // d = d0 / ((loss * l02)^(1/alpha2))
71  return breakpointDistance / (pow(loss * l02, 1 / alpha2));
72  }
73  else {
74  return m(1) / (pow(loss * l01, 1 / alpha1));
75  }
76 }

◆ initialize()

void inet::physicallayer::BreakpointPathLoss::initialize ( int  stage)
overrideprotectedvirtual
23 {
24  if (stage == INITSTAGE_LOCAL) {
25  l01 = math::dB2fraction(par("l01"));
26  l02 = math::dB2fraction(par("l02"));
27  alpha1 = par("alpha1");
28  alpha2 = par("alpha2");
29  breakpointDistance = m(par("breakpointDistance"));
30  }
31 }

◆ printToStream()

std::ostream & inet::physicallayer::BreakpointPathLoss::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
overridevirtual

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

34 {
35  stream << "BreakpointPathLoss";
36  if (level <= PRINT_LEVEL_TRACE)
37  stream << ", L01 = " << l01
38  << ", L02 = " << l02
39  << ", alpha1 = " << alpha1
40  << ", alpha2 = " << alpha2
42  return stream;
43 }

Member Data Documentation

◆ alpha1

double inet::physicallayer::BreakpointPathLoss::alpha1
protected

pathloss exponents

Referenced by computePathLoss(), computeRange(), initialize(), and printToStream().

◆ alpha2

double inet::physicallayer::BreakpointPathLoss::alpha2
protected

◆ breakpointDistance

m inet::physicallayer::BreakpointPathLoss::breakpointDistance
protected

Breakpoint distance squared.

Referenced by computePathLoss(), computeRange(), initialize(), and printToStream().

◆ l01

double inet::physicallayer::BreakpointPathLoss::l01
protected

initial path loss

Referenced by computePathLoss(), computeRange(), initialize(), and printToStream().

◆ l02

double inet::physicallayer::BreakpointPathLoss::l02
protected

The documentation for this class was generated from the following files:
inet::physicallayer::BreakpointPathLoss::alpha1
double alpha1
pathloss exponents
Definition: BreakpointPathLoss.h:23
inet::physicallayer::BreakpointPathLoss::alpha2
double alpha2
Definition: BreakpointPathLoss.h:23
inet::physicallayer::BreakpointPathLoss::l02
double l02
Definition: BreakpointPathLoss.h:21
inet::physicallayer::BreakpointPathLoss::breakpointDistance
m breakpointDistance
Breakpoint distance squared.
Definition: BreakpointPathLoss.h:25
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::math::dB2fraction
double dB2fraction(double dB)
Converts a dB value to fraction.
Definition: INETMath.h:153
NaN
#define NaN
Definition: INETMath.h:91
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::IPrintableObject::PRINT_LEVEL_TRACE
@ PRINT_LEVEL_TRACE
Definition: IPrintableObject.h:22
inet::units::unit
pow< internal::none, 0 > unit
Definition: Units.h:72
inet::units::value::get
const value_type & get() const
Definition: Units.h:108
inet::physicallayer::BreakpointPathLoss::l01
double l01
initial path loss
Definition: BreakpointPathLoss.h:21
inet::units::values::m
value< double, units::m > m
Definition: Units.h:1233