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 
31 NS_LOG_COMPONENT_DEFINE("SatFwdLinkChannelEstimationErrorContainer");
32 
33 namespace ns3
34 {
35 
41 {
42  NS_LOG_FUNCTION(this);
43 }
44 
46 {
47 }
48 
49 double
50 SatChannelEstimationErrorContainer::AddError(double sinrIn, uint32_t wfId) const
51 {
52  NS_LOG_FUNCTION(this << sinrIn << wfId);
53 
54  return DoAddError(sinrIn, wfId);
55 }
56 
62 {
63  NS_LOG_FUNCTION(this);
64 }
65 
67 {
68 }
69 
70 double
71 SatSimpleChannelEstimationErrorContainer::DoAddError(double sinrIn, uint32_t /*wfId*/) const
72 {
73  NS_LOG_FUNCTION(this << sinrIn);
74 
75  return sinrIn;
76 }
77 
83 {
84  NS_LOG_FUNCTION(this);
85 
90  std::string dataPath = Singleton<SatEnvVariables>::Get()->LocateDataDirectory();
91  std::string filePathName = dataPath + "/sinrmeaserror/ChannelEstimationErrorFwdLink.txt";
92  m_channelEstimationError = CreateObject<SatChannelEstimationError>(filePathName);
93 }
94 
96 {
97 }
98 
99 double
100 SatFwdLinkChannelEstimationErrorContainer::DoAddError(double sinrIn, uint32_t /*wfId*/) const
101 {
102  NS_LOG_FUNCTION(this << sinrIn);
103 
104  return m_channelEstimationError->AddError(sinrIn);
105 }
106 
112  uint32_t minWfId,
113  uint32_t maxWfId)
114 {
115  NS_LOG_FUNCTION(this);
116 
121  std::string filePathName;
122  std::string dataPath = Singleton<SatEnvVariables>::Get()->LocateDataDirectory();
123  Ptr<SatChannelEstimationError> ce;
124 
125  for (uint32_t i = minWfId; i <= maxWfId; ++i)
126  {
127  std::ostringstream ss;
128  ss << i;
129  filePathName =
130  dataPath + "/sinrmeaserror/ChannelEstimationErrorRtnLinkWf_" + ss.str() + ".txt";
131  ce = CreateObject<SatChannelEstimationError>(filePathName);
132  m_channelEstimationErrors.insert(std::make_pair(i, ce));
133  }
134 }
135 
137 {
138 }
139 
140 double
142 {
143  NS_LOG_FUNCTION(this << wf << sinrIn);
144 
146  {
147  return m_channelEstimationErrors.at(wf)->AddError(sinrIn);
148  }
149  else
150  {
151  NS_FATAL_ERROR("Non-supported waveform id: " << wf);
152  }
153  return 0.0;
154 }
155 
156 } // 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.