satellite-channel-estimation-error-container.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 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: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
22 
23 #include "../utils/satellite-env-variables.h"
24 
25 #include <ns3/log.h>
26 #include <ns3/singleton.h>
27 
28 #include <sstream>
29 #include <string>
30 #include <utility>
31 
32 NS_LOG_COMPONENT_DEFINE("SatFwdLinkChannelEstimationErrorContainer");
33 
34 namespace ns3
35 {
36 
42 {
43  NS_LOG_FUNCTION(this);
44 }
45 
47 {
48 }
49 
50 double
51 SatChannelEstimationErrorContainer::AddError(double sinrIn, uint32_t wfId) const
52 {
53  NS_LOG_FUNCTION(this << sinrIn << wfId);
54 
55  return DoAddError(sinrIn, wfId);
56 }
57 
63 {
64  NS_LOG_FUNCTION(this);
65 }
66 
68 {
69 }
70 
71 double
72 SatSimpleChannelEstimationErrorContainer::DoAddError(double sinrIn, uint32_t /*wfId*/) const
73 {
74  NS_LOG_FUNCTION(this << sinrIn);
75 
76  return sinrIn;
77 }
78 
84 {
85  NS_LOG_FUNCTION(this);
86 
91  std::string dataPath = Singleton<SatEnvVariables>::Get()->LocateDataDirectory();
92  std::string filePathName =
93  dataPath + "/additional-input/sinrmeaserror/ChannelEstimationErrorFwdLink.txt";
94  m_channelEstimationError = CreateObject<SatChannelEstimationError>(filePathName);
95 }
96 
98 {
99 }
100 
101 double
102 SatFwdLinkChannelEstimationErrorContainer::DoAddError(double sinrIn, uint32_t /*wfId*/) const
103 {
104  NS_LOG_FUNCTION(this << sinrIn);
105 
106  return m_channelEstimationError->AddError(sinrIn);
107 }
108 
114  uint32_t minWfId,
115  uint32_t maxWfId)
116 {
117  NS_LOG_FUNCTION(this);
118 
123  std::string filePathName;
124  std::string dataPath = Singleton<SatEnvVariables>::Get()->LocateDataDirectory();
125  Ptr<SatChannelEstimationError> ce;
126 
127  for (uint32_t i = minWfId; i <= maxWfId; ++i)
128  {
129  std::ostringstream ss;
130  ss << i;
131  filePathName = dataPath +
132  "/additional-input/sinrmeaserror/ChannelEstimationErrorRtnLinkWf_" +
133  ss.str() + ".txt";
134  ce = CreateObject<SatChannelEstimationError>(filePathName);
135  m_channelEstimationErrors.insert(std::make_pair(i, ce));
136  }
137 }
138 
140 {
141 }
142 
143 double
145 {
146  NS_LOG_FUNCTION(this << wf << sinrIn);
147 
149  {
150  return m_channelEstimationErrors.at(wf)->AddError(sinrIn);
151  }
152  else
153  {
154  NS_FATAL_ERROR("Non-supported waveform id: " << wf);
155  }
156  return 0.0;
157 }
158 
159 } // namespace ns3
virtual double DoAddError(double sinrInDb, uint32_t wfId) const =0
Pure virtual method for the implementation in derived classes.
virtual ~SatChannelEstimationErrorContainer()
Destructor for SatChannelEstimationErrorContainer.
double AddError(double sinrInDb, uint32_t wfId=0) const
Add channel estimation error to SINR.
virtual ~SatSimpleChannelEstimationErrorContainer()
Destructor for SatSimpleChannelEstimationErrorContainer.
virtual double DoAddError(double sinrInDb, uint32_t wfId) const
Simple channel estimation error does nothing to the SINR.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.