A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
minstrel-wifi-manager.cc
Go to the documentation of this file.
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 #define Min(a,b) ((a < b) ? a : b)
42 
43 NS_LOG_COMPONENT_DEFINE ("MinstrelWifiManager");
44 
45 
46 namespace ns3 {
47 
48 
50 {
52 
59  uint32_t m_col, m_index;
60  uint32_t m_maxTpRate;
61  uint32_t m_maxTpRate2;
62  uint32_t m_maxProbRate;
63 
66 
67  bool m_isSampling;
68  uint32_t m_sampleRate;
70  uint32_t m_currentRate;
71 
72  uint32_t m_shortRetry;
73  uint32_t m_longRetry;
74  uint32_t m_retry;
75  uint32_t m_err;
76  uint32_t m_txrate;
77 
79 };
80 
82 
83 TypeId
85 {
86  static TypeId tid = TypeId ("ns3::MinstrelWifiManager")
88  .AddConstructor<MinstrelWifiManager> ()
89  .AddAttribute ("UpdateStatistics",
90  "The interval between updating statistics table ",
91  TimeValue (Seconds (0.1)),
92  MakeTimeAccessor (&MinstrelWifiManager::m_updateStats),
93  MakeTimeChecker ())
94  .AddAttribute ("LookAroundRate",
95  "the percentage to try other rates",
96  DoubleValue (10),
97  MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate),
98  MakeDoubleChecker<double> ())
99  .AddAttribute ("EWMA",
100  "EWMA level",
101  DoubleValue (75),
102  MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel),
103  MakeDoubleChecker<double> ())
104  .AddAttribute ("SampleColumn",
105  "The number of columns used for sampling",
106  DoubleValue (10),
107  MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol),
108  MakeDoubleChecker <double> ())
109  .AddAttribute ("PacketLength",
110  "The packet length used for calculating mode TxTime",
111  DoubleValue (1200),
112  MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen),
113  MakeDoubleChecker <double> ())
114  ;
115  return tid;
116 }
117 
119 {
120  m_uniformRandomVariable = CreateObject<UniformRandomVariable> ();
121 
122  m_nsupported = 0;
123 }
124 
126 {
127 }
128 
129 void
131 {
132  uint32_t nModes = phy->GetNModes ();
133  for (uint32_t i = 0; i < nModes; i++)
134  {
135  WifiMode mode = phy->GetMode (i);
136  WifiTxVector txVector;
137  txVector.SetMode(mode);
139  }
141 }
142 
143 int64_t
145 {
146  NS_LOG_FUNCTION (this << stream);
148  return 1;
149 }
150 
151 Time
153 {
154 
155  for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++)
156  {
157  if (mode == i->second)
158  {
159  return i->first;
160  }
161  }
162  NS_ASSERT (false);
163  return Seconds (0);
164 }
165 
166 void
168 {
169  m_calcTxTime.push_back (std::make_pair (t, mode));
170 }
171 
174 {
176 
178  station->m_col = 0;
179  station->m_index = 0;
180  station->m_maxTpRate = 0;
181  station->m_maxTpRate2 = 0;
182  station->m_maxProbRate = 0;
183  station->m_packetCount = 0;
184  station->m_sampleCount = 0;
185  station->m_isSampling = false;
186  station->m_sampleRate = 0;
187  station->m_sampleRateSlower = false;
188  station->m_currentRate = 0;
189  station->m_shortRetry = 0;
190  station->m_longRetry = 0;
191  station->m_retry = 0;
192  station->m_err = 0;
193  station->m_txrate = 0;
194  station->m_initialized = false;
195 
196  return station;
197 }
198 
199 void
201 {
202  if (!station->m_initialized && GetNSupported (station) > 1)
203  {
204  // Note: we appear to be doing late initialization of the table
205  // to make sure that the set of supported rates has been initialized
206  // before we perform our own initialization.
207  m_nsupported = GetNSupported (station);
209  m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol));
210  InitSampleTable (station);
211  RateInit (station);
212  station->m_initialized = true;
213  }
214 }
215 
216 void
218  double rxSnr, WifiMode txMode)
219 {
220  NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
221 }
222 
223 void
225 {
227  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
228 
229  station->m_shortRetry++;
230 }
231 
232 void
233 MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr)
234 {
235  NS_LOG_DEBUG ("self=" << st << " rts ok");
236 }
237 
238 void
240 {
242  UpdateRetry (station);
243  station->m_err++;
244 }
245 
246 void
248 {
266  CheckInit (station);
267  if (!station->m_initialized)
268  {
269  return;
270  }
271 
272  station->m_longRetry++;
273 
274  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
275 
277  if (!station->m_isSampling)
278  {
280  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
281  {
282  ;
283  }
284 
286  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
287  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
288  {
289  station->m_txrate = station->m_maxTpRate2;
290  }
291 
293  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
294  m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
295  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
296  {
297  station->m_txrate = station->m_maxProbRate;
298  }
299 
301  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
302  m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
303  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
304  {
305  station->m_txrate = 0;
306  }
307  }
308 
310  else
311  {
313  if (station->m_sampleRateSlower)
314  {
316  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
317  {
318  ;
319  }
320 
322  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
323  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
324  {
325  station->m_txrate = station->m_sampleRate;
326  }
327 
329  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
330  m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
331  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount ))
332  {
333  station->m_txrate = station->m_maxProbRate;
334  }
335 
337  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
338  m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
339  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
340  {
341  station->m_txrate = 0;
342  }
343  }
344 
346  else
347  {
349  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
350  {
351  ;
352  }
353 
355  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
356  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
357  {
358  station->m_txrate = station->m_maxTpRate;
359  }
360 
362  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
363  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
364  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
365  {
366  station->m_txrate = station->m_maxProbRate;
367  }
368 
370  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
371  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
372  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
373  {
374  station->m_txrate = 0;
375  }
376  }
377  }
378 }
379 
380 void
382  double ackSnr, WifiMode ackMode, double dataSnr)
383 {
385 
386  station->m_isSampling = false;
387  station->m_sampleRateSlower = false;
388 
389  CheckInit (station);
390  if (!station->m_initialized)
391  {
392  return;
393  }
394 
395  m_minstrelTable[station->m_txrate].numRateSuccess++;
396  m_minstrelTable[station->m_txrate].numRateAttempt++;
397 
398  UpdateRetry (station);
399 
400  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
401  station->m_packetCount++;
402 
403  if (m_nsupported >= 1)
404  {
405  station->m_txrate = FindRate (station);
406  }
407 }
408 
409 void
411 {
413  NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate=" << station->m_txrate);
414 
415  station->m_isSampling = false;
416  station->m_sampleRateSlower = false;
417 
418  UpdateRetry (station);
419 
420  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
421  station->m_err++;
422 
423  if (m_nsupported >= 1)
424  {
425  station->m_txrate = FindRate (station);
426  }
427 }
428 
429 void
431 {
432  station->m_retry = station->m_shortRetry + station->m_longRetry;
433  station->m_shortRetry = 0;
434  station->m_longRetry = 0;
435 }
436 
439  uint32_t size)
440 {
442  if (!station->m_initialized)
443  {
444  CheckInit (station);
445 
447  station->m_txrate = m_nsupported / 2;
448  }
449  UpdateStats (station);
451 }
452 
455 {
457  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
458 
460 }
461 
462 bool
464 {
465  return true;
466 }
467 uint32_t
469 {
470  uint32_t bitrate;
471  bitrate = m_sampleTable[station->m_index][station->m_col];
472  station->m_index++;
473 
475  if (station->m_index > (m_nsupported - 2))
476  {
477  station->m_index = 0;
478  station->m_col++;
479  if (station->m_col >= m_sampleCol)
480  {
481  station->m_col = 0;
482  }
483  }
484  return bitrate;
485 }
486 
487 uint32_t
489 {
490  NS_LOG_DEBUG ("FindRate " << "packet=" << station->m_packetCount );
491 
492  if ((station->m_sampleCount + station->m_packetCount) == 0)
493  {
494  return 0;
495  }
496 
497 
498  uint32_t idx;
499 
501  int coinFlip = m_uniformRandomVariable->GetInteger (0, 100) % 2;
502 
508  if ( (((100 * station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate)
509  && (coinFlip == 1) )
510  {
511 
513  idx = GetNextSample (station);
514 
515 
520  if (idx != station->m_maxTpRate && idx != station->m_txrate)
521  {
522 
524  station->m_sampleCount++;
525 
527  station->m_isSampling = true;
528 
530  if (station->m_packetCount >= 10000)
531  {
532  station->m_sampleCount = 0;
533  station->m_packetCount = 0;
534  }
535 
537  if (idx >= m_nsupported)
538  {
539  NS_LOG_DEBUG ("ALERT!!! ERROR");
540  }
541 
543  station->m_sampleRate = idx;
544 
545  if (station->m_sampleRate == station->m_maxTpRate)
546  {
547  station->m_sampleRate = station->m_maxTpRate2;
548  }
549 
551  station->m_sampleRateSlower =
552  (m_minstrelTable[idx].perfectTxTime > m_minstrelTable[station->m_maxTpRate].perfectTxTime);
553 
555  if (station->m_sampleRateSlower)
556  {
557  idx = station->m_maxTpRate;
558  }
559  }
560 
561  }
562 
564  else
565  {
566  idx = station->m_maxTpRate;
567  }
568 
569 
570  NS_LOG_DEBUG ("FindRate " << "sample rate=" << idx);
571 
572  return idx;
573 }
574 
575 void
577 {
578  if (Simulator::Now () < station->m_nextStatsUpdate)
579  {
580  return;
581  }
582 
583  if (!station->m_initialized)
584  {
585  return;
586  }
587  NS_LOG_DEBUG ("Updating stats=" << this);
588 
590 
591  Time txTime;
592  uint32_t tempProb;
593 
594  for (uint32_t i = 0; i < m_nsupported; i++)
595  {
596 
598  txTime = m_minstrelTable[i].perfectTxTime;
599 
601  if (txTime.GetMicroSeconds () == 0)
602  {
603  txTime = Seconds (1);
604  }
605 
606  NS_LOG_DEBUG ("m_txrate=" << station->m_txrate <<
607  "\t attempt=" << m_minstrelTable[i].numRateAttempt <<
608  "\t success=" << m_minstrelTable[i].numRateSuccess);
609 
611  if (m_minstrelTable[i].numRateAttempt)
612  {
617  tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt;
618 
620  m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess;
621  m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt;
622  m_minstrelTable[i].prob = tempProb;
623 
625  tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100);
626 
627  m_minstrelTable[i].ewmaProb = tempProb;
628 
630  m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ());
631 
632  }
633 
635  m_minstrelTable[i].prevNumRateAttempt = m_minstrelTable[i].numRateAttempt;
636  m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess;
637  m_minstrelTable[i].numRateSuccess = 0;
638  m_minstrelTable[i].numRateAttempt = 0;
639 
641  if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800))
642  {
647  m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1;
648  if (m_minstrelTable[i].adjustedRetryCount > 2)
649  {
650  m_minstrelTable[i].adjustedRetryCount = 2;
651  }
652  }
653  else
654  {
655  m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount;
656  }
657 
659  if (m_minstrelTable[i].adjustedRetryCount == 0)
660  {
661  m_minstrelTable[i].adjustedRetryCount = 1;
662  }
663  }
664 
665 
666  uint32_t max_prob = 0, index_max_prob = 0, max_tp = 0, index_max_tp = 0, index_max_tp2 = 0;
667 
669  for (uint32_t i = 0; i < m_nsupported; i++)
670  {
671  NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput <<
672  "\n ewma" << m_minstrelTable[i].ewmaProb);
673 
674  if (max_tp < m_minstrelTable[i].throughput)
675  {
676  index_max_tp = i;
677  max_tp = m_minstrelTable[i].throughput;
678  }
679 
680  if (max_prob < m_minstrelTable[i].ewmaProb)
681  {
682  index_max_prob = i;
683  max_prob = m_minstrelTable[i].ewmaProb;
684  }
685  }
686 
687 
688  max_tp = 0;
690  for (uint32_t i = 0; i < m_nsupported; i++)
691  {
692  if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput))
693  {
694  index_max_tp2 = i;
695  max_tp = m_minstrelTable[i].throughput;
696  }
697  }
698 
699  station->m_maxTpRate = index_max_tp;
700  station->m_maxTpRate2 = index_max_tp2;
701  station->m_maxProbRate = index_max_prob;
702  station->m_currentRate = index_max_tp;
703 
704  if (index_max_tp > station->m_txrate)
705  {
706  station->m_txrate = index_max_tp;
707  }
708 
709  NS_LOG_DEBUG ("max tp=" << index_max_tp << "\nmax tp2=" << index_max_tp2 << "\nmax prob=" << index_max_prob);
710 
712  RateInit (station);
713 }
714 
715 void
717 {
718  NS_LOG_DEBUG ("RateInit=" << station);
719 
720  for (uint32_t i = 0; i < m_nsupported; i++)
721  {
722  m_minstrelTable[i].numRateAttempt = 0;
723  m_minstrelTable[i].numRateSuccess = 0;
724  m_minstrelTable[i].prob = 0;
725  m_minstrelTable[i].ewmaProb = 0;
726  m_minstrelTable[i].prevNumRateAttempt = 0;
727  m_minstrelTable[i].prevNumRateSuccess = 0;
728  m_minstrelTable[i].successHist = 0;
729  m_minstrelTable[i].attemptHist = 0;
730  m_minstrelTable[i].throughput = 0;
731  m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i));
732  m_minstrelTable[i].retryCount = 1;
733  m_minstrelTable[i].adjustedRetryCount = 1;
734  }
735 }
736 
737 void
739 {
740  NS_LOG_DEBUG ("InitSampleTable=" << this);
741 
742  station->m_col = station->m_index = 0;
743 
745  uint32_t numSampleRates = m_nsupported;
746 
747  uint32_t newIndex;
748  for (uint32_t col = 0; col < m_sampleCol; col++)
749  {
750  for (uint32_t i = 0; i < numSampleRates; i++ )
751  {
752 
757  int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates);
758  newIndex = (i + uv) % numSampleRates;
759 
761  while (m_sampleTable[newIndex][col] != 0)
762  {
763  newIndex = (newIndex + 1) % m_nsupported;
764  }
765  m_sampleTable[newIndex][col] = i;
766 
767  }
768  }
769 }
770 
771 void
773 {
774  NS_LOG_DEBUG ("PrintSampleTable=" << station);
775 
776  uint32_t numSampleRates = m_nsupported;
777  for (uint32_t i = 0; i < numSampleRates; i++)
778  {
779  for (uint32_t j = 0; j < m_sampleCol; j++)
780  {
781  std::cout << m_sampleTable[i][j] << "\t";
782  }
783  std::cout << std::endl;
784  }
785 }
786 
787 void
789 {
790  NS_LOG_DEBUG ("PrintTable=" << station);
791 
792  for (uint32_t i = 0; i < m_nsupported; i++)
793  {
794  std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime << "\n";
795  }
796 }
797 
798 } // namespace ns3
799 
800 
801 
802 
803 
uint32_t m_nsupported
modes supported
void CheckInit(MinstrelWifiRemoteStation *station)
check for initializations
void PrintTable(MinstrelWifiRemoteStation *station)
printing Minstrel Table
uint32_t GetNSupported(const WifiRemoteStation *station) const
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:311
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
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:...
virtual uint32_t GetNModes(void) const =0
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)
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_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
virtual void SetupPhy(Ptr< WifiPhy > phy)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
uint32_t GetNumberOfReceiveAntennas(const WifiRemoteStation *station) const
WifiMode GetSupported(const WifiRemoteStation *station, uint32_t i) const
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
virtual void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr)
virtual void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
bool GetStbc(const WifiRemoteStation *station) const
NS_LOG_COMPONENT_DEFINE("MinstrelWifiManager")
bool m_isSampling
a flag to indicate we are currently sampling
int64_t GetMicroSeconds(void) const
Definition: nstime.h:283
int m_sampleCount
how many packets we have sample so far
hold objects of type ns3::Time
Definition: nstime.h:828
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
void PrintSampleTable(MinstrelWifiRemoteStation *station)
printing Sample Table
virtual void SetupPhy(Ptr< WifiPhy > phy)
double m_ewmaLevel
exponential weighted moving average
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Definition: int64x64.h:90
virtual WifiRemoteStation * DoCreateStation(void) const
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint32_t size)
void AddCalcTxTime(WifiMode mode, Time t)
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)
hold a list of per-remote-station state.
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
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
virtual WifiMode GetMode(uint32_t mode) const =0
bool GetShortGuardInterval(const WifiRemoteStation *station) const
static Time Now(void)
Definition: simulator.cc:180
uint32_t m_retry
total retries short + long
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
void SetMode(WifiMode mode)
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
static Time CalculateTxDuration(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble)
Definition: wifi-phy.cc:439
double throughput
uint32_t GetLongRetryCount(const WifiRemoteStation *station) const
virtual void DoReportRtsFailed(WifiRemoteStation *station)
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
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. Both limits are inclusive.
Definition: time.cc:404
uint32_t GetShortRetryCount(const WifiRemoteStation *station) const
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
virtual void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr)
a unique identifier for an interface.
Definition: type-id.h:49
MinstrelRate m_minstrelTable
minstrel table
void RateInit(MinstrelWifiRemoteStation *station)
initialize Minstrel Table
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
std::vector< std::vector< uint32_t > > SampleRate
hold per-remote-station state.
Time m_nextStatsUpdate
10 times every second