![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiMeMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2011 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 5, D-52074 Aachen, Germany 00009 * phone: ++49-241-80-27910, 00010 * fax: ++49-241-80-22242 00011 * email: info@openwns.org 00012 * www: http://www.openwns.org 00013 * _____________________________________________________________________________ 00014 * 00015 * openWNS is free software; you can redistribute it and/or modify it under the 00016 * terms of the GNU Lesser General Public License version 2 as published by the 00017 * Free Software Foundation; 00018 * 00019 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00021 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00022 * details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 * 00027 ******************************************************************************/ 00028 00029 #ifndef WIMEMAC_ERRORMODELLING_HPP 00030 #define WIMEMAC_ERRORMODELLING_HPP 00031 #include <WNS/ldk/ErrorRateProviderInterface.hpp> 00032 #include <WNS/pyconfig/View.hpp> 00033 #include <WNS/PowerRatio.hpp> 00034 00035 #include <WNS/ldk/fu/Plain.hpp> 00036 #include <WNS/ldk/Processor.hpp> 00037 00038 #include <WNS/distribution/Uniform.hpp> 00039 #include <WNS/logger/Logger.hpp> 00040 00041 #include <WNS/probe/bus/ContextCollector.hpp> 00042 00043 #include <WNS/container/RangeMap.hpp> 00044 00045 #include <WIMEMAC/convergence/PhyUser.hpp> 00046 #include <WIMEMAC/lowerMAC/IManagerServices.hpp> 00047 00048 namespace wimemac { namespace convergence { 00049 class IPhyServices; 00050 }} 00051 00052 namespace wimemac { namespace convergence { 00053 00057 class ErrorModellingCommand : 00058 public wns::ldk::Command, 00059 public wns::ldk::ErrorRateProviderInterface 00060 00061 { 00062 public: 00063 ErrorModellingCommand() 00064 { 00065 local.per = 1; 00066 local.destructorCalled = NULL; 00067 local.sinr.set_dB(0); 00068 local.checkOK = false; 00069 00070 } 00071 00072 ~ErrorModellingCommand() 00073 { 00074 if(NULL != local.destructorCalled) 00075 *local.destructorCalled = true; 00076 } 00077 00078 00079 virtual double getErrorRate() const 00080 { 00081 return local.per; 00082 } 00083 00084 virtual wns::Ratio getSINR() const 00085 { 00086 return local.sinr; 00087 } 00088 00089 struct { 00090 double per; 00091 long *destructorCalled; 00092 wns::Ratio sinr; 00093 bool checkOK; 00094 } local; 00095 struct {} peer; 00096 struct {} magic; 00097 00098 }; 00099 00107 class ErrorModelling : 00108 public wns::ldk::fu::Plain<ErrorModelling, ErrorModellingCommand>, 00109 public wns::ldk::Processor<ErrorModelling> 00110 { 00111 public: 00112 // FUNConfigCreator interface realisation 00113 ErrorModelling(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00114 00118 void processIncoming(const wns::ldk::CompoundPtr& compound); 00119 void processOutgoing(const wns::ldk::CompoundPtr& compound); 00120 00122 wimemac::convergence::MCS getMaxPosMCS(wns::Ratio sinr_, Bit maxCompoundSize_, double per_); 00123 00125 double getErrorRateForCommandFrames(wns::Ratio sinr_, Bit maxCompoundSize_); 00126 00127 void onFUNCreated(); 00128 00129 private: 00130 00132 wns::probe::bus::ContextCollectorPtr perProbe_; 00133 00134 typedef wns::container::RangeMap<float, float> SNR2PmeanMap; 00135 SNR2PmeanMap snr2pmean_100_; 00136 SNR2PmeanMap snr2pmean_150_; 00137 SNR2PmeanMap snr2pmean_200_; 00138 SNR2PmeanMap snr2pmean_300_; 00139 SNR2PmeanMap snr2pmean_375_; 00140 SNR2PmeanMap snr2pmean_600_; 00141 SNR2PmeanMap snr2pmean_750_; 00142 SNR2PmeanMap snr2pmean_900_; 00143 00144 typedef wns::container::Registry<wimemac::convergence::MCS, SNR2PmeanMap*> SNR2PmeanRegistry; 00145 SNR2PmeanRegistry snr2pmeanReg_; 00146 00147 wns::pyconfig::View config; 00148 wns::logger::Logger logger; 00149 const std::string phyUserCommandName; 00150 const std::string phyUserName; 00151 const std::string managerCommandName; 00152 const std::string managerName; 00153 00155 wns::distribution::StandardUniform dis; 00156 wns::container::Registry<wns::service::dll::UnicastAddress, bool> lastPreambleWasDecoded; 00157 00158 wns::probe::bus::ContextCollectorPtr lossRatio; 00159 00160 struct Friends 00161 { 00162 wimemac::convergence::IPhyServices* phyuser; 00163 wimemac::lowerMAC::IManagerServices* manager; 00164 } friends; 00165 00166 }; // ErrorModelling 00167 } // namespace convergence 00168 } // namespace WiMeMac 00169 00170 #endif 00171
1.5.5