INET Framework for OMNeT++/OMNEST
|
a simple snr decider... More...
#include <SnrDecider.h>
Protected Member Functions | |
virtual void | initialize (int) |
Initialization of the module and some variables. | |
virtual bool | snrOverThreshold (SnrList &) const |
virtual void | handleLowerMsg (AirFrame *, SnrList &) |
In this function the decision whether a frame is received correctly or not is made. | |
Protected Attributes | |
double | snrThresholdLevel |
Level for decision [mW]. |
a simple snr decider...
This decider simply takes a look at the sduList contained in the received PhySDU packet and checks whether one of the mentioned snr levels is lower than the snrThresholdLevel which has to be read in at the beginning of a simulation. (suggestion: from the omnetpp.ini file!)
void SnrDecider::handleLowerMsg | ( | AirFrame * | frame, |
SnrList & | snrList | ||
) | [protected, virtual] |
In this function the decision whether a frame is received correctly or not is made.
Redefine this function if you want to process messages from the channel before they are forwarded to upper layers
In this function it has to be decided whether this message got lost or not. This can be done with a simple SNR threshold or with transformations of SNR into bit error probabilities...
If you want to forward the message to upper layers please use sendUp which will decapsulate the MAC frame before sending
Reimplemented from BasicDecider.
Reimplemented in ErrAndCollDecider.
{ if (snrOverThreshold(receivedList)) { EV << "Message handed on to Mac\n"; sendUp(af); } else { delete af; } }
void SnrDecider::initialize | ( | int | stage | ) | [protected, virtual] |
Initialization of the module and some variables.
First we have to initialize the module from which we derived ours, in this case BasicModule.
Then we have to intialize the gates and - if necessary - some own variables.
Reimplemented from BasicDecider.
{ BasicDecider::initialize(stage); if (stage == 0) { snrThresholdLevel = FWMath::dBm2mW(par("snrThresholdLevel")); } }
bool SnrDecider::snrOverThreshold | ( | SnrList & | snrlist | ) | const [protected, virtual] |
Checks the received sduList (from the PhySDU header) if it contains an snr level above the threshold
Referenced by handleLowerMsg(), and ErrAndCollDecider::handleLowerMsg().
{ //check the entries in the sduList if a level is lower than the //acceptable minimum: //check for (SnrList::const_iterator iter = snrlist.begin(); iter != snrlist.end(); iter++) { if (iter->snr <= snrThresholdLevel) { EV << "Message got lost. MessageSnr: " << iter-> snr << " Threshold: " << snrThresholdLevel << endl; return false; } } return true; }
double SnrDecider::snrThresholdLevel [protected] |
Level for decision [mW].
When a packet contains an snr level higher than snrThresholdLevel it will be considered as lost. This parameter has to be specified at the beginning of a simulation (omnetpp.ini) in dBm.
Referenced by initialize(), and snrOverThreshold().