A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
minstrel-wifi-manager.cc
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 Duy Nguyen
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Duy Nguyen <duy@soe.ucsc.edu>
19  *
20  * Some Comments:
21  *
22  * 1) Segment Size is declared for completeness but not used because it has
23  * to do more with the requirement of the specific hardware.
24  *
25  * 2) By default, Minstrel applies the multi-rate retry(the core of Minstrel
26  * algorithm). Otherwise, please use ConstantRateWifiManager instead.
27  *
28  * http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel
29  */
30 
31 #include "minstrel-wifi-manager.h"
32 #include "wifi-phy.h"
33 #include "ns3/simulator.h"
34 #include "ns3/log.h"
35 #include "ns3/uinteger.h"
36 #include "ns3/double.h"
37 #include "ns3/wifi-mac.h"
38 #include "ns3/assert.h"
39 #include <vector>
40 
41 NS_LOG_COMPONENT_DEFINE ("MinstrelWifiManager");
42 
43 
44 namespace ns3 {
45 
46 
48 {
50 
57  uint32_t m_col, m_index;
58  uint32_t m_maxTpRate;
59  uint32_t m_maxTpRate2;
60  uint32_t m_maxProbRate;
61 
64 
65  bool m_isSampling;
66  uint32_t m_sampleRate;
68  uint32_t m_currentRate;
69 
70  uint32_t m_shortRetry;
71  uint32_t m_longRetry;
72  uint32_t m_retry;
73  uint32_t m_err;
74  uint32_t m_txrate;
75 
77 };
78 
79 NS_OBJECT_ENSURE_REGISTERED (MinstrelWifiManager);
80 
81 TypeId
82 MinstrelWifiManager::GetTypeId (void)
83 {
84  static TypeId tid = TypeId ("ns3::MinstrelWifiManager")
86  .AddConstructor<MinstrelWifiManager> ()
87  .AddAttribute ("UpdateStatistics",
88  "The interval between updating statistics table ",
89  TimeValue (Seconds (0.1)),
90  MakeTimeAccessor (&MinstrelWifiManager::m_updateStats),
91  MakeTimeChecker ())
92  .AddAttribute ("LookAroundRate",
93  "the percentage to try other rates",
94  DoubleValue (10),
95  MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate),
96  MakeDoubleChecker<double> ())
97  .AddAttribute ("EWMA",
98  "EWMA level",
99  DoubleValue (75),
100  MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel),
101  MakeDoubleChecker<double> ())
102  .AddAttribute ("SegmentSize",
103  "The largest allowable segment size packet",
104  DoubleValue (6000),
105  MakeDoubleAccessor (&MinstrelWifiManager::m_segmentSize),
106  MakeDoubleChecker <double> ())
107  .AddAttribute ("SampleColumn",
108  "The number of columns used for sampling",
109  DoubleValue (10),
110  MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol),
111  MakeDoubleChecker <double> ())
112  .AddAttribute ("PacketLength",
113  "The packet length used for calculating mode TxTime",
114  DoubleValue (1200),
115  MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen),
116  MakeDoubleChecker <double> ())
117  ;
118  return tid;
119 }
120 
121 MinstrelWifiManager::MinstrelWifiManager ()
122 {
123  m_uniformRandomVariable = CreateObject<UniformRandomVariable> ();
124 
125  m_nsupported = 0;
126 }
127 
128 MinstrelWifiManager::~MinstrelWifiManager ()
129 {
130 }
131 
132 void
133 MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy)
134 {
135  uint32_t nModes = phy->GetNModes ();
136  for (uint32_t i = 0; i < nModes; i++)
137  {
138  WifiMode mode = phy->GetMode (i);
139  AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, mode, WIFI_PREAMBLE_LONG));
140  }
141  WifiRemoteStationManager::SetupPhy (phy);
142 }
143 
144 int64_t
146 {
147  NS_LOG_FUNCTION (this << stream);
149  return 1;
150 }
151 
152 Time
154 {
155 
156  for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++)
157  {
158  if (mode == i->second)
159  {
160  return i->first;
161  }
162  }
163  NS_ASSERT (false);
164  return Seconds (0);
165 }
166 
167 void
168 MinstrelWifiManager::AddCalcTxTime (WifiMode mode, Time t)
169 {
170  m_calcTxTime.push_back (std::make_pair (t, mode));
171 }
172 
173 WifiRemoteStation *
175 {
177 
179  station->m_col = 0;
180  station->m_index = 0;
181  station->m_maxTpRate = 0;
182  station->m_maxTpRate2 = 0;
183  station->m_maxProbRate = 0;
184  station->m_packetCount = 0;
185  station->m_sampleCount = 0;
186  station->m_isSampling = false;
187  station->m_sampleRate = 0;
188  station->m_sampleRateSlower = false;
189  station->m_currentRate = 0;
190  station->m_shortRetry = 0;
191  station->m_longRetry = 0;
192  station->m_retry = 0;
193  station->m_err = 0;
194  station->m_txrate = 0;
195  station->m_initialized = false;
196 
197  return station;
198 }
199 
200 void
202 {
203  if (!station->m_initialized && GetNSupported (station) > 1)
204  {
205  // Note: we appear to be doing late initialization of the table
206  // to make sure that the set of supported rates has been initialized
207  // before we perform our own initialization.
208  m_nsupported = GetNSupported (station);
210  m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol));
211  InitSampleTable (station);
212  RateInit (station);
213  station->m_initialized = true;
214  }
215 }
216 
217 void
218 MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st,
219  double rxSnr, WifiMode txMode)
220 {
221  NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
222 }
223 
224 void
225 MinstrelWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
226 {
227  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
228  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
229 
230  station->m_shortRetry++;
231 }
232 
233 void
234 MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr)
235 {
236  NS_LOG_DEBUG ("self=" << st << " rts ok");
237 }
238 
239 void
240 MinstrelWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
241 {
242  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
243  UpdateRetry (station);
244  station->m_err++;
245 }
246 
247 void
249 {
267  CheckInit (station);
268  if (!station->m_initialized)
269  {
270  return;
271  }
272 
273  station->m_longRetry++;
274 
275  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
276 
278  if (!station->m_isSampling)
279  {
281  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
282  {
283  ;
284  }
285 
287  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
288  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
289  {
290  station->m_txrate = station->m_maxTpRate2;
291  }
292 
294  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
295  m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
296  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
297  {
298  station->m_txrate = station->m_maxProbRate;
299  }
300 
302  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
303  m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
304  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
305  {
306  station->m_txrate = 0;
307  }
308  }
309 
311  else
312  {
314  if (station->m_sampleRateSlower)
315  {
317  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
318  {
319  ;
320  }
321 
323  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
324  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
325  {
326  station->m_txrate = station->m_sampleRate;
327  }
328 
330  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
331  m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
332  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount ))
333  {
334  station->m_txrate = station->m_maxProbRate;
335  }
336 
338  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
339  m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
340  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
341  {
342  station->m_txrate = 0;
343  }
344  }
345 
347  else
348  {
350  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
351  {
352  ;
353  }
354 
356  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
357  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
358  {
359  station->m_txrate = station->m_maxTpRate;
360  }
361 
363  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
364  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
365  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
366  {
367  station->m_txrate = station->m_maxProbRate;
368  }
369 
371  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
372  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
373  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
374  {
375  station->m_txrate = 0;
376  }
377  }
378  }
379 }
380 
381 void
382 MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st,
383  double ackSnr, WifiMode ackMode, double dataSnr)
384 {
386 
387  station->m_isSampling = false;
388  station->m_sampleRateSlower = false;
389 
390  CheckInit (station);
391  if (!station->m_initialized)
392  {
393  return;
394  }
395 
396  m_minstrelTable[station->m_txrate].numRateSuccess++;
397  m_minstrelTable[station->m_txrate].numRateAttempt++;
398 
399  UpdateRetry (station);
400 
401  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
402  station->m_packetCount++;
403 
404  if (m_nsupported >= 1)
405  {
406  station->m_txrate = FindRate (station);
407  }
408 }
409 
410 void
411 MinstrelWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
412 {
413  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st;
414  NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate=" << station->m_txrate);
415 
416  station->m_isSampling = false;
417  station->m_sampleRateSlower = false;
418 
419  UpdateRetry (station);
420 
421  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
422  station->m_err++;
423 
424  if (m_nsupported >= 1)
425  {
426  station->m_txrate = FindRate (station);
427  }
428 }
429 
430 void
432 {
433  station->m_retry = station->m_shortRetry + station->m_longRetry;
434  station->m_shortRetry = 0;
435  station->m_longRetry = 0;
436 }
437 
438 WifiMode
440  uint32_t size)
441 {
443  if (!station->m_initialized)
444  {
445  CheckInit (station);
446 
448  station->m_txrate = m_nsupported / 2;
449  }
450  UpdateStats (station);
451  return GetSupported (station, station->m_txrate);
452 }
453 
454 WifiMode
456 {
458  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
459 
460  return GetSupported (station, 0);
461 }
462 
463 bool
465 {
466  return true;
467 }
468 uint32_t
470 {
471  uint32_t bitrate;
472  bitrate = m_sampleTable[station->m_index][station->m_col];
473  station->m_index++;
474 
476  if (station->m_index > (m_nsupported - 2))
477  {
478  station->m_index = 0;
479  station->m_col++;
480  if (station->m_col >= m_sampleCol)
481  {
482  station->m_col = 0;
483  }
484  }
485  return bitrate;
486 }
487 
488 uint32_t
490 {
491  NS_LOG_DEBUG ("FindRate " << "packet=" << station->m_packetCount );
492 
493  if ((station->m_sampleCount + station->m_packetCount) == 0)
494  {
495  return 0;
496  }
497 
498 
499  uint32_t idx;
500 
502  int coinFlip = m_uniformRandomVariable->GetInteger (0, 100) % 2;
503 
509  if ( (((100 * station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate)
510  && (coinFlip == 1) )
511  {
512 
514  idx = GetNextSample (station);
515 
516 
521  if (idx != station->m_maxTpRate && idx != station->m_txrate)
522  {
523 
525  station->m_sampleCount++;
526 
528  station->m_isSampling = true;
529 
531  if (station->m_packetCount >= 10000)
532  {
533  station->m_sampleCount = 0;
534  station->m_packetCount = 0;
535  }
536 
538  if (idx >= m_nsupported)
539  {
540  NS_LOG_DEBUG ("ALERT!!! ERROR");
541  }
542 
544  station->m_sampleRate = idx;
545 
546  if (station->m_sampleRate == station->m_maxTpRate)
547  {
548  station->m_sampleRate = station->m_maxTpRate2;
549  }
550 
552  station->m_sampleRateSlower =
553  (m_minstrelTable[idx].perfectTxTime > m_minstrelTable[station->m_maxTpRate].perfectTxTime);
554 
556  if (station->m_sampleRateSlower)
557  {
558  idx = station->m_maxTpRate;
559  }
560  }
561 
562  }
563 
565  else
566  {
567  idx = station->m_maxTpRate;
568  }
569 
570 
571  NS_LOG_DEBUG ("FindRate " << "sample rate=" << idx);
572 
573  return idx;
574 }
575 
576 void
578 {
579  if (Simulator::Now () < station->m_nextStatsUpdate)
580  {
581  return;
582  }
583 
584  if (!station->m_initialized)
585  {
586  return;
587  }
588  NS_LOG_DEBUG ("Updating stats=" << this);
589 
591 
592  Time txTime;
593  uint32_t tempProb;
594 
595  for (uint32_t i = 0; i < m_nsupported; i++)
596  {
597 
599  txTime = m_minstrelTable[i].perfectTxTime;
600 
602  if (txTime.GetMicroSeconds () == 0)
603  {
604  txTime = Seconds (1);
605  }
606 
607  NS_LOG_DEBUG ("m_txrate=" << station->m_txrate <<
608  "\t attempt=" << m_minstrelTable[i].numRateAttempt <<
609  "\t success=" << m_minstrelTable[i].numRateSuccess);
610 
612  if (m_minstrelTable[i].numRateAttempt)
613  {
618  tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt;
619 
621  m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess;
622  m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt;
623  m_minstrelTable[i].prob = tempProb;
624 
626  tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100);
627 
628  m_minstrelTable[i].ewmaProb = tempProb;
629 
631  m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ());
632 
633  }
634 
636  m_minstrelTable[i].prevNumRateAttempt = m_minstrelTable[i].numRateAttempt;
637  m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess;
638  m_minstrelTable[i].numRateSuccess = 0;
639  m_minstrelTable[i].numRateAttempt = 0;
640 
642  if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800))
643  {
648  m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1;
649  if (m_minstrelTable[i].adjustedRetryCount > 2)
650  {
651  m_minstrelTable[i].adjustedRetryCount = 2;
652  }
653  }
654  else
655  {
656  m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount;
657  }
658 
660  if (m_minstrelTable[i].adjustedRetryCount == 0)
661  {
662  m_minstrelTable[i].adjustedRetryCount = 1;
663  }
664  }
665 
666 
667  uint32_t max_prob = 0, index_max_prob = 0, max_tp = 0, index_max_tp = 0, index_max_tp2 = 0;
668 
670  for (uint32_t i = 0; i < m_nsupported; i++)
671  {
672  NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput <<
673  "\n ewma" << m_minstrelTable[i].ewmaProb);
674 
675  if (max_tp < m_minstrelTable[i].throughput)
676  {
677  index_max_tp = i;
678  max_tp = m_minstrelTable[i].throughput;
679  }
680 
681  if (max_prob < m_minstrelTable[i].ewmaProb)
682  {
683  index_max_prob = i;
684  max_prob = m_minstrelTable[i].ewmaProb;
685  }
686  }
687 
688 
689  max_tp = 0;
691  for (uint32_t i = 0; i < m_nsupported; i++)
692  {
693  if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput))
694  {
695  index_max_tp2 = i;
696  max_tp = m_minstrelTable[i].throughput;
697  }
698  }
699 
700  station->m_maxTpRate = index_max_tp;
701  station->m_maxTpRate2 = index_max_tp2;
702  station->m_maxProbRate = index_max_prob;
703  station->m_currentRate = index_max_tp;
704 
705  if (index_max_tp > station->m_txrate)
706  {
707  station->m_txrate = index_max_tp;
708  }
709 
710  NS_LOG_DEBUG ("max tp=" << index_max_tp << "\nmax tp2=" << index_max_tp2 << "\nmax prob=" << index_max_prob);
711 
713  RateInit (station);
714 }
715 
716 void
718 {
719  NS_LOG_DEBUG ("RateInit=" << station);
720 
721  for (uint32_t i = 0; i < m_nsupported; i++)
722  {
723  m_minstrelTable[i].numRateAttempt = 0;
724  m_minstrelTable[i].numRateSuccess = 0;
725  m_minstrelTable[i].prob = 0;
726  m_minstrelTable[i].ewmaProb = 0;
727  m_minstrelTable[i].prevNumRateAttempt = 0;
728  m_minstrelTable[i].prevNumRateSuccess = 0;
729  m_minstrelTable[i].successHist = 0;
730  m_minstrelTable[i].attemptHist = 0;
731  m_minstrelTable[i].throughput = 0;
732  m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i));
733  m_minstrelTable[i].retryCount = 1;
734  m_minstrelTable[i].adjustedRetryCount = 1;
735  }
736 }
737 
738 void
740 {
741  NS_LOG_DEBUG ("InitSampleTable=" << this);
742 
743  station->m_col = station->m_index = 0;
744 
746  uint32_t numSampleRates = m_nsupported;
747 
748  uint32_t newIndex;
749  for (uint32_t col = 0; col < m_sampleCol; col++)
750  {
751  for (uint32_t i = 0; i < numSampleRates; i++ )
752  {
753 
758  int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates);
759  newIndex = (i + uv) % numSampleRates;
760 
762  while (m_sampleTable[newIndex][col] != 0)
763  {
764  newIndex = (newIndex + 1) % m_nsupported;
765  }
766  m_sampleTable[newIndex][col] = i;
767 
768  }
769  }
770 }
771 
772 void
774 {
775  NS_LOG_DEBUG ("PrintSampleTable=" << station);
776 
777  uint32_t numSampleRates = m_nsupported;
778  for (uint32_t i = 0; i < numSampleRates; i++)
779  {
780  for (uint32_t j = 0; j < m_sampleCol; j++)
781  {
782  std::cout << m_sampleTable[i][j] << "\t";
783  }
784  std::cout << std::endl;
785  }
786 }
787 
788 void
790 {
791  NS_LOG_DEBUG ("PrintTable=" << station);
792 
793  for (uint32_t i = 0; i < m_nsupported; i++)
794  {
795  std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime << "\n";
796  }
797 }
798 
799 } // namespace ns3
800 
801 
802 
803 
804 
uint32_t m_nsupported
modes supported
void CheckInit(MinstrelWifiRemoteStation *station)
check for initializations
void PrintTable(MinstrelWifiRemoteStation *station)
printing Minstrel Table
keep track of time unit.
Definition: nstime.h:149
virtual WifiMode DoGetRtsMode(WifiRemoteStation *station)
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:311
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
virtual WifiMode DoGetDataMode(WifiRemoteStation *station, uint32_t size)
uint32_t GetInteger(uint32_t min, uint32_t max)
Returns a random unsigned integer from a uniform distribution over the interval [min,max] including both ends.
Implementation of Minstrel Rate Control AlgorithmPorting Minstrel from Madwifi and Linux Kernel http:...
Time m_updateStats
how frequent do we calculate the stats(1/10 seconds)
void UpdateStats(MinstrelWifiRemoteStation *station)
updating the Minstrel Table every 1/10 seconds
#define NS_ASSERT(condition)
Definition: assert.h:64
uint32_t m_segmentSize
largest allowable segment size
#define NS_LOG_COMPONENT_DEFINE(name)
Definition: log.h:122
uint32_t m_sampleRate
current sample rate
uint32_t GetNextSample(MinstrelWifiRemoteStation *station)
getting the next sample from Sample Table
uint32_t m_txrate
current transmit rate
SampleRate m_sampleTable
sample table
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:88
uint32_t FindRate(MinstrelWifiRemoteStation *station)
find a rate to use from Minstrel Table
uint32_t m_pktLen
packet length used for calculate mode TxTime
uint32_t m_currentRate
current rate we are using
bool m_isSampling
a flag to indicate we are currently sampling
int64_t GetMicroSeconds(void) const
Definition: nstime.h:279
int m_sampleCount
how many packets we have sample so far
hold objects of type ns3::Time
Definition: nstime.h:700
void PrintSampleTable(MinstrelWifiRemoteStation *station)
printing Sample Table
double m_ewmaLevel
exponential weighted moving average
virtual WifiRemoteStation * DoCreateStation(void) const
hold a list of per-remote-station state.
uint32_t m_longRetry
long retries such as data packets
bool m_initialized
for initializing tables
TxTime m_calcTxTime
to hold all the calculated TxTime for all modes
virtual bool IsLowLatency(void) const
int64_t AssignStreams(int64_t stream)
uint32_t m_maxTpRate2
second highest throughput rate
static Time Now(void)
Definition: simulator.cc:179
uint32_t m_retry
total retries short + long
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
void UpdateRetry(MinstrelWifiRemoteStation *station)
update the number of retries and reset accordingly
double m_lookAroundRate
the % to try other rates than our current rate
void InitSampleTable(MinstrelWifiRemoteStation *station)
initialize Sample Table
uint32_t m_maxProbRate
rate with highest prob of success
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Definition: nstime.h:586
uint32_t m_maxTpRate
the current throughput rate
#define NS_LOG_DEBUG(msg)
Definition: log.h:255
Time GetCalcTxTime(WifiMode mode) const
for estimating the TxTime of a packet with a given mode
virtual void DoReportDataFailed(WifiRemoteStation *station)
std::vector< struct RateInfo > MinstrelRate
uint32_t m_sampleCol
number of sample columns
uint32_t m_shortRetry
short retries such as control packts
Hold an floating point type.
Definition: double.h:41
bool m_sampleRateSlower
a flag to indicate sample rate is slower
int m_packetCount
total number of packets as of now
a unique identifier for an interface.
Definition: type-id.h:44
MinstrelRate m_minstrelTable
minstrel table
void RateInit(MinstrelWifiRemoteStation *station)
initialize Minstrel Table
TypeId SetParent(TypeId tid)
Definition: type-id.cc:471
std::vector< std::vector< uint32_t > > SampleRate
hold per-remote-station state.
Time m_nextStatsUpdate
10 times every second