A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
jakes-process.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Telum (www.telum.ru)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Kirill Andreev <andreev@telum.ru>, Alexander Sofronov <sofronov@telum.ru>
18 */
19#ifndef DOPPLER_PROCESS_H
20#define DOPPLER_PROCESS_H
21
22#include "ns3/nstime.h"
23#include "ns3/object.h"
24#include "ns3/random-variable-stream.h"
25
26#include <complex>
27
28namespace ns3
29{
30class PropagationLossModel;
31class JakesPropagationLossModel;
32
33/**
34 * \ingroup propagation
35 *
36 * \brief Implementation for a single path Stationary Jakes propagation loss model.
37 *
38 * The Jakes propagation loss model implemented here is
39 * described in [1].
40 *
41 * We consider one transmitter - receiver pair and calculate
42 * the complex coefficients for this case as follow:
43 * \f[ X(t)=X_c(t) + j X_s(t)\f]
44 * \f[ X_c(t) = \frac{2}{\sqrt{M}}\sum_{n=1}^{M}\cos(\psi_n)\cos(\omega_d t\cos(\alpha_n)+\phi_n)\f]
45 * \f[ X_s(t) = \frac{2}{\sqrt{M}}\sum_{n=1}^{M}\sin(\psi_n)\cos(\omega_d t\cos(\alpha_n)+\phi_n)\f]
46 * with
47 * \f[ \alpha_n = \frac{2\pi n - \pi + \theta}{4M}, n=1,2, \ldots,M\f]
48 * where \f$\theta\f$, \f$\phi\f$, and \f$\psi_n\f$ are
49 * statically independent and uniformly distributed over \f$[-\pi, \pi)\f$ for all \f$n\f$.
50 *
51 *
52 * [1] Y. R. Zheng and C. Xiao, "Simulation Models With Correct
53 * Statistical Properties for Rayleigh Fading Channel", IEEE
54 * Trans. on Communications, Vol. 51, pp 920-928, June 2003
55 */
56class JakesProcess : public Object
57{
58 public:
59 /**
60 * \brief Get the type ID.
61 * \return the object TypeId
62 */
63 static TypeId GetTypeId();
65 ~JakesProcess() override;
66
67 /**
68 * Get the channel complex gain
69 * \return the channel complex gain
70 */
71 std::complex<double> GetComplexGain() const;
72 /**
73 * Get the channel gain in dB
74 * \return the channel gain [dB]
75 */
76 double GetChannelGainDb() const;
77
78 /**
79 * Set the propagation model using this class
80 * \param model the propagation model using this class
81 */
83
84 protected:
85 void DoDispose() override;
86
87 private:
88 /**
89 * This class Represents a single oscillator
90 */
92 {
93 /**
94 * Initiate oscillator with complex amplitude, initial phase and rotation speed
95 * \param amplitude initial complex amplitude
96 * \param initialPhase initial phase
97 * \param omega rotation speed
98 */
99 Oscillator(std::complex<double> amplitude, double initialPhase, double omega);
100 /**
101 * Get the complex amplitude at a given moment
102 * \param t time instant
103 * \returns the complex amplitude
104 */
105 std::complex<double> GetValueAt(Time t) const;
106
107 std::complex<double>
108 m_amplitude; //!< Complex number \f$Re=\cos(\psi_n), Im = i\sin(\psi_n)]\f$
109 double m_phase; //!< Phase \f$\phi_n\f$ of the oscillator
110 double m_omega; //!< Rotation speed of the oscillator \f$\omega_d \cos(\alpha_n)\f$
111 };
112
113 private:
114 /**
115 * Set the number of Oscillators to use
116 * @param nOscillators the number of oscillators
117 */
118 void SetNOscillators(unsigned int nOscillators);
119
120 /**
121 * Set the Doppler frequency
122 * @param dopplerFrequencyHz the Doppler frequency [Hz]
123 */
124 void SetDopplerFrequencyHz(double dopplerFrequencyHz);
125
126 /**
127 * Builds the object Oscillators
128 */
130
131 private:
132 std::vector<Oscillator> m_oscillators; //!< Vector of oscillators
133 double m_omegaDopplerMax; //!< max rotation speed Doppler frequency
134 unsigned int m_nOscillators; //!< number of oscillators
136 Ptr<const JakesPropagationLossModel> m_jakes; //!< pointer to the propagation loss model
137};
138} // namespace ns3
139#endif // DOPPLER_PROCESS_H
Implementation for a single path Stationary Jakes propagation loss model.
Definition: jakes-process.h:57
Ptr< UniformRandomVariable > m_uniformVariable
random stream
void SetNOscillators(unsigned int nOscillators)
Set the number of Oscillators to use.
unsigned int m_nOscillators
number of oscillators
void SetDopplerFrequencyHz(double dopplerFrequencyHz)
Set the Doppler frequency.
std::vector< Oscillator > m_oscillators
Vector of oscillators.
~JakesProcess() override
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
double GetChannelGainDb() const
Get the channel gain in dB.
double m_omegaDopplerMax
max rotation speed Doppler frequency
std::complex< double > GetComplexGain() const
Get the channel complex gain.
Ptr< const JakesPropagationLossModel > m_jakes
pointer to the propagation loss model
void SetPropagationLossModel(Ptr< const PropagationLossModel > model)
Set the propagation model using this class.
void ConstructOscillators()
Builds the object Oscillators.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This class Represents a single oscillator.
Definition: jakes-process.h:92
double m_phase
Phase of the oscillator.
double m_omega
Rotation speed of the oscillator .
std::complex< double > m_amplitude
Complex number .
std::complex< double > GetValueAt(Time t) const
Get the complex amplitude at a given moment.