User Manual, Developers Guide and API Documentation

LTE_UL.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2009
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #include <WNS/scheduler/strategy/apcstrategy/LTE_UL.hpp>
00029 #include <WNS/scheduler/SchedulerTypes.hpp>
00030 #include <WNS/scheduler/strategy/StrategyInterface.hpp>
00031 #include <WNS/simulator/ISimulator.hpp>
00032 
00033 
00034 using namespace wns::scheduler;
00035 using namespace wns::scheduler::strategy;
00036 using namespace wns::scheduler::strategy::apcstrategy;
00037 
00038 STATIC_FACTORY_REGISTER_WITH_CREATOR(LTE_UL,
00039                     APCStrategyInterface,
00040                     "LTE_UL",
00041                     wns::PyConfigViewCreator);
00042 
00043 LTE_UL::LTE_UL(const wns::pyconfig::View& config)
00044     : APCStrategy(config),
00045     pNull_(config.get<wns::Power>("pNull")),
00046     alpha_(config.get<double>("alpha")),
00047     sinrMargin_(config.get<wns::Ratio>("sinrMargin")),
00048     minimumPhyMode_(config.get<int>("minimumPhyMode"))
00049 {
00050     assure(minimumPhyMode_ >= 0, "PhyMode must be >= 0");
00051 }
00052 
00053 LTE_UL::~LTE_UL()
00054 {
00055 }
00056 
00057 void
00058 LTE_UL::initialize(SchedulerStatePtr schedulerState,
00059         SchedulingMapPtr schedulingMap)
00060 {
00061     APCStrategy::initialize(schedulerState,schedulingMap); // must always initialize base class too
00062     MESSAGE_SINGLE(NORMAL, logger, "APCStrategy::initialize(" << apcstrategyName << ")");
00063 
00064     assure(minimumPhyMode_ >= 0, "PhyMode must be >= 0");
00065     assure(minimumPhyMode_ < (phyModeMapper->getPhyModeCount()-1), "To high PhyMode, maximum is " << (phyModeMapper->getPhyModeCount()-1));
00066 }
00067 
00068 APCResult
00069 LTE_UL::doStartAPC(RequestForResource& request,
00070                      SchedulerStatePtr schedulerState,
00071                      SchedulingMapPtr schedulingMap)
00072 {
00073     // no power control, just nominal values
00074     APCResult apcResult;
00075 
00076     assure(request.subChannel >= 0, "need a valid subChannel");
00077 
00078     wns::Ratio pathloss     = request.cqiOnSubChannel.pathloss;
00079     wns::Power interference = request.cqiOnSubChannel.interference;
00080 
00081     if (schedulerState->defaultTxPower != wns::Power())
00082     { // predefined, e.g. in slave mode
00083         apcResult.txPower = schedulerState->defaultTxPower;
00084     } 
00085     else 
00086     {
00087         wns::Ratio scalePL;
00088         scalePL.set_dB(pathloss.get_dB() * alpha_);
00089         apcResult.txPower = pNull_ * scalePL;
00090     }
00091 
00092     MESSAGE_SINGLE(NORMAL, logger,"doStartAPC(" << request.toString() << "): "
00093         << "estd. PL = " << pathloss << ", estd I. = " << interference);
00094     if (schedulerState->defaultPhyModePtr != wns::service::phy::phymode::PhyModeInterfacePtr())
00095     { // predefined, e.g. in slave mode
00096         apcResult.phyModePtr = schedulerState->defaultPhyModePtr;
00097     }
00098     else
00099     {
00100         wns::Ratio sinr = apcResult.txPower/(interference * pathloss);
00101 
00102         apcResult.phyModePtr = phyModeMapper->getBestPhyMode(sinr - sinrMargin_);
00103         apcResult.sinr = sinr;
00104 
00105         // Now we introduce some limiting
00106         if (phyModeMapper->getIndexForPhyMode(*apcResult.phyModePtr) < minimumPhyMode_)
00107         {
00108             apcResult.phyModePtr = phyModeMapper->getPhyModeForIndex(minimumPhyMode_);
00109             MESSAGE_SINGLE(NORMAL, logger, "doStartAPC"
00110                            << "Below minimum phy mode, raising to " << *(apcResult.phyModePtr));
00111         }
00112     }
00113 
00114     apcResult.estimatedCandI = wns::CandI(apcResult.txPower/pathloss,interference);
00115 
00116     MESSAGE_SINGLE(NORMAL, logger,"doStartAPC(" << request.toString() << "): "
00117                << "SINR=" << apcResult.sinr << ", PhyMode=" << *(apcResult.phyModePtr));
00118 
00119     request.phyModePtr = apcResult.phyModePtr; // maybe needed later
00120 
00121     return apcResult;
00122 }
00123 
00124 void 
00125 LTE_UL::postProcess(SchedulerStatePtr schedulerState,
00126                      SchedulingMapPtr schedulingMap)
00127 {
00128 }

Generated on Thu May 24 03:31:50 2012 for openWNS by  doxygen 1.5.5