![]() |
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 #ifndef WIFIMAC_PATHSELECTION_BEACONLINKQUALITYMEASUREMENT_HPP 00030 #define WIFIMAC_PATHSELECTION_BEACONLINKQUALITYMEASUREMENT_HPP 00031 00032 #include <WIFIMAC/lowerMAC/Manager.hpp> 00033 #include <WIFIMAC/pathselection/Metric.hpp> 00034 #include <WIFIMAC/pathselection/IPathSelection.hpp> 00035 #include <WIFIMAC/management/Beacon.hpp> 00036 #include <WIFIMAC/draftn/SINRwithMIMOInformationBase.hpp> 00037 00038 #include <WNS/ldk/Command.hpp> 00039 #include <WNS/ldk/fu/Plain.hpp> 00040 #include <WNS/ldk/probe/Probe.hpp> 00041 #include <WNS/probe/bus/ContextCollector.hpp> 00042 00043 #include <WNS/events/PeriodicTimeout.hpp> 00044 #include <WNS/events/CanTimeout.hpp> 00045 #include <WNS/logger/Logger.hpp> 00046 #include <WNS/Observer.hpp> 00047 #include <WNS/distribution/Uniform.hpp> 00048 #include <WNS/SlidingWindow.hpp> 00049 00050 namespace wifimac { namespace draftn { 00051 00055 typedef wns::container::Registry<wns::service::dll::UnicastAddress, double> Address2SuccessRateMap; 00059 typedef wns::container::Registry<wns::service::dll::UnicastAddress, wns::Ratio> Address2RatioMap; 00060 00065 class BeaconLinkQualityMeasurementwithMIMOCommand : 00066 public wns::ldk::Command 00067 { 00068 public: 00069 struct { } local; 00070 00071 struct { 00075 wns::simulator::Time interval; 00076 00080 Address2SuccessRateMap rxBeaconSuccessRates; 00081 00085 Address2RatioMap rxBeaconSINRs; 00086 00087 SINRwithMIMOInformationBase::AddressToFactorsMap rxMIMOfactors; 00088 } peer; 00089 00090 struct { } magic; 00091 }; 00092 00093 class BeaconLinkQualityMeasurementwithMIMO; 00094 00098 class BroadcastLinkQualitywithMIMO: 00099 public wns::events::CanTimeout 00100 { 00101 public: 00103 BroadcastLinkQualitywithMIMO(const wns::pyconfig::View& config_, 00104 BeaconLinkQualityMeasurementwithMIMO* parent_, 00105 wns::service::dll::UnicastAddress peerAddress_, 00106 wns::service::dll::UnicastAddress myAddress_, 00107 wns::simulator::Time interval_); 00109 double 00110 getSuccessRate(); 00111 00113 wns::Ratio 00114 getAverageSINR(); 00115 00116 SINRwithMIMOInformationBase::NumSSToFactorMap 00117 getMIMOfactors(); 00118 00120 void 00121 newBeacon(wns::simulator::Time interval); 00122 00124 wifimac::pathselection::Metric 00125 newPeerMeasurement(double peerSuccessRate, wns::Ratio peerSINR, SINRwithMIMOInformationBase::NumSSToFactorMap factors); 00126 00130 void 00131 deadPeerMeasurement(); 00132 00134 bool 00135 isActive() const; 00136 00137 private: 00141 void 00142 onTimeout(); 00143 00149 double 00150 getBestRate(wns::Ratio sinr); 00151 00152 double getBestTotalRate(wns::Ratio peerSINR, SINRwithMIMOInformationBase::NumSSToFactorMap factors); 00156 const wns::pyconfig::View config; 00157 00159 BeaconLinkQualityMeasurementwithMIMO* parent; 00160 00162 const wns::service::dll::UnicastAddress peerAddress; 00163 00165 wns::service::dll::UnicastAddress myAddress; 00166 00168 wns::simulator::Time curInterval; 00169 00171 wns::SlidingWindow successRate; 00172 00175 int missedBeaconsInRow; 00176 00179 bool linkCreated; 00180 00182 wifimac::pathselection::IPathSelection* ps; 00183 00185 wifimac::draftn::SINRwithMIMOInformationBase* sinrMIB; 00186 00188 const Bit meanFrameSize; 00190 const wns::simulator::Time maximumACKDuration; 00192 const wns::simulator::Time slotDuration; 00194 const wns::simulator::Time sifsDuration; 00196 const wns::simulator::Time preambleDuration; 00198 const double scalingFactor; 00200 const int maxMissedBeacons; 00201 }; 00202 00212 class BeaconLinkQualityMeasurementwithMIMO : 00213 public wns::ldk::fu::Plain<BeaconLinkQualityMeasurementwithMIMO, BeaconLinkQualityMeasurementwithMIMOCommand>, 00214 public wns::ldk::probe::Probe 00215 { 00216 public: 00218 BeaconLinkQualityMeasurementwithMIMO(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00219 00221 virtual 00222 ~BeaconLinkQualityMeasurementwithMIMO(); 00223 00227 void newLinkCost(wns::service::dll::UnicastAddress rx, wifimac::pathselection::Metric cost); 00228 00232 wns::logger::Logger logger; 00233 00234 private: 00236 virtual bool doIsAccepting(const wns::ldk::CompoundPtr& _compound) const; 00237 00239 virtual void doSendData(const wns::ldk::CompoundPtr& _compound); 00240 00242 virtual void doWakeup(); 00243 00252 virtual void doOnData(const wns::ldk::CompoundPtr& _compound); 00253 00255 virtual void onFUNCreated(); 00256 00260 void calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const; 00261 00263 const wns::pyconfig::View config; 00264 00266 wns::simulator::Time beaconInterval; 00267 00271 wifimac::pathselection::IPathSelection* ps; 00272 00274 typedef wns::container::Registry<wns::service::dll::UnicastAddress, BroadcastLinkQualitywithMIMO*> adr2qualityMap; 00275 00279 adr2qualityMap linkQualities; 00280 00282 wns::service::dll::UnicastAddress myMACAddress; 00283 00285 const std::string phyUserCommandName; 00286 00288 wns::probe::bus::ContextCollectorPtr receivedPower; 00289 00291 wns::probe::bus::ContextCollectorPtr peerMeasurement; 00292 00294 wns::probe::bus::ContextCollectorPtr linkCost; 00295 00296 struct Friends 00297 { 00298 wifimac::lowerMAC::Manager* manager; 00299 } friends; 00300 }; 00301 00302 }} 00303 00304 #endif 00305
1.5.5