INET Framework for OMNeT++/OMNEST
SnrDecider Class Reference

a simple snr decider... More...

#include <SnrDecider.h>

Inheritance diagram for SnrDecider:
BasicDecider BasicModule INotifiable ErrAndCollDecider

List of all members.

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].

Detailed Description

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!)

Author:
Marc Löbbers, Andreas Koepke

Definition at line 39 of file SnrDecider.h.


Member Function Documentation

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.

Definition at line 61 of file SnrDecider.cc.

{
    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.

Definition at line 28 of file SnrDecider.cc.

{
    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

Definition at line 43 of file SnrDecider.cc.

Referenced by ErrAndCollDecider::handleLowerMsg(), and 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;
}

Member Data Documentation

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.

Definition at line 48 of file SnrDecider.h.

Referenced by initialize(), and snrOverThreshold().


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