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));
54 .AddConstructor<JakesProcess> ()
55 .AddAttribute (
"DopplerFrequencyHz",
"Corresponding doppler frequency[Hz]",
58 MakeDoubleChecker<double> (0.0, 1e4))
59 .AddAttribute (
"NumberOfOscillators",
"The number of oscillators",
62 MakeUintegerChecker<unsigned int> (4, 1000))
71 NS_ASSERT_MSG (jakes != 0,
"Jakes Process can work only with JakesPropagationLossModel!");
97 double phi =
m_jakes->GetUniformRandomVariable ()->GetValue ();
99 double theta =
m_jakes->GetUniformRandomVariable ()->GetValue ();
102 unsigned int n = i + 1;
107 double omega = m_omegaDopplerMax * std::cos (alpha);
109 double psi =
m_jakes->GetUniformRandomVariable ()->GetValue ();
110 std::complex<double> amplitude = std::complex<double> (std::cos (psi), std::sin (psi)) * 2.0 / std::sqrt (m_nOscillators);
112 m_oscillators.push_back (
Oscillator (amplitude, phi, omega));
117 m_omegaDopplerMax (0),
124 m_oscillators.clear ();
136 std::complex<double> sumAplitude = std::complex<double> (0, 0);
137 for (
unsigned int i = 0; i < m_oscillators.size (); i++)
139 sumAplitude += m_oscillators[i].GetValueAt (
Now ());
148 return (10 * std::log10 ((std::pow (complexGain.real (), 2) + std::pow (complexGain.imag (), 2)) / 2));
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual void DoDispose()
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
double GetSeconds(void) const
NS_LOG_COMPONENT_DEFINE("JakesProcess")
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)
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.