INET Framework for OMNeT++/OMNEST
SnrEval.h
Go to the documentation of this file.
00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        SnrEval.h
00003  *
00004  * author:      Marc Loebbers
00005  *              Multi-channel support: Levente Meszaros, Andras Varga
00006  *
00007  * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at
00008  *              Technische Universitaet Berlin, Germany.
00009  *
00010  *              This program is free software; you can redistribute it
00011  *              and/or modify it under the terms of the GNU General Public
00012  *              License as published by the Free Software Foundation; either
00013  *              version 2 of the License, or (at your option) any later
00014  *              version.
00015  *              For further information see file COPYING
00016  *              in the top level directory
00017  ***************************************************************************
00018  * part of:     framework implementation developed by tkn
00019  ***************************************************************************/
00020 
00021 #ifndef SNR_EVAL_H
00022 #define SNR_EVAL_H
00023 
00024 #include "BasicSnrEval.h"
00025 #include "RadioState.h"
00026 #include "PhyControlInfo_m.h"
00027 
00054 class INET_API SnrEval : public BasicSnrEval
00055 {
00056   public:
00057     SnrEval();
00058 
00065     virtual void changeChannel(int channel);
00066 
00070     virtual void setBitrate(double bitrate);
00071 
00072   protected:
00074     virtual void initialize(int);
00075 
00076     virtual void finish();
00077 
00078     virtual ~SnrEval();
00079 
00080   protected:
00081     virtual void handleMessage(cMessage *msg);
00082 
00083     virtual void handleUpperMsg(AirFrame*);
00084 
00085     virtual void handleSelfMsg(cMessage*);
00086 
00087     virtual void handleCommand(int msgkind, cPolymorphic *ctrl);
00088 
00090     virtual void handleLowerMsgStart(AirFrame*);
00091 
00093     virtual void handleLowerMsgEnd(AirFrame*);
00094 
00096     virtual double calcRcvdPower(double pSend, double distance);
00097 
00099     virtual int getChannelNumber() const  {return rs.getChannelNumber();}
00100 
00102     virtual void addNewSnr();
00103 
00104   protected:
00106     enum
00107       {
00109         TRANSM_OVER
00110       };
00111 
00116     struct SnrStruct {
00118       AirFrame* ptr;
00120       double rcvdPower;
00122       SnrList sList;
00123     };
00124 
00130     SnrStruct snrInfo;
00131 
00136     typedef std::map<AirFrame*,double> RecvBuff;
00137 
00142     RecvBuff recvBuff;
00143 
00145     RadioState rs;
00146 
00148     int newChannel;
00149 
00151     double newBitrate;
00152 
00154     double noiseLevel;
00155 
00159     double carrierFrequency;
00160 
00165     double thermalNoise;
00166 
00173     double sensitivity;
00174 
00181     double pathLossAlpha;
00182 };
00183 
00184 #endif
00185