satellite-loo-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 
21 #include "satellite-loo-conf.h"
22 
23 #include "satellite-markov-conf.h"
24 
25 #include <map>
26 
27 namespace ns3
28 {
29 
30 NS_OBJECT_ENSURE_REGISTERED(SatLooConf);
31 NS_LOG_COMPONENT_DEFINE("SatLooConf");
32 
33 static const double g_LooParameters
48  /* Elevation 30 degrees */
49  {{0.0, 0.5, -25.0, 10, 10, 2, 30},
50  {-10.0, 3.0, -25.0, 10, 10, 2, 30},
51  {-21.0, 4.0, -25.0, 10, 10, 2, 30}}};
52 
53 TypeId
55 {
56  static TypeId tid = TypeId("ns3::SatLooConf")
57  .SetParent<SatBaseFaderConf>()
58  .AddConstructor<SatLooConf>()
59  .AddAttribute("ElevationCount",
60  "Number of elevation sets in the Markov model.",
62  MakeUintegerAccessor(&SatLooConf::m_elevationCount),
63  MakeUintegerChecker<uint32_t>())
64  .AddAttribute("StateCount",
65  "Number of states in the Markov model.",
67  MakeUintegerAccessor(&SatLooConf::m_stateCount),
68  MakeUintegerChecker<uint32_t>());
69  return tid;
70 }
71 
73  : m_elevationCount(SatMarkovConf::DEFAULT_ELEVATION_COUNT),
74  m_stateCount(SatMarkovConf::DEFAULT_STATE_COUNT)
75 {
76  NS_LOG_FUNCTION(this);
77 
78  for (uint32_t i = 0; i < m_elevationCount; i++)
79  {
80  std::vector<std::vector<double>> states;
81 
82  for (uint32_t j = 0; j < m_stateCount; j++)
83  {
84  std::vector<double> parameters;
85 
86  for (uint32_t k = 0; k < SatLooConf::DEFAULT_LOO_PARAMETER_COUNT; k++)
87  {
88  parameters.push_back(g_LooParameters[i][j][k]);
89  }
90  states.push_back(parameters);
91  }
92  m_looParameters.push_back(states);
93  }
94 }
95 
97 {
98  NS_LOG_FUNCTION(this);
99 
100  Reset();
101 }
102 
103 std::vector<std::vector<double>>
105 {
106  NS_LOG_FUNCTION(this << set);
107 
108  if (set >= m_elevationCount)
109  {
110  NS_FATAL_ERROR("SatLooConf::GetParameters - Invalid set");
111  }
112 
113  return m_looParameters[set];
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION(this);
120 
121  for (uint32_t i = 0; i < m_elevationCount; i++)
122  {
123  for (uint32_t j = 0; j < m_stateCount; j++)
124  {
125  m_looParameters[i][j].clear();
126  }
127  }
128 }
129 
130 void
132 {
133  NS_LOG_FUNCTION(this);
134 
135  Reset();
136  SatBaseFaderConf::DoDispose();
137 }
138 
139 } // namespace ns3
Base class for fader configuration classes.
std::vector< std::vector< double > > GetParameters(uint32_t set)
Function for getting the Loo parameters.
uint32_t m_elevationCount
Number of parameters sets.
static const uint32_t DEFAULT_LOO_PARAMETER_COUNT
Default Loo parameter count.
SatLooConf()
Constructor.
std::vector< std::vector< std::vector< double > > > m_looParameters
Loo's model parameters.
uint32_t m_stateCount
Number of states.
void DoDispose()
Do needed dispose actions.
void Reset()
Clear used variables.
static TypeId GetTypeId(void)
NS-3 function for type id.
~SatLooConf()
Destructor.
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.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static const double g_LooParameters[SatMarkovConf::DEFAULT_ELEVATION_COUNT][SatMarkovConf::DEFAULT_STATE_COUNT][SatLooConf::DEFAULT_LOO_PARAMETER_COUNT]