26 #include <ns3/simulator.h>
36 NS_LOG_COMPONENT_DEFINE(
"SatFadingExternalInputTrace");
47 "SatFadingExternalInputTrace::SatFadingExternalInputTrace - Constructor not in use");
54 NS_LOG_FUNCTION(
this);
62 NS_LOG_FUNCTION(
this);
68 NS_LOG_FUNCTION(
this << filePathName);
71 std::ifstream* ifs =
new std::ifstream(filePathName.c_str(), std::ios::in | std::ios::binary);
77 filePathName =
"../../" + filePathName;
78 ifs =
new std::ifstream(filePathName.c_str(), std::ifstream::in);
82 NS_FATAL_ERROR(
"The file " << filePathName <<
" is not found.");
91 std::vector<float> values;
92 ifs->read((
char*)&temp,
sizeof(
float));
99 values.push_back(temp);
103 ifs->read((
char*)&temp,
sizeof(
float));
106 if (count % columns == 0)
108 NS_ASSERT(values.size() == columns);
127 NS_LOG_FUNCTION(
this);
130 float simTime = Simulator::Now().GetSeconds();
134 NS_LOG_ERROR(
this <<
" requested time is smaller than the minimum time value!");
142 NS_LOG_ERROR(
this <<
" calculated index exceeds trace file size!");
153 double fading = lowerVal + (upperVal - lowerVal) * (simTime - lowerKey) / (upperKey - lowerKey);
170 NS_LOG_FUNCTION(
this);
173 std::vector<std::vector<float>>::const_iterator cit;
174 float prevTime(-1.0);
175 float currTime(-1.0);
182 double diff = std::abs(std::abs(currTime - prevTime) -
m_timeInterval);
186 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.