00001 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2005,2006,2007 INRIA 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Federico Maguolo <maguolof@dei.unipd.it> 00019 */ 00020 #ifndef PROPAGATION_JAKES_MODEL_H 00021 #define PROPAGATION_JAKES_MODEL_H 00022 00023 #include "ns3/nstime.h" 00024 #include "propagation-loss-model.h" 00025 00026 namespace ns3 { 00027 00028 00029 /** 00030 * \brief a Jakes propagation loss model 00031 * 00032 * The Jakes propagation loss model implemented here is 00033 * described in [1]. 00034 * 00035 * 00036 * We call path the set of rays that depart from a given 00037 * transmitter and arrive to a given receiver. For each ray 00038 * The complex coefficient is compute as follow: 00039 * \f[ u(t)=u_c(t) + j u_s(t)\f] 00040 * \f[ u_c(t) = \frac{2}{\sqrt{N}}\sum_{n=0}^{M}a_n\cos(\omega_n t+\phi_n)\f] 00041 * \f[ u_s(t) = \frac{2}{\sqrt{N}}\sum_{n=0}^{M}b_n\cos(\omega_n t+\phi_n)\f] 00042 * where 00043 * \f[ a_n=\left \{ \begin{array}{ll} 00044 * \sqrt{2}\cos\beta_0 & n=0 \\ 00045 * 2\cos\beta_n & n=1,2,\ldots,M 00046 * \end{array} 00047 * \right .\f] 00048 * \f[ b_n=\left \{ \begin{array}{ll} 00049 * \sqrt{2}\sin\beta_0 & n=0 \\ 00050 * 2\sin\beta_n & n=1,2,\ldots,M 00051 * \end{array} 00052 * \right .\f] 00053 * \f[ \beta_n=\left \{ \begin{array}{ll} 00054 * \frac{\pi}{4} & n=0 \\ 00055 * \frac{\pi n}{M} & n=1,2,\ldots,M 00056 * \end{array} 00057 * \right .\f] 00058 * \f[ \omega_n=\left \{ \begin{array}{ll} 00059 * 2\pi f_d & n=0 \\ 00060 * 2\pi f_d \cos\frac{2\pi n}{N} & n=1,2,\ldots,M 00061 * \end{array} 00062 * \right .\f] 00063 * 00064 * The parameter \f$f_d\f$ is the doppler frequency and \f$N=4M+2\f$ where 00065 * \f$M\f$ is the number of oscillators per ray. 00066 * 00067 * The attenuation coefficent of the path is the magnitude of the sum of 00068 * all the ray coefficients. This attenuation coefficient could be greater than 00069 * \f$1\f$, hence it is divide by \f$ \frac{2N_r}{\sqrt{N}} \sum_{n+0}^{M}\sqrt{a_n^2 +b_n^2}\f$ 00070 * where \f$N_r\f$ is the number of rays. 00071 * 00072 * The initail phases \f$\phi_i\f$ are random and they are choosen according 00073 * to a given distribution. 00074 * 00075 * [1] Y. R. Zheng and C. Xiao, "Simulation Models With Correct 00076 * Statistical Properties for Rayleigh Fading Channel", IEEE 00077 * Trans. on Communications, Vol. 51, pp 920-928, June 2003 00078 */ 00079 class JakesPropagationLossModel : public PropagationLossModel 00080 { 00081 public: 00082 static TypeId GetTypeId (void); 00083 JakesPropagationLossModel (); 00084 virtual ~JakesPropagationLossModel (); 00085 00086 /** 00087 * \param nRays Number of rays per path 00088 * 00089 * Set the number of rays for each path 00090 */ 00091 void SetNRays (uint8_t nRays); 00092 /** 00093 * \param nOscillators Number of oscillators 00094 * 00095 * Set the number of oscillators to use to compute the ray coefficient 00096 */ 00097 void SetNOscillators (uint8_t nOscillators); 00098 00099 private: 00100 JakesPropagationLossModel (const JakesPropagationLossModel &o); 00101 JakesPropagationLossModel & operator = (const JakesPropagationLossModel &o); 00102 void DoConstruct (void); 00103 virtual double DoCalcRxPower (double txPowerDbm, 00104 Ptr<MobilityModel> a, 00105 Ptr<MobilityModel> b) const; 00106 00107 class PathCoefficients; 00108 struct ComplexNumber { 00109 double real; 00110 double imag; 00111 }; 00112 friend class PathCoefficents; 00113 typedef std::vector<PathCoefficients *> DestinationList; 00114 struct PathsSet { 00115 Ptr<MobilityModel> sender; 00116 DestinationList receivers; 00117 }; 00118 typedef std::vector<PathsSet *> PathsList; 00119 00120 00121 static const double PI; 00122 ComplexNumber* m_amp; 00123 RandomVariable m_variable; 00124 double m_fd; 00125 mutable PathsList m_paths; 00126 uint8_t m_nRays; 00127 uint8_t m_nOscillators; 00128 }; 00129 00130 } // namespace ns3 00131 00132 #endif /* PROPAGATION_JAKES_MODEL_H */ 00133 00134