User Manual, Developers Guide and API Documentation

SINR.cpp

Go to the documentation of this file.
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/lowerMAC/rateAdaptationStrategies/SINR.hpp>
00030 
00031 using namespace wifimac::lowerMAC::rateAdaptationStrategies;
00032 
00033 STATIC_FACTORY_REGISTER_WITH_CREATOR(SINR, IRateAdaptationStrategy, "SINR", IRateAdaptationStrategyCreator);
00034 
00035 SINR::SINR(
00036     const wns::pyconfig::View& _config,
00037     wns::service::dll::UnicastAddress receiver,
00038     wifimac::management::PERInformationBase* _per,
00039     wifimac::management::SINRInformationBase* _sinr,
00040     wifimac::lowerMAC::Manager* _manager,
00041     wifimac::convergence::PhyUser* _phyUser,
00042     wns::logger::Logger* _logger):
00043     ARF(_config, receiver, _per, _sinr, _manager, _phyUser, _logger),
00044     per(_per),
00045     sinr(_sinr),
00046     myReceiver(receiver),
00047     retransmissionLQMReduction(_config.get<double>("retransmissionLQMReduction")),
00048     logger(_logger)
00049 {
00050     friends.phyUser = _phyUser;
00051 }
00052 
00053 wifimac::convergence::PhyMode
00054 SINR::getPhyMode(size_t numTransmissions, const wns::Ratio lqm) const
00055 {
00056     // Reduce lqm by retransmissionLQMReduction dB for every retransmission
00057     wns::Ratio myLQM = wns::Ratio::from_dB(lqm.get_dB() - (numTransmissions-1)*retransmissionLQMReduction);
00058     wifimac::convergence::PhyMode pm = friends.phyUser->getPhyModeProvider()->getDefaultPhyMode();
00059     pm.setMCS(friends.phyUser->getPhyModeProvider()->getMCS(myLQM));
00060     MESSAGE_SINGLE(NORMAL, *logger, "RA getPhyMode with lqm " << lqm << " and " << numTransmissions << " transmissions, suggested phyMode " << pm);
00061     return(pm);
00062 }
00063 
00064 wifimac::convergence::PhyMode
00065 SINR::getPhyMode(size_t numTransmissions) const
00066 {
00067     if(sinr->knowsPeerSINR(myReceiver))
00068     {
00069         return(getPhyMode(numTransmissions, sinr->getPeerSINR(myReceiver)));
00070     }
00071     else
00072     {
00073         return(ARF::getPhyMode(numTransmissions));
00074     }
00075 }
00076 
00077 void
00078 SINR::setCurrentPhyMode(wifimac::convergence::PhyMode pm)
00079 {
00080     if(not sinr->knowsPeerSINR(myReceiver))
00081     {
00082         // no SINR known, phyMode setting is handled by ARF
00083         ARF::setCurrentPhyMode(pm);
00084     }
00085     // otherwise do nothing, no internal state required
00086 }

Generated on Fri May 25 03:32:12 2012 for openWNS by  doxygen 1.5.5