Decider80211 Class Reference

#include <Decider80211.h>

Inheritance diagram for Decider80211:

BasicDecider BasicModule INotifiable

List of all members.


Detailed Description

Decider for the 802.11 modules.

Depending on the minimum of the snr included in the PhySDU this module computes a bit error probability. The header (1 Mbit/s) is always modulated with DBQPSK. The PDU is normally modulated either with DBPSK (1 and 2 Mbit/s) or CCK (5.5 and 11 Mbit/s). CCK is not easy to model, therefore it is modeled as DQPSK with a 16-QAM for 5.5 Mbit/s and a 256-QAM for 11 Mbit/s.

Author:
Marc Löbbers, David Raguin

Protected Member Functions

virtual void initialize (int)
 Initialization of the module and some variables.
virtual void handleLowerMsg (AirFrame *, SnrList &)
 In this function the decision whether a frame is received correctly or not is made.
double dB2fraction (double)
 converts a dB value into a normal fraction
virtual bool isPacketOK (double, int)
 computes if packet is ok or has errors

Protected Attributes

double bitrate
 should be set in the omnetpp.ini
double snirThreshold
 should be set in the omnetpp.ini; everthing below this threshold can't be read and is therefor considered as a collision

Member Function Documentation

void Decider80211::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 BasicDecider.

This decider also needs the bitrate and some 802.11 parameters are initialized

Reimplemented from BasicDecider.

00035 {
00036     BasicDecider::initialize(stage);
00037 
00038     if (stage == 0)
00039     {
00040         EV << "initializing stage 0\n";
00041         bitrate = par("bitrate");
00042         if (bitrate != 1E+6 && bitrate != 2E+6 && bitrate != 5.5E+6 && bitrate != 11E+6)
00043             error("Wrong bitrate!! Please chose 1E+6, 2E+6, 5.5E+6 or 11E+6 as bitrate!!");
00044         snirThreshold = dB2fraction(par("snirThreshold"));
00045     }
00046 }

void Decider80211::handleLowerMsg ( AirFrame *  af,
SnrList receivedList 
) [protected, virtual]

In this function the decision whether a frame is received correctly or not is made.

Handle message from lower layer. The minimal snir is read in and it is computed wether the packet has collided or has bit errors or was received correctly. The corresponding kind is set and it is handed on to the upper layer.

Reimplemented from BasicDecider.

00057 {
00058 
00059     double snirMin;
00060 
00061     //initialize snirMin:
00062     snirMin = receivedList.begin()->snr;
00063 
00064     for (SnrList::iterator iter = receivedList.begin(); iter != receivedList.end(); iter++)
00065     {
00066         if (iter->snr < snirMin)
00067             snirMin = iter->snr;
00068     }
00069     cMessage *fr = af->getEncapsulatedMsg();
00070     EV << "packet (" << fr->getClassName() << ")" << fr->getName() << " (" << fr->info() << ") snrMin=" << snirMin << endl;
00071 
00072     //if snir is big enough so that packet can be recognized at all
00073     if (snirMin > snirThreshold)
00074     {
00075         if (isPacketOK(snirMin, af->getEncapsulatedMsg()->getBitLength()))
00076         {
00077             EV << "packet was received correctly, it is now handed to upper layer...\n";
00078             sendUp(af);
00079         }
00080         else
00081         {
00082             EV << "Packet has BIT ERRORS! It is lost!\n";
00083             af->setName("ERROR");
00084             af->getEncapsulatedMsg()->setKind(BITERROR);
00085             sendUp(af);
00086         }
00087     }
00088     else
00089     {
00090         EV << "COLLISION! Packet got lost\n";
00091         af->setName("COLLISION");
00092         af->getEncapsulatedMsg()->setKind(COLLISION);
00093         sendUp(af);
00094     }
00095 }

double Decider80211::dB2fraction ( double  dB  )  [protected]

converts a dB value into a normal fraction

Referenced by initialize().

00136 {
00137     return pow(10.0, (dB / 10));
00138 }

bool Decider80211::isPacketOK ( double  snirMin,
int  lengthMPDU 
) [protected, virtual]

computes if packet is ok or has errors

Referenced by handleLowerMsg().

00099 {
00100     double berHeader, berMPDU;
00101 
00102     berHeader = 0.5 * exp(-snirMin * BANDWIDTH / BITRATE_HEADER);
00103     //if PSK modulation
00104     if (bitrate == 1E+6 || bitrate == 2E+6)
00105         berMPDU = 0.5 * exp(-snirMin * BANDWIDTH / bitrate);
00106     //if CCK modulation (modeled with 16-QAM)
00107     else if (bitrate == 5.5E+6)
00108         berMPDU = 0.5 * (1 - 1 / sqrt(pow(2.0, 4))) * erfc(snirMin * BANDWIDTH / bitrate);
00109     else                        // CCK, modelled with 256-QAM
00110         berMPDU = 0.25 * (1 - 1 / sqrt(pow(2.0, 8))) * erfc(snirMin * BANDWIDTH / bitrate);
00111     //probability of no bit error in the PLCP header
00112     double headerNoError = pow(1.0 - berHeader, HEADER_WITHOUT_PREAMBLE);
00113 
00114     //probability of no bit error in the MPDU
00115     double MpduNoError = pow(1.0 - berMPDU, lengthMPDU);
00116     EV << "berHeader: " << berHeader << " berMPDU: " << berMPDU << endl;
00117     double rand = dblrand();
00118 
00119     //if error in header
00120     if (rand > headerNoError)
00121         return (false);
00122     else
00123     {
00124         rand = dblrand();
00125 
00126         //if error in MPDU
00127         if (rand > MpduNoError)
00128             return (false);
00129         //if no error
00130         else
00131             return (true);
00132     }
00133 }


Member Data Documentation

double Decider80211::bitrate [protected]

should be set in the omnetpp.ini

Referenced by initialize(), and isPacketOK().

double Decider80211::snirThreshold [protected]

should be set in the omnetpp.ini; everthing below this threshold can't be read and is therefor considered as a collision

Referenced by handleLowerMsg(), and initialize().


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

Generated on Fri Mar 20 18:51:18 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5