User Manual, Developers Guide and API Documentation

PhyUser.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-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 #ifndef LTE_MACR_PHYUSER_HPP
00029 #define LTE_MACR_PHYUSER_HPP
00030 
00031 #include <LTE/macr/PhyCommand.hpp>
00032 #include <LTE/helper/HasModeName.hpp>
00033 
00034 #include <WNS/ldk/FunctionalUnit.hpp>
00035 #include <WNS/ldk/Compound.hpp>
00036 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00037 #include <WNS/ldk/HasReceptor.hpp>
00038 #include <WNS/ldk/HasConnector.hpp>
00039 #include <WNS/ldk/HasDeliverer.hpp>
00040 #include <WNS/ldk/Receptor.hpp>
00041 #include <WNS/ldk/Connector.hpp>
00042 #include <WNS/probe/bus/json/probebus.hpp>
00043 
00044 #include <WNS/service/phy/ofdma/Handler.hpp>
00045 #include <WNS/service/phy/ofdma/Notification.hpp>
00046 #include <WNS/service/phy/ofdma/DataTransmission.hpp>
00047 #include <WNS/service/phy/power/PowerMeasurement.hpp>
00048 #include <WNS/service/phy/phymode/PhyModeInterface.hpp>
00049 #include <WNS/service/dll/Address.hpp>
00050 
00051 #include <WNS/pyconfig/View.hpp>
00052 #include <WNS/Positionable.hpp>
00053 #include <WNS/Observer.hpp>
00054 
00055 namespace dll {
00056     class ILayer2;
00057     namespace services {
00058         namespace management {
00059             class InterferenceCache;
00060         }
00061     }
00062 }
00063 
00064 namespace dll {
00065     class StationManager;
00066     namespace services { namespace control {
00067             class Association;
00068         }}}
00069 
00070 namespace wns {
00071     namespace service { namespace phy { namespace phymode {
00072                 class SNR2MIInterface;
00073             }}}
00074 }
00075 namespace lte{
00076     namespace macr {
00077 
00078         class IRxTxSettable
00079         {
00080         public:
00084             typedef enum { Invalid, Tx, Rx, BothRxTx } StateRxTx;
00085 
00089             virtual void
00090             setStateRxTx(StateRxTx _state) = 0;
00091         };
00092 
00094         class PhyUser :
00095                 virtual public wns::ldk::FunctionalUnit,
00096                 public wns::ldk::CommandTypeSpecifier< PhyCommand >,
00097                 public wns::ldk::HasReceptor<>,
00098                 public wns::ldk::HasConnector<>,
00099                 public wns::ldk::HasDeliverer<>,
00100                 public wns::Cloneable<PhyUser>,
00101                 virtual public wns::service::phy::ofdma::Handler,
00102                 public lte::helper::HasModeName,
00103                 public IRxTxSettable
00104         {
00106             class StartTxEvent
00107             {
00108                 wns::ldk::CompoundPtr compound;
00109                 int subBand;
00110                 PhyUser* phyUser;
00111             public:
00112                 StartTxEvent(const wns::ldk::CompoundPtr& _compound,
00113                              PhyUser* _phyUser) :
00114                     compound(_compound),
00115                     phyUser(_phyUser)
00116                 {};
00117 
00118                 virtual ~StartTxEvent(){
00119                     compound = wns::ldk::CompoundPtr();
00120                 }
00121 
00122                 virtual void
00123                 operator()()
00124                 {
00125                     phyUser->startTransmission(compound);
00126                 };
00127             };
00128 
00130             class StopTxEvent
00131             {
00132                 wns::ldk::CompoundPtr compound;
00133                 int subBand;
00134                 PhyUser* phyUser;
00135             public:
00136                 StopTxEvent(const wns::ldk::CompoundPtr& _compound,
00137                             int _subBand,
00138                             PhyUser* _phyUser) :
00139                     compound(_compound),
00140                     subBand(_subBand),
00141                     phyUser(_phyUser)
00142                 {};
00143 
00144                 virtual
00145                 ~StopTxEvent(){
00146                     compound = wns::ldk::CompoundPtr();
00147                 }
00148 
00149                 virtual void
00150                 operator()()
00151                 {
00152                     phyUser->stopTransmission(compound, subBand);
00153                 };
00154             };
00155 
00156         public:
00157 
00158             PhyUser(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& pyConfigView);
00159             virtual ~PhyUser();
00160 
00161 
00164             virtual void
00165             onFUNCreated();
00167 
00170             virtual bool
00171             doIsAccepting(const wns::ldk::CompoundPtr& compound) const;
00172             virtual void
00173             doSendData(const wns::ldk::CompoundPtr& sdu);
00174             virtual void
00175             doOnData(const wns::ldk::CompoundPtr& compound);
00176             virtual void
00177             doWakeup();
00179 
00183             virtual void
00184             onData(wns::osi::PDUPtr pdu, wns::service::phy::power::PowerMeasurementPtr rxPowerMeasurement);
00186 
00189             void
00190             startTransmission(const wns::ldk::CompoundPtr& compound);
00191             void
00192             stopTransmission(wns::osi::PDUPtr pdu, int subBand);
00194 
00197             bool
00198             checkIdle();
00199 
00203             void
00204             setStateRxTx(StateRxTx _state);
00205 
00207             std::string
00208             getStateRxTx() const;
00209 
00211             virtual void
00212             rapTuning();
00213 
00215             virtual void
00216             utTuning();
00217 
00219             virtual void
00220             setNotificationService(wns::service::Service* phy);
00221 
00223             virtual wns::service::phy::ofdma::Notification*
00224             getNotificationService() const;
00225 
00227             virtual void
00228             setDataTransmissionService(wns::service::Service* phy);
00229 
00231             virtual wns::service::phy::ofdma::DataTransmission*
00232             getDataTransmissionService() const;
00233 
00235             virtual void
00236             setMACAddress(const wns::service::dll::UnicastAddress& address);
00237 
00238             void
00239             setMobility(wns::PositionableInterface* _mobility);
00240 
00242             bool
00243             isFddCapable() const;
00244 
00245             void
00246             setReceiveAntennaPattern(wns::node::Interface* destination, wns::service::phy::ofdma::PatternPtr pattern);
00247 
00249             void
00250             deleteReceiveAntennaPatterns();
00251         private:
00252 
00253 #ifndef NDEBUG
00254             void
00255             traceIncoming(wns::ldk::CompoundPtr compound, wns::service::phy::power::PowerMeasurementPtr rxPowerMeasurement);
00256 
00257             wns::ldk::CommandReaderInterface* schedulerCommandReader_;
00258 #endif 
00259             void
00260             measureInterference(PhyCommand*, wns::Power);            
00261 
00262             wns::pyconfig::View config_;
00263 
00265             dll::ILayer2* layer2;
00267             StateRxTx stateRxTx;
00268             wns::logger::Logger logger;
00269 
00271             std::list< std::pair<wns::osi::PDUPtr, int> > activeSubBands;
00272 
00274             bool fddCapable;
00275 
00277             simTimeType safetyFraction;
00278 
00280             wns::events::scheduler::Interface* es;
00281 
00282             wns::service::dll::UnicastAddress address;
00283 
00285             dll::services::management::InterferenceCache* iCache;
00286 
00288             wns::service::phy::ofdma::BFInterface* bfTransmission;
00289 
00291             wns::service::phy::ofdma::NonBFInterface* transmission;
00292 
00294             wns::service::phy::ofdma::Notification* notificationService;
00295 
00297             wns::PositionableInterface* mobility;
00298 
00300             dll::StationManager* stationManager;
00301 
00303             bool sendAllBroadcast;
00304 
00305             std::map<int, wns::Power> interf;
00306 
00307             wns::simulator::Time lastMeasureTime;
00308 
00309             wns::simulator::Time measurementDelay_;
00310 
00311             wns::probe::bus::ContextCollectorPtr jsonTracingCC_;
00312 
00313         };
00314     } }
00315 #endif // NOT defined LTE_MACR_PHYUSER_HPP
00316 
00317 

Generated on Sun May 27 03:32:05 2012 for openWNS by  doxygen 1.5.5