![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiFiMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2007 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 16, 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 #include <WIFIMAC/convergence/ErrorModelling.hpp> 00030 #include <WIFIMAC/convergence/PhyMode.hpp> 00031 #include <WIFIMAC/lowerMAC/Manager.hpp> 00032 00033 #include <WNS/Assure.hpp> 00034 #include <WNS/Exception.hpp> 00035 00036 using namespace wifimac::convergence; 00037 00038 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00039 wifimac::convergence::ErrorModelling, 00040 wns::ldk::FunctionalUnit, 00041 "wifimac.convergence.ErrorModelling", 00042 wns::ldk::FUNConfigCreator); 00043 00044 ErrorModelling::ErrorModelling(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& _config) : 00045 wns::ldk::fu::Plain<ErrorModelling, ErrorModellingCommand>(fun), 00046 config(_config), 00047 logger(config.get<wns::pyconfig::View>("logger")), 00048 phyUserCommandName(config.get<std::string>("phyUserCommandName")), 00049 managerCommandName(config.get<std::string>("managerCommandName")), 00050 protocolCalculatorName(config.get<std::string>("protocolCalculatorName")) 00051 { 00052 00053 } 00054 00055 void ErrorModelling::onFUNCreated() 00056 { 00057 pc = getFUN()->getLayer<dll::ILayer2*>()->getManagementService<wifimac::management::ProtocolCalculator>(protocolCalculatorName); 00058 } 00059 00060 void ErrorModelling::processIncoming(const wns::ldk::CompoundPtr& compound) 00061 { 00062 wns::Ratio sinr = getFUN()->getCommandReader(phyUserCommandName)-> 00063 readCommand<wifimac::convergence::CIRProviderCommand>(compound->getCommandPool())->getCIR(); 00064 wns::Power rss = getFUN()->getCommandReader(phyUserCommandName)-> 00065 readCommand<wifimac::convergence::CIRProviderCommand>(compound->getCommandPool())->getRSS(); 00066 wifimac::convergence::PhyMode phyMode = getFUN()->getCommandReader(managerCommandName)-> 00067 readCommand<wifimac::lowerMAC::ManagerCommand>(compound->getCommandPool())->getPhyMode(); 00068 00069 ErrorModellingCommand* emc = activateCommand(compound->getCommandPool()); 00070 00071 Bit commandPoolSize = 0; 00072 Bit dataSize = 0; 00073 this->calculateSizes(compound->getCommandPool(), commandPoolSize, dataSize); 00074 00075 emc->local.per = pc->getErrorProbability()->getPER(sinr, commandPoolSize + dataSize, phyMode); 00076 00077 MESSAGE_BEGIN(NORMAL, logger, m, "New compound with SNR " << sinr); 00078 m << " len " << commandPoolSize + dataSize; 00079 m << " phyMode " << phyMode; 00080 m << " per " << emc->local.per; 00081 MESSAGE_END(); 00082 } 00083 00084 void ErrorModelling::processOutgoing(const wns::ldk::CompoundPtr& /*compound*/) 00085 { 00086 00087 }
1.5.5