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::physicallayer::IPrintableObject

Public Member Functions

 BreakpointPathLoss ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) 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::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () 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::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 

Detailed Description

Implementation of a breakpoint path loss model.

Constructor & Destructor Documentation

inet::physicallayer::BreakpointPathLoss::BreakpointPathLoss ( )
9  :
10  l01(NaN),
11  l02(NaN),
12  alpha1(NaN),
13  alpha2(NaN),
15 {
16 }
double alpha1
pathloss exponents
Definition: BreakpointPathLoss.h:19
m breakpointDistance
Breakpoint distance squared.
Definition: BreakpointPathLoss.h:21
double alpha2
Definition: BreakpointPathLoss.h:19
#define NaN
Definition: INETMath.h:103
double l02
Definition: BreakpointPathLoss.h:17
double l01
initial path loss
Definition: BreakpointPathLoss.h:17
value< double, units::m > m
Definition: Units.h:1047

Member Function Documentation

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.

42 {
43  // PL(d) = PL0 + 10 alpha log10 (d/d0)
44  // 10 ^ { PL(d)/10 } = 10 ^{PL0 + 10 alpha log10 (d/d0)}/10
45  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * 10 ^ { 10 log10 (d/d0)^alpha }/10
46  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * 10 ^ { log10 (d/d0)^alpha }
47  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * (d/d0)^alpha
48  if (distance < breakpointDistance)
49  return 1 / (l01 * pow(distance.get(), alpha1));
50  else
51  return 1 / (l02 * pow(unit(distance / breakpointDistance).get(), alpha2));
52 }
double alpha1
pathloss exponents
Definition: BreakpointPathLoss.h:19
m breakpointDistance
Breakpoint distance squared.
Definition: BreakpointPathLoss.h:21
double alpha2
Definition: BreakpointPathLoss.h:19
double l02
Definition: BreakpointPathLoss.h:17
pow< internal::none, 0 > unit
Definition: Units.h:60
double l01
initial path loss
Definition: BreakpointPathLoss.h:17
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.

55 {
56  // this assumes the path loss is a continuous function
57  // the result should be the same for the second case including l02 and alpha2
58  double breakpointPathLoss = 1 / (l01 * pow(breakpointDistance.get(), alpha1));
59 
60  if(loss < breakpointPathLoss) {
61  // the allowed loss factor is smaller than the one faced at the breakpoint distance
62  // -> range is higher than breakpointDistance
63  // loss = 1 / (l02 * (d / d0)^alpha2)
64  // (d / d0)^alpha2 = 1 / (loss * l02)
65  // (d / d0) = 1 / ((loss * l02)^(1/alpha2))
66  // d = d0 / ((loss * l02)^(1/alpha2))
67  return breakpointDistance / (pow(loss * l02, 1/alpha2));
68  }
69  else {
70  return m(1) / (pow(loss * l01, 1/alpha1));
71  }
72 }
double alpha1
pathloss exponents
Definition: BreakpointPathLoss.h:19
m breakpointDistance
Breakpoint distance squared.
Definition: BreakpointPathLoss.h:21
const value_type & get() const
Definition: Units.h:89
double alpha2
Definition: BreakpointPathLoss.h:19
double l02
Definition: BreakpointPathLoss.h:17
double l01
initial path loss
Definition: BreakpointPathLoss.h:17
value< double, units::m > m
Definition: Units.h:1047
void inet::physicallayer::BreakpointPathLoss::initialize ( int  stage)
overrideprotectedvirtual
19 {
20  if (stage == INITSTAGE_LOCAL) {
21  l01 = math::dB2fraction(par("l01"));
22  l02 = math::dB2fraction(par("l02"));
23  alpha1 = par("alpha1");
24  alpha2 = par("alpha2");
25  breakpointDistance = m(par("breakpointDistance"));
26  }
27 }
double alpha1
pathloss exponents
Definition: BreakpointPathLoss.h:19
m breakpointDistance
Breakpoint distance squared.
Definition: BreakpointPathLoss.h:21
double alpha2
Definition: BreakpointPathLoss.h:19
double dB2fraction(double dB)
Converts a dB value to fraction.
Definition: INETMath.h:166
Local initializations.
Definition: InitStages.h:35
double l02
Definition: BreakpointPathLoss.h:17
double l01
initial path loss
Definition: BreakpointPathLoss.h:17
value< double, units::m > m
Definition: Units.h:1047
std::ostream & inet::physicallayer::BreakpointPathLoss::printToStream ( std::ostream &  stream,
int  level 
) const
overridevirtual

Prints this object to the provided output stream.

Function calls to operator<< with pointers or references either const or not are all forwarded to this function.

Reimplemented from inet::physicallayer::IPrintableObject.

30 {
31  stream << "BreakpointPathLoss";
32  if (level <= PRINT_LEVEL_TRACE)
33  stream << ", L01 = " << l01
34  << ", L02 = " << l02
35  << ", alpha1 = " << alpha1
36  << ", alpha2 = " << alpha2
37  << ", breakpointDistance = " << breakpointDistance;
38  return stream;
39 }
double alpha1
pathloss exponents
Definition: BreakpointPathLoss.h:19
m breakpointDistance
Breakpoint distance squared.
Definition: BreakpointPathLoss.h:21
double alpha2
Definition: BreakpointPathLoss.h:19
double l02
Definition: BreakpointPathLoss.h:17
double l01
initial path loss
Definition: BreakpointPathLoss.h:17

Member Data Documentation

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

pathloss exponents

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

double inet::physicallayer::BreakpointPathLoss::alpha2
protected
m inet::physicallayer::BreakpointPathLoss::breakpointDistance
protected

Breakpoint distance squared.

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

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

initial path loss

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

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

The documentation for this class was generated from the following files: