|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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 .SetGroupName (
"Propagation")
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;
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);
136 std::complex<double> sumAplitude = std::complex<double> (0, 0);
148 return (10 * std::log10 ((std::pow (complexGain.real (), 2) + std::pow (complexGain.imag (), 2)) / 2));
a unique identifier for an interface.
#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.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
static TypeId GetTypeId(void)
Get the type ID.
void SetDopplerFrequencyHz(double dopplerFrequencyHz)
Set the Doppler frequency.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< Oscillator > m_oscillators
Vector of oscillators.
virtual void DoDispose()
Destructor implementation.
std::complex< double > GetComplexGain() const
Get the channel complex gain.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
a Jakes narrowband propagation model.
Oscillator(std::complex< double > amplitude, double initialPhase, double omega)
Initiate oscillator with complex amplitude, initial phase and rotation speed.
double GetChannelGainDb() const
Get the channel gain in dB.
Smart pointer class similar to boost::intrusive_ptr.
double m_omegaDopplerMax
max rotation speed Doppler frequency
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
A base class which provides memory management and object aggregation.
This class Represents a single oscillator.
Ptr< const JakesPropagationLossModel > m_jakes
pointer to the propagation loss model
Simulation virtual time values and global simulation resolution.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
void ConstructOscillators()
std::complex< double > GetValueAt(Time t) const
Get the complex amplitude at a given moment.
Implementation for a single path Stationary Jakes propagation loss model.
unsigned int m_nOscillators
number of oscillators
Hold an unsigned integer type.
void SetPropagationLossModel(Ptr< const PropagationLossModel > model)
Set the propagation model using this class.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
void SetNOscillators(unsigned int nOscillators)
Set the number of Oscillators to use.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.