A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
28
namespace
ns3
29
{
30
class
PropagationLossModel;
31
class
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
*/
56
class
JakesProcess
:
public
Object
57
{
58
public
:
59
/**
60
* \brief Get the type ID.
61
* \return the object TypeId
62
*/
63
static
TypeId
GetTypeId
();
64
JakesProcess
();
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
*/
82
void
SetPropagationLossModel
(
Ptr<const PropagationLossModel>
model);
83
84
protected
:
85
void
DoDispose
()
override
;
86
87
private
:
88
/**
89
* This class Represents a single oscillator
90
*/
91
struct
Oscillator
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
*/
129
void
ConstructOscillators
();
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
135
Ptr<UniformRandomVariable>
m_uniformVariable
;
//!< random stream
136
Ptr<const JakesPropagationLossModel>
m_jakes
;
//!< pointer to the propagation loss model
137
};
138
}
// namespace ns3
139
#endif
// DOPPLER_PROCESS_H
ns3::JakesProcess
Implementation for a single path Stationary Jakes propagation loss model.
Definition:
jakes-process.h:57
ns3::JakesProcess::JakesProcess
JakesProcess()
Definition:
jakes-process.cc:125
ns3::JakesProcess::m_uniformVariable
Ptr< UniformRandomVariable > m_uniformVariable
random stream
Definition:
jakes-process.h:135
ns3::JakesProcess::SetNOscillators
void SetNOscillators(unsigned int nOscillators)
Set the number of Oscillators to use.
Definition:
jakes-process.cc:88
ns3::JakesProcess::m_nOscillators
unsigned int m_nOscillators
number of oscillators
Definition:
jakes-process.h:134
ns3::JakesProcess::SetDopplerFrequencyHz
void SetDopplerFrequencyHz(double dopplerFrequencyHz)
Set the Doppler frequency.
Definition:
jakes-process.cc:94
ns3::JakesProcess::m_oscillators
std::vector< Oscillator > m_oscillators
Vector of oscillators.
Definition:
jakes-process.h:132
ns3::JakesProcess::~JakesProcess
~JakesProcess() override
Definition:
jakes-process.cc:131
ns3::JakesProcess::DoDispose
void DoDispose() override
Destructor implementation.
Definition:
jakes-process.cc:137
ns3::JakesProcess::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
jakes-process.cc:54
ns3::JakesProcess::GetChannelGainDb
double GetChannelGainDb() const
Get the channel gain in dB.
Definition:
jakes-process.cc:155
ns3::JakesProcess::m_omegaDopplerMax
double m_omegaDopplerMax
max rotation speed Doppler frequency
Definition:
jakes-process.h:133
ns3::JakesProcess::GetComplexGain
std::complex< double > GetComplexGain() const
Get the channel complex gain.
Definition:
jakes-process.cc:144
ns3::JakesProcess::m_jakes
Ptr< const JakesPropagationLossModel > m_jakes
pointer to the propagation loss model
Definition:
jakes-process.h:136
ns3::JakesProcess::SetPropagationLossModel
void SetPropagationLossModel(Ptr< const PropagationLossModel > model)
Set the propagation model using this class.
Definition:
jakes-process.cc:74
ns3::JakesProcess::ConstructOscillators
void ConstructOscillators()
Builds the object Oscillators.
Definition:
jakes-process.cc:100
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::JakesProcess::Oscillator
This class Represents a single oscillator.
Definition:
jakes-process.h:92
ns3::JakesProcess::Oscillator::m_phase
double m_phase
Phase of the oscillator.
Definition:
jakes-process.h:109
ns3::JakesProcess::Oscillator::m_omega
double m_omega
Rotation speed of the oscillator .
Definition:
jakes-process.h:110
ns3::JakesProcess::Oscillator::m_amplitude
std::complex< double > m_amplitude
Complex number .
Definition:
jakes-process.h:108
ns3::JakesProcess::Oscillator::GetValueAt
std::complex< double > GetValueAt(Time t) const
Get the complex amplitude at a given moment.
Definition:
jakes-process.cc:46
src
propagation
model
jakes-process.h
Generated on Tue May 28 2024 23:39:03 for ns-3 by
1.9.6