30 NS_OBJECT_ENSURE_REGISTERED(SatMarkovContainer);
31 NS_LOG_COMPONENT_DEFINE(
"SatMarkovContainer");
37 TypeId(
"ns3::SatMarkovContainer")
39 .AddConstructor<SatMarkovContainer>()
40 .AddTraceSource(
"FadingTrace",
41 "The trace for fading values",
43 "ns3::SatMarkovContainer::FadingTraceCallback");
48 : m_markovModel(NULL),
56 m_cooldownPeriodLength(),
57 m_minimumPositionChangeInMeters(),
58 m_latestCalculatedFadingValue_up(),
59 m_latestCalculatedFadingValue_down(),
60 m_latestCalculationTime_up(),
61 m_latestCalculationTime_down(),
62 m_enableSetLock(false),
63 m_enableStateLock(false),
65 m_latestStateChangeTime(),
68 NS_LOG_FUNCTION(
this);
69 NS_FATAL_ERROR(
"SatMarkovContainer::SatMarkovContainer - Constructor not in use");
75 : m_markovModel(NULL),
76 m_markovConf(markovConf),
79 m_numOfStates(markovConf->GetStateCount()),
80 m_numOfSets(markovConf->GetNumOfSets()),
81 m_currentState(markovConf->GetInitialState()),
82 m_cooldownPeriodLength(markovConf->GetCooldownPeriod()),
83 m_minimumPositionChangeInMeters(markovConf->GetMinimumPositionChange()),
84 m_latestCalculatedFadingValue_up(0.0),
85 m_latestCalculatedFadingValue_down(0.0),
86 m_latestCalculationTime_up(Now()),
87 m_latestCalculationTime_down(Now()),
88 m_enableSetLock(false),
89 m_enableStateLock(false),
91 m_latestStateChangeTime(Now()),
92 m_currentElevation(elevation),
93 m_useDecibels(markovConf->AreDecibelsUsed())
95 NS_LOG_FUNCTION(
this);
112 NS_LOG_INFO(
"Creating SatMarkovContainer, States: "
121 NS_LOG_FUNCTION(
this);
129 NS_LOG_FUNCTION(
this);
132 SatBaseFading::DoDispose();
138 NS_LOG_FUNCTION(
this);
152 NS_LOG_FUNCTION(
this << faderType);
177 NS_FATAL_ERROR(
"SatMarkovContainer::CreateFaders - Invalid fader type");
185 NS_LOG_FUNCTION(
this << channelType);
189 NS_LOG_INFO(
"Getting fading");
193 NS_LOG_INFO(
"Cool down period has passed, calculating new fading value");
203 NS_LOG_INFO(
"Cool down period in effect, using old fading value");
215 NS_LOG_FUNCTION(
this << channelType);
228 NS_FATAL_ERROR(
"SatMarkovContainer::GetCachedFadingValue - Invalid channel type");
237 NS_LOG_FUNCTION(
this);
268 NS_LOG_FUNCTION(
this << channelType);
291 NS_FATAL_ERROR(
"SatMarkovContainer::HasCooldownPeriodPassed - Invalid channel type");
300 NS_LOG_FUNCTION(
this << set);
302 std::vector<std::vector<double>> probabilities =
m_markovConf->GetElevationProbabilities(set);
304 NS_LOG_INFO(
"Updating probabilities...");
312 NS_LOG_INFO(
"------");
319 NS_LOG_FUNCTION(
this << channelType);
373 NS_FATAL_ERROR(
"SatMarkovContainer::CalculateFading - Invalid channel type");
382 NS_LOG_FUNCTION(
this << newSet <<
" " << newState);
386 NS_FATAL_ERROR(
"SatMarkovContainer::LockToSetAndState - Invalid state");
390 NS_FATAL_ERROR(
"SatMarkovContainer::LockToSetAndState - Invalid set");
405 NS_LOG_FUNCTION(
this << newSet);
409 NS_FATAL_ERROR(
"SatMarkovContainer::LockToSet - Invalid set");
423 NS_LOG_FUNCTION(
this);
426 uint32_t newState = 0;
444 NS_LOG_FUNCTION(
this);
448 uint32_t newState = 0;
463 NS_LOG_FUNCTION(
this);
472 NS_LOG_FUNCTION(
this);
Base class for fading models such as Markov-based fading or fading trace.
Callback< double > VelocityCallback
Gets velocity in m/s.
Callback< double > ElevationCallback
Gets elevation angle in degrees.
ChannelType_t
Types of channel.
MarkovFaderType_t
Possible types of Markov state faders.
double DoGetFading(Address macAddress, SatEnums::ChannelType_t channeltype)
Function for getting the fading.
void UpdateProbabilities(uint32_t set)
Function for updating the state change probabilities.
Time m_latestCalculationTime_up
Latest calculation time for uplink fading value.
bool m_useDecibels
Defines whether the calculations should return the fading value in decibels or not.
double m_minimumPositionChangeInMeters
Minimum state change distance in meters.
void UnlockSetAndState()
Function for unlocking the parameter set and state.
SatMarkovContainer()
Constructor.
void EvaluateStateChange(SatEnums::ChannelType_t channelType)
Function for evaluating state change.
void DoDispose()
Do needed dispose actions.
uint32_t m_currentState
Current state.
double m_latestCalculatedFadingValue_down
Latest calculated downlink fading value.
Time m_latestCalculationTime_down
Latest calculation time for downlink fading value.
uint32_t m_numOfSets
Number of parameter sets available.
double GetCachedFadingValue(SatEnums::ChannelType_t channelType)
Function for getting the cached fading values.
double m_latestCalculatedFadingValue_up
Latest calculated uplink fading value.
void LockToSet(uint32_t newSet)
Function for locking the parameter set.
void RandomizeLockedSetAndState()
Function for locking the parameter set and state to random values.
Ptr< SatMarkovConf > m_markovConf
Markoc model configuration.
TracedCallback< double, SatEnums::ChannelType_t, double > m_fadingTrace
Fading trace function.
bool m_enableSetLock
Variable for disabling the parameter set change.
uint32_t m_numOfStates
Number of states available.
double CalculateFading(SatEnums::ChannelType_t channelType)
Function for calculating the fading value.
VelocityCallback m_velocity
Node movement velocity.
void Reset()
Clear used variables.
~SatMarkovContainer()
Destructor.
double CalculateDistanceSinceLastStateChange()
Function for calculating the distance since latest state change position.
static TypeId GetTypeId(void)
NS-3 function for type id.
bool HasCooldownPeriodPassed(SatEnums::ChannelType_t channelType)
Function for checking whether the cooldown period has passed.
uint32_t m_currentSet
Current parameter set.
ElevationCallback m_currentElevation
Current elevation value.
bool m_enableStateLock
Variable for disabling state changes.
void RandomizeLockedState(uint32_t set)
Function for locking the state to random value.
Ptr< SatBaseFader > m_fader_up
Uplink fader.
Time m_cooldownPeriodLength
Cooldown period length in time.
Time m_latestStateChangeTime
Latest calculation time for state change.
Ptr< SatBaseFader > m_fader_down
Downlink fader.
void LockToSetAndState(uint32_t newSet, uint32_t newState)
Function for locking the parameter set and state.
void CreateFaders(SatMarkovConf::MarkovFaderType_t faderType)
Function for creating the Markov state faders.
Ptr< SatMarkovModel > m_markovModel
Markov model object.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.