A Discrete-Event Network Simulator
API
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 
57 class JakesProcess : public Object
58 {
59  public:
64  static TypeId GetTypeId();
65  JakesProcess();
66  ~JakesProcess() override;
67 
72  std::complex<double> GetComplexGain() const;
77  double GetChannelGainDb() const;
78 
84 
85  protected:
86  void DoDispose() override;
87 
88  private:
92  struct Oscillator
93  {
100  Oscillator(std::complex<double> amplitude, double initialPhase, double omega);
106  std::complex<double> GetValueAt(Time t) const;
107 
108  std::complex<double>
110  double m_phase;
111  double m_omega;
112  };
113 
114  private:
119  void SetNOscillators(unsigned int nOscillators);
120 
125  void SetDopplerFrequencyHz(double dopplerFrequencyHz);
126 
130  void ConstructOscillators();
131 
132  private:
133  std::vector<Oscillator> m_oscillators;
135  unsigned int m_nOscillators;
138 };
139 } // namespace ns3
140 #endif // DOPPLER_PROCESS_H
Implementation for a single path Stationary Jakes propagation loss model.
Definition: jakes-process.h:58
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:93
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.