26 #include <ns3/simulator.h>
31 NS_LOG_COMPONENT_DEFINE(
"SatFadingExternalInputTrace");
42 "SatFadingExternalInputTrace::SatFadingExternalInputTrace - Constructor not in use");
49 NS_LOG_FUNCTION(
this);
57 NS_LOG_FUNCTION(
this);
63 NS_LOG_FUNCTION(
this << filePathName);
66 std::ifstream* ifs =
new std::ifstream(filePathName.c_str(), std::ios::in | std::ios::binary);
72 filePathName =
"../../" + filePathName;
73 ifs =
new std::ifstream(filePathName.c_str(), std::ifstream::in);
77 NS_FATAL_ERROR(
"The file " << filePathName <<
" is not found.");
86 std::vector<float> values;
87 ifs->read((
char*)&temp,
sizeof(
float));
94 values.push_back(temp);
98 ifs->read((
char*)&temp,
sizeof(
float));
101 if (count % columns == 0)
103 NS_ASSERT(values.size() == columns);
122 NS_LOG_FUNCTION(
this);
125 float simTime = Simulator::Now().GetSeconds();
129 NS_LOG_ERROR(
this <<
" requested time is smaller than the minimum time value!");
137 NS_LOG_ERROR(
this <<
" calculated index exceeds trace file size!");
148 double fading = lowerVal + (upperVal - lowerVal) * (simTime - lowerKey) / (upperKey - lowerKey);
165 NS_LOG_FUNCTION(
this);
168 std::vector<std::vector<float>>::const_iterator cit;
169 float prevTime(-1.0);
170 float currTime(-1.0);
177 double diff = std::abs(std::abs(currTime - prevTime) -
m_timeInterval);
181 if (diff > 0.0003 || currTime < prevTime)
static T DbToLinear(T db)
Converts decibels to linear.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.