Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Ieee80211RadioModel Class Reference

#include <Ieee80211RadioModel.h>

Inheritance diagram for Ieee80211RadioModel:

IRadioModel List of all members.

Detailed Description

Radio model for IEEE 802.11. The implementation is largely based on the Mobility Framework's SnrEval80211 and Decider80211 modules. See the NED file for more info.


Public Member Functions

virtual void initializeFrom (cModule *radioModule)
virtual double calculateDuration (AirFrame *airframe)
virtual bool isReceivedCorrectly (AirFrame *airframe, const SnrList &receivedList)

Protected Member Functions

virtual bool packetOk (double snirMin, int lengthMPDU, double bitrate)
virtual double dB2fraction (double dB)

Protected Attributes

double snirThreshold


Member Function Documentation

double Ieee80211RadioModel::calculateDuration AirFrame airframe  )  [virtual]
 

Should be defined to calculate the duration of the AirFrame. Usually the duration is just the frame length divided by the bitrate. However, in some cases, notably IEEE 802.11, the header has a different modulation (and thus a different bitrate) than the rest of the message.

Implements IRadioModel.

00035 {
00036     // The physical layer header is sent with 1Mbit/s and the rest with the frame's bitrate
00037     return airframe->length()/airframe->getBitrate() + PHY_HEADER_LENGTH/BITRATE_HEADER;
00038 }

double Ieee80211RadioModel::dB2fraction double  dB  )  [protected, virtual]
 

00103 {
00104     return pow(10.0, (dB / 10));
00105 }

void Ieee80211RadioModel::initializeFrom cModule *  radioModule  )  [virtual]
 

Allows parameters to be read from the module parameters of a module that contains this object.

Implements IRadioModel.

00030 {
00031     snirThreshold = dB2fraction(radioModule->par("snirThreshold"));
00032 }

bool Ieee80211RadioModel::isReceivedCorrectly AirFrame airframe,
const SnrList receivedList
[virtual]
 

Should be defined to calculate whether the frame has been received correctly. Input is the signal-noise ratio over the duration of the frame. The calculation may take into account the modulation scheme, possible error correction code, etc.

Implements IRadioModel.

00042 {
00043     // calculate snirMin
00044     double snirMin = receivedList.begin()->snr;
00045     for (SnrList::const_iterator iter = receivedList.begin(); iter != receivedList.end(); iter++)
00046         if (iter->snr < snirMin)
00047             snirMin = iter->snr;
00048 
00049     cMessage *frame = airframe->encapsulatedMsg();
00050     EV << "packet (" << frame->className() << ")" << frame->name() << " (" << frame->info() << ") snrMin=" << snirMin << endl;
00051 
00052     if (snirMin <= snirThreshold)
00053     {
00054         // if snir is too low for the packet to be recognized
00055         EV << "COLLISION! Packet got lost\n";
00056         return false;
00057     }
00058     else if (packetOk(snirMin, airframe->encapsulatedMsg()->length(), airframe->getBitrate()))
00059     {
00060         EV << "packet was received correctly, it is now handed to upper layer...\n";
00061         return true;
00062     }
00063     else
00064     {
00065         EV << "Packet has BIT ERRORS! It is lost!\n";
00066         return false;
00067     }
00068 }

bool Ieee80211RadioModel::packetOk double  snirMin,
int  lengthMPDU,
double  bitrate
[protected, virtual]
 

00072 {
00073     double berHeader, berMPDU;
00074 
00075     berHeader = 0.5 * exp(-snirMin * BANDWIDTH / BITRATE_HEADER);
00076 
00077     // if PSK modulation
00078     if (bitrate == 1E+6 || bitrate == 2E+6)
00079         berMPDU = 0.5 * exp(-snirMin * BANDWIDTH / bitrate);
00080     // if CCK modulation (modeled with 16-QAM)
00081     else if (bitrate == 5.5E+6)
00082         berMPDU = 0.5 * (1 - 1 / sqrt(pow(2.0, 4))) * erfc(snirMin * BANDWIDTH / bitrate);
00083     else                        // CCK, modelled with 256-QAM
00084         berMPDU = 0.25 * (1 - 1 / sqrt(pow(2.0, 8))) * erfc(snirMin * BANDWIDTH / bitrate);
00085 
00086     // probability of no bit error in the PLCP header
00087     double headerNoError = pow(1.0 - berHeader, HEADER_WITHOUT_PREAMBLE);
00088 
00089     // probability of no bit error in the MPDU
00090     double MpduNoError = pow(1.0 - berMPDU, lengthMPDU);
00091     EV << "berHeader: " << berHeader << " berMPDU: " << berMPDU << endl;
00092     double rand = dblrand();
00093 
00094     if (rand > headerNoError)
00095         return false; // error in header
00096     else if (dblrand() > MpduNoError)
00097         return false;  // error in MPDU
00098     else
00099         return true; // no error
00100 }


Member Data Documentation

double Ieee80211RadioModel::snirThreshold [protected]
 


The documentation for this class was generated from the following files:
Generated on Thu Oct 19 18:22:24 2006 for INET Framework for OMNeT++/OMNEST by  doxygen 1.4.0