Loading...
Searching...
No Matches
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
24
25#include "ns3/log.h"
26#include "ns3/singleton.h"
27
28#include <sstream>
29#include <string>
30#include <utility>
31
32NS_LOG_COMPONENT_DEFINE("SatFwdLinkChannelEstimationErrorContainer");
33
34namespace ns3
35{
36
40
45
49
50double
51SatChannelEstimationErrorContainer::AddError(double sinrIn, uint32_t wfId) const
52{
53 NS_LOG_FUNCTION(this << sinrIn << wfId);
54
55 return DoAddError(sinrIn, wfId);
56}
57
61
66
70
71double
72SatSimpleChannelEstimationErrorContainer::DoAddError(double sinrIn, uint32_t /*wfId*/) const
73{
74 NS_LOG_FUNCTION(this << sinrIn);
75
76 return sinrIn;
77}
78
82
84{
85 NS_LOG_FUNCTION(this);
86
91 std::string dataPath = SatEnvVariables::GetInstance()->LocateDataDirectory();
92 std::string filePathName =
93 dataPath + "/additional-input/sinrmeaserror/ChannelEstimationErrorFwdLink.txt";
94 m_channelEstimationError = CreateObject<SatChannelEstimationError>(filePathName);
95}
96
100
101double
102SatFwdLinkChannelEstimationErrorContainer::DoAddError(double sinrIn, uint32_t /*wfId*/) const
103{
104 NS_LOG_FUNCTION(this << sinrIn);
105
106 return m_channelEstimationError->AddError(sinrIn);
107}
108
112
114 uint32_t minWfId,
115 uint32_t maxWfId)
116{
117 NS_LOG_FUNCTION(this);
118
123 std::string filePathName;
124 std::string dataPath = SatEnvVariables::GetInstance()->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
142
143double
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.
static Ptr< SatEnvVariables > GetInstance()
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.