24 #include <ns3/simulator.h>
32 NS_LOG_COMPONENT_DEFINE(
"SatCnoEstimator");
46 NS_LOG_FUNCTION(
this);
51 NS_LOG_FUNCTION(
this);
57 NS_LOG_FUNCTION(
this << sample);
65 NS_LOG_FUNCTION(
this);
75 NS_LOG_FUNCTION(
this);
83 NS_LOG_FUNCTION(
this);
88 NS_LOG_FUNCTION(
this);
94 NS_LOG_FUNCTION(
this << sample);
100 m_samples.insert(std::make_pair(Simulator::Now(), sample));
105 m_samples.insert(std::make_pair(Simulator::Now(), sample));
110 m_samples.insert(std::make_pair(Simulator::Now(), sample));
114 NS_FATAL_ERROR(
"Not supported estimation mode!!!");
122 NS_LOG_FUNCTION(
this);
124 double estimatedCno = NAN;
133 estimatedCno =
m_samples.begin()->second;
139 if (std::isnan(estimatedCno) ||
140 ((!std::isnan(it->second)) && (it->second < estimatedCno)))
142 estimatedCno = it->second;
148 estimatedCno = std::accumulate(
m_samples.begin(),
156 NS_FATAL_ERROR(
"Not supported estimation mode!!!");
167 NS_LOG_FUNCTION(
this);
168 SampleMap_t::iterator itLastValid =
m_samples.lower_bound(Simulator::Now() -
m_window);
void ClearOutdatedSamples()
Clear outdated samples from storage.
static double AddToSum(double currentSum, const std::pair< Time, double > &sample)
Method to add a sample value to current sum.
virtual void DoAddSample(double cno)
Add a C/N0 sample to estimator.
SatBasicCnoEstimator()
Default construct a SatCnoEstimator.
~SatBasicCnoEstimator()
Destroy a SatCnoEstimator.
virtual double DoGetCnoEstimation()
Estimate C/N0 value of the samples in window.
double GetCnoEstimation()
Estimate C/N0 value of the samples.
virtual void DoAddSample(double cno)=0
Add a C/N0 sample to estimator.
virtual double DoGetCnoEstimation()=0
Estimate C/N0 value of the samples.
EstimationMode_t
Definition of modes for estimator.
@ MINIMUM
Minimum value in the given window returned.
@ LAST
Last value in the given window returned.
@ AVERAGE
Average value in the given window returned.
virtual ~SatCnoEstimator()
Destroy a SatCnoEstimator.
void AddSample(double cno)
Add a C/N0 sample to estimator.
SatCnoEstimator()
Default construct a SatCnoEstimator.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.