Public Member Functions | Protected Attributes

BreakpointPathlossModel Class Reference
[analogueModels - AnalogueModel implementations]

Basic implementation of a BreakpointPathlossModel. This class can be used to implement the ieee802154 path loss model. More...

#include <BreakpointPathlossModel.h>

Inherits AnalogueModel.

Collaboration diagram for BreakpointPathlossModel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BreakpointPathlossModel (double L01, double L02, double alpha1, double alpha2, double breakpointDistance, double carrierFrequency, const Move *myMove, bool useTorus, const Coord &playgroundSize, bool debug)
 Initializes the analogue model. myMove and playgroundSize need to be valid as long as this instance exists.
virtual void filterSignal (Signal &s)
 Filters a specified Signal by adding an attenuation over time to the Signal.
virtual bool isActiveAtDestination ()
virtual bool isActiveAtOrigin ()

Protected Attributes

double PL01
 Model to use for distances below breakpoint distance.
double PL02
double PL01_real
 initial path loss
double PL02_real
double alpha1
 pathloss exponents
double alpha2
double breakpointDistance
 Breakpoint distance squared.
double carrierFrequency
 Carrier frequency in Hz.
const MovemyMove
 stores my Move pattern
const bool useTorus
 Information needed about the playground.
const CoordplaygroundSize
 The size of the playground.
bool debug
 Whether debug messages should be displayed.
cOutVector pathlosses

Detailed Description

Basic implementation of a BreakpointPathlossModel. This class can be used to implement the ieee802154 path loss model.

Definition at line 18 of file BreakpointPathlossModel.h.


Constructor & Destructor Documentation

BreakpointPathlossModel::BreakpointPathlossModel ( double  L01,
double  L02,
double  alpha1,
double  alpha2,
double  breakpointDistance,
double  carrierFrequency,
const Move myMove,
bool  useTorus,
const Coord playgroundSize,
bool  debug 
) [inline]

Initializes the analogue model. myMove and playgroundSize need to be valid as long as this instance exists.

The constructor needs some specific knowledge in order to create its mapping properly:

Parameters:
alpha the coefficient alpha (specified e.g. in config.xml and passed in constructor call)
carrierFrequency the carrier frequency
myMove a pointer to the hosts move pattern
useTorus information about the playground the host is moving in
playgroundSize information about the playground the host is moving in
debug display debug messages?

Definition at line 73 of file BreakpointPathlossModel.h.

References pathlosses, PL01, and PL01_real.

                                                                 :
//    closeRangeModel(L01, alpha1, carrierFrequency, myMove, useTorus, playgroundSize, debug),
//    farRangeModel(L02, alpha2, carrierFrequency, myMove, useTorus, playgroundSize, debug),
//    breakpointDistance2(breakpointDistance*breakpointDistance),
    PL01(L01), PL02(L02), alpha1(alpha1), alpha2(alpha2), breakpointDistance(breakpointDistance),
    carrierFrequency(carrierFrequency),
    myMove(*myMove),
    useTorus(useTorus),
    playgroundSize(playgroundSize),
    debug(debug)
  {
    PL01_real =  pow(10, PL01/10);
    PL02_real =  pow(10, PL02/10);
    pathlosses.setName("pathlosses");
  }


Member Function Documentation

void BreakpointPathlossModel::filterSignal ( Signal s  )  [virtual]

Filters a specified Signal by adding an attenuation over time to the Signal.

Get start of the signal

claim the Move pattern of the sender from the Signal

Calculate the distance factor

Implements AnalogueModel.

Definition at line 6 of file BreakpointPathlossModel.cc.

References Signal::addAttenuation(), alpha1, breakpointDistance, debug, Signal::getMove(), Move::getPositionAt(), Signal::getSignalLength(), Signal::getSignalStart(), myMove, pathlosses, PL01_real, playgroundSize, TimeMapping< Interpolator >::setValue(), Coord::sqrdist(), Coord::sqrTorusDist(), DimensionSet::timeDomain, and useTorus.

                                                    {

  simtime_t sStart = s.getSignalStart();
  simtime_t sEnd = s.getSignalLength() + sStart;

  Coord sendersPos = s.getMove().getPositionAt(sStart);
  Coord myPos = myMove.getPositionAt(sStart);

  double distance = useTorus ? myPos.sqrTorusDist(sendersPos, playgroundSize)
                  : myPos.sqrdist(sendersPos);
  distance = sqrt(distance);
  debugEV << "distance is: " << distance << endl;

  if(distance <= 1.0) {
    //attenuation is negligible
    return;
  }

  double attenuation = 1;
  // PL(d) = PL0 + 10 alpha log10 (d/d0)
  // 10 ^ { PL(d)/10 } = 10 ^{PL0 + 10 alpha log10 (d/d0)}/10
  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * 10 ^ { 10 log10 (d/d0)^alpha }/10
  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * 10 ^ { log10 (d/d0)^alpha }
  // 10 ^ { PL(d)/10 } = 10 ^ PL0/10 * (d/d0)^alpha
  if(distance < breakpointDistance) {
    attenuation = attenuation * PL01_real;
    attenuation = attenuation * pow(distance, alpha1);
  } else {
    attenuation = attenuation * PL02_real;
    attenuation = attenuation * pow(distance/breakpointDistance, alpha2);
  }
  attenuation = 1/attenuation;
  debugEV << "attenuation is: " << attenuation << endl;

  if(debug) {
    pathlosses.record(10*log10(attenuation)); // in dB
  }

  const DimensionSet& domain = DimensionSet::timeDomain;
  Argument arg; // default constructor initializes with a single dimension, time, and value 0 (offset from signal start)
  TimeMapping<Linear>* attMapping = new TimeMapping<Linear> (); // mapping performs a linear interpolation from our single point -> constant
  attMapping->setValue(arg, attenuation);

  /* at last add the created attenuation mapping to the signal */
  s.addAttenuation(attMapping);
}


Member Data Documentation

cOutVector BreakpointPathlossModel::pathlosses [protected]

logs computed pathlosses.

Definition at line 55 of file BreakpointPathlossModel.h.

Referenced by BreakpointPathlossModel(), and filterSignal().

double BreakpointPathlossModel::PL01 [protected]

Model to use for distances below breakpoint distance.

Model to use for distances larger than the breakpoint distanceinitial path loss in dB

Definition at line 29 of file BreakpointPathlossModel.h.

Referenced by BreakpointPathlossModel().


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