00001 /* -*-c++-*-*************************************************************** 00002 delayprofile.h - description 00003 ------------------- 00004 begin : November 2003 00005 copyright : (C) 2003 by Christian Stimming 00006 email : stimming@tuhh.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 #ifndef DELAYPROFILE_H 00029 #define DELAYPROFILE_H 00030 00031 #include <iostream> 00032 #include <complex> 00033 00034 #include <phbib.h> 00035 #include <phrand.h> 00036 00037 namespace simthlib 00038 { 00039 00040 using simth::Complex; 00041 00044 00045 00048 class DelayProfile 00049 { 00050 00051 public: 00052 DelayProfile() {}; 00053 virtual ~DelayProfile() {}; 00054 00059 virtual double get() const = 0; 00060 00061 /* Returns the maximal delay. 00062 */ 00063 virtual double maxDelay() const = 0; 00064 00068 virtual void print(std::ostream &os) const = 0; 00069 }; 00070 00071 00072 00107 class ExponentialDelayProfile : public DelayProfile 00108 { 00109 00110 public: 00122 ExponentialDelayProfile(double att, double maxT); 00123 00126 virtual ~ExponentialDelayProfile(); 00127 00131 double get() const; 00132 00133 00137 double attenuationFactor() const {return expRng.attenuationFactor();} 00138 00139 /* Maximal delay \f$\tau_{max}\f$. 00140 */ 00141 double maxDelay() const {return expRng.maxLimit();} 00142 00143 virtual void print(std::ostream &os) const ; 00144 00145 private: 00146 00147 simth::ExponentialMaxLimitRng expRng; 00148 }; 00149 00150 00151 00152 00153 00159 class BuDelayProfile : public DelayProfile 00160 { 00161 00162 protected: 00163 00166 simth::ExponentialMaxLimitRng exp1; 00167 00170 simth::UniformRng uni; 00171 00172 00173 public: 00176 BuDelayProfile( ); 00177 00180 virtual ~BuDelayProfile(); 00181 00183 double get() const; 00184 00185 /* Maximal delay, is fixed to 10e-6 seconds for bad urban delay profile. 00186 */ 00187 double maxDelay() const {return getMaxDelay();} 00188 00189 void print(std::ostream &os) const ; 00190 00194 static double getMaxDelay(){return 10e-6;}; 00195 00196 }; 00197 00198 00199 00200 00207 class HtDelayProfile : public DelayProfile 00208 { 00209 protected: 00210 00212 simth::ExponentialMaxLimitRng exp1, exp2; 00213 00215 simth::UniformRng uni; 00216 00217 public: 00218 00220 HtDelayProfile( ); 00221 00222 // destructor 00223 virtual ~HtDelayProfile(); 00224 00227 double get() const; 00228 00229 /* Maximal delay, is fixed to 20e-6 seconds for hilly terrain 00230 delay profile. 00231 */ 00232 double maxDelay() const {return getMaxDelay();} 00233 00234 void print(std::ostream &os) const; 00235 00239 static double getMaxDelay(){return 20e-6;} 00240 00241 }; 00242 00243 00265 class UniformDelayProfile : public DelayProfile 00266 { 00267 00270 simth::UniformRng uni; 00271 double scaling; 00272 00273 public: 00279 UniformDelayProfile(double tau_max); 00280 00283 virtual ~UniformDelayProfile(); 00284 00288 double get() const; 00289 00290 /* Maximal delay \f$\tau_{max}\f$. 00291 */ 00292 double maxDelay() const {return 1.0/scaling;} 00293 00294 void print(std::ostream &os) const; 00295 00296 }; 00297 00298 00300 00301 } // namespace 00302 00303 #endif // DELAYPROFILE_H