30 NS_OBJECT_ENSURE_REGISTERED(SatMarkovConf);
31 NS_LOG_COMPONENT_DEFINE(
"SatMarkovConf");
46 {{0.9684, 0.0316, 0.0000}, {0.4155, 0.5845, 0.0000}, {0.0000, 0.0000, 0.0000}}};
63 TypeId(
"ns3::SatMarkovConf")
65 .AddConstructor<SatMarkovConf>()
66 .AddAttribute(
"ElevationCount",
67 "Number of elevation sets in the Markov model.",
70 MakeUintegerChecker<uint32_t>())
71 .AddAttribute(
"StateCount",
72 "Number of states in the Markov model.",
75 MakeUintegerChecker<uint32_t>())
77 "MinimumPositionChangeInMeters",
78 "Minimum position change in meters for Markov model state change cooldown.",
81 MakeDoubleChecker<double>())
82 .AddAttribute(
"CooldownPeriodLength",
83 "Cooldown period length for state change.",
84 TimeValue(Seconds(0.0001)),
87 .AddAttribute(
"UseDecibels",
88 "Defines whether the fading value should be in decibels or not.",
91 MakeBooleanChecker());
98 m_minimumPositionChangeInMeters(1000.0),
99 m_cooldownPeriodLength(Seconds(0.00005)),
100 m_useDecibels(false),
102 m_rayleighConf(NULL),
105 NS_LOG_FUNCTION(
this);
109 std::vector<std::vector<double>> states;
113 std::vector<double> probabilities;
119 states.push_back(probabilities);
129 std::pair<double, uint32_t> elevation;
131 elevation.first = 30.0;
132 elevation.second = 0;
140 NS_FATAL_ERROR(
"SatMarkovConf::SatMarkovConf - Markov elevations does not match");
146 NS_LOG_FUNCTION(
this);
154 NS_LOG_FUNCTION(
this);
174 NS_LOG_FUNCTION(
this);
180 std::vector<std::vector<double>>
183 NS_LOG_FUNCTION(
this << set);
187 NS_FATAL_ERROR(
"SatMarkovConf::GetElevationProbabilities - Invalid set");
196 NS_LOG_FUNCTION(
this << elevation);
198 if (elevation < 0.0 && elevation > 90.0)
200 NS_FATAL_ERROR(
"SatMarkovConf::GetProbabilitySetID - Invalid elevation");
203 uint32_t smallestDifferenceIndex = 0;
204 double smallestDifference = 360;
205 double difference = 0;
207 std::map<double, uint32_t>::iterator iter;
211 difference = fabs(iter->first - elevation);
212 if (difference < smallestDifference)
214 smallestDifference = difference;
215 smallestDifferenceIndex = iter->second;
219 NS_LOG_INFO(
"New ID for elevation " << elevation <<
" is " << smallestDifferenceIndex);
220 return smallestDifferenceIndex;
226 NS_LOG_FUNCTION(
this);
234 NS_LOG_FUNCTION(
this);
242 NS_LOG_FUNCTION(
this);
250 NS_LOG_FUNCTION(
this);
258 NS_LOG_FUNCTION(
this);
269 NS_FATAL_ERROR(
"SatMarkovConf::GetInitialState - Total sum doesn not match");
272 double r = total * (std::rand() / double(RAND_MAX));
291 NS_LOG_FUNCTION(
this);
299 NS_LOG_FUNCTION(
this);
307 NS_LOG_FUNCTION(
this);
315 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]