31NS_LOG_COMPONENT_DEFINE(
"SatLooModel");
42 TypeId(
"ns3::SatLooModel").SetParent<
SatBaseFader>().AddConstructor<SatLooModel>();
54 NS_LOG_FUNCTION(
this);
56 NS_FATAL_ERROR(
"SatLooModel::SatLooModel - Constructor not in use");
62 uint32_t initialState)
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);
SatBaseFader()
Constructor.
Class for Loo's model 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.
uint32_t m_currentSet
Current parameter set.
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.
std::complex< double > GetOscillatorCosineWaveSum(std::vector< Ptr< SatFadingOscillator > > oscillator, double timeInSeconds)
Function for calculating cosine wave oscillator complex sum.
static TypeId GetTypeId(void)
NS-3 function for type id.
std::complex< double > GetOscillatorComplexSum(std::vector< Ptr< SatFadingOscillator > > oscillator, double timeInSeconds)
Function for calculating oscillator complex sum.
Ptr< SatLooConf > m_looConf
Loo's model configuration object.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.