Container for Markov-model. More...
#include "satellite-markov-container.h"
Public Types | |
typedef void(* | FadingTraceCallback) (double time, SatEnums::ChannelType_t channelType, double value) |
Callback for FadingTrace trace source. More... | |
Public Types inherited from ns3::SatBaseFading | |
typedef Callback< double > | ElevationCallback |
Gets elevation angle in degrees. More... | |
typedef Callback< double > | VelocityCallback |
Gets velocity in m/s. More... | |
Public Member Functions | |
SatMarkovContainer () | |
Constructor. More... | |
SatMarkovContainer (Ptr< SatMarkovConf > markovConf, SatBaseFading::ElevationCallback elevation, SatBaseFading::VelocityCallback velocity) | |
Constructor. More... | |
~SatMarkovContainer () | |
Destructor. More... | |
void | DoDispose () |
Do needed dispose actions. More... | |
double | DoGetFading (Address macAddress, SatEnums::ChannelType_t channeltype) |
Function for getting the fading. More... | |
void | LockToSet (uint32_t newSet) |
Function for locking the parameter set. More... | |
void | LockToSetAndState (uint32_t newSet, uint32_t newState) |
Function for locking the parameter set and state. More... | |
void | RandomizeLockedSetAndState () |
Function for locking the parameter set and state to random values. More... | |
void | RandomizeLockedState (uint32_t set) |
Function for locking the state to random value. More... | |
void | UnlockSetAndState () |
Function for unlocking the parameter set and state. More... | |
Public Member Functions inherited from ns3::SatBaseFading | |
SatBaseFading () | |
Constructor. More... | |
virtual | ~SatBaseFading () |
Destructor. More... | |
double | GetFading (Address macAddress, SatEnums::ChannelType_t channelType) |
Function for getting the fading value. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
NS-3 function for type id. More... | |
Static Public Member Functions inherited from ns3::SatBaseFading | |
static TypeId | GetTypeId (void) |
NS-3 type id function. More... | |
Private Member Functions | |
double | CalculateDistanceSinceLastStateChange () |
Function for calculating the distance since latest state change position. More... | |
double | CalculateElevation () |
Function for calculating the elevation. More... | |
double | CalculateFading (SatEnums::ChannelType_t channelType) |
Function for calculating the fading value. More... | |
void | CreateFaders (SatMarkovConf::MarkovFaderType_t faderType) |
Function for creating the Markov state faders. More... | |
void | EvaluateStateChange (SatEnums::ChannelType_t channelType) |
Function for evaluating state change. More... | |
double | GetCachedFadingValue (SatEnums::ChannelType_t channelType) |
Function for getting the cached fading values. More... | |
bool | HasCooldownPeriodPassed (SatEnums::ChannelType_t channelType) |
Function for checking whether the cooldown period has passed. More... | |
void | Reset () |
Clear used variables. More... | |
void | UpdateProbabilities (uint32_t set) |
Function for updating the state change probabilities. More... | |
Private Attributes | |
Time | m_cooldownPeriodLength |
Cooldown period length in time. More... | |
ElevationCallback | m_currentElevation |
Current elevation value. More... | |
uint32_t | m_currentSet |
Current parameter set. More... | |
uint32_t | m_currentState |
Current state. More... | |
bool | m_enableSetLock |
Variable for disabling the parameter set change. More... | |
bool | m_enableStateLock |
Variable for disabling state changes. More... | |
Ptr< SatBaseFader > | m_fader_down |
Downlink fader. More... | |
Ptr< SatBaseFader > | m_fader_up |
Uplink fader. More... | |
TracedCallback< double, SatEnums::ChannelType_t, double > | m_fadingTrace |
Fading trace function. More... | |
double | m_latestCalculatedFadingValue_down |
Latest calculated downlink fading value. More... | |
double | m_latestCalculatedFadingValue_up |
Latest calculated uplink fading value. More... | |
Time | m_latestCalculationTime_down |
Latest calculation time for downlink fading value. More... | |
Time | m_latestCalculationTime_up |
Latest calculation time for uplink fading value. More... | |
Time | m_latestStateChangeTime |
Latest calculation time for state change. More... | |
Ptr< SatMarkovConf > | m_markovConf |
Markoc model configuration. More... | |
Ptr< SatMarkovModel > | m_markovModel |
Markov model object. More... | |
double | m_minimumPositionChangeInMeters |
Minimum state change distance in meters. More... | |
uint32_t | m_numOfSets |
Number of parameter sets available. More... | |
uint32_t | m_numOfStates |
Number of states available. More... | |
bool | m_useDecibels |
Defines whether the calculations should return the fading value in decibels or not. More... | |
VelocityCallback | m_velocity |
Node movement velocity. More... | |
Container for Markov-model.
This class contains the Markov-model state machines and implements the fading interface. The class implements, e.g., the state machine selection and contains the logic for deciding when the new fading value will be calculated and state change evaluation should happen.
Definition at line 47 of file satellite-markov-container.h.
typedef void(* ns3::SatMarkovContainer::FadingTraceCallback) (double time, SatEnums::ChannelType_t channelType, double value) |
Callback for FadingTrace
trace source.
time | the current simulation time (in seconds) |
channelType | the type of the relevant channel, e.g., FORWARD_FEEDER_CH, FORWARD_USER_CH, RETURN_USER_CH, or RETURN_FEEDER_CH |
value | fading value, in unit determined by configuration |
Definition at line 129 of file satellite-markov-container.h.
ns3::SatMarkovContainer::SatMarkovContainer | ( | ) |
Constructor.
Definition at line 49 of file satellite-markov-container.cc.
ns3::SatMarkovContainer::SatMarkovContainer | ( | Ptr< SatMarkovConf > | markovConf, |
SatBaseFading::ElevationCallback | elevation, | ||
SatBaseFading::VelocityCallback | velocity | ||
) |
Constructor.
markovConf | Markov configuration object. |
elevation | Elevation angle callback. |
velocity | Velocity callback. |
create Markov model
initialize Markov model
create faders
initialize fading values
Definition at line 74 of file satellite-markov-container.cc.
References CalculateFading(), CreateFaders(), ns3::SatEnums::FORWARD_USER_CH, m_cooldownPeriodLength, m_currentElevation, m_currentSet, m_currentState, m_markovConf, m_markovModel, m_minimumPositionChangeInMeters, m_numOfStates, ns3::SatEnums::RETURN_USER_CH, and UpdateProbabilities().
ns3::SatMarkovContainer::~SatMarkovContainer | ( | ) |
Destructor.
Definition at line 121 of file satellite-markov-container.cc.
References Reset().
|
private |
Function for calculating the distance since latest state change position.
Definition at line 472 of file satellite-markov-container.cc.
References m_latestStateChangeTime, and m_velocity.
Referenced by EvaluateStateChange().
|
private |
Function for calculating the elevation.
|
private |
Function for calculating the fading value.
channelType | channel type |
Definition at line 319 of file satellite-markov-container.cc.
References ns3::SatEnums::FORWARD_FEEDER_CH, ns3::SatEnums::FORWARD_USER_CH, m_currentSet, m_currentState, m_enableStateLock, m_fader_down, m_fader_up, m_latestCalculatedFadingValue_down, m_latestCalculatedFadingValue_up, m_latestCalculationTime_down, m_latestCalculationTime_up, m_markovModel, m_numOfStates, m_useDecibels, ns3::SatEnums::RETURN_FEEDER_CH, and ns3::SatEnums::RETURN_USER_CH.
Referenced by SatMarkovContainer(), and DoGetFading().
|
private |
Function for creating the Markov state faders.
Definition at line 152 of file satellite-markov-container.cc.
References ns3::SatMarkovConf::LOO_FADER, m_currentSet, m_currentState, m_fader_down, m_fader_up, m_markovConf, m_numOfStates, and ns3::SatMarkovConf::RAYLEIGH_FADER.
Referenced by SatMarkovContainer().
void ns3::SatMarkovContainer::DoDispose | ( | void | ) |
Do needed dispose actions.
Definition at line 129 of file satellite-markov-container.cc.
References Reset().
|
virtual |
Function for getting the fading.
SatMarkovContainer is inherited from SatBaseFading abstract base class, which defines an abstract interface method DoGetFading with Address and ChannelType as input parameters. DoGetFading is implemented in the inherited classes SatMarkovContainer and SatFadingInputTrace. SatFadingInputTrace needs the Address as a parameter in DoGetFading method to be able to get the fading from the correct fading file. Note, that the Address parameter is not utilized in SatMarkovContainer::DoGetFading () at all.
macAddress | MAC address |
channeltype | channel type |
Implements ns3::SatBaseFading.
Definition at line 185 of file satellite-markov-container.cc.
References CalculateFading(), EvaluateStateChange(), GetCachedFadingValue(), HasCooldownPeriodPassed(), m_fadingTrace, and m_velocity.
Referenced by ns3::SatMarkovFadingExamplePlot::Run().
|
private |
Function for evaluating state change.
Definition at line 237 of file satellite-markov-container.cc.
References CalculateDistanceSinceLastStateChange(), m_currentElevation, m_currentSet, m_enableSetLock, m_enableStateLock, m_latestStateChangeTime, m_markovConf, m_markovModel, m_minimumPositionChangeInMeters, and UpdateProbabilities().
Referenced by DoGetFading().
|
private |
Function for getting the cached fading values.
channelType | channel type |
Definition at line 215 of file satellite-markov-container.cc.
References ns3::SatEnums::FORWARD_FEEDER_CH, ns3::SatEnums::FORWARD_USER_CH, m_latestCalculatedFadingValue_down, m_latestCalculatedFadingValue_up, ns3::SatEnums::RETURN_FEEDER_CH, and ns3::SatEnums::RETURN_USER_CH.
Referenced by DoGetFading().
|
static |
NS-3 function for type id.
Definition at line 36 of file satellite-markov-container.cc.
References m_fadingTrace.
|
private |
Function for checking whether the cooldown period has passed.
channelType | channel type |
Definition at line 268 of file satellite-markov-container.cc.
References ns3::SatEnums::FORWARD_FEEDER_CH, ns3::SatEnums::FORWARD_USER_CH, m_cooldownPeriodLength, m_latestCalculationTime_down, m_latestCalculationTime_up, ns3::SatEnums::RETURN_FEEDER_CH, and ns3::SatEnums::RETURN_USER_CH.
Referenced by DoGetFading().
void ns3::SatMarkovContainer::LockToSet | ( | uint32_t | newSet | ) |
Function for locking the parameter set.
newSet | new set |
Definition at line 405 of file satellite-markov-container.cc.
References m_currentSet, m_enableSetLock, m_enableStateLock, m_numOfSets, and UpdateProbabilities().
Referenced by RandomizeLockedState().
void ns3::SatMarkovContainer::LockToSetAndState | ( | uint32_t | newSet, |
uint32_t | newState | ||
) |
Function for locking the parameter set and state.
newSet | new set |
newState | new state |
Definition at line 382 of file satellite-markov-container.cc.
References m_currentSet, m_currentState, m_enableSetLock, m_enableStateLock, m_numOfSets, m_numOfStates, and UpdateProbabilities().
Referenced by RandomizeLockedSetAndState(), and ns3::SatMarkovFadingExamplePlot::Run().
void ns3::SatMarkovContainer::RandomizeLockedSetAndState | ( | ) |
Function for locking the parameter set and state to random values.
Definition at line 423 of file satellite-markov-container.cc.
References LockToSetAndState(), m_numOfSets, and m_numOfStates.
void ns3::SatMarkovContainer::RandomizeLockedState | ( | uint32_t | set | ) |
Function for locking the state to random value.
The set will be locked to the value provided by the parameter
set | The value for set |
Definition at line 444 of file satellite-markov-container.cc.
References LockToSet(), m_currentState, m_enableStateLock, and m_numOfStates.
|
private |
Clear used variables.
Definition at line 138 of file satellite-markov-container.cc.
References m_currentElevation, m_fader_down, m_fader_up, m_markovConf, m_markovModel, and m_velocity.
Referenced by ~SatMarkovContainer(), and DoDispose().
void ns3::SatMarkovContainer::UnlockSetAndState | ( | ) |
Function for unlocking the parameter set and state.
Definition at line 463 of file satellite-markov-container.cc.
References m_enableSetLock, and m_enableStateLock.
|
private |
Function for updating the state change probabilities.
set | parameter set |
Definition at line 300 of file satellite-markov-container.cc.
References m_markovConf, m_markovModel, and m_numOfStates.
Referenced by SatMarkovContainer(), EvaluateStateChange(), LockToSet(), and LockToSetAndState().
|
private |
Cooldown period length in time.
Definition at line 177 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), and HasCooldownPeriodPassed().
|
private |
Current elevation value.
Definition at line 227 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), EvaluateStateChange(), and Reset().
|
private |
Current parameter set.
Definition at line 167 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), CalculateFading(), CreateFaders(), EvaluateStateChange(), LockToSet(), and LockToSetAndState().
|
private |
Current state.
Definition at line 172 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), CalculateFading(), CreateFaders(), LockToSetAndState(), and RandomizeLockedState().
|
private |
Variable for disabling the parameter set change.
Definition at line 207 of file satellite-markov-container.h.
Referenced by EvaluateStateChange(), LockToSet(), LockToSetAndState(), and UnlockSetAndState().
|
private |
Variable for disabling state changes.
Definition at line 212 of file satellite-markov-container.h.
Referenced by CalculateFading(), EvaluateStateChange(), LockToSet(), LockToSetAndState(), RandomizeLockedState(), and UnlockSetAndState().
|
private |
Downlink fader.
Definition at line 152 of file satellite-markov-container.h.
Referenced by CalculateFading(), CreateFaders(), and Reset().
|
private |
Uplink fader.
Definition at line 147 of file satellite-markov-container.h.
Referenced by CalculateFading(), CreateFaders(), and Reset().
|
private |
Fading trace function.
Definition at line 241 of file satellite-markov-container.h.
Referenced by DoGetFading(), and GetTypeId().
|
private |
Latest calculated downlink fading value.
Definition at line 192 of file satellite-markov-container.h.
Referenced by CalculateFading(), and GetCachedFadingValue().
|
private |
Latest calculated uplink fading value.
Definition at line 187 of file satellite-markov-container.h.
Referenced by CalculateFading(), and GetCachedFadingValue().
|
private |
Latest calculation time for downlink fading value.
Definition at line 202 of file satellite-markov-container.h.
Referenced by CalculateFading(), and HasCooldownPeriodPassed().
|
private |
Latest calculation time for uplink fading value.
Definition at line 197 of file satellite-markov-container.h.
Referenced by CalculateFading(), and HasCooldownPeriodPassed().
|
private |
Latest calculation time for state change.
Definition at line 222 of file satellite-markov-container.h.
Referenced by CalculateDistanceSinceLastStateChange(), and EvaluateStateChange().
|
private |
Markoc model configuration.
Definition at line 142 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), CreateFaders(), EvaluateStateChange(), Reset(), and UpdateProbabilities().
|
private |
Markov model object.
Definition at line 137 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), CalculateFading(), EvaluateStateChange(), Reset(), and UpdateProbabilities().
|
private |
Minimum state change distance in meters.
Definition at line 182 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), and EvaluateStateChange().
|
private |
Number of parameter sets available.
Definition at line 162 of file satellite-markov-container.h.
Referenced by LockToSet(), LockToSetAndState(), and RandomizeLockedSetAndState().
|
private |
Number of states available.
Definition at line 157 of file satellite-markov-container.h.
Referenced by SatMarkovContainer(), CalculateFading(), CreateFaders(), LockToSetAndState(), RandomizeLockedSetAndState(), RandomizeLockedState(), and UpdateProbabilities().
|
private |
Defines whether the calculations should return the fading value in decibels or not.
Definition at line 232 of file satellite-markov-container.h.
Referenced by CalculateFading().
|
private |
Node movement velocity.
Definition at line 217 of file satellite-markov-container.h.
Referenced by CalculateDistanceSinceLastStateChange(), DoGetFading(), and Reset().