![]() |
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_UPPERMAC_TRAFFICESTIMATION_MEAN_HPP 00030 #define WIMEMAC_UPPERMAC_TRAFFICESTIMATION_MEAN_HPP 00031 00032 #include <map> 00033 #include <WNS/ldk/fu/Plain.hpp> 00034 #include <WNS/service/dll/Address.hpp> 00035 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00036 #include <WNS/logger/Logger.hpp> 00037 #include <WNS/simulator/Time.hpp> 00038 #include <WIMEMAC/management/BeaconBuilder.hpp> 00039 #include <WIMEMAC/lowerMAC/IManagerServices.hpp> 00040 #include <boost/bind.hpp> 00041 #include <WNS/events/scheduler/Callable.hpp> 00042 #include <WNS/events/PeriodicTimeout.hpp> 00043 00044 #include <WNS/scheduler/SchedulerTypes.hpp> 00045 #include <WNS/StaticFactory.hpp> 00046 00047 00048 00049 namespace wimemac { namespace upperMAC { 00050 00051 class TrafficEstimation_mean : 00052 public wns::ldk::fu::Plain<TrafficEstimation_mean, wns::ldk::EmptyCommand>, 00053 public wns::events::PeriodicTimeout 00054 { 00055 public: 00056 00057 TrafficEstimation_mean(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); 00058 00059 virtual 00060 ~TrafficEstimation_mean(); 00061 00062 private: 00063 // FunctionalUnit / CompoundHandlerInterface 00064 00065 00066 virtual void 00067 onFUNCreated(); 00068 00069 virtual bool 00070 doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00071 00072 00073 virtual void 00074 doSendData(const wns::ldk::CompoundPtr& compound); 00075 00076 virtual void 00077 doWakeup(); 00078 00079 virtual void 00080 doOnData(const wns::ldk::CompoundPtr& compound); 00081 00082 //void QueueEval(wns::service::dll::UnicastAddress rx); 00083 00084 virtual void 00085 periodically(); 00086 00087 const std::string managerName; 00088 00089 struct Friends 00090 { 00091 wns::ldk::CommandReaderInterface* keyReader; 00092 wimemac::lowerMAC::IManagerServices* manager; 00093 } friends; 00094 00095 struct config 00096 { 00097 int CompoundspSF; 00098 int BitspSF; 00099 int MaxCompoundSize; 00100 bool overWriteEstimation; 00101 } trafficEstimationConfig; 00102 00103 struct measurementDatapSF 00104 { 00105 int sentCompounds;//number of compounds sent to a specific address 00106 int maxCompoundSize;//the size of the biggest compound sent to a specific address 00107 int bitsTotal;//number of bits sent to a specific address so far 00108 }; 00109 00110 struct estimatedTraffic 00111 { 00112 int CompoundspSF; 00113 int BitspSF; 00114 int MaxCompoundSize; 00115 }; 00116 00117 std::deque<measurementDatapSF> measurementWindow; 00118 00119 //stores the addresses of all the stations served so far and their connection parameters 00120 std::map<wns::service::dll::UnicastAddress, std::deque<measurementDatapSF> > windowedTrafficPerAddress; 00121 std::map<wns::service::dll::UnicastAddress, estimatedTraffic > currentTrafficPerAddress; 00122 std::map<wns::service::dll::UnicastAddress, estimatedTraffic > lastSetTrafficPerAddress; 00123 00124 std::map<wns::service::dll::UnicastAddress, bool > NeedsNewEstimatePerAddress; 00125 00126 wns::logger::Logger logger; 00127 00128 wns::ldk::CompoundPtr compound; 00129 00130 wns::simulator::Time maxWait; 00131 wns::probe::bus::ContextCollectorPtr datathroughputProbe; 00132 int bitsPerSF; 00133 wns::simulator::Time measuringSince; 00134 int averageOverSFs; 00135 00136 wns::events::scheduler::Interface* scheduler; 00137 wns::events::scheduler::Callable call; 00138 00139 }; 00140 00141 } // namespace upperMAC 00142 } // namespace wimemac 00143 00144 #endif // WIMEMAC_UPPERMAC_TRAFFICESTIMATION_MEAN_HPP
1.5.5