satellite-loo-model.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_LOO_MODEL_H
21 #define SATELLITE_LOO_MODEL_H
22 
23 #include "satellite-base-fader.h"
25 #include "satellite-loo-conf.h"
26 
27 #include <ns3/random-variable-stream.h>
28 #include <ns3/vector.h>
29 
30 #include <complex>
31 #include <stdint.h>
32 #include <vector>
33 
34 namespace ns3
35 {
36 
44 class SatLooModel : public SatBaseFader
45 {
46  public:
51  static TypeId GetTypeId(void);
52 
56  SatLooModel();
57 
65  SatLooModel(Ptr<SatLooConf> looConf,
66  uint32_t numOfStates,
67  uint32_t initialSet,
68  uint32_t initialState);
69 
73  ~SatLooModel();
74 
78  void DoDispose();
79 
84  double GetChannelGainDb();
85 
90  double GetChannelGain();
91 
97  void UpdateParameters(uint32_t set, uint32_t state);
98 
99  private:
103  uint32_t m_numOfStates;
104 
108  uint32_t m_currentSet;
109 
113  uint32_t m_currentState;
114 
118  std::vector<double> m_sigma;
119 
123  Ptr<SatLooConf> m_looConf;
124 
128  std::vector<std::vector<double>> m_looParameters;
129 
133  Ptr<NormalRandomVariable> m_normalRandomVariable;
134 
138  Ptr<UniformRandomVariable> m_uniformVariable;
139 
143  std::vector<std::vector<Ptr<SatFadingOscillator>>> m_directSignalOscillators;
144 
148  std::vector<std::vector<Ptr<SatFadingOscillator>>> m_multipathOscillators;
149 
154 
159 
166  std::complex<double> GetOscillatorCosineWaveSum(
167  std::vector<Ptr<SatFadingOscillator>> oscillator,
168  double timeInSeconds);
169 
176  std::complex<double> GetOscillatorComplexSum(std::vector<Ptr<SatFadingOscillator>> oscillator,
177  double timeInSeconds);
178 
183  void ChangeState(uint32_t newState);
184 
190  void ChangeSet(uint32_t newSet, uint32_t newState);
191 
195  void CalculateSigma();
196 
200  void Reset();
201 };
202 
203 } // namespace ns3
204 
205 #endif /* SATELLITE_LOO_MODEL_H */
Base class for faders such as the Rayleigh fader.
Class for Loo's model fader.
double GetChannelGain()
Function for returning the channel gain.
double GetChannelGainDb()
Function for returning the channel gain in dB.
SatLooModel()
Constructor.
void ChangeState(uint32_t newState)
Function for setting the state.
void UpdateParameters(uint32_t set, uint32_t state)
Function for updating the parameter set and state.
Ptr< UniformRandomVariable > m_uniformVariable
Uniform distribution random variable.
std::vector< std::vector< double > > m_looParameters
Loo's model parameters.
std::complex< double > GetOscillatorComplexSum(std::vector< Ptr< SatFadingOscillator >> oscillator, double timeInSeconds)
Function for calculating oscillator complex sum.
uint32_t m_currentSet
Current parameter set.
std::complex< double > GetOscillatorCosineWaveSum(std::vector< Ptr< SatFadingOscillator >> oscillator, double timeInSeconds)
Function for calculating cosine wave oscillator complex sum.
void CalculateSigma()
Function for calculating sigma for different states.
uint32_t m_numOfStates
Number of states.
void ChangeSet(uint32_t newSet, uint32_t newState)
Function for setting the parameter set and state.
uint32_t m_currentState
Current state.
void Reset()
Clear used variables.
std::vector< std::vector< Ptr< SatFadingOscillator > > > m_multipathOscillators
Multipath oscillators.
void ConstructMultipathOscillators()
Function for constructing multipath oscillators.
std::vector< double > m_sigma
Multipath power converted to linear units.
~SatLooModel()
Destructor.
void ConstructDirectSignalOscillators()
Function for constructing direct signal oscillators.
Ptr< NormalRandomVariable > m_normalRandomVariable
Normal distribution random variable.
void DoDispose()
Do needed dispose actions.
std::vector< std::vector< Ptr< SatFadingOscillator > > > m_directSignalOscillators
Direct signal oscillators.
static TypeId GetTypeId(void)
NS-3 function for type id.
Ptr< SatLooConf > m_looConf
Loo's model configuration object.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.