29 #include "ns3/simulator.h" 30 #include "ns3/double.h" 31 #include "ns3/integer.h" 32 #include "ns3/uinteger.h" 35 NS_LOG_COMPONENT_DEFINE(
"ndn.RttMeanDeviation");
49 TypeId(
"ns3::ndn::RttMeanDeviation")
51 .AddConstructor<RttMeanDeviation>()
52 .AddAttribute(
"Gain",
"Gain used in estimating the RTT (smoothed RTT), must be 0 < Gain < 1",
53 DoubleValue(0.125), MakeDoubleAccessor(&RttMeanDeviation::m_gain),
54 MakeDoubleChecker<double>())
55 .AddAttribute(
"Gain2",
"Gain2 used in estimating the RTT (variance), must be 0 < Gain2 < 1",
56 DoubleValue(0.25), MakeDoubleAccessor(&RttMeanDeviation::m_gain2),
57 MakeDoubleChecker<double>());
64 NS_LOG_FUNCTION(
this);
71 , m_variance(c.m_variance)
73 NS_LOG_FUNCTION(
this);
85 NS_LOG_FUNCTION(
this << m);
88 double gErr = err.ToDouble(Time::S) * m_gain;
90 Time difference = Abs(err) - m_variance;
92 "m_variance += " << Time::FromDouble(difference.ToDouble(Time::S) * m_gain2, Time::S));
93 m_variance += Time::FromDouble(difference.ToDouble(Time::S) * m_gain2, Time::S);
99 m_variance = Seconds(m.ToDouble(Time::S) / 2);
100 NS_LOG_DEBUG(
"(first sample) m_variance += " << m);
108 NS_LOG_FUNCTION(
this);
110 double retval = std::min(
m_maxRto.ToDouble(Time::S),
113 + 4 * m_variance.ToDouble(Time::S))));
115 NS_LOG_DEBUG(
"RetransmitTimeout: return " << retval);
117 return Seconds(retval);
123 NS_LOG_FUNCTION(
this);
124 return CopyObject<RttMeanDeviation>(
this);
130 NS_LOG_FUNCTION(
this);
132 m_variance = Seconds(0);
139 NS_LOG_FUNCTION(
this);
140 NS_ASSERT_MSG((g > 0) && (g < 1),
141 "RttMeanDeviation: Gain must be less than 1 and greater than 0");
148 NS_LOG_FUNCTION(
this << seq << size);
166 NS_LOG_FUNCTION(
this << ackSeq);
170 Time m = Seconds(0.0);
175 if (ackSeq == i->seq) {
177 m = Simulator::Now() - i->time;
void SentSeq(SequenceNumber32 seq, uint32_t size)
Note that a particular sequence has been sent.
Copyright (c) 2011-2015 Regents of the University of California.
The modified version of "Mean--Deviation" RTT estimator, as discussed by Van Jacobson that better sui...
Ptr< RttEstimator > Copy() const
NS_OBJECT_ENSURE_REGISTERED(ContentStore)
Time RetransmitTimeout()
Returns the estimated RTO.
virtual void Reset()
Resets the estimation to its initial state.
virtual TypeId GetInstanceTypeId(void) const
void Reset()
Resets the estimation to its initial state.
Table::const_iterator iterator
virtual void ResetMultiplier()
Resets the estimation multiplier to 1.
Copyright (c) 2011-2015 Regents of the University of California.
Time AckSeq(SequenceNumber32 ackSeq)
Note that a particular ack sequence has been received.
static TypeId GetTypeId(void)
Base class for all RTT Estimators.
Helper class to store RTT measurements.
Time m_currentEstimatedRtt
void Measurement(Time measure)
Add a new measurement to the estimator.