User Manual, Developers Guide and API Documentation

BCHSchedulerStrategy.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-2007
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 <LTE/controlplane/bch/BCHSchedulerStrategy.hpp>
00029 #include <WNS/scheduler/MapInfoEntry.hpp>
00030 
00031 using namespace lte::controlplane::bch;
00032 
00033 STATIC_FACTORY_REGISTER_WITH_CREATOR(BCHSchedulerStrategy,
00034                                      wns::scheduler::strategy::staticpriority::SubStrategyInterface,
00035                                      "lte.BCH.BCHSchedulerStrategy",
00036                                      wns::PyConfigViewCreator);
00037 
00038 BCHSchedulerStrategy::BCHSchedulerStrategy(const wns::pyconfig::View& config):
00039     logger_(config.get("logger"))
00040 {
00041     availableInSubframes_.resize(config.len("availableInSubframes"));
00042     for (int ii=0; ii<config.len("availableInSubframes"); ++ii)
00043     {
00044         availableInSubframes_[ii] = config.get<int>("availableInSubframes", ii);
00045     }
00046     numberOfSubchannels_ = config.get<int>("numberOfSubchannels");
00047 }
00048 
00049 BCHSchedulerStrategy::~BCHSchedulerStrategy()
00050 {
00051 }
00052 
00053 void
00054 BCHSchedulerStrategy::initialize()
00055 {
00056 }
00057 
00058 wns::scheduler::MapInfoCollectionPtr
00059 BCHSchedulerStrategy::doStartSubScheduling(wns::scheduler::strategy::SchedulerStatePtr schedulerState,
00060                                            wns::scheduler::SchedulingMapPtr schedulingMap)
00061 {
00062     std::vector<int>::iterator result;
00063     result = std::find(availableInSubframes_.begin(), availableInSubframes_.end(), schedulingMap->getFrameNr());
00064 
00065     if (result == availableInSubframes_.end() )
00066     {
00067         MESSAGE_SINGLE(NORMAL, logger_, "BCH is not active in this frame (frameNr = " << schedulingMap->getFrameNr()  << ")");
00068     }
00069 
00070     wns::scheduler::MapInfoCollectionPtr mapInfoCollection = wns::scheduler::MapInfoCollectionPtr(new wns::scheduler::MapInfoCollection); // result datastructure
00071 
00072     wns::scheduler::ConnectionSet &currentConnections = schedulerState->currentState->activeConnections;
00073 
00074     assure(currentConnections.size() == 1, "There should only be one CID for the BCH");
00075 
00076     if(colleagues.queue->queueHasPDUs( (*currentConnections.begin()) ))
00077     {
00078         int pduCounter = 0;
00079 
00080         scheduleCid(schedulerState,schedulingMap,(*currentConnections.begin()),pduCounter, 10000, mapInfoCollection);
00081     }
00082 
00083     return mapInfoCollection;
00084 }

Generated on Mon May 21 03:32:02 2012 for openWNS by  doxygen 1.5.5