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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Kirill Andreev <andreev@telum.ru>, Alexander Sofronov <sofronov@telum.ru>
7 */
8#ifndef DOPPLER_PROCESS_H
9#define DOPPLER_PROCESS_H
10
11#include "ns3/nstime.h"
12#include "ns3/object.h"
13#include "ns3/random-variable-stream.h"
14
15#include <complex>
16
17namespace ns3
18{
19class PropagationLossModel;
20class JakesPropagationLossModel;
21
22/**
23 * \ingroup propagation
24 *
25 * \brief Implementation for a single path Stationary Jakes propagation loss model.
26 *
27 * The Jakes propagation loss model implemented here is
28 * described in [1].
29 *
30 * We consider one transmitter - receiver pair and calculate
31 * the complex coefficients for this case as follow:
32 * \f[ X(t)=X_c(t) + j X_s(t)\f]
33 * \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]
34 * \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]
35 * with
36 * \f[ \alpha_n = \frac{2\pi n - \pi + \theta}{4M}, n=1,2, \ldots,M\f]
37 * where \f$\theta\f$, \f$\phi\f$, and \f$\psi_n\f$ are
38 * statically independent and uniformly distributed over \f$[-\pi, \pi)\f$ for all \f$n\f$.
39 *
40 *
41 * [1] Y. R. Zheng and C. Xiao, "Simulation Models With Correct
42 * Statistical Properties for Rayleigh Fading Channel", IEEE
43 * Trans. on Communications, Vol. 51, pp 920-928, June 2003
44 */
45class JakesProcess : public Object
46{
47 public:
48 /**
49 * \brief Get the type ID.
50 * \return the object TypeId
51 */
52 static TypeId GetTypeId();
54 ~JakesProcess() override;
55
56 /**
57 * Get the channel complex gain
58 * \return the channel complex gain
59 */
60 std::complex<double> GetComplexGain() const;
61 /**
62 * Get the channel gain in dB
63 * \return the channel gain [dB]
64 */
65 double GetChannelGainDb() const;
66
67 /**
68 * Set the propagation model using this class
69 * \param model the propagation model using this class
70 */
72
73 protected:
74 void DoDispose() override;
75
76 private:
77 /**
78 * This class Represents a single oscillator
79 */
81 {
82 /**
83 * Initiate oscillator with complex amplitude, initial phase and rotation speed
84 * \param amplitude initial complex amplitude
85 * \param initialPhase initial phase
86 * \param omega rotation speed
87 */
88 Oscillator(std::complex<double> amplitude, double initialPhase, double omega);
89 /**
90 * Get the complex amplitude at a given moment
91 * \param t time instant
92 * \returns the complex amplitude
93 */
94 std::complex<double> GetValueAt(Time t) const;
95
96 std::complex<double>
97 m_amplitude; //!< Complex number \f$Re=\cos(\psi_n), Im = i\sin(\psi_n)]\f$
98 double m_phase; //!< Phase \f$\phi_n\f$ of the oscillator
99 double m_omega; //!< Rotation speed of the oscillator \f$\omega_d \cos(\alpha_n)\f$
100 };
101
102 private:
103 /**
104 * Set the number of Oscillators to use
105 * @param nOscillators the number of oscillators
106 */
107 void SetNOscillators(unsigned int nOscillators);
108
109 /**
110 * Set the Doppler frequency
111 * @param dopplerFrequencyHz the Doppler frequency [Hz]
112 */
113 void SetDopplerFrequencyHz(double dopplerFrequencyHz);
114
115 /**
116 * Builds the object Oscillators
117 */
119
120 private:
121 std::vector<Oscillator> m_oscillators; //!< Vector of oscillators
122 double m_omegaDopplerMax; //!< max rotation speed Doppler frequency
123 unsigned int m_nOscillators; //!< number of oscillators
125 Ptr<const JakesPropagationLossModel> m_jakes; //!< pointer to the propagation loss model
126};
127} // namespace ns3
128#endif // DOPPLER_PROCESS_H
Implementation for a single path Stationary Jakes propagation loss model.
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:78
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This class Represents a single oscillator.
double m_phase
Phase of the oscillator.
Oscillator(std::complex< double > amplitude, double initialPhase, double omega)
Initiate oscillator with complex amplitude, initial phase and rotation speed.
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.