?? asyncsnreval.h
字號:
/* -*- mode:c++ -*- ********************************************************
* file: AsyncSnrEval.h
*
* author: Yupeng.hu
*
* copyright: (C) 2006 HUNAN Universtiy, ChangSha China
*
***************************************************************************
* part of: Async Simulation
* description: - Async Description
*
***************************************************************************
* changelog: $Revision$
* last modified: $Date: 2006-7-13 12:57 $
* by: $Author: Yupeng.hu $
***************************************************************************/
#ifndef SYNCSNR_EVAL_H
#define SYNCSNR_EVAL_H
#include <BasicSnrEval.h>
#include "RadioState.h"
/**
* @brief Keeps track of the different snir levels when receiving a
* packet
*
* This module keeps track of the noise level of the channel.
*
* When receiving a packet this module updates the noise level of the
* channel. Based on the receive power of the packet it is processed
* and handed to upper layers or just treated as noise.
*
* After the packet is completely received the snir information is
* attached and it is handed to the deceider module.
*
* The snir information is a SnrList that lists all different snr
* levels together with the point of time (simTime()) when they
* started.
*
* On top of that this module publishes the RadioState on the
* Blackboard. The radio state gives information about whether this
* module is sending a packet, receiving a packet or idle. This
* information can be accessed via the Blackboard by other modules,
* e.g. a CSMAMacLayer.
**/
class AsyncSnrEval : public BasicSnrEval
{
Module_Class_Members( AsyncSnrEval, BasicSnrEval, 0 );
public:
/** @brief Initialize variables and publish the radio status*/
virtual void initialize(int);
virtual void finish();
protected:
virtual void handleUpperMsg(AirFrame*);
virtual void handleSelfMsg(cMessage*);
/**\brief Buffer the frame and update noise levels and snr information...*/
virtual void handleLowerMsgStart(AirFrame*);
/**\brief Unbuffer the frame and update noise levels and snr information*/
virtual void handleLowerMsgEnd(AirFrame*);
/**\brief Calculates the power with which a packet is received.*/
double calcRcvdPower(double pSend, double distance);
/**\brief updates the snr information of the relevant AirFrames*/
void addNewSnr();
protected:
/** @brief Enum to store self message kind()s*/
enum
{
/** @brief timer to indicate that a message is completely sent now*/
TRANSM_OVER
};
/**
* @brief Struct to store a pointer to the mesage, rcvdPower AND a
* SnrList, needed in AsyncSnrEval::addNewSnr
**/
struct SnrStruct{
/** @brief Pointer to the message this information belongs to*/
AirFrame* ptr;
/** @brief Received power of the message*/
double rcvdPower;
/** @brief Snr list to store the SNR values*/
SnrList sList;
};
/**
* @brief SnrInfo stores the snrList and the the recvdPower for the
* message currently beeing received together with a pointer to the
* message.
**/
SnrStruct snrInfo;
/**
* @brief Typedef used to store received messages together with
* receive power.
**/
typedef std::map<AirFrame*,double> cRecvBuff;
/**
* @brief A buffer to store a pointer to a message and the related
* receive power.
**/
cRecvBuff recvBuff;
/** @brief Reference to the RadioState*/
BBItemRef bbRs;
/** @brief Actual RadioState of the nic*/
RadioState* rs;
/**\brief The noise level of the channel.*/
double noiseLevel;
/**
* @brief The carrier frequency used.Can be specified in the
* omnetpp.ini file. If not it is read from the ChannelControl
* module.
**/
double carrierFrequency;
int colliscount;
/**
* @brief Thermal noise on the channel. Can be specified in
* omnetpp.ini. Default: -100 dBm
**/
double thermalNoise;
/**
* @brief Defines up to what Power level (in dBm) a message can be
* understood. If the level of a received packet is lower, it is
* only treated as noise. Can be specified in omnetpp.ini. Default:
* -85 dBm
**/
double sensitivity;
/**
* @brief Path loss coefficient. Can be specified in omnetpp.ini. If
* not it is read from the ChannelControl module. This value CANNOT
* be smaller than the one specified in the ChannelControl
* module. The simulation will exit with an error!
**/
double pathLossAlpha;
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -