satellite-markov-container.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Frans Laakso <frans.laakso@magister.fi>
19  */
20 #ifndef SATELLITE_MARKOV_CONTAINER_H
21 #define SATELLITE_MARKOV_CONTAINER_H
22 
23 #include "geo-coordinate.h"
24 #include "satellite-base-fading.h"
25 #include "satellite-loo-model.h"
26 #include "satellite-markov-conf.h"
27 #include "satellite-markov-model.h"
29 
30 #include <ns3/traced-callback.h>
31 #include <ns3/vector.h>
32 
33 namespace ns3
34 {
35 
46 {
47  public:
52  static TypeId GetTypeId(void);
53 
58 
65  SatMarkovContainer(Ptr<SatMarkovConf> markovConf,
68 
73 
77  void DoDispose();
78 
88  double DoGetFading(Address macAddress, SatEnums::ChannelType_t channeltype);
89 
93  void UnlockSetAndState();
94 
100  void LockToSetAndState(uint32_t newSet, uint32_t newState);
101 
106  void LockToSet(uint32_t newSet);
107 
112 
117  void RandomizeLockedState(uint32_t set);
118 
127  typedef void (*FadingTraceCallback)(double time,
128  SatEnums::ChannelType_t channelType,
129  double value);
130 
131  private:
135  Ptr<SatMarkovModel> m_markovModel;
136 
140  Ptr<SatMarkovConf> m_markovConf;
141 
145  Ptr<SatBaseFader> m_fader_up;
146 
150  Ptr<SatBaseFader> m_fader_down;
151 
155  uint32_t m_numOfStates;
156 
160  uint32_t m_numOfSets;
161 
165  uint32_t m_currentSet;
166 
170  uint32_t m_currentState;
171 
176 
181 
186 
191 
196 
201 
206 
211 
216 
221 
226 
231 
235  TracedCallback<double, // time
236  SatEnums::ChannelType_t, // channel type
237  double // fading value
238  >
240 
245  void UpdateProbabilities(uint32_t set);
246 
251 
257  double CalculateFading(SatEnums::ChannelType_t channelType);
258 
264 
271 
277  double GetCachedFadingValue(SatEnums::ChannelType_t channelType);
278 
283 
289 
293  void Reset();
294 };
295 
296 } // namespace ns3
297 
298 #endif /* SATELLITE_MARKOV_CONTAINER_H */
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.
Container for Markov-model.
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.
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.
void(* FadingTraceCallback)(double time, SatEnums::ChannelType_t channelType, double value)
Callback for FadingTrace trace source.
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.
double CalculateElevation()
Function for calculating the elevation.
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.