Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

BasicSnrEval Class Reference
[snrEval - modules for attenuation and interference calculationbasicModules - basic module classes of the MF]

The basic class for all snrEval modules. More...

#include <BasicSnrEval.h>

Inherits ChannelAccess.

Inherited by SnrEval, and TestSnrEval.

Inheritance diagram for BasicSnrEval:

Inheritance graph
[legend]
Collaboration diagram for BasicSnrEval:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Module_Class_Members (BasicSnrEval, ChannelAccess, 0)
virtual void initialize (int)
 Initialization of the module and some variables.
virtual void finish ()
void handleMessage (cMessage *)
 Called every time a message arrives.
virtual void receiveBBItem (int category, const BBItem *details, int scopeModuleId)
 Called by the Blackboard whenever a change occurs we're interested in.

Protected Types

enum  BasicSnrMsgKinds { RECEPTION_COMPLETE = 1350101811 }
 The kind field of messages. More...

Protected Member Functions

virtual double calcDuration (cMessage *)=0
 This function calculates the duration of the AirFrame.
Handle Messages
Functions to redefine by the programmer

These are the functions provided to add own functionality to your modules. These functions are called whenever a blackboard message, a self message or a data message from the upper or lower layer arrives respectively.

virtual void handleUpperMsg (AirFrame *)
 Fill the header fields, redefine for your own needs...
virtual void handleSelfMsg (cMessage *msg)
 Handle self messages such as timer...
virtual void handleLowerMsgStart (AirFrame *)=0
 Calculate Snr Information before buffering.
virtual void handleLowerMsgEnd (AirFrame *)
 Calculate SnrInfo after buffering and add the PhySnrList to the message.
Convenience Functions
Functions for convenience - NOT to be modified

These are functions taking care of message encapsulation and message sending. Normally you should not need to alter these but should use them to handle message encasulation and sending. They will wirte all necessary information into packet headers and add or strip the appropriate headers for each layer.

void bufferMsg (AirFrame *frame)
 Buffers message for 'transmission time'.
AirFrame * unbufferMsg (cMessage *msg)
 Unbuffers a message after 'transmission time'.
void sendUp (AirFrame *, const SnrList &)
 Sends a message to the upper layer.
void sendDown (AirFrame *msg)
 Sends a message to the channel.
void sendControlUp (cMessage *)
 Sends a control message to the upper layer.
AirFrame * encapsMsg (cMessage *msg)
 Encapsulates a MAC frame into an Air Frame.

Protected Attributes

int headerLength
double transmitterPower
 power used to transmit messages
double carrierFrequency
 carrier frequency used to send messages
double sensitivity
 signal attenuation threshold
double alpha
 path loss coefficient
bool coreDebug
 debug this core module?
cMessage * txOverTimer
 Timer to indicate the end of a transmission to a higher layer.
ActiveChannel channel
 Currently active channel, set using radio, updated via BB.
int catActiveChannel
 category number given by bb for ActiveChannel
int uppergateOut
 gate id
int uppergateIn
 gate id
int upperControlOut
 gate id

Static Protected Attributes

static const double speedOfLight = ChannelControl::speedOfLight
 Speed of light.

Detailed Description

The basic class for all snrEval modules.

The BasicSnrEval module provides functionality like en- and decapsulation of messages. If you use the standard message formats everythng should work fine. Before a packet is sent some information, e.g. transmission power, can be written to the AirFrame header. If you write your own snrEval, just subclass and redefine the handleUpperMsg function (see description of the function). After receiving a message it can be processed in handleLowerMsgStart. Then it is buffered for the time the transmission would last in reality, and then can be handled again. Again you can redefine the 1. handleLowerMsgStart and 2. handleLowerMsgEnd for your own needs (see description). So, the call of these functions represent the following events: 1. received a message (i.e. transmission startet) 2. message will be handed on to the upper layer (i.e. transmission time is over)

Author:
Marc Loebbers

Andreas Koepke

Daniel Willkomm


Member Enumeration Documentation

enum BasicSnrEval::BasicSnrMsgKinds [protected]
 

The kind field of messages.

that are used internally by this class have one of these values


Member Function Documentation

void BasicSnrEval::bufferMsg AirFrame *  frame  )  [protected]
 

Buffers message for 'transmission time'.

The packet is put in a buffer for the time the transmission would last in reality. A timer indicates when the transmission is complete. So, look at unbufferMsg to see what happens when the transmission is complete..

AirFrame * BasicSnrEval::encapsMsg cMessage *  msg  )  [protected]
 

Encapsulates a MAC frame into an Air Frame.

This function encapsulates messages from the upper layer into an AirFrame, copies the type and channel fields, adds the headerLength, sets the pSend (transmitterPower) and returns the AirFrame.

Reimplemented in SnrEval80211.

