24 #include <ns3/simulator.h>
29 NS_LOG_COMPONENT_DEFINE(
"SatCnoEstimator");
43 NS_LOG_FUNCTION(
this);
48 NS_LOG_FUNCTION(
this);
54 NS_LOG_FUNCTION(
this << sample);
62 NS_LOG_FUNCTION(
this);
72 NS_LOG_FUNCTION(
this);
80 NS_LOG_FUNCTION(
this);
85 NS_LOG_FUNCTION(
this);
91 NS_LOG_FUNCTION(
this << sample);
97 m_samples.insert(std::make_pair(Simulator::Now(), sample));
102 m_samples.insert(std::make_pair(Simulator::Now(), sample));
107 m_samples.insert(std::make_pair(Simulator::Now(), sample));
111 NS_FATAL_ERROR(
"Not supported estimation mode!!!");
119 NS_LOG_FUNCTION(
this);
121 double estimatedCno = NAN;
130 estimatedCno =
m_samples.begin()->second;
136 if (std::isnan(estimatedCno) ||
137 ((!std::isnan(it->second)) && (it->second < estimatedCno)))
139 estimatedCno = it->second;
145 estimatedCno = std::accumulate(
m_samples.begin(),
153 NS_FATAL_ERROR(
"Not supported estimation mode!!!");
164 NS_LOG_FUNCTION(
this);
165 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.