26 #include <ns3/double.h>
27 #include <ns3/fatal-error.h>
35 NS_LOG_COMPONENT_DEFINE(
"SatMutualInformationTable");
40 NS_OBJECT_ENSURE_REGISTERED(SatMutualInformationTable);
45 NS_LOG_FUNCTION(
this << mutualInformationPath);
46 Load(mutualInformationPath);
51 NS_LOG_FUNCTION(
this);
57 NS_LOG_FUNCTION(
this);
79 static TypeId tid = TypeId(
"ns3::SatMutualInformationTable")
82 "The adjusting factor for the MI function",
85 MakeDoubleChecker<double>());
92 NS_LOG_FUNCTION(
this << snirDb);
93 NS_LOG_INFO(
"SatMutualInformationTable::GetNormalizedSymbolInformation - SNIR dB=" << snirDb);
103 NS_LOG_INFO(
this <<
" Very low SNIR -> Symbol Information = 0.0");
109 while ((i < n) && (snirDb >
m_snirDb[i]))
114 NS_LOG_DEBUG(
this <<
" i=" << i <<
" snir[i]=" <<
m_snirDb[i]
120 NS_LOG_INFO(
this <<
" Very high SNIR -> Symbol Information = 1.0");
129 double snir = snirDb;
137 NS_LOG_INFO(
this <<
" Interpolate: " << snir <<
" to Symbol Information = "
138 << symbolInformation <<
"(snir0: " << snir0 <<
", snir1: " << snir1
142 return symbolInformation;
150 NS_LOG_FUNCTION(
this << symbolInformationTarget);
151 NS_LOG_INFO(
"SatMutualInformationTable::GetSnirDb - Symbol Information Target="
152 << symbolInformationTarget);
163 NS_LOG_INFO(
"SatMutualInformationTable::GetSnirDb - SNIR dB=" << -1.0e10);
169 if (symbolInformationTarget > 1.0)
171 NS_FATAL_ERROR(
"The Symbol Information target is set to be too high!");
178 NS_LOG_INFO(
"SatMutualInformationTable::GetSnirDb - SNIR dB=" <<
m_snirDb[n - 1]);
184 for (uint32_t i = 0; i < n; ++i)
193 NS_LOG_INFO(
this <<
" Interpolate: " << symbolInformationTarget <<
" to snir = " << snir
207 NS_LOG_FUNCTION(
this << mutualInformationPath);
211 m_ifs =
new std::ifstream(mutualInformationPath.c_str(), std::ifstream::in);
213 if (!
m_ifs->is_open())
217 mutualInformationPath =
"../../" + mutualInformationPath;
218 m_ifs =
new std::ifstream(mutualInformationPath.c_str(), std::ifstream::in);
220 if (!
m_ifs->is_open())
222 NS_FATAL_ERROR(
"The file " << mutualInformationPath <<
" is not found.");
226 double lastSnirDb = -100.0;
227 double lastSymbolInformation = 0.0;
229 double snirDb, symbolInformation;
230 *
m_ifs >> snirDb >> symbolInformation;
232 while (
m_ifs->good())
234 NS_LOG_DEBUG(
this <<
" snirDb=" << snirDb <<
", symbolInformation=" << symbolInformation);
237 if ((snirDb <= lastSnirDb) || (symbolInformation < lastSymbolInformation))
239 NS_FATAL_ERROR(
"The file " << mutualInformationPath <<
" is not properly sorted.");
246 lastSymbolInformation = symbolInformation;
249 *
m_ifs >> snirDb >> symbolInformation;
261 NS_FATAL_ERROR(
"Error reading data from file " << mutualInformationPath <<
".");
static double Interpolate(double x, double x0, double x1, double y0, double y1)
Simple linear interpolation.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.