22 #include "ns3/simulator.h"
23 #include "ns3/double.h"
25 #include "ns3/uinteger.h"
35 m_amplitude (amplitude),
36 m_phase (initialPhase),
43 return (m_amplitude * std::cos (at.
GetSeconds () * m_omega + m_phase));
53 .AddConstructor<JakesProcess> ()
54 .AddAttribute (
"DopplerFrequencyHz",
"Corresponding doppler frequency[Hz]",
57 MakeDoubleChecker<double> (0.0, 1e4))
58 .AddAttribute (
"NumberOfOscillators",
"The number of oscillators",
61 MakeUintegerChecker<unsigned int> (4, 1000))
70 NS_ASSERT_MSG (jakes != 0,
"Jakes Process can work only with JakesPropagationLossModel!");
96 double phi =
m_jakes->GetUniformRandomVariable ()->GetValue ();
98 double theta =
m_jakes->GetUniformRandomVariable ()->GetValue ();
101 unsigned int n = i + 1;
108 double psi =
m_jakes->GetUniformRandomVariable ()->GetValue ();
109 std::complex<double> amplitude = std::complex<double> (std::cos (psi), std::sin (psi)) * 2.0 / std::sqrt (m_nOscillators);
135 std::complex<double> sumAplitude = std::complex<double> (0, 0);
147 return (10 * std::log10 ((std::pow (complexGain.real (), 2) + std::pow (complexGain.imag (), 2)) / 2));
Simulation virtual time values and global simulation resolution.
smart pointer class similar to boost::intrusive_ptr
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::vector< Oscillator > m_oscillators
Vector of oscillators:
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
double GetSeconds(void) const
Represents a single oscillator.
Oscillator(std::complex< double > amplitude, double initialPhase, double omega)
Initiate oscillator with complex amplitude, initial phase and rotation speed.
Hold an unsigned integer type.
double GetChannelGainDb() const
Get Channel gain [dB].
std::complex< double > GetComplexGain() const
void SetDopplerFrequencyHz(double dopplerFrequencyHz)
unsigned int m_nOscillators
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
static TypeId GetTypeId(void)
std::complex< double > GetValueAt(Time t) const
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void ConstructOscillators()
a base class which provides memory management and object aggregation
Ptr< const JakesPropagationLossModel > m_jakes
Hold a floating point type.
a jakes narrowband propagation model.
a unique identifier for an interface.
void SetPropagationLossModel(Ptr< const PropagationLossModel >)
TypeId SetParent(TypeId tid)
void SetNOscillators(unsigned int nOscillators)
Implementation for a single path Stationary Jakes propagation loss model.