21 #include "aarf-wifi-manager.h"
23 #include "ns3/double.h"
24 #include "ns3/uinteger.h"
27 #define Min(a,b) ((a < b) ? a : b)
28 #define Max(a,b) ((a > b) ? a : b)
42 uint32_t m_timerTimeout;
43 uint32_t m_successThreshold;
52 AarfWifiManager::GetTypeId (
void)
56 .AddConstructor<AarfWifiManager> ()
57 .AddAttribute (
"SuccessK",
"Multiplication factor for the success threshold in the AARF algorithm.",
59 MakeDoubleAccessor (&AarfWifiManager::m_successK),
60 MakeDoubleChecker<double> ())
61 .AddAttribute (
"TimerK",
62 "Multiplication factor for the timer threshold in the AARF algorithm.",
64 MakeDoubleAccessor (&AarfWifiManager::m_timerK),
65 MakeDoubleChecker<double> ())
66 .AddAttribute (
"MaxSuccessThreshold",
67 "Maximum value of the success threshold in the AARF algorithm.",
69 MakeUintegerAccessor (&AarfWifiManager::m_maxSuccessThreshold),
70 MakeUintegerChecker<uint32_t> ())
71 .AddAttribute (
"MinTimerThreshold",
72 "The minimum value for the 'timer' threshold in the AARF algorithm.",
74 MakeUintegerAccessor (&AarfWifiManager::m_minTimerThreshold),
75 MakeUintegerChecker<uint32_t> ())
76 .AddAttribute (
"MinSuccessThreshold",
77 "The minimum value for the success threshold in the AARF algorithm.",
79 MakeUintegerAccessor (&AarfWifiManager::m_minSuccessThreshold),
80 MakeUintegerChecker<uint32_t> ())
85 AarfWifiManager::AarfWifiManager ()
89 AarfWifiManager::~AarfWifiManager ()
100 station->m_successThreshold = m_minSuccessThreshold;
101 station->m_timerTimeout = m_minTimerThreshold;
103 station->m_success = 0;
104 station->m_failed = 0;
105 station->m_recovery =
false;
106 station->m_retry = 0;
107 station->m_timer = 0;
134 station->m_success = 0;
136 if (station->m_recovery)
139 if (station->m_retry == 1)
142 station->m_successThreshold = (int)(Min (station->m_successThreshold * m_successK,
143 m_maxSuccessThreshold));
144 station->m_timerTimeout = (int)(Max (station->m_timerTimeout * m_timerK,
145 m_minSuccessThreshold));
146 if (station->m_rate != 0)
151 station->m_timer = 0;
156 if (((station->m_retry - 1) % 2) == 1)
159 station->m_timerTimeout = m_minTimerThreshold;
160 station->m_successThreshold = m_minSuccessThreshold;
161 if (station->m_rate != 0)
166 if (station->m_retry >= 2)
168 station->m_timer = 0;
179 AarfWifiManager::DoReportRtsOk (WifiRemoteStation *station,
180 double ctsSnr, WifiMode ctsMode,
double rtsSnr)
186 AarfWifiManager::DoReportDataOk (WifiRemoteStation *st,
187 double ackSnr, WifiMode ackMode,
double dataSnr)
190 AarfWifiRemoteStation *station = (AarfWifiRemoteStation *) st;
192 station->m_success++;
193 station->m_failed = 0;
194 station->m_recovery =
false;
195 station->m_retry = 0;
196 NS_LOG_DEBUG (
"station=" << station <<
" data ok success=" << station->m_success <<
", timer=" << station->m_timer);
197 if ((station->m_success == station->m_successThreshold
198 || station->m_timer == station->m_timerTimeout)
199 && (station->m_rate < (GetNSupported (station) - 1)))
203 station->m_timer = 0;
204 station->m_success = 0;
205 station->m_recovery =
true;
209 AarfWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station)
214 AarfWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
224 return GetSupported (station, station->m_rate);
233 return GetSupported (station, 0);
#define NS_LOG_FUNCTION(parameters)
#define NS_ASSERT(condition)
virtual WifiMode DoGetDataMode(WifiRemoteStation *station, uint32_t size)
#define NS_LOG_COMPONENT_DEFINE(name)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual void DoReportDataFailed(WifiRemoteStation *station)
Hold an unsigned integer type.
virtual bool IsLowLatency(void) const
hold a list of per-remote-station state.
AARF Rate control algorithmThis class implements the AARF rate control algorithm which was initially ...
#define NS_LOG_DEBUG(msg)
Hold an floating point type.
virtual WifiRemoteStation * DoCreateStation(void) const
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
hold per-remote-station state.
virtual WifiMode DoGetRtsMode(WifiRemoteStation *station)