33 NS_OBJECT_ENSURE_REGISTERED(SatMarkovConf);
34 NS_LOG_COMPONENT_DEFINE(
"SatMarkovConf");
49 {{0.9684, 0.0316, 0.0000}, {0.4155, 0.5845, 0.0000}, {0.0000, 0.0000, 0.0000}}};
66 TypeId(
"ns3::SatMarkovConf")
68 .AddConstructor<SatMarkovConf>()
69 .AddAttribute(
"ElevationCount",
70 "Number of elevation sets in the Markov model.",
73 MakeUintegerChecker<uint32_t>())
74 .AddAttribute(
"StateCount",
75 "Number of states in the Markov model.",
78 MakeUintegerChecker<uint32_t>())
80 "MinimumPositionChangeInMeters",
81 "Minimum position change in meters for Markov model state change cooldown.",
84 MakeDoubleChecker<double>())
85 .AddAttribute(
"CooldownPeriodLength",
86 "Cooldown period length for state change.",
87 TimeValue(Seconds(0.0001)),
90 .AddAttribute(
"UseDecibels",
91 "Defines whether the fading value should be in decibels or not.",
94 MakeBooleanChecker());
101 m_minimumPositionChangeInMeters(1000.0),
102 m_cooldownPeriodLength(Seconds(0.00005)),
103 m_useDecibels(false),
105 m_rayleighConf(nullptr),
108 NS_LOG_FUNCTION(
this);
112 std::vector<std::vector<double>> states;
116 std::vector<double> probabilities;
122 states.push_back(probabilities);
132 std::pair<double, uint32_t> elevation;
134 elevation.first = 30.0;
135 elevation.second = 0;
143 NS_FATAL_ERROR(
"SatMarkovConf::SatMarkovConf - Markov elevations does not match");
149 NS_LOG_FUNCTION(
this);
157 NS_LOG_FUNCTION(
this);
177 NS_LOG_FUNCTION(
this);
183 std::vector<std::vector<double>>
186 NS_LOG_FUNCTION(
this << set);
190 NS_FATAL_ERROR(
"SatMarkovConf::GetElevationProbabilities - Invalid set");
199 NS_LOG_FUNCTION(
this << elevation);
201 if (elevation < 0.0 && elevation > 90.0)
203 NS_FATAL_ERROR(
"SatMarkovConf::GetProbabilitySetID - Invalid elevation");
206 uint32_t smallestDifferenceIndex = 0;
207 double smallestDifference = 360;
208 double difference = 0;
210 std::map<double, uint32_t>::iterator iter;
214 difference = fabs(iter->first - elevation);
215 if (difference < smallestDifference)
217 smallestDifference = difference;
218 smallestDifferenceIndex = iter->second;
222 NS_LOG_INFO(
"New ID for elevation " << elevation <<
" is " << smallestDifferenceIndex);
223 return smallestDifferenceIndex;
229 NS_LOG_FUNCTION(
this);
237 NS_LOG_FUNCTION(
this);
245 NS_LOG_FUNCTION(
this);
253 NS_LOG_FUNCTION(
this);
261 NS_LOG_FUNCTION(
this);
272 NS_FATAL_ERROR(
"SatMarkovConf::GetInitialState - Total sum doesn not match");
275 double r = total * (std::rand() / double(RAND_MAX));
294 NS_LOG_FUNCTION(
this);
302 NS_LOG_FUNCTION(
this);
310 NS_LOG_FUNCTION(
this);
318 NS_LOG_FUNCTION(
this);
A configuration class for three state Markov model.
void DoDispose()
Do needed dispose actions.
std::vector< double > m_initialProbabilities
Initial Markov state probabilities.
std::vector< std::vector< double > > GetElevationProbabilities(uint32_t set)
Function for returning the probabilities.
bool m_useDecibels
Defines whether the calculations should return the fading value in decibels or not.
static const uint32_t DEFAULT_ELEVATION_COUNT
Default elevation count.
Ptr< SatRayleighConf > m_rayleighConf
Rayleigh configuration.
uint32_t GetProbabilitySetID(double elevation)
Function for returning the parameter set.
Time m_cooldownPeriodLength
Cooldown period lengthin seconds.
std::vector< std::vector< std::vector< double > > > m_markovProbabilities
Markov state change probabilities.
MarkovFaderType_t
Possible types of Markov state faders.
SatMarkovConf::MarkovFaderType_t GetFaderType()
Function for returning the selected fader type.
double m_minimumPositionChangeInMeters
Minimum position change in meters.
std::map< double, uint32_t > m_markovElevations
Markov elevations.
SatMarkovConf::MarkovFaderType_t m_faderType
Selected fader type.
Ptr< SatLooConf > m_looConf
Loo configuration.
Ptr< SatLooConf > GetLooConf()
Function for returning the Loo's model configuration.
void Reset()
Clear used variables.
uint32_t GetInitialState()
Function for returning the initial state.
Time GetCooldownPeriod()
Function for returning the cooldown period.
~SatMarkovConf()
Destructor.
double GetMinimumPositionChange()
Function for returning the minimum position change distance.
static const uint32_t DEFAULT_STATE_COUNT
Default state count.
Ptr< SatRayleighConf > GetRayleighConf()
Function for returning the Loo's model configuration.
SatMarkovConf()
Constructor.
uint32_t GetStateCount()
Function for returning the number of states.
uint32_t m_elevationCount
Number of parameter sets.
static TypeId GetTypeId(void)
NS-3 function for type id.
uint32_t m_stateCount
Number of states.
bool AreDecibelsUsed()
Function for getting whether the calculations should return the fading value in decibels or not.
uint32_t GetNumOfSets()
Function for returning the number of parameter sets.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static const double g_MarkovElevationStateChangeProbabilities[SatMarkovConf::DEFAULT_ELEVATION_COUNT][SatMarkovConf::DEFAULT_STATE_COUNT][SatMarkovConf::DEFAULT_STATE_COUNT]
static const double g_MarkovInitialStateProbabilities[SatMarkovConf::DEFAULT_STATE_COUNT]