User Manual, Developers Guide and API Documentation

Scheduler.hpp

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  * email: info@openwns.org
00009  * www: http://www.openwns.org
00010  * _____________________________________________________________________________
00011  *
00012  * openWNS is free software; you can redistribute it and/or modify it under the
00013  * terms of the GNU Lesser General Public License version 2 as published by the
00014  * Free Software Foundation;
00015  *
00016  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00017  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00018  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00019  * details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023  *
00024  ******************************************************************************/
00025 
00026 
00027 #ifndef WIMAC_SCHEDULER_SCHEDULER_HPP
00028 #define WIMAC_SCHEDULER_SCHEDULER_HPP
00029 
00030 #include <string>
00031 #include <queue>
00032 
00033 #include <boost/filesystem/fstream.hpp>
00034 
00035 #include <WNS/Cloneable.hpp>
00036 #include <WNS/pyconfig/View.hpp>
00037 #include <WNS/scheduler/MapInfoProviderInterface.hpp>
00038 #include <WNS/scheduler/SchedulerTypes.hpp>
00039 #include <WNS/Observer.hpp>
00040 #include <WNS/probe/bus/ContextCollector.hpp>
00041 #include <WNS/scheduler/strategy/StrategyInterface.hpp>
00042 
00043 #include <WIMAC/Classifier.hpp>
00044 #include <WIMAC/Logger.hpp>
00045 #include <WIMAC/scheduler/Interface.hpp>
00046 #include <WIMAC/services/ConnectionManager.hpp>
00047 
00048 namespace wns {
00049     namespace ldk {
00050         class FunctionalUnit;
00051         class Receptor;
00052     }
00053 
00054     namespace scheduler {
00055 
00056         class RegistryProxyInterface;
00057         class CallBackInterface;
00058 
00059         namespace queue {
00060             class QueueInterface;
00061         }
00062 
00063 //         namespace strategy {
00064 //             class StrategyResultPtr;
00065 //             class StrategyInterface;
00066 //         }
00067 
00068         namespace grouper {
00069             class GroupingProviderInterface;
00070         }
00071     }
00072 
00073     namespace service { namespace phy { namespace ofdma {
00074                 class DataTransmission;
00075             }
00076         }
00077     }
00078 }
00079 
00080 namespace wimac {
00081     class PhyUser;
00082     namespace frame {
00083         class MapHandlerInterface;
00084     }
00085 }
00086 namespace wimac { namespace scheduler {
00087         class Callback;
00088         class PseudoBWRequestGenerator;
00089         class RegistryProxyWiMAC;
00090 
00098         class Scheduler :
00099             public virtual wimac::scheduler::Interface,
00100             public wns::scheduler::MapInfoProviderInterface,
00101             public wns::Cloneable<Scheduler>,
00102             public wns::Observer<wimac::service::ConnectionDeletedNotification>
00103         {
00104         public:
00105             Scheduler(wns::ldk::FunctionalUnit* parent, const wns::pyconfig::View& config);
00106 
00107             ~Scheduler();
00108 
00109             void schedule(const wns::ldk::CompoundPtr&);
00110             void startScheduling();
00111             void finishScheduling(){}
00112             void deliverSchedule(wns::ldk::Connector*);
00113 
00114             void resetAllQueues();
00115 
00116             void resetCID(ConnectionIdentifier::CID cid);
00117 
00118             void finishCollection();
00119 
00121             void setProvider(wns::service::phy::ofdma::DataTransmission* _ofdmaProvider);
00122 
00123             void setFUN(wns::ldk::fun::FUN*);
00124 
00125             void setReceptor(wns::ldk::Receptor* receptor)
00126             { receptor_ = receptor; }
00127 
00128             void setDuration(const wns::simulator::Time& duration)
00129             { duration_ = duration; }
00130 
00131             wns::simulator::Time getDuration() const
00132             { return duration_; }
00133 
00134             // For MapInfoProviderInterface
00135             wns::scheduler::SchedulingMapPtr getSchedulingMap() const;
00136             wns::scheduler::MapInfoCollectionPtr getMapInfo() const 
00137             {
00138                 assure(0, "getMapInfo() should not be called anymore");
00139                 return wns::scheduler::MapInfoCollectionPtr();
00140             }
00141             int getNumBursts() const;
00142 
00143             void notifyAboutConnectionDeleted(const ConnectionIdentifier);
00144 
00148             wns::scheduler::queue::QueueInterface* 
00149             getQueue() const;
00150 
00151             wimac::scheduler::RegistryProxyWiMAC* 
00152             getRegistryProxy(){return colleagues.registry;};
00153 
00154             wns::scheduler::harq::HARQInterface*
00155             getHARQ(){return colleagues.harq;};
00156 
00157         protected:
00158             void setupPlotting();
00159             void handleBroadcast();
00160 
00161             bool plotFrames;
00162 
00163             struct {
00164                 wns::scheduler::grouper::GroupingProviderInterface* grouper;
00165                 wns::scheduler::queue::QueueInterface* queue;
00166                 wns::scheduler::strategy::StrategyInterface* strategy;
00167                 wns::scheduler::harq::HARQInterface* harq;
00168                 // we have special WiMAC extensions to the registry proxy so don't
00169                 // use the wns::scheduler::RegistryProxyInterface* version here
00170                 wimac::scheduler::RegistryProxyWiMAC* registry;
00171                 wimac::scheduler::Callback* callback;
00172                 wimac::scheduler::PseudoBWRequestGenerator* pseudoGenerator;
00173             } colleagues;
00174 
00175             wns::simulator::Time usedSlotDuration;
00176             wns::simulator::Time offsetInSlot;
00177             unsigned int freqChannels;
00178             unsigned int maxBeams;
00179             bool beamforming;
00180             int numberOfTimeSlots_;
00181             bool uplink;
00182         bool alwaysAcceptIfQueueAccepts;
00183 
00184             struct Friends
00185             {
00186                 wns::ldk::CommandTypeSpecifier<wns::ldk::ClassifierCommand>* classifier;
00187                 wimac::PhyUser* phyUser;
00188             } friends_;
00189 
00190             wns::logger::Logger logger;
00191             std::vector<boost::filesystem::fstream*> plotFiles;
00192 
00193 
00194         private:
00195             bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const;
00196             void doStart(int);
00197 
00198             void putProbe(int bits, int compounds);
00199 
00200             wns::service::phy::ofdma::DataTransmission* ofdmaProvider;
00201             std::string strategyName;
00202             std::string grouperName;
00203             std::string queueName;
00204             std::string registryName;
00205             std::string callbackName;
00206             wns::simulator::Time duration_;
00207 
00208             wimac::frame::MapHandlerInterface* mapHandler_;
00209             std::string mapHandlerName_;
00210 
00211             int pduCount;
00212             int frameNo;
00213 
00214             wns::pyconfig::View pyConfig;
00215 
00216             std::string outputDir;
00217 
00219             wns::scheduler::SchedulerSpotType schedulerSpot_;
00220 
00221             // Probes
00222             wns::probe::bus::ContextCollectorPtr resetedBitsProbe;
00223             wns::probe::bus::ContextCollectorPtr resetedCompoundsProbe;
00224 
00225             wns::scheduler::strategy::StrategyResultPtr strategyResult_;
00226 
00227             wns::ldk::FunctionalUnit* parent_;
00228             wns::ldk::Receptor* receptor_;
00229             bool accepting_;
00230             double slotDuration;
00231         };
00232     }
00233 }
00234 #endif
00235 
00236 

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