#include <SnrDecider.h>
Inheritance diagram for SnrDecider:
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!)
Protected Member Functions | |
virtual void | initialize (int) |
Initialization of the module and some variables. | |
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]. |
|
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. 00062 { 00063 if (snrOverThreshold(receivedList)) 00064 { 00065 EV << "Message handed on to Mac\n"; 00066 sendUp(af); 00067 } 00068 else 00069 { 00070 delete af; 00071 } 00072 }
|
|
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. 00029 { 00030 BasicDecider::initialize(stage); 00031 00032 if (stage == 0) 00033 { 00034 snrThresholdLevel = FWMath::dBm2mW(par("snrThresholdLevel")); 00035 } 00036 }
|
|
Checks the received sduList (from the PhySDU header) if it contains an snr level above the threshold 00044 { 00045 //check the entries in the sduList if a level is lower than the 00046 //acceptable minimum: 00047 00048 //check 00049 for (SnrList::const_iterator iter = snrlist.begin(); iter != snrlist.end(); iter++) 00050 { 00051 if (iter->snr <= snrThresholdLevel) 00052 { 00053 EV << "Message got lost. MessageSnr: " << iter-> 00054 snr << " Threshold: " << snrThresholdLevel << endl; 00055 return false; 00056 } 00057 } 00058 return true; 00059 }
|
|
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. |