![]() |
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 00029 #include <WIFIMAC/draftn/SINRwithMIMOInformationBase.hpp> 00030 00031 using namespace wifimac::draftn; 00032 00033 STATIC_FACTORY_REGISTER_WITH_CREATOR( 00034 wifimac::draftn::SINRwithMIMOInformationBase, 00035 wns::ldk::ManagementServiceInterface, 00036 "wifimac.draftn.SINRwithMIMOInformationBase", 00037 wns::ldk::MSRConfigCreator); 00038 00039 SINRwithMIMOInformationBase::SINRwithMIMOInformationBase( wns::ldk::ManagementServiceRegistry* msr, 00040 const wns::pyconfig::View& config ): 00041 wifimac::management::SINRInformationBase(msr, config), 00042 logger(config.get("logger")) 00043 { 00044 00045 } 00046 00047 void 00048 SINRwithMIMOInformationBase::onMSRCreated() 00049 { 00050 00051 } 00052 00053 void 00054 SINRwithMIMOInformationBase::putFactorMeasurement(const wns::service::dll::UnicastAddress tx, 00055 const std::vector<wns::Ratio> sinrFactor) 00056 { 00057 assure(tx.isValid(), "Address is not valid"); 00058 if(not factorsMeasurement.knows(tx)) 00059 { 00060 factorsMeasurement.insert(tx, new NumSSToFactorMap()); 00061 } 00062 (*factorsMeasurement.find(tx))[sinrFactor.size()] = sinrFactor; 00063 } 00064 00065 bool 00066 SINRwithMIMOInformationBase::knowsMeasuredFactor(const wns::service::dll::UnicastAddress tx, 00067 unsigned int numSS) const 00068 { 00069 assure(tx.isValid(), "Address is not valid"); 00070 if(factorsMeasurement.knows(tx)) 00071 { 00072 return (factorsMeasurement.find(tx)->count(numSS) == 1); 00073 } 00074 return(false); 00075 } 00076 00077 00078 00079 std::vector<wns::Ratio> 00080 SINRwithMIMOInformationBase::getMeasuredFactor(const wns::service::dll::UnicastAddress tx, 00081 unsigned int numSS) const 00082 { 00083 assure(this->knowsMeasuredFactor(tx, numSS), "Factor for transmitter " << tx << " not known"); 00084 return ((*factorsMeasurement.find(tx))[numSS]); 00085 } 00086 00087 void 00088 SINRwithMIMOInformationBase::putPeerFactor(const wns::service::dll::UnicastAddress peer, 00089 const std::vector<wns::Ratio> factor) 00090 { 00091 if(not peerFactors.knows(peer)) 00092 { 00093 peerFactors.insert(peer, new NumSSToFactorMap()); 00094 } 00095 (*peerFactors.find(peer))[factor.size()] = factor; 00096 } 00097 00098 bool 00099 SINRwithMIMOInformationBase::knowsPeerFactor(const wns::service::dll::UnicastAddress peer, 00100 unsigned int numSS) const 00101 { 00102 if(fakePeerFactors.knows(peer) and 00103 fakePeerFactors.find(peer)->second == wns::simulator::getEventScheduler()->getTime()) 00104 { 00105 return(fakePeerFactors.find(peer)->first.count(numSS) == 1); 00106 } 00107 00108 if(peerFactors.knows(peer)) 00109 { 00110 return (peerFactors.find(peer)->count(numSS) == 1); 00111 } 00112 00113 return(false); 00114 } 00115 00116 00117 std::vector<wns::Ratio> 00118 SINRwithMIMOInformationBase::getPeerFactor(const wns::service::dll::UnicastAddress peer, 00119 unsigned int numSS) const 00120 { 00121 assure(this->knowsPeerFactor(peer, numSS), "Factor for peer " << peer << " not known"); 00122 00123 if(fakePeerFactors.knows(peer) and 00124 fakePeerFactors.find(peer)->second == wns::simulator::getEventScheduler()->getTime() and 00125 fakePeerFactors.find(peer)->first.count(numSS) == 1) 00126 { 00127 return (fakePeerFactors.find(peer)->first)[numSS]; 00128 } 00129 00130 return ((*peerFactors.find(peer))[numSS]); 00131 } 00132 00133 void 00134 SINRwithMIMOInformationBase::putFakePeerMIMOFactors(const wns::service::dll::UnicastAddress peer, 00135 NumSSToFactorMap allFactors) 00136 { 00137 if(not fakePeerFactors.knows(peer)) 00138 { 00139 fakePeerFactors.insert(peer, new FactorsTimePair); 00140 } 00141 fakePeerFactors.find(peer)->first = allFactors; 00142 fakePeerFactors.find(peer)->second = wns::simulator::getEventScheduler()->getTime(); 00143 } 00144 00145 std::map<unsigned int, std::vector<wns::Ratio> > 00146 SINRwithMIMOInformationBase::getAllMeasuredFactors(const wns::service::dll::UnicastAddress peer) const 00147 { 00148 assure(factorsMeasurement.knows(peer), "Factor for transmitter " << peer << " not known"); 00149 return (*factorsMeasurement.find(peer)); 00150 }
1.5.5