void BasicSnrEval::handleLowerMsgEnd AirFrame *   )  [protected, virtual]
 

Calculate SnrInfo after buffering and add the PhySnrList to the message.

Redefine this function if you want to process messages from the channel before they are forwarded to upper layers

Reimplemented in GilbertElliotSnr, and SnrEval.

virtual void BasicSnrEval::handleLowerMsgStart AirFrame *   )  [protected, pure virtual]
 

Calculate Snr Information before buffering.

This function is called right after a message is received, i.e. right before it is buffered for 'transmission time'.

Here you should decide whether the message is "really" received or whether it's receive power is so low that it is just treated as noise.

If the energy of the message is high enough to really receive it you should create an snr list (SnrList) to be able to store sn(i)r information for that message. Every time a new message arrives you can add a new snr value together with a timestamp to that list. Make sure to store a pointer to the mesage together with the snr information to be able to retrieve it later.

In this function also an initial SNR value can be calculated for this message.

Please take a look at SnrEval to see a "real" example.

See also:
SnrList, SnrEval

Implemented in GilbertElliotSnr, SnrEval, and TestSnrEval.

void BasicSnrEval::handleMessage cMessage *  msg  ) 
 

Called every time a message arrives.

The basic handle message function.

Depending on the gate a message arrives handleMessage just calls different handle*Msg functions to further process the message.

Messages from the channel are also buffered here in order to simulate a transmission delay

You should not make any changes in this function but implement all your functionality into the handle*Msg functions called from here.

See also:
handleUpperMsg, handleLowerMsgStart, handleLowerMsgEnd, handleSelfMsg

Reimplemented in SnrEval80211.

virtual void BasicSnrEval::handleSelfMsg cMessage *  msg  )  [inline, protected, virtual]
 

Handle self messages such as timer...

Define this function if you want to process timer or other kinds of self messages

Reimplemented in GilbertElliotSnr.

void BasicSnrEval::handleUpperMsg AirFrame *  frame  )  [protected, virtual]
 

Fill the header fields, redefine for your own needs...

Redefine this function if you want to process messages from upper layers before they are send to the channel.

The MAC frame is already encapsulated in an AirFrame and all standard header fields are set.

void BasicSnrEval::initialize int  stage  )  [virtual]
 

Initialization of the module and some variables.

First we have to initialize the module from which we derived ours, in this case ChannelAccess.

Then we have to intialize the gates and - if necessary - some own variables.

If you want to use your own AirFrames you have to redefine createCapsulePkt function.

Reimplemented from ChannelAccess.

Reimplemented in GilbertElliotSnr, SnrEval, and SnrEval80211.

void BasicSnrEval::sendControlUp cMessage *  msg  )  [protected]
 

Sends a control message to the upper layer.

send a control message to the upper layer

void BasicSnrEval::sendDown AirFrame *  msg  )  [protected]
 

Sends a message to the channel.

Convenience function which calls sendToChannel with delay set to 0.0.

It also schedules the txOverTimer which indicates the end of transmission to upper layers.

See also:
sendToChannel

void BasicSnrEval::sendUp AirFrame *  msg,
const SnrList list
[protected]
 

Sends a message to the upper layer.

Attach control info to the message and send message to the upper layer.

Parameters:
msg AirFrame to pass to the decider
list Snr list to attach as control info
to be called within handleLowerMsgEnd.

AirFrame * BasicSnrEval::unbufferMsg cMessage *  msg  )  [protected]
 

Unbuffers a message after 'transmission time'.

Get the context pointer to the now completely received AirFrame and delete the self message


Member Data Documentation

double BasicSnrEval::alpha [protected]
 

path loss coefficient

The path loss coefficient is initially set to the minimum path loss coefficient possible defined in the ChannelControl module.

It can be changed by the user but NEVER to a smaller value than defined in ChannelControl.

double BasicSnrEval::carrierFrequency [protected]
 

carrier frequency used to send messages

The carrier frequency is initially set to the minimum carrier frequency defined in the ChannelControl module.

It can be changed by the user but NEVER to a smaller value than defined in ChannelControl.

int BasicSnrEval::headerLength [protected]
 

brief a parameter that has to be read in from omnetpp.ini

double BasicSnrEval::sensitivity [protected]
 

signal attenuation threshold

The signal attenuation threshold is initially set to the minimum signal attenuation threshold possible defined in the ChannelControl module.

It can be changed by the user but NEVER to a smaller value than defined in ChannelControl.

double BasicSnrEval::transmitterPower [protected]
 

power used to transmit messages

The transmission power is initially set to the maximal transmission power possible defined in the ChannelControl module.

It can be changed by the user but NEVER to a bigger value than defined in ChannelControl.


The documentation for this class was generated from the following files:
Generated on Fri Jan 12 08:29:43 2007 for Mobility Framework by  doxygen 1.4.4