![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiFiMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2007 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 16, 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 #ifndef WIFIMAC_CONVERGENCE_PHYMODE_HPP 00029 #define WIFIMAC_CONVERGENCE_PHYMODE_HPP 00030 00031 // must be the first include! 00032 #include <WNS/Python.hpp> 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 <WIFIMAC/management/protocolCalculatorPlugins/ConfigGetter.hpp> 00040 00041 #include <math.h> 00042 #include <map> 00043 00044 namespace wifimac { 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 MCS(const wifimac::management::protocolCalculatorPlugins::ConfigGetter& config); 00056 00057 std::string getModulation() const; 00058 std::string getRate() const; 00059 00060 void 00061 setIndex(unsigned int index) 00062 { this->index = index;}; 00063 unsigned int 00064 getIndex() const 00065 { return this->index;}; 00066 00067 wns::Ratio getMinSINR() const 00068 { return this->minSINR;}; 00072 bool operator <(const MCS& rhs) const; 00073 bool operator ==(const MCS& rhs) const; 00074 bool operator !=(const MCS& rhs) const; 00075 00076 private: 00077 void setMCS(const std::string& newModulation, const std::string& newCodingRate); 00078 00079 std::string modulation; 00080 std::string codingRate; 00081 00082 unsigned int nominator; 00083 unsigned int denominator; 00084 00085 unsigned int index; 00086 wns::Ratio minSINR; 00087 }; 00088 00089 inline std::ostream& operator<< (std::ostream& s, const MCS& mcs) 00090 { 00091 return s << mcs.getModulation() << "-" << mcs.getRate(); 00092 }; 00093 00103 class PhyMode { 00104 public: 00106 PhyMode(); 00107 PhyMode(const wns::pyconfig::View& config); 00108 PhyMode(const wifimac::management::protocolCalculatorPlugins::ConfigGetter& config); 00109 00113 Bit getDataBitsPerSymbol() const; 00114 00118 unsigned int getNumberOfSpatialStreams() const 00119 { return this->spatialStreams.size(); }; 00120 00121 void setMCS(const MCS& mcs) 00122 { this->setUniformMCS(mcs, 1); }; 00123 00124 void setUniformMCS(const MCS& mcs, unsigned int numSS); 00125 00126 std::vector<MCS> getSpatialStreams() const 00127 { return this->spatialStreams; }; 00128 00129 void setSpatialStreams(const std::vector<MCS>& ss); 00130 00131 wns::Ratio getMinSINR() const 00132 { return this->spatialStreams[0].getMinSINR();}; 00133 00134 unsigned int getNumberOfDataSubcarriers() const 00135 { return this->numberOfDataSubcarriers;}; 00136 void setNumberOfDataSubcarriers(unsigned int ds) 00137 { this->numberOfDataSubcarriers = ds; }; 00138 00139 std::string getPreambleMode() const 00140 { return this->plcpMode;}; 00141 void setPreambleMode(std::string pm) 00142 { this->plcpMode = pm;} 00143 00144 wns::simulator::Time getGuardIntervalDuration() const 00145 { return this->guardIntervalDuration;}; 00146 void setGuardIntervalDuration(wns::simulator::Time gi) 00147 { this->guardIntervalDuration = gi;}; 00148 00152 bool operator <(const PhyMode& rhs) const; 00156 bool operator ==(const PhyMode& rhs) const; 00157 bool operator !=(const PhyMode& rhs) const; 00158 00159 private: 00160 std::vector<MCS> spatialStreams; 00161 unsigned int numberOfDataSubcarriers; 00162 std::string plcpMode; 00163 wns::simulator::Time guardIntervalDuration; 00164 }; 00165 00166 inline std::ostream& operator<< (std::ostream& s, const PhyMode& p) 00167 { 00168 s << "|"; 00169 std::vector<MCS> ss = p.getSpatialStreams(); 00170 for (std::vector<MCS>::iterator it = ss.begin(); 00171 it != ss.end(); 00172 ++it) 00173 { 00174 s << (*it) << "|"; 00175 } 00176 s << "*" << wns::Ttos(p.getNumberOfDataSubcarriers()) 00177 << " (-> " << wns::Ttos(p.getDataBitsPerSymbol()) << " dbps)"; 00178 return s; 00179 }; 00180 }} 00181 00182 #endif // WIFIMAC_CONVERGENCE_PHYMODE_HPP
1.5.5