#include <BasicSnrEval.h>
Inherits ChannelAccess.
Inherited by SnrEval, and TestSnrEval.
Inheritance diagram for BasicSnrEval:
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. |
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)
Andreas Koepke
Daniel Willkomm
|
The kind field of messages. that are used internally by this class have one of these values |
|
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.. |
|
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. |
|
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. |
|
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.
Implemented in GilbertElliotSnr, SnrEval, and TestSnrEval. |
|
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.
Reimplemented in SnrEval80211. |
|
Handle self messages such as timer... Define this function if you want to process timer or other kinds of self messages Reimplemented in GilbertElliotSnr. |
|
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. |
|
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. |
|
Sends a control message to the upper layer. send a control message to the upper layer |
|
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.
|
|
Sends a message to the upper layer. Attach control info to the message and send message to the upper layer.
|
|
Unbuffers a message after 'transmission time'. Get the context pointer to the now completely received AirFrame and delete the self message |
|
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. |
|
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. |
|
brief a parameter that has to be read in from omnetpp.ini |
|
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. |
|
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. |