31 NS_LOG_COMPONENT_DEFINE(
"SatLooModel");
36 NS_OBJECT_ENSURE_REGISTERED(SatLooModel);
42 TypeId(
"ns3::SatLooModel").SetParent<
SatBaseFader>().AddConstructor<SatLooModel>();
51 m_normalRandomVariable(nullptr),
52 m_uniformVariable(nullptr)
54 NS_LOG_FUNCTION(
this);
56 NS_FATAL_ERROR(
"SatLooModel::SatLooModel - Constructor not in use");
62 uint32_t initialState)
63 : m_numOfStates(numOfStates),
64 m_currentSet(initialSet),
65 m_currentState(initialState),
67 m_normalRandomVariable(nullptr),
68 m_uniformVariable(nullptr)
70 NS_LOG_FUNCTION(
this << numOfStates <<
" " << initialSet <<
" " << initialState);
84 NS_LOG_FUNCTION(
this);
92 NS_LOG_FUNCTION(
this);
95 SatBaseFader::DoDispose();
101 NS_LOG_FUNCTION(
this);
138 NS_LOG_FUNCTION(
this);
142 std::vector<Ptr<SatFadingOscillator>> oscillators;
154 double alpha = (2.0 * M_PI * n - M_PI + theta) / (4.0 *
m_looParameters[i][3]);
169 oscillators.push_back(CreateObject<SatFadingOscillator>(amplitude, phi, omega));
178 NS_LOG_FUNCTION(
this);
182 std::vector<Ptr<SatFadingOscillator>> oscillators;
194 double alpha = (2.0 * M_PI * n - M_PI + theta) / (4.0 *
m_looParameters[i][4]);
199 std::complex<double> amplitude = std::complex<double>(std::cos(psi), std::sin(psi)) *
202 oscillators.push_back(CreateObject<SatFadingOscillator>(amplitude, phi, omega));
211 NS_LOG_FUNCTION(
this);
214 NS_LOG_INFO(
"Channel gain: " << tempChannelGainDb);
215 return tempChannelGainDb;
221 NS_LOG_FUNCTION(
this);
223 double timeInSeconds = Now().GetSeconds();
226 std::complex<double> directComplexGain =
230 std::complex<double> multipathComplexGain =
235 std::complex<double> fadingGain = directComplexGain + multipathComplexGain;
236 return sqrt((pow(fadingGain.real(), 2) + pow(fadingGain.imag(), 2)));
241 double timeInSeconds)
243 NS_LOG_FUNCTION(
this);
245 std::complex<double> complexSum = std::complex<double>(0, 0);
247 for (uint32_t i = 0; i < oscillator.size(); i++)
249 complexSum += oscillator[i]->GetCosineWaveValueAt(timeInSeconds);
257 double timeInSeconds)
259 NS_LOG_FUNCTION(
this);
261 std::complex<double> complexSum = std::complex<double>(0, 0);
263 for (uint32_t i = 0; i < oscillator.size(); i++)
265 complexSum += oscillator[i]->GetComplexValueAt(timeInSeconds);
274 NS_LOG_FUNCTION(
this << newSet <<
" " << newState);
290 NS_LOG_FUNCTION(
this << newSet <<
" " << newState);
332 NS_LOG_FUNCTION(
this << newState);
340 NS_LOG_FUNCTION(
this);
Base class for faders such as the Rayleigh fader.
double GetChannelGain()
Function for returning the channel gain.
double GetChannelGainDb()
Function for returning the channel gain in dB.
SatLooModel()
Constructor.
void ChangeState(uint32_t newState)
Function for setting the state.
void UpdateParameters(uint32_t set, uint32_t state)
Function for updating the parameter set and state.
Ptr< UniformRandomVariable > m_uniformVariable
Uniform distribution random variable.
std::vector< std::vector< double > > m_looParameters
Loo's model parameters.
std::complex< double > GetOscillatorComplexSum(std::vector< Ptr< SatFadingOscillator >> oscillator, double timeInSeconds)
Function for calculating oscillator complex sum.
uint32_t m_currentSet
Current parameter set.
std::complex< double > GetOscillatorCosineWaveSum(std::vector< Ptr< SatFadingOscillator >> oscillator, double timeInSeconds)
Function for calculating cosine wave oscillator complex sum.
void CalculateSigma()
Function for calculating sigma for different states.
uint32_t m_numOfStates
Number of states.
void ChangeSet(uint32_t newSet, uint32_t newState)
Function for setting the parameter set and state.
uint32_t m_currentState
Current state.
void Reset()
Clear used variables.
std::vector< std::vector< Ptr< SatFadingOscillator > > > m_multipathOscillators
Multipath oscillators.
void ConstructMultipathOscillators()
Function for constructing multipath oscillators.
std::vector< double > m_sigma
Multipath power converted to linear units.
~SatLooModel()
Destructor.
void ConstructDirectSignalOscillators()
Function for constructing direct signal oscillators.
Ptr< NormalRandomVariable > m_normalRandomVariable
Normal distribution random variable.
void DoDispose()
Do needed dispose actions.
std::vector< std::vector< Ptr< SatFadingOscillator > > > m_directSignalOscillators
Direct signal oscillators.
static TypeId GetTypeId(void)
NS-3 function for type id.
Ptr< SatLooConf > m_looConf
Loo's model configuration object.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.