14#include "ns3/double.h"
16#include "ns3/simulator.h"
17#include "ns3/uinteger.h"
28 : m_amplitude(amplitude),
29 m_phase(initialPhase),
37 return (m_amplitude * std::cos(at.
GetSeconds() * m_omega + m_phase));
47 .SetGroupName(
"Propagation")
49 .AddAttribute(
"DopplerFrequencyHz",
50 "Corresponding doppler frequency[Hz]",
54 .AddAttribute(
"NumberOfOscillators",
55 "The number of oscillators",
67 NS_ASSERT_MSG(jakes,
"Jakes Process can work only with JakesPropagationLossModel!");
93 double phi =
m_jakes->GetUniformRandomVariable()->GetValue();
95 double theta =
m_jakes->GetUniformRandomVariable()->GetValue();
98 unsigned int n = i + 1;
102 double alpha = (2.0 * M_PI * n - M_PI + theta) / (4.0 *
m_nOscillators);
106 double psi =
m_jakes->GetUniformRandomVariable()->GetValue();
107 std::complex<double> amplitude =
108 std::complex<double>(std::cos(psi), std::sin(psi)) * 2.0 / std::sqrt(
m_nOscillators);
135 std::complex<double> sumAmplitude = std::complex<double>(0, 0);
148 std::log10((std::pow(complexGain.real(), 2) + std::pow(complexGain.imag(), 2)) / 2));
This class can be used to hold variables of floating point type such as 'double' or 'float'.
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.
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 Jakes narrowband propagation model.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Oscillator(std::complex< double > amplitude, double initialPhase, double omega)
Initiate oscillator with complex amplitude, initial phase and rotation speed.
std::complex< double > GetValueAt(Time t) const
Get the complex amplitude at a given moment.