INET Framework for OMNeT++/OMNEST
inet::ieee80211::OnoeRateControl Class Reference

Implements the Onoe rate control algorithms. More...

#include <OnoeRateControl.h>

Inheritance diagram for inet::ieee80211::OnoeRateControl:
inet::ieee80211::RateControlBase inet::ieee80211::ModeSetListener inet::ieee80211::IRateControl

Public Member Functions

virtual const IIeee80211ModegetRate () override
 
virtual void frameTransmitted (const Ieee80211Frame *frame, int retryCount, bool isSuccessful, bool isGivenUp) override
 
virtual void frameReceived (const Ieee80211Frame *frame, const Ieee80211ReceptionIndication *receptionIndication) override
 
- Public Member Functions inherited from inet::ieee80211::IRateControl
virtual ~IRateControl ()
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void computeMode ()
 
virtual void resetStatisticalVariables ()
 
virtual void computeModeIfTimerIsExpired ()
 
virtual void updateDisplayString ()
 
- Protected Member Functions inherited from inet::ieee80211::RateControlBase
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 
virtual void emitDatarateSignal ()
 
const IIeee80211ModeincreaseRateIfPossible (const IIeee80211Mode *currentMode)
 
const IIeee80211ModedecreaseRateIfPossible (const IIeee80211Mode *currentMode)
 

Protected Attributes

simtime_t timer = SIMTIME_ZERO
 
simtime_t interval = SIMTIME_ZERO
 
int numOfRetries = 0
 
int numOfSuccTransmissions = 0
 
int numOfGivenUpTransmissions = 0
 
double avgRetriesPerFrame = 0
 
int credit = 0
 
- Protected Attributes inherited from inet::ieee80211::RateControlBase
const IIeee80211ModecurrentMode = nullptr
 
- Protected Attributes inherited from inet::ieee80211::ModeSetListener
Ieee80211ModeSetmodeSet = nullptr
 

Additional Inherited Members

- Static Public Attributes inherited from inet::ieee80211::RateControlBase
static simsignal_t datarateSignal = cComponent::registerSignal("datarate")
 

Detailed Description

Implements the Onoe rate control algorithms.

Member Function Documentation

void inet::ieee80211::OnoeRateControl::computeMode ( )
protectedvirtual

Referenced by computeModeIfTimerIsExpired().

81 {
82  int numOfFrameTransmitted = numOfSuccTransmissions + numOfGivenUpTransmissions + numOfRetries;
84 
85  if (numOfSuccTransmissions > 0)
86  {
87  if (numOfFrameTransmitted >= 10 && avgRetriesPerFrame > 1)
88  {
92  EV_DETAIL << "Decreased rate to " << *currentMode << endl;
93  credit = 0;
94  }
95  else if (avgRetriesPerFrame >= 0.1)
96  credit--;
97  else
98  credit++;
99 
100  if (credit >= 10)
101  {
105  EV_DETAIL << "Increased rate to " << *currentMode << endl;
106  credit = 0;
107  }
108 
110  }
111 }
virtual void updateDisplayString()
Definition: OnoeRateControl.cc:39
const IIeee80211Mode * increaseRateIfPossible(const IIeee80211Mode *currentMode)
Definition: RateControlBase.cc:31
int credit
Definition: OnoeRateControl.h:40
virtual void resetStatisticalVariables()
Definition: OnoeRateControl.cc:44
int numOfRetries
Definition: OnoeRateControl.h:35
double avgRetriesPerFrame
Definition: OnoeRateControl.h:39
int numOfGivenUpTransmissions
Definition: OnoeRateControl.h:37
int numOfSuccTransmissions
Definition: OnoeRateControl.h:36
const IIeee80211Mode * currentMode
Definition: RateControlBase.h:33
virtual void emitDatarateSignal()
Definition: RateControlBase.cc:43
const IIeee80211Mode * decreaseRateIfPossible(const IIeee80211Mode *currentMode)
Definition: RateControlBase.cc:37
void inet::ieee80211::OnoeRateControl::computeModeIfTimerIsExpired ( )
protectedvirtual

Referenced by frameTransmitted(), and getRate().

68 {
69  if (simTime() - timer >= interval)
70  {
71  computeMode();
72  timer = simTime();
73  }
74 }
virtual void computeMode()
Definition: OnoeRateControl.cc:80
simtime_t interval
Definition: OnoeRateControl.h:33
simtime_t timer
Definition: OnoeRateControl.h:32
void inet::ieee80211::OnoeRateControl::frameReceived ( const Ieee80211Frame frame,
const Ieee80211ReceptionIndication receptionIndication 
)
overridevirtual

