00001 /* -*- mode:c++ -*- ******************************************************** 00002 * file: SnrEval.h 00003 * 00004 * copyright: (C) 2004-6 Telecommunication Networks Group (TKN) at 00005 * Technische Universitaet Berlin, Germany. 00006 * 00007 * This program is free software; you can redistribute it 00008 * and/or modify it under the terms of the GNU General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later 00011 * version. 00012 * For further information see file COPYING 00013 * in the top level directory 00014 *************************************************************************** 00015 * part of: framework implementation developed by tkn 00016 * description: - SnrEval class 00017 * - mains tasks are to determine the SNR for a message and 00018 * to simulate a transmission delay 00019 * 00020 ***************************************************************************/ 00021 00022 00023 #ifndef SNR_EVAL_H 00024 #define SNR_EVAL_H 00025 00026 #include <BasicSnrEval.h> 00027 #include "RadioState.h" 00028 #include "RSSI.h" 00029 #include "MediumIndication.h" 00030 00031 #include <list> 00060 class SnrEval : public BasicSnrEval 00061 { 00062 Module_Class_Members( SnrEval, BasicSnrEval, 0 ); 00063 00064 public: 00066 virtual void initialize(int); 00067 00069 virtual void receiveBBItem(int category, const BBItem *details, int scopeModuleId); 00070 00071 protected: 00072 00074 virtual void handleLowerMsgStart(AirFrame*); 00075 00077 virtual void handleLowerMsgEnd(AirFrame*); 00078 00079 00085 virtual double calcRcvdPower(AirFrame* frame) { 00086 return calcPathloss(frame); 00087 } 00088 00091 double calcPathloss(AirFrame* frame); 00092 00096 void addNewSnr(); 00097 00098 void handlePublish(RSSI *r); 00099 00103 void modifySnrList(SnrList& list); 00104 00106 virtual double calcDuration(cMessage* m) { 00107 return static_cast<double>(m->length()) / bitrate; 00108 } 00109 00110 00111 protected: 00116 struct SnrStruct{ 00118 AirFrame* ptr; 00120 double rcvdPower; 00122 SnrList sList; 00123 }; 00124 00130 SnrStruct snrInfo; 00131 00136 typedef std::map<AirFrame*,double> cRecvBuff; 00137 00142 cRecvBuff recvBuff; 00143 00145 RadioState::States radioState; 00147 int catRadioState; 00148 00150 RSSI rssi; 00152 int catRSSI; 00157 bool publishRSSIAlways; 00158 00160 MediumIndication indication; 00161 int catIndication; 00162 00164 int nicModuleId; 00165 00167 double noiseLevel; 00168 00170 double recvTime; 00171 00178 double waveLength; 00179 00184 double thermalNoise; 00185 00196 double pathLossAlphaHalf; 00197 00199 static const double speedOfLight; 00200 00202 bool useTorus; 00203 00205 Coord playground; 00206 00208 double bitrate; 00210 int catBitrate; 00211 }; 00212 00213 #endif