27 NS_LOG_COMPONENT_DEFINE(
"SatLooModel");
32 NS_OBJECT_ENSURE_REGISTERED(SatLooModel);
38 TypeId(
"ns3::SatLooModel").SetParent<
SatBaseFader>().AddConstructor<SatLooModel>();
47 m_normalRandomVariable(NULL),
48 m_uniformVariable(NULL)
50 NS_LOG_FUNCTION(
this);
52 NS_FATAL_ERROR(
"SatLooModel::SatLooModel - Constructor not in use");
58 uint32_t initialState)
59 : m_numOfStates(numOfStates),
60 m_currentSet(initialSet),
61 m_currentState(initialState),
63 m_normalRandomVariable(NULL),
64 m_uniformVariable(NULL)
66 NS_LOG_FUNCTION(
this << numOfStates <<
" " << initialSet <<
" " << initialState);
80 NS_LOG_FUNCTION(
this);
88 NS_LOG_FUNCTION(
this);
91 SatBaseFader::DoDispose();
97 NS_LOG_FUNCTION(
this);
134 NS_LOG_FUNCTION(
this);
138 std::vector<Ptr<SatFadingOscillator>> oscillators;
150 double alpha = (2.0 * M_PI * n - M_PI + theta) / (4.0 *
m_looParameters[i][3]);
165 oscillators.push_back(CreateObject<SatFadingOscillator>(amplitude, phi, omega));
174 NS_LOG_FUNCTION(
this);
178 std::vector<Ptr<SatFadingOscillator>> oscillators;
190 double alpha = (2.0 * M_PI * n - M_PI + theta) / (4.0 *
m_looParameters[i][4]);
195 std::complex<double> amplitude = std::complex<double>(std::cos(psi), std::sin(psi)) *
198 oscillators.push_back(CreateObject<SatFadingOscillator>(amplitude, phi, omega));
207 NS_LOG_FUNCTION(
this);
210 NS_LOG_INFO(
"Channel gain: " << tempChannelGainDb);
211 return tempChannelGainDb;
217 NS_LOG_FUNCTION(
this);
219 double timeInSeconds = Now().GetSeconds();
222 std::complex<double> directComplexGain =
226 std::complex<double> multipathComplexGain =
231 std::complex<double> fadingGain = directComplexGain + multipathComplexGain;
232 return sqrt((pow(fadingGain.real(), 2) + pow(fadingGain.imag(), 2)));
237 double timeInSeconds)
239 NS_LOG_FUNCTION(
this);
241 std::complex<double> complexSum = std::complex<double>(0, 0);
243 for (uint32_t i = 0; i < oscillator.size(); i++)
245 complexSum += oscillator[i]->GetCosineWaveValueAt(timeInSeconds);
253 double timeInSeconds)
255 NS_LOG_FUNCTION(
this);
257 std::complex<double> complexSum = std::complex<double>(0, 0);
259 for (uint32_t i = 0; i < oscillator.size(); i++)
261 complexSum += oscillator[i]->GetComplexValueAt(timeInSeconds);
270 NS_LOG_FUNCTION(
this << newSet <<
" " << newState);
286 NS_LOG_FUNCTION(
this << newSet <<
" " << newState);
328 NS_LOG_FUNCTION(
this << newState);
336 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.