![]() |
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 __SIGNALAVERAGINGSTRATEGY_HPP 00029 #define __SIGNALAVERAGINGSTRATEGY_HPP 00030 00031 00032 #include <RISE/transceiver/transmitter.hpp> 00033 00034 #include <WNS/simulator/ISimulator.hpp> 00035 #include <WNS/events/scheduler/Interface.hpp> 00036 00037 #include <WNS/Assure.hpp> 00038 #include <WNS/PowerRatio.hpp> 00039 #include <WNS/TimeWeightedAverage.hpp> 00040 #include <WNS/Birthmark.hpp> 00041 00042 #include <map> 00043 00044 namespace rise { namespace receiver { 00045 class PathlossCalculationInterface 00046 { 00047 public: 00048 virtual ~PathlossCalculationInterface() {} 00049 00050 protected: 00051 virtual wns::Ratio getLoss(Transmitter* t, double frequency) = 0; 00052 }; 00053 00054 class SignalCalculationInterface 00055 { 00056 public: 00060 virtual wns::Power getRxPower(const TransmissionObjectPtr& t) = 0; // implemented in rise::Receiver 00061 virtual ~SignalCalculationInterface() {} 00062 }; 00063 00064 00065 class InterferenceCalculationInterface 00066 { 00067 public: 00071 virtual wns::Power getInterference(const TransmissionObjectPtr& t) = 0; 00072 virtual ~InterferenceCalculationInterface() {} 00073 }; 00074 00078 class TransmissionAveragingStrategy : 00079 virtual public SignalCalculationInterface, 00080 virtual public InterferenceCalculationInterface 00081 { 00082 public: 00083 virtual ~TransmissionAveragingStrategy() 00084 {} 00085 00092 virtual void signalLevelsChange() = 0; 00093 00100 virtual void endOfTransmission(const TransmissionObjectPtr& t) = 0; 00101 00106 virtual void add(const TransmissionObjectPtr& t) = 0; 00107 00111 virtual void remove(const TransmissionObjectPtr& t) = 0; 00112 00116 virtual void removeAll() = 0; 00117 00124 virtual wns::Power getAveragedRxPower(const TransmissionObjectPtr& t) = 0; 00125 00132 virtual wns::Power getAveragedInterference(const TransmissionObjectPtr& t) = 0; 00133 00140 virtual wns::Ratio getAveragedCIR(const TransmissionObjectPtr& t) = 0; 00141 }; 00142 00147 class NoTransmissionAveraging : 00148 virtual public TransmissionAveragingStrategy 00149 { 00150 typedef std::map<wns::Birthmark, std::pair<TransmissionObjectPtr, wns::Power> > CurrentSignalMap; 00151 typedef std::map<wns::Birthmark, std::pair<TransmissionObjectPtr, bool> > CalledEndOfTransmission; 00152 public: 00153 NoTransmissionAveraging(); 00154 virtual ~NoTransmissionAveraging(); 00155 00156 // TransmissionAveragingStrategy interface 00157 virtual void signalLevelsChange(); 00158 virtual void endOfTransmission(const TransmissionObjectPtr& t); 00159 virtual void add(const TransmissionObjectPtr& t); 00160 virtual void remove(const TransmissionObjectPtr& t); 00161 virtual void removeAll(); 00162 virtual wns::Power getAveragedRxPower(const TransmissionObjectPtr& t); 00163 virtual wns::Power getAveragedInterference(const TransmissionObjectPtr& t); 00164 virtual wns::Ratio getAveragedCIR(const TransmissionObjectPtr& t); 00165 private: 00166 CurrentSignalMap carrier; 00167 CurrentSignalMap interference; 00168 CalledEndOfTransmission calledEOT; 00169 simTimeType lastAveraging; 00170 }; 00171 00176 class TimeWeightedTransmissionAveraging : 00177 virtual public TransmissionAveragingStrategy 00178 { 00179 typedef wns::TimeWeightedAverage<wns::Power, wns::events::scheduler::Interface> SignalAverage; 00180 typedef std::map<wns::Birthmark, std::pair<TransmissionObjectPtr, SignalAverage> > AveragedSignalMap; 00181 typedef std::map<wns::Birthmark, std::pair<TransmissionObjectPtr, bool> > CalledEndOfTransmission; 00182 public: 00183 TimeWeightedTransmissionAveraging(); 00184 virtual ~TimeWeightedTransmissionAveraging(); 00185 00186 // TransmissionAveragingStrategy interface 00187 virtual void signalLevelsChange(); 00188 virtual void endOfTransmission(const TransmissionObjectPtr& t); 00189 virtual void add(const TransmissionObjectPtr& t); 00190 virtual void remove(const TransmissionObjectPtr& t); 00191 virtual void removeAll(); 00192 virtual wns::Power getAveragedRxPower(const TransmissionObjectPtr& t); 00193 virtual wns::Power getAveragedInterference(const TransmissionObjectPtr& t); 00194 virtual wns::Ratio getAveragedCIR(const TransmissionObjectPtr& t); 00195 00196 private: 00197 AveragedSignalMap carrier; 00198 AveragedSignalMap interference; 00199 CalledEndOfTransmission calledEOT; 00200 simTimeType lastAveraging; 00201 }; 00202 }} 00203 #endif // not defined __SIGNALAVERAGINGSTRATEGY_HPP 00204 00205 00206
1.5.5