![]() |
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 __RECEIVER_HPP 00029 #define __RECEIVER_HPP 00030 00031 #include <RISE/misc/pointer.hpp> 00032 #include <RISE/misc/RISELogger.hpp> 00033 #include <RISE/receiver/ReceiverInterface.hpp> 00034 00035 #include <WNS/PowerRatio.hpp> 00036 #include <WNS/DoubleDispatcher.hpp> 00037 #include <WNS/TypeInfo.hpp> 00038 #include <WNS/TimeWeightedAverage.hpp> 00039 #include <WNS/Cache.hpp> 00040 #include <WNS/logger/Logger.hpp> 00041 #include <WNS/pyconfig/View.hpp> 00042 00043 #include <sstream> 00044 #include <list> 00045 00046 namespace rise { namespace antenna { 00047 class Antenna; 00048 }} 00049 00050 namespace rise { namespace medium { 00051 class PhysicalResource; 00052 }} 00053 00054 namespace rise 00055 { 00056 class Transmitter; 00057 class Station; 00058 class Demodulator; 00059 class Decoder; 00060 class PropagationCache; 00061 class PropCacheEntry; 00062 00078 class ReceiverBase : 00079 virtual public receiver::ReceiverInterface 00080 { 00081 friend class PropagationCache; 00082 public: 00086 ReceiverBase(Station* s, 00087 Demodulator *demodulator, 00088 Decoder *decoder, 00089 wns::Ratio rnf); 00090 00094 virtual ~ReceiverBase(); 00095 00097 00104 virtual void startReceiving(); 00105 00107 00114 virtual void stopReceiving(); 00115 00117 // Receiver is listening to. 00122 virtual wns::Power getTotalRxPower(); 00123 00125 00127 virtual wns::Power getInterference(const TransmissionObjectPtr& t); 00128 00130 virtual wns::Power getRxPower(const TransmissionObjectPtr& t); 00131 00133 wns::Power getNoise(); 00134 00136 virtual void tune(double f, double b, long int numberOfSubCarriers); 00137 00139 00142 virtual void mobilityUpdate(Transmitter* transmitter); 00143 00145 00149 virtual bool contains(TransmissionObjectPtr); 00150 00151 bool isActive() const 00152 { 00153 return active; 00154 } 00155 00157 00159 virtual void positionChanged(); 00160 00162 virtual void positionWillChange(); 00163 00164 virtual antenna::Antenna* getAntenna() const = 0; 00165 protected: 00166 00168 00171 virtual void writeCacheEntry(PropCacheEntry& cacheEntry, 00172 Transmitter* t, 00173 double freq); 00174 00176 wns::Ratio CIR; 00177 00179 unsigned long int receiverId; 00180 00182 static unsigned long int nextid; 00183 00185 Demodulator *demodulator; 00186 00188 Decoder *decoder; 00189 00191 wns::Cache<wns::Power> totalRxPower; 00192 00194 std::list<TransmissionObjectPtr> transmissionObjects; 00195 00197 PropagationCache* propCache; 00198 00199 wns::Ratio receiverNoiseFigure; 00200 bool pd_debugFlag; 00201 00202 typedef std::vector<medium::PhysicalResource*> PhysicalResourceContainer; 00203 typedef PhysicalResourceContainer::iterator PhysicalResourceIterator; 00204 00208 PhysicalResourceContainer prc; 00209 00213 bool active; 00214 00218 double midFrequency; 00220 RISELogger log; 00221 // TODO: ^ replace by this: 00222 //wns::logger::Logger logger; 00223 00224 private: 00225 00226 void configureLogger(); 00228 void initiatePropCache(); 00229 }; 00230 00231 class Receiver : public ReceiverBase 00232 { 00233 public: 00237 Receiver(Station* s, 00238 antenna::Antenna* a, 00239 Demodulator *demodulator, 00240 Decoder *decoder, 00241 wns::Ratio rnf); 00245 virtual ~Receiver(); 00246 virtual antenna::Antenna* getAntenna() const 00247 { 00248 return antenna; 00249 } 00251 virtual wns::Ratio getLoss( Transmitter* t); 00252 00253 protected: 00257 antenna::Antenna* antenna; 00258 private: 00262 Receiver(const Receiver&); 00266 ReceiverBase& operator=(const ReceiverBase&); 00267 00268 }; 00269 00270 } 00271 #endif 00272 00273
1.5.5