Public Member Functions | Protected Attributes

PERModel Class Reference
[analogueModels - AnalogueModel implementations]

This class applies a parameterized packet error rate to incoming packets. This allows the user to easily study the robustness of its system to packet loss. More...

#include <PERModel.h>

Inherits AnalogueModel.

Collaboration diagram for PERModel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PERModel (double per)
 The PERModel constructor takes as argument the packet error rate to apply (must be between 0 and 1).
virtual void filterSignal (Signal &s)
 Has to be overriden by every implementation.

Protected Attributes

double packetErrorRate

Detailed Description

This class applies a parameterized packet error rate to incoming packets. This allows the user to easily study the robustness of its system to packet loss.

Author:
Jérôme Rousselot <jerome.rousselot@csem.ch>

Definition at line 15 of file PERModel.h.


Member Function Documentation

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

Has to be overriden by every implementation.

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

Implements AnalogueModel.

Definition at line 3 of file PERModel.cc.

References Signal::addAttenuation(), Signal::getSignalLength(), Signal::getSignalStart(), and TimeMapping< Interpolator >::setValue().

                                     {
  simtime_t start = s.getSignalStart();
  simtime_t end = start + s.getSignalLength();

  double attenuationFactor = 1;  // no attenuation
  if(packetErrorRate > 0 && uniform(0, 1) < packetErrorRate) {
    attenuationFactor = 0;  // absorb all energy so that the receveir cannot receive anything
  }

  TimeMapping<Linear>* attMapping = new TimeMapping<Linear> ();
  Argument arg;
  attMapping->setValue(arg, attenuationFactor);
  s.addAttenuation(attMapping);
}


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