![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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 #ifndef WNS_SCHEDULER_STRATEGY_SCHEDULERSTATE_HPP 00029 #define WNS_SCHEDULER_STRATEGY_SCHEDULERSTATE_HPP 00030 00031 #include <WNS/scheduler/SchedulerTypes.hpp> 00032 #include <WNS/scheduler/MapInfoEntry.hpp> 00033 #include <WNS/scheduler/SchedulingMap.hpp> 00034 #include <WNS/service/dll/StationTypes.hpp> 00035 #include <WNS/service/phy/ofdma/Pattern.hpp> 00036 #include <WNS/service/phy/phymode/PhyModeInterface.hpp> 00037 #include <WNS/ldk/Command.hpp> 00038 #include <WNS/ldk/Compound.hpp> 00039 #include <WNS/ldk/FunctionalUnit.hpp> 00040 #include <WNS/ldk/Classifier.hpp> 00041 #include <WNS/node/Node.hpp> 00042 #include <WNS/PowerRatio.hpp> 00043 #include <WNS/CandI.hpp> 00044 #include <WNS/Enum.hpp> 00045 00046 #include <map> 00047 #include <vector> 00048 #include <set> 00049 #include <list> 00050 #include <string> 00051 #include <sstream> 00052 00053 namespace wns { namespace scheduler { 00054 class MapInfoEntry; // forward declaration 00055 namespace strategy { 00056 class StrategyInput; 00057 class StrategyInterface; 00058 00062 class RequestForResource 00063 : virtual public wns::RefCountable 00064 { 00065 public: 00066 RequestForResource(ConnectionID _cid, UserID _user, Bits _bits, Bits _queuedBits, bool useHARQ); 00067 ~RequestForResource(); 00068 std::string toString() const; 00069 public: 00071 simTimeType getDuration() const; 00072 00074 ConnectionID cid; 00076 UserID user; 00078 Bits bits; 00080 Bits queuedBits; 00081 00085 wns::service::phy::phymode::PhyModeInterfacePtr phyModePtr; 00088 int subChannel; 00090 int timeSlot; 00092 int spatialLayer; // also called "stream" or better "spacialIndex" 00097 ChannelQualityOnOneSubChannel cqiOnSubChannel; // memory here 00098 bool useHARQ; 00099 }; 00100 00104 class RevolvingState 00105 : virtual public wns::RefCountable 00106 { 00107 public: 00108 RevolvingState(const strategy::StrategyInput* _strategyInput); 00109 virtual ~RevolvingState(); 00110 virtual std::string toString() const; 00111 virtual GroupingPtr getNewGrouping(); 00112 virtual bool groupingIsValid() const; 00113 virtual bool sdmaGroupingIsValid() const; 00114 virtual GroupingPtr getGrouping() const; 00115 virtual void setGrouping(GroupingPtr groupingPtr); 00116 virtual void setCurrentPriority(int priority); 00117 virtual int getCurrentPriority() const; 00118 virtual void clearMap(); 00119 public: 00121 const strategy::StrategyInput* strategyInput; 00125 MapInfoCollectionPtr bursts; 00130 wns::scheduler::SchedulingMapPtr schedulingMap; 00132 //ConnectionSet allActiveConnections; 00134 ConnectionSet activeConnections; 00136 ChannelQualitiesOfAllUsersPtr channelQualitiesOfAllUsers; 00137 protected: 00139 GroupingPtr grouping; 00140 00142 int currentPriority; 00143 }; // class RevolvingState 00145 typedef SmartPtr<RevolvingState> RevolvingStatePtr; 00147 //typedef std::vector< RevolvingStatePtr > RevolvingStateVector; 00148 00149 00152 class SchedulerState 00153 : virtual public wns::RefCountable 00154 { 00155 public: 00156 SchedulerState(strategy::StrategyInterface* _strategy): 00157 strategy(_strategy), 00158 defaultPhyModePtr(), 00159 defaultTxPower(), 00160 powerCapabilities(), 00161 isTx(true), 00162 isDL(true), 00163 useCQI(false), 00164 powerControlType(PowerControlDLMaster), 00165 //schedulerSpot(wns::scheduler::SchedulerSpot::DLMaster()), 00166 schedulerSpot(-1), // initialized to good value in setFriends 00167 myUserID(NULL), 00168 excludeTooLowSINR(true), 00169 keepResultHistory(false), 00170 symbolDuration(0.0), 00171 eirpLimited(false), 00172 currentState() // empty RevolvingState(), not persistent 00173 { 00174 assure(strategy!=NULL,"strategy==NULL"); 00175 } 00176 ~SchedulerState() { strategy=NULL; }; 00177 00181 virtual void setDefaultPhyMode(wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr) 00182 { defaultPhyModePtr = _phyModePtr; /*_phyModePtr->clone();*/} 00183 virtual wns::service::phy::phymode::PhyModeInterfacePtr 00184 getDefaultPhyMode() 00185 { assure(defaultPhyModePtr!=wns::service::phy::phymode::PhyModeInterfacePtr(),"defaultPhyModePtr=NULL"); return defaultPhyModePtr; } 00189 virtual void setDefaultTxPower(wns::Power _txPower) { 00190 defaultTxPower = _txPower; } 00192 virtual void clearMap() { 00193 assure(currentState!=RevolvingStatePtr(),"uninitialized currentState"); 00194 if (currentState!=RevolvingStatePtr()) currentState->clearMap(); } 00196 virtual RevolvingStatePtr 00197 getCurrentState() { 00198 assure (currentState!=RevolvingStatePtr(),"uninitialized currentState"); 00199 return currentState; } 00200 public: 00201 strategy::StrategyInterface* strategy; // allow strategy to be asked 00203 wns::service::phy::phymode::PhyModeInterfacePtr defaultPhyModePtr; 00205 wns::Power defaultTxPower; 00209 PowerCapabilities powerCapabilities; 00211 bool isTx; 00213 bool isDL; 00217 bool useCQI; 00219 PowerControlType powerControlType; 00221 SchedulerSpotType schedulerSpot; 00223 UserID myUserID; 00226 bool excludeTooLowSINR; 00229 bool keepResultHistory; 00231 simTimeType symbolDuration; 00233 bool eirpLimited; 00234 00237 RevolvingStatePtr currentState; 00238 00239 }; // class SchedulerState 00240 00242 typedef SmartPtr<SchedulerState> SchedulerStatePtr; 00243 00245 class betterChannelQuality 00246 { 00247 public: 00248 bool operator()(wns::scheduler::ChannelQualityOnOneSubChannel a, wns::scheduler::ChannelQualityOnOneSubChannel b) 00249 { 00250 return a.pathloss.get_factor() * a.interference.get_mW() 00251 < b.pathloss.get_factor() * b.interference.get_mW(); 00252 } 00253 }; 00254 00255 }}} // namespace wns::scheduler::strategy 00256 #endif // WNS_SCHEDULER_STRATEGY_SCHEDULERSTATE_HPP 00257 00258
1.5.5