![]() |
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 _CANDI_HPP 00029 #define _CANDI_HPP 00030 00031 #include <WNS/PowerRatio.hpp> 00032 #include <WNS/IOutputStreamable.hpp> 00033 #include <cmath> 00034 00035 namespace wns 00036 { 00041 class CandI 00042 : public wns::IOutputStreamable 00043 { 00044 public: 00045 // Default constructor 00046 CandI() : 00047 C(wns::Power::from_mW(0.0)), 00048 I(wns::Power::from_mW(0.0)), 00049 PL(wns::Ratio::from_dB(0.0)), 00050 IPL(wns::Ratio::from_dB(0.0)) 00051 { 00052 sdma.iIntra = wns::Power::from_mW(0.0); 00053 } 00054 00055 CandI(wns::Power carrier, wns::Power interference) : 00056 C(carrier), 00057 I(interference), 00058 PL(wns::Ratio::from_dB(0.0)), 00059 IPL(wns::Ratio::from_dB(0.0)) 00060 { 00061 sdma.iIntra = wns::Power::from_mW(0.0); 00062 } 00063 00064 CandI(wns::Power carrier, wns::Power interference, wns::Ratio pathloss) : 00065 C(carrier), 00066 I(interference), 00067 PL(pathloss), 00068 IPL(wns::Ratio::from_dB(0.0)) 00069 { 00070 sdma.iIntra = wns::Power::from_mW(0.0); 00071 } 00072 00073 CandI(wns::Power carrier, wns::Power interference, wns::Ratio pathloss, wns::Ratio iPathloss) : 00074 C(carrier), 00075 I(interference), 00076 PL(pathloss), 00077 IPL(iPathloss) 00078 { 00079 sdma.iIntra = wns::Power::from_mW(0.0); 00080 } 00081 00082 wns::Ratio toSINR() const 00083 { 00084 return wns::Ratio(C/I); 00085 } 00086 00088 bool isValid() const 00089 { 00090 return (C.get_mW()!=0.0 && I.get_mW()!=0.0); 00091 } 00092 00093 bool operator <(const CandI& candi) const { 00094 return ( (C/I) < (candi.C / candi.I) ); 00095 } 00096 00098 virtual std::string doToString() const 00099 { 00100 std::stringstream s; 00101 if (isValid()) { 00102 s << toSINR().get_dB() << " dB"; 00103 } else { 00104 s << "invalid_CandI"; 00105 } 00106 return s.str(); 00107 } 00108 00109 friend std::ostream& operator <<(std::ostream &str, const CandI& candi) 00110 { 00111 if (candi.isValid()) { 00112 str << candi.toSINR().get_dB() << " dB"; 00113 } else { 00114 str << "invalid_CandI"; 00115 } 00116 return str; 00117 } 00118 00119 // Default destructor 00120 ~CandI(){} 00121 00122 wns::Power C; 00123 wns::Power I; 00124 wns::Ratio PL; 00125 wns::Ratio IPL; 00126 00127 struct { 00128 // estimated intra-cell interference 00129 wns::Power iIntra; 00130 } sdma; 00131 }; 00132 } 00133 #endif // _CANDI_HPP
1.5.5