User Manual, Developers Guide and API Documentation

Station.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 OFDMAPHY_STATION_HPP
00029 #define OFDMAPHY_STATION_HPP
00030 
00031 #include <OFDMAPHY/Transmitter.hpp>
00032 #include <OFDMAPHY/RSSInterface.hpp>
00033 
00034 #include <RISE/antenna/Antenna.hpp>
00035 #include <RISE/stations/station.hpp>
00036 #include <RISE/misc/pointer.hpp>
00037 #include <RISE/antenna/Beamforming.hpp>
00038 #include <RISE/manager/systemmanager.hpp>
00039 
00040 #include <WNS/logger/Logger.hpp>
00041 #include <WNS/service/phy/ofdma/DataTransmission.hpp>
00042 #include <WNS/service/phy/ofdma/Notification.hpp>
00043 #include <WNS/service/phy/ofdma/Handler.hpp>
00044 #include <WNS/service/phy/ofdma/Measurements.hpp>
00045 #include <WNS/service/phy/ofdma/MeasurementHandler.hpp>
00046 #include <WNS/service/phy/ofdma/CarrierSensing.hpp>
00047 #include <WNS/service/phy/ofdma/Pattern.hpp>
00048 #include <WNS/service/phy/phymode/PhyModeInterface.hpp>
00049 #include <WNS/CandI.hpp>
00050 
00051 namespace ofdmaphy {
00052     class SystemManager;
00053     namespace receiver {
00054         class Receiver;
00055     }
00056     class Component;
00057 
00058     namespace tests { class TransmitterTest;}
00059 
00060     class PowerAdmissionInterface
00061     {
00062     public:
00063         virtual
00064         ~PowerAdmissionInterface(){}
00065 
00066         virtual wns::Power
00067         admit(const wns::Power&) const = 0;
00068     };
00069 
00070     class Station :
00071         virtual public wns::service::phy::ofdma::DataTransmission,
00072         virtual public wns::service::phy::ofdma::Notification,
00073         virtual public wns::service::phy::ofdma::Measurements,
00074         public wns::Observer<RSSInterface>,
00075         virtual public PowerAdmissionInterface,
00076         public rise::Station
00077     {
00078 
00079         friend class ofdmaphy::tests::TransmitterTest;
00080 
00081         typedef wns::service::phy::ofdma::BFIdu bFIdu;
00082 
00083     public:
00084         Station(Component* component, const wns::pyconfig::View& pyConfigView);
00085         virtual ~Station();
00086 
00087         void
00088         onNodeCreated();
00089 
00091         virtual void
00092         startBroadcast(wns::osi::PDUPtr sdu,
00093                        int subBand,
00094                        wns::Power requestedTxPower,
00095                        int numberOfSpatialStreams = 1);
00096 
00101         virtual void
00102         startBroadcast(wns::osi::PDUPtr sdu,
00103                        int subBand,
00104                        wns::Power requestedTxPower,
00105                        wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr);
00106 
00108         virtual void
00109         startUnicast(wns::osi::PDUPtr sdu,
00110                      wns::node::Interface* _recipient,
00111                      int subBand,
00112                      wns::Power requestedTxPower,
00113                      int numberOfSpatialStreams = 1);
00114 
00119         virtual void
00120         startUnicast(wns::osi::PDUPtr sdu,
00121                      wns::node::Interface* _recipient,
00122                      int subBand,
00123                      wns::Power requestedTxPower,
00124                      wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr);
00125 
00126         virtual void
00127         stopTransmission(wns::osi::PDUPtr sdu, int subBand);
00128 
00130         void
00131         receiveData(wns::osi::PDUPtr sdu, wns::service::phy::power::PowerMeasurementPtr rxPowerMeasurementPtr);
00132 
00134         void
00135         measurementUpdate(wns::node::Interface* source, wns::service::phy::power::OFDMAMeasurementPtr rxPowerMeasurementPtr);
00136 
00138         void
00139         onNewRSS(wns::Power rss);
00140 
00141         void
00142         updateRequest();
00143 
00144         void
00145         endTransmission(rise::TransmissionObjectPtr t);
00146 
00147         virtual rise::SystemManager*
00148         getSystemManager() const;
00149 
00150         simTimeType
00151         getArrivalTime(simTimeType time, int len);
00152 
00153         // beamforming interface
00154         // TODO: remove this function:
00155         virtual std::map<wns::node::Interface*, wns::Ratio>
00156         calculateSINRsRx(const std::vector<wns::node::Interface*>& combination,
00157                          wns::Power IinterPlusNoise);
00158 
00159         virtual std::map<wns::node::Interface*, wns::CandI >
00160         calculateCandIsRx(const std::vector<wns::node::Interface*>& combination,
00161                           wns::Power IinterPlusNoise);
00162 
00163         // TODO: remove this function:
00164         virtual std::map<wns::node::Interface*, wns::Ratio>
00165         calculateSINRsTx(const std::map<wns::node::Interface*, wns::Power>& Station2NoisePlusIintercell,
00166                          wns::Power x_friendlyness,
00167                          wns::Power intendedTxPower);
00168 
00169         virtual std::map<wns::node::Interface*, wns::CandI >
00170         calculateCandIsTx(const std::map<wns::node::Interface*, wns::Power>& Station2NoisePlusIintercell,
00171                           wns::Power x_friendlyness,
00172                           wns::Power intendedTxPower);
00173 
00174         //should be calculateAndStorePattern
00175         virtual wns::service::phy::ofdma::PatternPtr
00176         calculateAndSetBeam(wns::node::Interface *id,
00177                             const std::vector<wns::node::Interface*>& undesired,
00178                             wns::Power IinterPlusNoise);
00179 
00180         virtual double
00181         estimateDoA(wns::node::Interface *id);
00182 
00183         virtual void
00184         startTransmission(wns::osi::PDUPtr pdu,
00185                           wns::node::Interface* _recipient,
00186                           int subBand,
00187                           wns::service::phy::ofdma::PatternPtr pattern,
00188                           wns::Power requestedTxPower,
00189                           int numberOfSpatialStreams = 1);
00190 
00191         virtual void
00192         startTransmission(wns::osi::PDUPtr pdu,
00193                           wns::node::Interface* _recipient,
00194                           int subBand,
00195                           wns::service::phy::ofdma::PatternPtr pattern,
00196                           wns::Power requestedTxPower,
00197                           wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr);
00198 
00199         virtual bool
00200         isReceiving() const;
00201 
00202         virtual std::string
00203         printActiveTransmissions() const;
00204 
00205         virtual void
00206         insertReceivePattern(wns::node::Interface*, wns::service::phy::ofdma::PatternPtr);
00207 
00208         virtual void
00209         removeReceivePattern(wns::node::Interface*);
00210 
00211         virtual void
00212         setCurrentReceivePatterns(std::map<wns::node::Interface*, wns::service::phy::ofdma::PatternPtr>);
00213 
00214         virtual void
00215         startReceiving();
00216 
00217         virtual void
00218         stopReceiving();
00219 
00220         virtual void
00221         enableReception();
00222 
00223         virtual void
00224         disableReception();
00225 
00226         virtual bool
00227         isReceptionEnabled() const ;
00228 
00229         virtual wns::Power
00230         getMaxPowerPerSubband() const {return maxTxPowerPerSubband;}
00231 
00232         virtual wns::Power
00233         getMaxOutputPower() const {return totalPower;};
00234 
00235         bool
00236         isEIRPLimited() const {return eirpLimited;}
00237 
00238         virtual wns::service::phy::ofdma::Tune
00239         getRxTune() const {return tuneRx;}
00240 
00241         virtual wns::service::phy::ofdma::Tune
00242         getTxTune() const {return tuneTx;}
00243 
00244         virtual void
00245         setTxTune(const wns::service::phy::ofdma::Tune& txTune);
00246 
00247         virtual void
00248         setRxTune(const wns::service::phy::ofdma::Tune& rxTune);
00249 
00251         virtual void
00252         setTxRxSwap(bool reverse);
00253 
00254         void
00255         setTxPowerForStation(wns::node::Interface* stack, wns::Power _txPower);
00256 
00257         void
00258         setPowerReceivedForStation(wns::node::Interface* stack, wns::Power _rxPower);
00259 
00260         rise::antenna::Beamforming*
00261         getBFAntenna() const;
00262 
00264         virtual void
00265         registerHandler(wns::service::phy::ofdma::Handler* _handler)
00266             {
00267                 assure(_handler, "must be non-NULL");
00268                 handler = _handler;
00269             }
00270 
00271         virtual void
00272         registerRSSHandler(wns::service::phy::ofdma::RSSHandler* _rssHandler);
00273 
00275         virtual void
00276         registerMeasurementHandler(wns::service::phy::ofdma::MeasurementHandler* _measurementHandler)
00277             {
00278                 assure(_measurementHandler, "must be non-NULL");
00279                 measurementHandler = _measurementHandler;
00280             }
00281 
00282         virtual wns::node::Interface*
00283         getNode();
00284 
00285         bool
00286         beamformingEnabled() const;
00287 
00288         receiver::Receiver*
00289         getReceiver(){return receiver;};
00290 
00291         Transmitter<Station>*
00292         getTransmitter(){return transmitter;};
00293 
00294         virtual int
00295         getNumAntennas() const
00296             {
00297                 return this->numAntennas;
00298             };
00299 
00300     protected:
00301         bool eirpLimited;
00302 
00307         virtual wns::Power
00308         getSumPower() const;
00309 
00310         virtual wns::Power
00311         admit(const wns::Power& requestedPower) const;
00312 
00313     private:
00314 
00315         void
00316         startTransmitting(wns::osi::PDUPtr sdu, rise::TransmissionObjectPtr txObject, int subBand);
00317 
00318         wns::logger::Logger logger;
00319         SystemManager* systemManager;
00320         Transmitter<Station>* transmitter;
00321         receiver::Receiver* receiver;
00322         PowerAdmissionInterface* powerAdmission;
00323         // maximum Tx power of the OFDMA station
00324         // reduced tx power allowed, e.g., controlled by DLL-based power control
00325         // wns::Power txPower;
00326         wns::Power maxTxPowerPerSubband;
00327         wns::Power totalPower; // for all subBands; typ. 1..40W
00328 
00330         const int numAntennas;
00331 
00332         wns::service::phy::ofdma::Tune tuneRx;
00333         wns::service::phy::ofdma::Tune tuneTx;
00334         bool reverseState;
00335 
00336         rise::antenna::Beamforming* beamformingAntenna;
00337         bool supportsBeamforming;
00338         std::map<wns::osi::PDUPtr, rise::TransmissionObjectPtr> activeTransmissions;
00339         wns::service::phy::ofdma::Handler* handler;
00340         wns::service::phy::ofdma::RSSHandler* rssHandler;
00341         wns::service::phy::ofdma::MeasurementHandler* measurementHandler;
00342         Component* component;
00343         bool isReceptionEnabledFlag;
00344 
00345         virtual wns::CandI getCurrentCandI(wns::osi::PDUPtr sdu);
00346 
00347         template <typename NEWTYPE, typename CONTAINER>
00348         class ConvertNode {
00349         public:
00350             ConvertNode(NEWTYPE c) :
00351                 result(),
00352                 caller(c)
00353                 {}
00354 
00355             void operator()(wns::node::Interface* n) {
00356                 result.push_back(caller->systemManager->getStation(n));
00357             }
00358 
00359             CONTAINER result;
00360             NEWTYPE caller;
00361         };
00362 
00363     };
00364 } // ofdmaphy
00365 
00366 #endif // NOT defined OFDMAPHY_STATION_HPP
00367 
00368 

Generated on Sat May 26 03:32:16 2012 for openWNS by  doxygen 1.5.5