32 #include "ns3/double.h"
48 .SetGroupName (
"Internet")
49 .AddAttribute (
"InitialEstimation",
50 "Initial RTT estimate",
88 m_initialEstimatedRtt (c.m_initialEstimatedRtt),
89 m_estimatedRtt (c.m_estimatedRtt),
90 m_estimatedVariation (c.m_estimatedVariation),
91 m_nSamples (c.m_nSamples)
133 .SetGroupName (
"Internet")
135 .AddAttribute (
"Alpha",
136 "Gain used in estimating the RTT, must be 0 <= alpha <= 1",
139 MakeDoubleChecker<double> (0, 1))
140 .AddAttribute (
"Beta",
141 "Gain used in estimating the RTT variation, must be 0 <= beta <= 1",
144 MakeDoubleChecker<double> (0, 1))
155 :
RttEstimator (c), m_alpha (c.m_alpha), m_beta (c.m_beta)
175 if (std::abs (1/val - 8) < TOLERANCE)
179 if (std::abs (1/val - 4) < TOLERANCE)
183 if (std::abs (1/val - 32) < TOLERANCE)
187 if (std::abs (1/val - 16) < TOLERANCE)
191 if (std::abs (1/val - 2) < TOLERANCE)
250 if (rttShift && variationShift)
263 NS_LOG_DEBUG (
"(first sample) m_estimatedVariation += " << m);
272 return CopyObject<RttMeanDeviation> (
this);
Simulation virtual time values and global simulation resolution.
uint32_t GetNSamples(void) const
gets the number of samples used in the estimates
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static TypeId GetTypeId(void)
Get the type ID.
double m_alpha
Filter gain for average.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void IntegerUpdate(Time m, uint32_t rttShift, uint32_t variationShift)
Method to update the rtt and variation estimates using integer arithmetic, used when the values of Al...
The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson.
static Time From(const int64x64_t &value)
Create a Time in the current unit.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static TypeId GetTypeId(void)
Get the type ID.
Time m_initialEstimatedRtt
Initial RTT estimation.
virtual TypeId GetInstanceTypeId(void) const
Implement the GetInstanceTypeId method defined in ObjectBase.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
double ToDouble(enum Unit unit) const
Get the Time value expressed in a particular unit.
Base class for all RTT Estimators.
List of Attribute name, value and checker triples used to construct Objects.
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Time m_estimatedRtt
Current estimate.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetVariation(void) const
Note that this is not a formal statistical variance; it has the the same units as the estimate...
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
uint32_t m_nSamples
Number of samples.
int64_t GetInteger(void) const
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void Reset()
Resets the estimation to its initial state.
void Reset()
Resets the estimator.
double m_beta
Filter gain for variation.
void FloatingPointUpdate(Time m)
Method to update the rtt and variation estimates using floating point arithmetic, used when the value...
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static Time FromDouble(double value, enum Unit unit)
Create a Time equal to value in unit unit.
Ptr< RttEstimator > Copy() const
Copy object (including current internal state)
void Measurement(Time measure)
Add a new measurement to the estimator.
virtual TypeId GetInstanceTypeId(void) const
Implement the GetInstanceTypeId method defined in ObjectBase.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
static const double TOLERANCE
Time GetEstimate(void) const
gets the RTT estimate.
A base class which provides memory management and object aggregation.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Time m_estimatedVariation
Current estimate variation.
uint32_t CheckForReciprocalPowerOfTwo(double val) const
Utility function to check for possible conversion of a double value (0 < value < 1) to a reciprocal p...