![]() |
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-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 RISE_PLMAPPING_PHYMODE_HPP 00029 #define RISE_PLMAPPING_PHYMODE_HPP 00030 00031 #include <string> 00032 #include <WNS/Enum.hpp> 00033 #include <WNS/pyconfig/View.hpp> 00034 #include <WNS/service/phy/phymode/PhyModeInterface.hpp> 00035 #include <WNS/service/phy/phymode/SNR2MIInterface.hpp> 00036 #include <WNS/service/phy/phymode/MI2PERInterface.hpp> 00037 #include <RISE/plmapping/CodeRates.hpp> 00038 00039 namespace rise { namespace plmapping { 00040 namespace tests { 00041 class PhyModeTest; 00042 class PhyModeMapperTest; 00043 } 00044 00045 const unsigned int UNDEFINED_PHYMODE = 0; 00046 const unsigned int UNDEFINED_MODULATION = 0; 00047 const unsigned int MAX_MODULATIONS = 8; 00048 const unsigned int MOD_BITS = 6; 00049 const unsigned int MOD_MASK = 63; 00050 00055 ENUM_BEGIN(Modulations); 00056 //ENUM(UNDEFINED_MODULATION, 0); // see above 00057 ENUM(BPSK, 1); 00058 ENUM(QPSK, 2); 00059 ENUM(QAM8, 3); 00060 ENUM(QAM16, 4); 00061 ENUM(QAM32, 5); 00062 ENUM(QAM64, 6); 00063 ENUM(QAM128,7); 00064 ENUM(QAM256,8); 00065 ENUM_END(); 00066 00068 typedef wns::service::phy::phymode::Modulation Modulation; 00069 00081 class PhyMode : 00082 public wns::service::phy::phymode::PhyModeInterface, 00083 // ^ this is necessary so that libwns does not depend on rise. 00084 public wns::Cloneable<PhyMode> // allow SmartPtr 00085 { 00086 friend class rise::plmapping::tests::PhyModeTest; 00087 friend class rise::plmapping::tests::PhyModeMapperTest; 00088 private: 00090 wns::service::phy::phymode::SNR2MIInterface* snr2miMapper; 00092 //wns::service::phy::phymode::CoderMappingInterface* coderMapper; 00094 wns::service::phy::phymode::CoderFullMappingInterface* coderMapper; // mi2perMapper; 00096 rise::plmapping::Modulation modulation; // int 00098 rise::plmapping::Coding coding; // int 00100 bool subCarriersPerSubChannelKnown; 00101 unsigned int subCarriersPerSubChannel; 00102 bool symbolDurationKnown; 00103 simTimeType symbolDuration; // (symbolLength+cpLength) = 1/symbolRate 00104 bool dataRateKnown; 00105 double dataRate; 00106 public: 00108 class UndefinedException : 00109 public wns::Exception 00110 { 00111 public: 00112 UndefinedException() : 00113 wns::Exception("Undefined PhyMode") {}; 00114 00115 ~UndefinedException() throw() {}; 00116 }; 00117 00119 PhyMode(); 00120 00122 explicit 00123 PhyMode(const wns::pyconfig::View& config); 00124 00126 PhyMode(Modulation _modulation, rise::plmapping::Coding _coding, wns::service::phy::phymode::SNR2MIInterface* _snr2miMapper, wns::service::phy::phymode::CoderFullMappingInterface* _coderMapper); 00127 00128 virtual ~PhyMode(); 00129 00130 virtual void setSubCarriersPerSubChannel(unsigned int _subCarriersPerSubChannel); 00132 virtual void setSymbolDuration(simTimeType _symbolDuration); 00133 virtual bool isValid() const; 00135 virtual bool dataRateIsValid() const; 00136 00138 virtual rise::plmapping::Modulation getModulation() const; 00139 00141 virtual rise::plmapping::Coding getCoding() const; 00142 00144 virtual double getCodeRate() const; 00145 00151 virtual double getBitsPerSymbol() const; 00152 00154 //virtual unsigned int getBitCapacity(double numberOfOFDMSymbols) const; 00155 00159 virtual double getDataRate(double _symbolRate, unsigned int _subCarriersPerSubChannel=1) const; 00161 virtual double getDataRate() const; 00162 00164 virtual double getSINR2MI(const wns::Ratio& sinr) const; 00166 virtual double getSINR2MIB(const wns::Ratio& sinr) const; 00168 virtual double getMI2PER(const double mib, unsigned int bits) const; 00170 virtual double getSINR2PER(const wns::Ratio& sinr, unsigned int bits) const; 00171 virtual wns::Ratio getMIB2SINR(const double& mib) const; 00175 virtual unsigned int 00176 getBitCapacityFractional(simTimeType duration) const; 00177 00181 virtual unsigned int 00182 getBitCapacity(simTimeType duration) const; 00183 00185 virtual std::string getModulationString() const; 00187 virtual std::string getCodingString() const; 00189 virtual std::string getString() const; 00191 virtual std::string doToString() const { return this->getString(); } 00193 virtual bool nameMatches(const std::string& name) const; 00194 00197 static inline const PhyMode& emptyPhyMode() { 00198 static PhyMode emptyPhyMode = PhyMode(); 00199 return emptyPhyMode; 00200 } 00201 00202 private: 00204 virtual unsigned int toInt() const; 00205 00207 virtual void calculateDataRate(); 00208 00209 virtual void cloneParameters(const PhyMode& other); 00210 00211 }; // class definition ends 00212 00214 inline std::ostream& 00215 operator<< (std::ostream& s, const PhyMode& p) { 00216 return s << p.getString(); 00217 } 00218 00222 typedef wns::SmartPtr<rise::plmapping::PhyMode> PhyModePtr; 00223 00224 }} //namespace rise::plmapping 00225 #endif // RISE_PLMAPPING_PHYMODE_HPP
1.5.5