|
INET Framework for OMNeT++/OMNEST
|
00001 // file: SnrEval80211.cc 00002 // 00003 // author: Marc Löbbers 00004 // copyright: (c) by Tralafitty 00005 // Telecommunication Networks Group 00006 // TU-Berlin 00007 // email: loebbers@tkn.tu-berlin.de 00008 00009 // part of: framework implementation developed by tkn description: - a 00010 // snrEval extension for the use with the other 802.11 modules 00011 00012 00013 #include "SnrEval80211.h" 00014 #include "Consts80211.h" 00015 #include "AirFrame_m.h" 00016 00017 00018 Define_Module(SnrEval80211); 00019 00020 void SnrEval80211::initialize(int stage) 00021 { 00022 SnrEval::initialize(stage); 00023 00024 if (stage == 0) 00025 { 00026 EV << "initializing stage 0\n"; 00027 if (bitrate != 1E+6 && bitrate != 2E+6 && bitrate != 5.5E+6 && bitrate != 11E+6) 00028 error("Wrong bit rate for 802.11, valid values are 1E+6, 2E+6, 5.5E+6 or 11E+6"); 00029 headerLength = 192; //has to be 192; this makes sure it is! 00030 } 00031 } 00032 00033 00039 double SnrEval80211::calcDuration(cPacket *frame) 00040 { 00041 EV << "bits without header: " << frame->getBitLength() - 00042 headerLength << ", bits header: " << headerLength << endl; 00043 return ((frame->getBitLength() - headerLength) / bitrate + headerLength / BITRATE_HEADER); 00044 }