UWBIRStochasticPathlossModel.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        UWBIRPathGainModel.h
00003  *
00004  * author:      Jerome Rousselot
00005  *
00006  * copyright:   (C) 2008 Centre Suisse d'Electronique et Microtechnique (CSEM) SA
00007  *              Real-Time Software and Networking
00008  *              Jaquet-Droz 1, CH-2002 Neuchatel, Switzerland.
00009  *
00010  *              This program is free software; you can redistribute it
00011  *              and/or modify it under the terms of the GNU General Public
00012  *              License as published by the Free Software Foundation; either
00013  *              version 2 of the License, or (at your option) any later
00014  *              version.
00015  *              For further information see file COPYING
00016  *              in the top level directory
00017  * description: this AnalogueModel models free-space pathloss
00018  ***************************************************************************/
00019 
00020 #ifndef _UWBIRPATHLOSSMODEL_H
00021 #define _UWBIRPATHLOSSMODEL_H
00022 
00023 #include "AnalogueModel.h"
00024 #include "Mapping.h"
00025 #include "Signal_.h"
00026 #include "BaseWorldUtility.h"
00027 #include <math.h>
00028 
00053 class UWBIRStochasticPathlossModel : public AnalogueModel {
00054 
00055 public:
00056 
00057     //static const double Gtx = 0.9, Grx = 0.9, ntx = 0.9, nrx = 0.9;
00058     static const double Gtx = 1, Grx = 1, ntx = 1, nrx = 1;
00059     double PL0; // 0.000008913; // -50.5 dB   0.000019953
00060     static const double fc = 4492.8; // mandatory band 3, center frequency, MHz
00061     static const double d0 = 1;
00062     double mu_gamma, sigma_gamma; //1.7, 0.3
00063     double mu_sigma, sigma_sigma;
00064     double gamma, S, sigma;
00065     double n1, n2, n3;
00066     static double n1_limit, n2_limit;
00067 
00068     static const double s_mu = 1.6, s_sigma = 0.5;
00069     static const double kappa = 1;
00070 
00071     bool isEnabled, shadowing;
00072 
00073     cOutVector distances;
00074     cOutVector srcPosX, srcPosY, dstPosX, dstPosY;
00075 
00076     int myIndex;
00077     std::string myName;
00078 
00079     UWBIRStochasticPathlossModel(double _PL0, double _mu_gamma, double _sigma_gamma, double _mu_sigma, double _sigma_sigma, const Move* _move, bool _enabled, bool _shadowing=true) :
00080     PL0(_PL0), mu_gamma(_mu_gamma), sigma_gamma(_sigma_gamma), mu_sigma(_mu_sigma), sigma_sigma(_sigma_sigma), isEnabled(_enabled), shadowing(_shadowing), frequency("frequency"),
00081      move(_move) {
00082       distances.setName("distances");
00083       srcPosX.setName("srcPosX");
00084       srcPosY.setName("srcPosY");
00085       dstPosX.setName("dstPosX");
00086       dstPosY.setName("dstPosY");
00087       pathlosses.setName("pathloss");
00088     }
00089 
00090     void filterSignal(Signal& s);
00091 
00092 protected:
00093     double pathloss_exponent;
00094     double fading;
00095     Dimension frequency;
00096     const Move* move;
00097     cOutVector pathlosses;  // outputs computed pathlosses. Allows to compute Eb = Epulse*pathloss for Eb/N0 computations. (N0 is the noise sampled by the receiver)
00098 
00099     double getNarrowBandFreeSpacePathloss(double fc, double distance);
00100     double getGhassemzadehPathloss(double distance);
00101     double getFDPathloss(double freq, double distance);
00102     double simtruncnormal(double mean, double stddev, double a, int rng);
00103 
00104 };
00105 
00106 #endif  /* _UWBIRPATHLOSSMODEL_H */
00107