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 #include <vector>
27 
28 namespace ns3
29 {
30 
31 NS_OBJECT_ENSURE_REGISTERED(SatRayleighConf);
32 NS_LOG_COMPONENT_DEFINE("SatRayleighConf");
33 
45 
46  /* Elevation 30 degrees */
47  {{10, 10}, {10, 10}, {10, 10}}};
48 
49 TypeId
51 {
52  static TypeId tid = TypeId("ns3::SatRayleighConf")
53  .SetParent<SatBaseFaderConf>()
54  .AddConstructor<SatRayleighConf>()
55  .AddAttribute("ElevationCount",
56  "Number of elevation sets in the Markov model.",
58  MakeUintegerAccessor(&SatRayleighConf::m_elevationCount),
59  MakeUintegerChecker<uint32_t>())
60  .AddAttribute("StateCount",
61  "Number of states in the Markov model.",
63  MakeUintegerAccessor(&SatRayleighConf::m_stateCount),
64  MakeUintegerChecker<uint32_t>());
65  return tid;
66 }
67 
69  : m_elevationCount(SatMarkovConf::DEFAULT_ELEVATION_COUNT),
70  m_stateCount(SatMarkovConf::DEFAULT_STATE_COUNT)
71 {
72  NS_LOG_FUNCTION(this);
73 
74  for (uint32_t i = 0; i < m_elevationCount; i++)
75  {
76  std::vector<std::vector<double>> states;
77 
78  for (uint32_t j = 0; j < m_stateCount; j++)
79  {
80  std::vector<double> parameters;
81 
82  for (uint32_t k = 0; k < SatRayleighConf::DEFAULT_RAYLEIGH_PARAMETER_COUNT; k++)
83  {
84  parameters.push_back(g_RayleighParameters[i][j][k]);
85  }
86  states.push_back(parameters);
87  }
88  m_rayleighParameters.push_back(states);
89  }
90 }
91 
93 {
94  NS_LOG_FUNCTION(this);
95 
96  Reset();
97 }
98 
99 std::vector<std::vector<double>>
101 {
102  NS_LOG_FUNCTION(this << set);
103 
104  if (set >= m_elevationCount)
105  {
106  NS_FATAL_ERROR("SatRayleighConf::GetParameters - Invalid set");
107  }
108 
109  return m_rayleighParameters[set];
110 }
111 
112 void
114 {
115  NS_LOG_FUNCTION(this);
116 
117  for (uint32_t i = 0; i < m_elevationCount; i++)
118  {
119  for (uint32_t j = 0; j < m_stateCount; j++)
120  {
121  m_rayleighParameters[i][j].clear();
122  }
123  }
124 }
125 
126 void
128 {
129  NS_LOG_FUNCTION(this);
130 
131  Reset();
132  SatBaseFaderConf::DoDispose();
133 }
134 
135 } // 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]