26 #include <ns3/double.h>
27 #include <ns3/fatal-error.h>
32 NS_LOG_COMPONENT_DEFINE(
"SatMutualInformationTable");
37 NS_OBJECT_ENSURE_REGISTERED(SatMutualInformationTable);
42 NS_LOG_FUNCTION(
this << mutualInformationPath);
43 Load(mutualInformationPath);
48 NS_LOG_FUNCTION(
this);
54 NS_LOG_FUNCTION(
this);
76 static TypeId tid = TypeId(
"ns3::SatMutualInformationTable")
79 "The adjusting factor for the MI function",
82 MakeDoubleChecker<double>());
89 NS_LOG_FUNCTION(
this << snirDb);
90 NS_LOG_INFO(
"SatMutualInformationTable::GetNormalizedSymbolInformation - SNIR dB=" << snirDb);
100 NS_LOG_INFO(
this <<
" Very low SNIR -> Symbol Information = 0.0");
106 while ((i < n) && (snirDb >
m_snirDb[i]))
111 NS_LOG_DEBUG(
this <<
" i=" << i <<
" snir[i]=" <<
m_snirDb[i]
117 NS_LOG_INFO(
this <<
" Very high SNIR -> Symbol Information = 1.0");
126 double snir = snirDb;
134 NS_LOG_INFO(
this <<
" Interpolate: " << snir <<
" to Symbol Information = "
135 << symbolInformation <<
"(snir0: " << snir0 <<
", snir1: " << snir1
139 return symbolInformation;
147 NS_LOG_FUNCTION(
this << symbolInformationTarget);
148 NS_LOG_INFO(
"SatMutualInformationTable::GetSnirDb - Symbol Information Target="
149 << symbolInformationTarget);
160 NS_LOG_INFO(
"SatMutualInformationTable::GetSnirDb - SNIR dB=" << -1.0e10);
166 if (symbolInformationTarget > 1.0)
168 NS_FATAL_ERROR(
"The Symbol Information target is set to be too high!");
175 NS_LOG_INFO(
"SatMutualInformationTable::GetSnirDb - SNIR dB=" <<
m_snirDb[n - 1]);
181 for (uint32_t i = 0; i < n; ++i)
190 NS_LOG_INFO(
this <<
" Interpolate: " << symbolInformationTarget <<
" to snir = " << snir
204 NS_LOG_FUNCTION(
this << mutualInformationPath);
208 m_ifs =
new std::ifstream(mutualInformationPath.c_str(), std::ifstream::in);
210 if (!
m_ifs->is_open())
214 mutualInformationPath =
"../../" + mutualInformationPath;
215 m_ifs =
new std::ifstream(mutualInformationPath.c_str(), std::ifstream::in);
217 if (!
m_ifs->is_open())
219 NS_FATAL_ERROR(
"The file " << mutualInformationPath <<
" is not found.");
223 double lastSnirDb = -100.0;
224 double lastSymbolInformation = 0.0;
226 double snirDb, symbolInformation;
227 *
m_ifs >> snirDb >> symbolInformation;
229 while (
m_ifs->good())
231 NS_LOG_DEBUG(
this <<
" snirDb=" << snirDb <<
", symbolInformation=" << symbolInformation);
234 if ((snirDb <= lastSnirDb) || (symbolInformation < lastSymbolInformation))
236 NS_FATAL_ERROR(
"The file " << mutualInformationPath <<
" is not properly sorted.");
243 lastSymbolInformation = symbolInformation;
246 *
m_ifs >> snirDb >> symbolInformation;
258 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.