Loading...
Searching...
No Matches
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
24
25#include <map>
26#include <vector>
27
28namespace ns3
29{
30
31NS_OBJECT_ENSURE_REGISTERED(SatLooConf);
32NS_LOG_COMPONENT_DEFINE("SatLooConf");
33
34static const double g_LooParameters
48
49 /* Elevation 30 degrees */
50 {{0.0, 0.5, -25.0, 10, 10, 2, 30},
51 {-10.0, 3.0, -25.0, 10, 10, 2, 30},
52 {-21.0, 4.0, -25.0, 10, 10, 2, 30}}};
53
54TypeId
56{
57 static TypeId tid = TypeId("ns3::SatLooConf")
58 .SetParent<SatBaseFaderConf>()
59 .AddConstructor<SatLooConf>()
60 .AddAttribute("ElevationCount",
61 "Number of elevation sets in the Markov model.",
63 MakeUintegerAccessor(&SatLooConf::m_elevationCount),
64 MakeUintegerChecker<uint32_t>())
65 .AddAttribute("StateCount",
66 "Number of states in the Markov model.",
68 MakeUintegerAccessor(&SatLooConf::m_stateCount),
69 MakeUintegerChecker<uint32_t>());
70 return tid;
71}
72
74 : m_elevationCount(SatMarkovConf::DEFAULT_ELEVATION_COUNT),
75 m_stateCount(SatMarkovConf::DEFAULT_STATE_COUNT)
76{
77 NS_LOG_FUNCTION(this);
78
79 for (uint32_t i = 0; i < m_elevationCount; i++)
80 {
81 std::vector<std::vector<double>> states;
82
83 for (uint32_t j = 0; j < m_stateCount; j++)
84 {
85 std::vector<double> parameters;
86
87 for (uint32_t k = 0; k < SatLooConf::DEFAULT_LOO_PARAMETER_COUNT; k++)
88 {
89 parameters.push_back(g_LooParameters[i][j][k]);
90 }
91 states.push_back(parameters);
92 }
93 m_looParameters.push_back(states);
94 }
95}
96
98{
99 NS_LOG_FUNCTION(this);
100
101 Reset();
102}
103
104std::vector<std::vector<double>>
106{
107 NS_LOG_FUNCTION(this << set);
108
109 if (set >= m_elevationCount)
110 {
111 NS_FATAL_ERROR("SatLooConf::GetParameters - Invalid set");
112 }
113
114 return m_looParameters[set];
115}
116
117void
119{
120 NS_LOG_FUNCTION(this);
121
122 for (uint32_t i = 0; i < m_elevationCount; i++)
123 {
124 for (uint32_t j = 0; j < m_stateCount; j++)
125 {
126 m_looParameters[i][j].clear();
127 }
128 }
129}
130
131void
133{
134 NS_LOG_FUNCTION(this);
135
136 Reset();
137 SatBaseFaderConf::DoDispose();
138}
139
140} // namespace ns3
A configuration class for Loo's model fader.
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]