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

Two-Ray interference model borrowed from Veins (default parameterization) More...

#include <TwoRayInterference.h>

Inheritance diagram for inet::physicallayer::TwoRayInterference:
inet::physicallayer::IPathLoss inet::physicallayer::IPrintableObject

Public Member Functions

 TwoRayInterference ()
 
void initialize (int stage) override
 
double computePathLoss (const ITransmission *, const IArrival *) const override
 Returns the loss factor for the provided transmission and arrival. More...
 
double computePathLoss (mps propagation, Hz frequency, m distance) const override
 Returns the loss factor as a function of propagation speed, carrier frequency and distance. More...
 
m computeRange (mps propagation, Hz frequency, double loss) const override
 Returns the range for the given loss factor. More...
 
std::ostream & printToStream (std::ostream &, int level) const override
 Prints this object to the provided output stream. 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 double computeTwoRayInterference (const Coord &posTx, const Coord &posRx, m waveLength) const
 

Protected Attributes

double epsilon_r
 

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

Two-Ray interference model borrowed from Veins (default parameterization)

See "Using the Right Two-Way Model? A Measurement-based Evaluation of PHY Models in VANETs" by C. Sommer and F. Dressler (2011) or "On the Applicability of Two-Ray Path Loss Models for Vehicular Network Simulation" by C. Sommer, S. Joerer and F. Dressler (2012)

Constructor & Destructor Documentation

inet::physicallayer::TwoRayInterference::TwoRayInterference ( )
9  :
10  epsilon_r(1.0)
11 {
12 }
double epsilon_r
Definition: TwoRayInterference.h:28

Member Function Documentation

double inet::physicallayer::TwoRayInterference::computePathLoss ( const ITransmission transmission,
const IArrival arrival 
) const
overridevirtual

Returns the loss factor for the provided transmission and arrival.

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::IPathLoss.

30 {
31  auto radioMedium = transmission->getTransmitter()->getMedium();
32  auto narrowbandSignalAnalogModel = check_and_cast<const INarrowbandSignal *>(transmission->getAnalogModel());
33  mps propagationSpeed = radioMedium->getPropagation()->getPropagationSpeed();
34  Hz carrierFrequency = Hz(narrowbandSignalAnalogModel->getCarrierFrequency());
35  const m waveLength = propagationSpeed / carrierFrequency;
36 
37  return computeTwoRayInterference(transmission->getStartPosition(), arrival->getStartPosition(), waveLength);
38 }
pow< s,-1 > Hz
Definition: Units.h:766
virtual double computeTwoRayInterference(const Coord &posTx, const Coord &posRx, m waveLength) const
Definition: TwoRayInterference.cc:40
compose< m, pow< s,-1 > > mps
Definition: Units.h:968
value< double, units::m > m
Definition: Units.h:1047
double inet::physicallayer::TwoRayInterference::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::IPathLoss.

60 {
61  return NaN;
62 }
#define NaN
Definition: INETMath.h:103
m inet::physicallayer::TwoRayInterference::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.

65 {
66  return m(NaN);
67 }
#define NaN
Definition: INETMath.h:103
value< double, units::m > m
Definition: Units.h:1047
double inet::physicallayer::TwoRayInterference::computeTwoRayInterference ( const Coord posTx,
const Coord posRx,
m  waveLength 
) const
protectedvirtual

Referenced by computePathLoss().

41 {
42  const m distance { pos_r.distance(pos_t) };
43  const m h_sum { pos_t.z + pos_r.z };
44  const m h_dif { pos_t.z - pos_r.z };
45  const m d_los = sqrt(distance * distance + h_dif * h_dif);
46  const m d_ref = sqrt(distance * distance + h_sum * h_sum);
47 
48  const double phi = 2 * M_PI * unit((d_los - d_ref) / lambda).get();
49  const double sin_theta = unit(h_sum / d_ref).get();
50  const double cos_theta = unit(distance / d_ref).get();
51  const double gamma = sqrt(epsilon_r - cos_theta * cos_theta);
52  const double Gamma = (sin_theta - gamma) / (sin_theta + gamma);
53 
54  const double space = 4 * M_PI * unit(distance / lambda).get();
55  const double rays = sqrt(pow(1 + Gamma * cos(phi), 2) + Gamma * Gamma * pow(sin(phi), 2));
56  return pow(space / rays, -2);
57 }
Value cos(const value< Value, Unit > &angle)
Definition: Units.h:1201
double epsilon_r
Definition: TwoRayInterference.h:28
value< Value, pow< Unit, 1, 2 > > sqrt(const value< Value, Unit > &a)
Definition: Units.h:247
#define M_PI
Definition: PlotFigure.cc:27
pow< internal::none, 0 > unit
Definition: Units.h:60
Value sin(const value< Value, Unit > &angle)
Definition: Units.h:1195
value< double, units::m > m
Definition: Units.h:1047
void inet::physicallayer::TwoRayInterference::initialize ( int  stage)
override
15 {
16  if (stage == INITSTAGE_LOCAL) {
17  epsilon_r = par("epsilon_r");
18  }
19 }
double epsilon_r
Definition: TwoRayInterference.h:28
Local initializations.
Definition: InitStages.h:35
std::ostream & inet::physicallayer::TwoRayInterference::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.

22 {
23  os << "TwoRayInterference";
24  if (level >= PRINT_LEVEL_TRACE)
25  os << ", epsilon_r = " << epsilon_r;
26  return os;
27 }
double epsilon_r
Definition: TwoRayInterference.h:28

Member Data Documentation

double inet::physicallayer::TwoRayInterference::epsilon_r
protected

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