![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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_CONVERGENCE_PHYMODE_HPP 00030 #define WIMEMAC_CONVERGENCE_PHYMODE_HPP 00031 00032 // must be the first include! 00033 #include <WNS/PowerRatio.hpp> 00034 #include <WNS/pyconfig/View.hpp> 00035 #include <WNS/logger/Logger.hpp> 00036 #include <WNS/Ttos.hpp> 00037 #include <WNS/simulator/Bit.hpp> 00038 00039 #include <WIMEMAC/FrameType.hpp> 00040 00041 #include <math.h> 00042 #include <map> 00043 00044 namespace wimemac { namespace convergence { 00045 00046 class PhyMode; 00047 00048 class MCS { 00049 // PhyMode needs to access the nominator and denominator 00050 friend class PhyMode; 00051 public: 00052 MCS(); 00053 MCS(const wns::pyconfig::View& config); 00054 MCS(const MCS& other); 00055 00056 std::string getModulation() const 00057 { return this->modulation;}; 00058 00059 std::string getRate() const 00060 { return this->codingRate;}; 00061 00062 void 00063 setIndex(unsigned int index) 00064 { this->index = index;}; 00065 unsigned int 00066 getIndex() const 00067 { return this->index;}; 00068 00069 float getDataRate(); 00070 00071 wns::Ratio getMinSINR() const 00072 { return this->minSINR;}; 00073 00074 wns::Power getMinRxPower() const 00075 { return this->minRX;}; 00077 bool operator <(const MCS& rhs) const; 00078 bool operator ==(const MCS& rhs) const; 00079 bool operator !=(const MCS& rhs) const; 00080 00081 private: 00082 void setModulation(const std::string& modulation); 00083 void setCodingRate(const std::string codingRate); 00084 00085 std::string modulation; 00086 std::string codingRate; 00087 00088 unsigned int nominator; 00089 unsigned int denominator; 00090 00091 unsigned int nIBP6S; 00092 wns::simulator::Time SymbolDuration; 00093 00094 unsigned int index; 00095 wns::Ratio minSINR; 00096 wns::Power minRX; 00097 }; 00098 00099 inline std::ostream& operator<< (std::ostream& s, const MCS& mcs) 00100 { 00101 return s << mcs.getModulation() << "-" << mcs.getRate(); 00102 }; 00103 00113 class PhyMode { 00114 public: 00116 PhyMode(); 00117 PhyMode(const wns::pyconfig::View& config); 00118 00122 Bit getDataBitsPerSymbol() const; 00123 Bit getInfoBitsPer6Symbols() const; 00124 00125 float getDataRate(); 00126 00130 unsigned int getNumberOfSpatialStreams() const 00131 { return this->numberOfSpatialStreams; }; 00132 void setNumberOfSpatialStreams(unsigned int ss) 00133 { this->numberOfSpatialStreams = ss; }; 00134 00135 MCS getMCS() const 00136 { return this->mcs; }; 00137 void setMCS(const MCS& other) 00138 { this->mcs = other; }; 00139 00140 wns::Ratio getMinSINR() const 00141 { return this->mcs.getMinSINR();}; 00142 00143 wns::Power getMinRxPower() const 00144 { return this->mcs.getMinRxPower();}; 00145 00146 unsigned int getNumberOfDataSubcarriers() const 00147 { return this->numberOfDataSubcarriers;}; 00148 void setNumberOfDataSubcarriers(unsigned int ds) 00149 { this->numberOfDataSubcarriers = ds; }; 00150 00151 std::string getPreambleMode() const 00152 { return this->plcpMode;}; 00153 void setPreambleMode(std::string pm) 00154 { this->plcpMode = pm;} 00155 00156 wns::simulator::Time getGuardIntervalDuration() const 00157 { return this->guardIntervalDuration;}; 00158 void setGuardIntervalDuration(wns::simulator::Time gi) 00159 { this->guardIntervalDuration = gi;}; 00160 00164 bool operator <(const PhyMode& rhs) const; 00168 bool operator ==(const PhyMode& rhs) const; 00169 bool operator !=(const PhyMode& rhs) const; 00170 00171 private: 00172 MCS mcs; 00173 std::string codingRate; 00174 unsigned int numberOfSpatialStreams; 00175 unsigned int numberOfDataSubcarriers; 00176 std::string plcpMode; 00177 wns::simulator::Time guardIntervalDuration; 00178 }; 00179 00180 inline std::ostream& operator<< (std::ostream& s, const PhyMode& p) 00181 { 00182 return s << "(" << p.getMCS() << ")*" 00183 << wns::Ttos(p.getNumberOfDataSubcarriers()) 00184 << "*" << wns::Ttos(p.getNumberOfSpatialStreams()) 00185 << " (-> " << wns::Ttos(p.getDataBitsPerSymbol()) << " dbps)"; 00186 }; 00187 }} 00188 00189 #endif // WIMEMAC_CONVERGENCE_PHYMODE_HPP
1.5.5