satellite-rayleigh-conf.cc
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 
22 
23 #include "satellite-markov-conf.h"
24 
25 #include <map>
26 
27 namespace ns3
28 {
29 
30 NS_OBJECT_ENSURE_REGISTERED(SatRayleighConf);
31 NS_LOG_COMPONENT_DEFINE("SatRayleighConf");
32 
44 
45  /* Elevation 30 degrees */
46  {{10, 10}, {10, 10}, {10, 10}}};
47 
48 TypeId
50 {
51  static TypeId tid = TypeId("ns3::SatRayleighConf")
52  .SetParent<SatBaseFaderConf>()
53  .AddConstructor<SatRayleighConf>()
54  .AddAttribute("ElevationCount",
55  "Number of elevation sets in the Markov model.",
57  MakeUintegerAccessor(&SatRayleighConf::m_elevationCount),
58  MakeUintegerChecker<uint32_t>())
59  .AddAttribute("StateCount",
60  "Number of states in the Markov model.",
62  MakeUintegerAccessor(&SatRayleighConf::m_stateCount),
63  MakeUintegerChecker<uint32_t>());
64  return tid;
65 }
66 
68  : m_elevationCount(SatMarkovConf::DEFAULT_ELEVATION_COUNT),
69  m_stateCount(SatMarkovConf::DEFAULT_STATE_COUNT)
70 {
71  NS_LOG_FUNCTION(this);
72 
73  for (uint32_t i = 0; i < m_elevationCount; i++)
74  {
75  std::vector<std::vector<double>> states;
76 
77  for (uint32_t j = 0; j < m_stateCount; j++)
78  {
79  std::vector<double> parameters;
80 
81  for (uint32_t k = 0; k < SatRayleighConf::DEFAULT_RAYLEIGH_PARAMETER_COUNT; k++)
82  {
83  parameters.push_back(g_RayleighParameters[i][j][k]);
84  }
85  states.push_back(parameters);
86  }
87  m_rayleighParameters.push_back(states);
88  }
89 }
90 
92 {
93  NS_LOG_FUNCTION(this);
94 
95  Reset();
96 }
97 
98 std::vector<std::vector<double>>
100 {
101  NS_LOG_FUNCTION(this << set);
102 
103  if (set >= m_elevationCount)
104  {
105  NS_FATAL_ERROR("SatRayleighConf::GetParameters - Invalid set");
106  }
107 
108  return m_rayleighParameters[set];
109 }
110 
111 void
113 {
114  NS_LOG_FUNCTION(this);
115 
116  for (uint32_t i = 0; i < m_elevationCount; i++)
117  {
118  for (uint32_t j = 0; j < m_stateCount; j++)
119  {
120  m_rayleighParameters[i][j].clear();
121  }
122  }
123 }
124 
125 void
127 {
128  NS_LOG_FUNCTION(this);
129 
130  Reset();
131  SatBaseFaderConf::DoDispose();
132 }
133 
134 } // namespace ns3
Base class for fader configuration classes.
A configuration class for three state Markov model.
static const uint32_t DEFAULT_ELEVATION_COUNT
Default elevation count.
static const uint32_t DEFAULT_STATE_COUNT
Default state count.
uint32_t m_stateCount
Number of states.
std::vector< std::vector< double > > GetParameters(uint32_t set)
Function for getting the Rayleigh parameters.
static const uint32_t DEFAULT_RAYLEIGH_PARAMETER_COUNT
Default Rayleigh parameter count.
void Reset()
Clear used variables.
std::vector< std::vector< std::vector< double > > > m_rayleighParameters
Rayleigh model parameters.
static TypeId GetTypeId(void)
NS-3 function for type id.
uint32_t m_elevationCount
Number of parameters sets.
void DoDispose()
Do needed dispose actions.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static const double g_RayleighParameters[SatMarkovConf::DEFAULT_ELEVATION_COUNT][SatMarkovConf::DEFAULT_STATE_COUNT][SatRayleighConf::DEFAULT_RAYLEIGH_PARAMETER_COUNT]