User Manual, Developers Guide and API Documentation

DRPScheduler.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiMeMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2011
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 5, 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 #ifndef WIMEMAC_DRP_DRPSCHEDULER_H
00030 #define WIMEMAC_DRP_DRPSCHEDULER_H
00031 
00032 #include <WNS/ldk/fu/Plain.hpp>
00033 #include <WNS/logger/Logger.hpp>
00034 #include <WNS/service/dll/Address.hpp>
00035 #include <WIMEMAC/helper/Queues.hpp>
00036 #include <WNS/probe/bus/ContextCollector.hpp>
00037 
00038 #include <WIMEMAC/helper/IDRPQueueInterface.hpp>
00039 #include <WIMEMAC/drp/TempSendBuffer.hpp>
00040 
00041 #include <WNS/events/CanTimeout.hpp>
00042 
00043 #include <map>
00044 #include <WNS/PowerRatio.hpp>
00045 
00046 #include <WNS/probe/bus/utils.hpp>
00047 #include <WNS/ldk/probe/Probe.hpp>
00048 #include <WNS/probe/bus/ContextCollector.hpp>
00049 #include <WIMEMAC/management/BeaconBuilder.hpp>
00050 #include <WIMEMAC/management/BeaconCommand.hpp>
00051 #include <WIMEMAC/lowerMAC/timing/DCF.hpp>
00052 #include <WIMEMAC/lowerMAC/TXOP.hpp>
00053 #include <WIMEMAC/drp/IDRPSchedulerServices.hpp>
00054 
00055 #include <DLL/Layer2.hpp>
00056 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00057 #include <WNS/ldk/Layer.hpp>
00058 #include <WIMEMAC/TxType.hpp>
00059 #include <WIMEMAC/lowerMAC/ITXOPWindow.hpp>
00060 
00061 #include <WIMEMAC/management/PERInformationBase.hpp>
00062 #include <boost/bind.hpp>
00063 #include <WNS/events/scheduler/Callable.hpp>
00064 
00065 //  //
00066 namespace wimemac { namespace helper {
00067         class Queues;
00068 }}
00069 //  //
00070 namespace wimemac { namespace drp {
00071          class TempSendBuffer;
00072 }}
00073 //  //
00074 namespace wimemac { namespace management {
00075          class BeaconBuilder;
00076 }}
00077 //  //
00078 namespace wimemac { namespace lowerMAC { namespace timing {
00079          class DCF;
00080 }}}
00081 //  //
00082 namespace wimemac { namespace lowerMAC { 
00083          class TXOP;
00084 }}
00085 
00086 namespace wimemac { namespace drp {
00087 
00089     class DRPSchedulerCommand :
00090         public wimemac::IKnowsTxTypeCommand
00091     {
00092     public:
00093         struct { } local;
00094 
00095         struct {
00096             wimemac::TxType type;
00097             } peer;
00098 
00099         struct { } magic;
00100 
00101         DRPSchedulerCommand()
00102         {
00103             peer.type = DRP;
00104         }
00105 
00106         TxType getTxType()
00107         {
00108             return peer.type;
00109         }
00110     };
00111 
00112 
00127     typedef std::vector<wns::Power> PowerMap;
00128     typedef std::vector<bool> Vector;
00129 
00130     class DRPScheduler :
00131 
00132         public wns::ldk::fu::Plain<DRPScheduler, DRPSchedulerCommand>,
00133         public wimemac::helper::IDRPQueueInterface,
00134         public wns::events::CanTimeout,
00135         public wns::ldk::probe::Probe,
00136         public wimemac::lowerMAC::ITXOPWindow,
00137         public wimemac::drp::IDRPSchedulerServices
00138 
00139         {
00140         friend class TempSendBuffer;
00141 
00142         public:
00143 
00144             DRPScheduler(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config_ );
00145             ~DRPScheduler();
00146             void doOnData(const wns::ldk::CompoundPtr& );
00147 
00148             void doSendData(const wns::ldk::CompoundPtr& );
00149             bool doIsAccepting(const wns::ldk::CompoundPtr& compound) const;
00150             void doWakeup();
00151             void SendCompounds();
00152             void SendCompounds(wns::service::dll::UnicastAddress macaddress);
00153             void Acknowledgment(wns::service::dll::UnicastAddress tx);
00154 
00155             void
00156             TimeToTransmit(wns::service::dll::UnicastAddress macaddress, wns::simulator::Time duration);
00157 
00159             wimemac::convergence::PhyMode
00160             getPhyMode(wns::service::dll::UnicastAddress rx, int masNumber);
00161 
00163             wimemac::lowerMAC::Manager*
00164             getManager() {return friends.manager;}
00165 
00166             wimemac::management::BeaconBuilder*
00167             getBeaconBuilder() {return friends.bb;}
00168 
00170             double getDesiredPER() {return maxPER;}
00171 
00173             double getPatternPEROffset() {return patternPEROffset;}
00174 
00175             int getIsDroppingAfterRetr() {return isDroppingAfterRetr;}
00176 
00177             wns::service::dll::UnicastAddress
00178             getCurrentTransmissionTarget();
00179 
00181             bool
00182             isBeacon(const wns::ldk::CommandPool* commandPool) const;
00183 
00185             void failedAck(wns::service::dll::UnicastAddress rx);
00186 
00188             bool adjustMCSdown(wns::service::dll::UnicastAddress rx);
00189 
00191             bool UpdateMapWithPeerAvailabilityMap(wns::service::dll::UnicastAddress rx , Vector& DRPMap);
00192 
00194             void RequestIE(wns::service::dll::UnicastAddress rx, wimemac::management::BeaconCommand::ProbeElementID elementID);
00195 
00197             wns::simulator::Time
00198             getNextTransmissionDuration();
00199 
00201             wns::service::dll::UnicastAddress
00202             getNextReceiver() const;
00203 
00205             bool
00206             startPCAtransmission();
00207             void
00208             stopPCAtransmission();
00209             void
00210             txOPCloseIn(wns::simulator::Time duration);
00211 
00212             wns::simulator::Time
00213             getTimeUntilNextDRPReservation();
00214 
00215             void
00216             onBPStart(wns::simulator::Time BPduration);
00217             void
00218             RegisterDRPReservations(int thisMAS);
00219 
00220             void onDRPStart();
00221             void onDRPStop();
00222 
00224             int getNumOfRetransmissions(const wns::ldk::CompoundPtr& compound);
00225 
00227             void UpdateDRPMap(Vector DRPMap);
00228 
00229         protected:
00230 
00231             void onFUNCreated();
00232 
00233         private:
00234 
00235             wns::logger::Logger logger;
00236             helper::Queues* DRPQueues;
00237             wns::pyconfig::View config;
00238             typedef std::map<wns::service::dll::UnicastAddress, TempSendBuffer*> SendBufferContainer;
00239 
00240             int isDroppingAfterRetr;
00241             bool isPCAtransmissionActive;
00242             bool PCAcompoundsWereSent;
00243             wns::service::dll::UnicastAddress ActivePCArx;
00244             Vector currentDRPMap;
00245             Vector currentRegisterDRPMap;
00246 
00247             wns::simulator::Time nextDRPReservationTime;
00248 
00249             SendBufferContainer SendBuffer;
00250             SendBufferContainer PCABuffer;
00251             void onTimeout();
00252             bool AccessPermission;
00253             wns::service::dll::UnicastAddress AccessRx;
00254 
00255             double maxPER;
00256             double patternPEROffset;
00257             const std::string managerName;
00258             const std::string dcfName;
00259             const std::string txopName;
00260             const std::string beaconBuilderName;
00261             const std::string perMIBServiceName;
00262 
00263             wimemac::management::PERInformationBase* perMIB;
00264             wns::probe::bus::ContextCollectorPtr pcaPortionProbe;
00265 
00266             struct Friends
00267             {
00268                 wimemac::management::BeaconBuilder* bb;
00269                 wns::ldk::CommandReaderInterface* keyReader;
00270                 wimemac::lowerMAC::Manager* manager;
00271                 wimemac::lowerMAC::timing::DCF* dcf;
00272                 wimemac::lowerMAC::TXOP* txop;
00273             } friends;
00274 
00275     };
00276 }//drp
00277 }//wimemac
00278 #endif

Generated on Wed May 23 03:32:11 2012 for openWNS by  doxygen 1.5.5