Implements inet::ieee80211::IRateControl.

77 {
78 }
void inet::ieee80211::OnoeRateControl::frameTransmitted ( const Ieee80211Frame frame,
int  retryCount,
bool  isSuccessful,
bool  isGivenUp 
)
overridevirtual

Implements inet::ieee80211::IRateControl.

57 {
59  if (isSuccessful)
61  else if (isGivenUp)
63  if (retryCount > 0)
64  numOfRetries++;
65 }
virtual void computeModeIfTimerIsExpired()
Definition: OnoeRateControl.cc:67
int numOfRetries
Definition: OnoeRateControl.h:35
int numOfGivenUpTransmissions
Definition: OnoeRateControl.h:37
int numOfSuccTransmissions
Definition: OnoeRateControl.h:36
const IIeee80211Mode * inet::ieee80211::OnoeRateControl::getRate ( )
overridevirtual

Implements inet::ieee80211::IRateControl.

114 {
115  Enter_Method_Silent("getRate()");
117  EV_INFO << "The current mode is " << currentMode << " the net bitrate is " << currentMode->getDataMode()->getNetBitrate() << std::endl;
118  return currentMode;
119 }
virtual const IIeee80211DataMode * getDataMode() const =0
virtual void computeModeIfTimerIsExpired()
Definition: OnoeRateControl.cc:67
virtual bps getNetBitrate() const =0
const IIeee80211Mode * currentMode
Definition: RateControlBase.h:33
void inet::ieee80211::OnoeRateControl::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
52 {
53  throw cRuntimeError("This module doesn't handle self messages");
54 }
void inet::ieee80211::OnoeRateControl::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ieee80211::RateControlBase.

26 {
28  if (stage == INITSTAGE_LOCAL) {
29  interval = par("interval");
30  WATCH(numOfRetries);
31  WATCH(credit);
34  WATCH(avgRetriesPerFrame);
36  }
37 }
virtual void updateDisplayString()
Definition: OnoeRateControl.cc:39
int credit
Definition: OnoeRateControl.h:40
int numOfRetries
Definition: OnoeRateControl.h:35
simtime_t interval
Definition: OnoeRateControl.h:33
Local initializations.
Definition: InitStages.h:35
double avgRetriesPerFrame
Definition: OnoeRateControl.h:39
int numOfGivenUpTransmissions
Definition: OnoeRateControl.h:37
int numOfSuccTransmissions
Definition: OnoeRateControl.h:36
virtual void initialize(int stage) override
Definition: RateControlBase.cc:26
virtual int inet::ieee80211::OnoeRateControl::numInitStages ( ) const
inlineoverrideprotectedvirtual

Reimplemented from inet::ieee80211::RateControlBase.

43 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::ieee80211::OnoeRateControl::resetStatisticalVariables ( )
protectedvirtual

Referenced by computeMode().

45 {
46  numOfRetries = 0;
49 }
int numOfRetries
Definition: OnoeRateControl.h:35
int numOfGivenUpTransmissions
Definition: OnoeRateControl.h:37
int numOfSuccTransmissions
Definition: OnoeRateControl.h:36
void inet::ieee80211::OnoeRateControl::updateDisplayString ( )
protectedvirtual

Referenced by computeMode(), and initialize().

40 {
41  getDisplayString().setTagArg("t", 0, currentMode->getName());
42 }
const IIeee80211Mode * currentMode
Definition: RateControlBase.h:33
virtual const char * getName() const =0

Member Data Documentation

double inet::ieee80211::OnoeRateControl::avgRetriesPerFrame = 0
protected

Referenced by computeMode(), and initialize().

int inet::ieee80211::OnoeRateControl::credit = 0
protected

Referenced by computeMode(), and initialize().

simtime_t inet::ieee80211::OnoeRateControl::interval = SIMTIME_ZERO
protected
int inet::ieee80211::OnoeRateControl::numOfGivenUpTransmissions = 0
protected
int inet::ieee80211::OnoeRateControl::numOfRetries = 0
protected
int inet::ieee80211::OnoeRateControl::numOfSuccTransmissions = 0
protected
simtime_t inet::ieee80211::OnoeRateControl::timer = SIMTIME_ZERO
protected

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