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 
55 {
57 
64  uint32_t m_col, m_index;
65  uint32_t m_maxTpRate;
66  uint32_t m_maxTpRate2;
67  uint32_t m_maxProbRate;
68 
71 
72  bool m_isSampling;
73  uint32_t m_sampleRate;
75  uint32_t m_currentRate;
76 
77  uint32_t m_shortRetry;
78  uint32_t m_longRetry;
79  uint32_t m_retry;
80  uint32_t m_err;
81  uint32_t m_txrate;
82 
84 };
85 
87  ;
88 
89 TypeId
91 {
92  static TypeId tid = TypeId ("ns3::MinstrelWifiManager")
94  .AddConstructor<MinstrelWifiManager> ()
95  .AddAttribute ("UpdateStatistics",
96  "The interval between updating statistics table ",
97  TimeValue (Seconds (0.1)),
98  MakeTimeAccessor (&MinstrelWifiManager::m_updateStats),
99  MakeTimeChecker ())
100  .AddAttribute ("LookAroundRate",
101  "the percentage to try other rates",
102  DoubleValue (10),
103  MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate),
104  MakeDoubleChecker<double> ())
105  .AddAttribute ("EWMA",
106  "EWMA level",
107  DoubleValue (75),
108  MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel),
109  MakeDoubleChecker<double> ())
110  .AddAttribute ("SampleColumn",
111  "The number of columns used for sampling",
112  DoubleValue (10),
113  MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol),
114  MakeDoubleChecker <double> ())
115  .AddAttribute ("PacketLength",
116  "The packet length used for calculating mode TxTime",
117  DoubleValue (1200),
118  MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen),
119  MakeDoubleChecker <double> ())
120  ;
121  return tid;
122 }
123 
125 {
126  m_uniformRandomVariable = CreateObject<UniformRandomVariable> ();
127 
128  m_nsupported = 0;
129 }
130 
132 {
133 }
134 
135 void
137 {
138  uint32_t nModes = phy->GetNModes ();
139  for (uint32_t i = 0; i < nModes; i++)
140  {
141  WifiMode mode = phy->GetMode (i);
142  WifiTxVector txVector;
143  txVector.SetMode(mode);
145  }
147 }
148 
149 int64_t
151 {
152  NS_LOG_FUNCTION (this << stream);
154  return 1;
155 }
156 
157 Time
159 {
160 
161  for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++)
162  {
163  if (mode == i->second)
164  {
165  return i->first;
166  }
167  }
168  NS_ASSERT (false);
169  return Seconds (0);
170 }
171 
172 void
174 {
175  m_calcTxTime.push_back (std::make_pair (t, mode));
176 }
177 
180 {
182 
184  station->m_col = 0;
185  station->m_index = 0;
186  station->m_maxTpRate = 0;
187  station->m_maxTpRate2 = 0;
188  station->m_maxProbRate = 0;
189  station->m_packetCount = 0;
190  station->m_sampleCount = 0;
191  station->m_isSampling = false;
192  station->m_sampleRate = 0;
193  station->m_sampleRateSlower = false;
194  station->m_currentRate = 0;
195  station->m_shortRetry = 0;
196  station->m_longRetry = 0;
197  station->m_retry = 0;
198  station->m_err = 0;
199  station->m_txrate = 0;
200  station->m_initialized = false;
201 
202  return station;
203 }
204 
205 void
207 {
208  if (!station->m_initialized && GetNSupported (station) > 1)
209  {
210  // Note: we appear to be doing late initialization of the table
211  // to make sure that the set of supported rates has been initialized
212  // before we perform our own initialization.
213  m_nsupported = GetNSupported (station);
215  m_sampleTable = SampleRate (m_nsupported, std::vector<uint32_t> (m_sampleCol));
216  InitSampleTable (station);
217  RateInit (station);
218  station->m_initialized = true;
219  }
220 }
221 
222 void
224  double rxSnr, WifiMode txMode)
225 {
226  NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
227 }
228 
229 void
231 {
233  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
234 
235  station->m_shortRetry++;
236 }
237 
238 void
239 MinstrelWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, WifiMode ctsMode, double rtsSnr)
240 {
241  NS_LOG_DEBUG ("self=" << st << " rts ok");
242 }
243 
244 void
246 {
248  UpdateRetry (station);
249  station->m_err++;
250 }
251 
252 void
254 {
272  CheckInit (station);
273  if (!station->m_initialized)
274  {
275  return;
276  }
277 
278  station->m_longRetry++;
279 
280  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
281 
283  if (!station->m_isSampling)
284  {
286  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
287  {
288  ;
289  }
290 
292  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
293  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
294  {
295  station->m_txrate = station->m_maxTpRate2;
296  }
297 
299  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
300  m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
301  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
302  {
303  station->m_txrate = station->m_maxProbRate;
304  }
305 
307  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
308  m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount +
309  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
310  {
311  station->m_txrate = 0;
312  }
313  }
314 
316  else
317  {
319  if (station->m_sampleRateSlower)
320  {
322  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
323  {
324  ;
325  }
326 
328  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
329  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
330  {
331  station->m_txrate = station->m_sampleRate;
332  }
333 
335  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
336  m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
337  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount ))
338  {
339  station->m_txrate = station->m_maxProbRate;
340  }
341 
343  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
344  m_minstrelTable[station->m_sampleRate].adjustedRetryCount +
345  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount))
346  {
347  station->m_txrate = 0;
348  }
349  }
350 
352  else
353  {
355  if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount)
356  {
357  ;
358  }
359 
361  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
362  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
363  {
364  station->m_txrate = station->m_maxTpRate;
365  }
366 
368  else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount +
369  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
370  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
371  {
372  station->m_txrate = station->m_maxProbRate;
373  }
374 
376  else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount +
377  m_minstrelTable[station->m_maxTpRate].adjustedRetryCount +
378  m_minstrelTable[station->m_sampleRate].adjustedRetryCount))
379  {
380  station->m_txrate = 0;
381  }
382  }
383  }
384 }
385 
386 void
388  double ackSnr, WifiMode ackMode, double dataSnr)
389 {
391 
392  station->m_isSampling = false;
393  station->m_sampleRateSlower = false;
394 
395  CheckInit (station);
396  if (!station->m_initialized)
397  {
398  return;
399  }
400 
401  m_minstrelTable[station->m_txrate].numRateSuccess++;
402  m_minstrelTable[station->m_txrate].numRateAttempt++;
403 
404  UpdateRetry (station);
405 
406  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
407  station->m_packetCount++;
408 
409  if (m_nsupported >= 1)
410  {
411  station->m_txrate = FindRate (station);
412  }
413 }
414 
415 void
417 {
419  NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate=" << station->m_txrate);
420 
421  station->m_isSampling = false;
422  station->m_sampleRateSlower = false;
423 
424  UpdateRetry (station);
425 
426  m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry;
427  station->m_err++;
428 
429  if (m_nsupported >= 1)
430  {
431  station->m_txrate = FindRate (station);
432  }
433 }
434 
435 void
437 {
438  station->m_retry = station->m_shortRetry + station->m_longRetry;
439  station->m_shortRetry = 0;
440  station->m_longRetry = 0;
441 }
442 
445  uint32_t size)
446 {
448  if (!station->m_initialized)
449  {
450  CheckInit (station);
451 
453  station->m_txrate = m_nsupported / 2;
454  }
455  UpdateStats (station);
457 }
458 
461 {
463  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
464 
466 }
467 
468 bool
470 {
471  return true;
472 }
473 uint32_t
475 {
476  uint32_t bitrate;
477  bitrate = m_sampleTable[station->m_index][station->m_col];
478  station->m_index++;
479 
481  if (station->m_index > (m_nsupported - 2))
482  {
483  station->m_index = 0;
484  station->m_col++;
485  if (station->m_col >= m_sampleCol)
486  {
487  station->m_col = 0;
488  }
489  }
490  return bitrate;
491 }
492 
493 uint32_t
495 {
496  NS_LOG_DEBUG ("FindRate " << "packet=" << station->m_packetCount );
497 
498  if ((station->m_sampleCount + station->m_packetCount) == 0)
499  {
500  return 0;
501  }
502 
503 
504  uint32_t idx;
505 
507  int coinFlip = m_uniformRandomVariable->GetInteger (0, 100) % 2;
508 
514  if ( (((100 * station->m_sampleCount) / (station->m_sampleCount + station->m_packetCount )) < m_lookAroundRate)
515  && (coinFlip == 1) )
516  {
517 
519  idx = GetNextSample (station);
520 
521 
526  if (idx != station->m_maxTpRate && idx != station->m_txrate)
527  {
528 
530  station->m_sampleCount++;
531 
533  station->m_isSampling = true;
534 
536  if (station->m_packetCount >= 10000)
537  {
538  station->m_sampleCount = 0;
539  station->m_packetCount = 0;
540  }
541 
543  if (idx >= m_nsupported)
544  {
545  NS_LOG_DEBUG ("ALERT!!! ERROR");
546  }
547 
549  station->m_sampleRate = idx;
550 
551  if (station->m_sampleRate == station->m_maxTpRate)
552  {
553  station->m_sampleRate = station->m_maxTpRate2;
554  }
555 
557  station->m_sampleRateSlower =
558  (m_minstrelTable[idx].perfectTxTime > m_minstrelTable[station->m_maxTpRate].perfectTxTime);
559 
561  if (station->m_sampleRateSlower)
562  {
563  idx = station->m_maxTpRate;
564  }
565  }
566 
567  }
568 
570  else
571  {
572  idx = station->m_maxTpRate;
573  }
574 
575 
576  NS_LOG_DEBUG ("FindRate " << "sample rate=" << idx);
577 
578  return idx;
579 }
580 
581 void
583 {
584  if (Simulator::Now () < station->m_nextStatsUpdate)
585  {
586  return;
587  }
588 
589  if (!station->m_initialized)
590  {
591  return;
592  }
593  NS_LOG_DEBUG ("Updating stats=" << this);
594 
596 
597  Time txTime;
598  uint32_t tempProb;
599 
600  for (uint32_t i = 0; i < m_nsupported; i++)
601  {
602 
604  txTime = m_minstrelTable[i].perfectTxTime;
605 
607  if (txTime.GetMicroSeconds () == 0)
608  {
609  txTime = Seconds (1);
610  }
611 
612  NS_LOG_DEBUG ("m_txrate=" << station->m_txrate <<
613  "\t attempt=" << m_minstrelTable[i].numRateAttempt <<
614  "\t success=" << m_minstrelTable[i].numRateSuccess);
615 
617  if (m_minstrelTable[i].numRateAttempt)
618  {
623  tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt;
624 
626  m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess;
627  m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt;
628  m_minstrelTable[i].prob = tempProb;
629 
631  tempProb = static_cast<uint32_t> (((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) ) / 100);
632 
633  m_minstrelTable[i].ewmaProb = tempProb;
634 
636  m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds ());
637 
638  }
639 
641  m_minstrelTable[i].prevNumRateAttempt = m_minstrelTable[i].numRateAttempt;
642  m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess;
643  m_minstrelTable[i].numRateSuccess = 0;
644  m_minstrelTable[i].numRateAttempt = 0;
645 
647  if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800))
648  {
653  m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1;
654  if (m_minstrelTable[i].adjustedRetryCount > 2)
655  {
656  m_minstrelTable[i].adjustedRetryCount = 2;
657  }
658  }
659  else
660  {
661  m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount;
662  }
663 
665  if (m_minstrelTable[i].adjustedRetryCount == 0)
666  {
667  m_minstrelTable[i].adjustedRetryCount = 1;
668  }
669  }
670 
671 
672  uint32_t max_prob = 0, index_max_prob = 0, max_tp = 0, index_max_tp = 0, index_max_tp2 = 0;
673 
675  for (uint32_t i = 0; i < m_nsupported; i++)
676  {
677  NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput <<
678  "\n ewma" << m_minstrelTable[i].ewmaProb);
679 
680  if (max_tp < m_minstrelTable[i].throughput)
681  {
682  index_max_tp = i;
683  max_tp = m_minstrelTable[i].throughput;
684  }
685 
686  if (max_prob < m_minstrelTable[i].ewmaProb)
687  {
688  index_max_prob = i;
689  max_prob = m_minstrelTable[i].ewmaProb;
690  }
691  }
692 
693 
694  max_tp = 0;
696  for (uint32_t i = 0; i < m_nsupported; i++)
697  {
698  if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput))
699  {
700  index_max_tp2 = i;
701  max_tp = m_minstrelTable[i].throughput;
702  }
703  }
704 
705  station->m_maxTpRate = index_max_tp;
706  station->m_maxTpRate2 = index_max_tp2;
707  station->m_maxProbRate = index_max_prob;
708  station->m_currentRate = index_max_tp;
709 
710  if (index_max_tp > station->m_txrate)
711  {
712  station->m_txrate = index_max_tp;
713  }
714 
715  NS_LOG_DEBUG ("max tp=" << index_max_tp << "\nmax tp2=" << index_max_tp2 << "\nmax prob=" << index_max_prob);
716 
718  RateInit (station);
719 }
720 
721 void
723 {
724  NS_LOG_DEBUG ("RateInit=" << station);
725 
726  for (uint32_t i = 0; i < m_nsupported; i++)
727  {
728  m_minstrelTable[i].numRateAttempt = 0;
729  m_minstrelTable[i].numRateSuccess = 0;
730  m_minstrelTable[i].prob = 0;
731  m_minstrelTable[i].ewmaProb = 0;
732  m_minstrelTable[i].prevNumRateAttempt = 0;
733  m_minstrelTable[i].prevNumRateSuccess = 0;
734  m_minstrelTable[i].successHist = 0;
735  m_minstrelTable[i].attemptHist = 0;
736  m_minstrelTable[i].throughput = 0;
737  m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i));
738  m_minstrelTable[i].retryCount = 1;
739  m_minstrelTable[i].adjustedRetryCount = 1;
740  }
741 }
742 
743 void
745 {
746  NS_LOG_DEBUG ("InitSampleTable=" << this);
747 
748  station->m_col = station->m_index = 0;
749 
751  uint32_t numSampleRates = m_nsupported;
752 
753  uint32_t newIndex;
754  for (uint32_t col = 0; col < m_sampleCol; col++)
755  {
756  for (uint32_t i = 0; i < numSampleRates; i++ )
757  {
758 
763  int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates);
764  newIndex = (i + uv) % numSampleRates;
765 
767  while (m_sampleTable[newIndex][col] != 0)
768  {
769  newIndex = (newIndex + 1) % m_nsupported;
770  }
771  m_sampleTable[newIndex][col] = i;
772 
773  }
774  }
775 }
776 
777 void
779 {
780  NS_LOG_DEBUG ("PrintSampleTable=" << station);
781 
782  uint32_t numSampleRates = m_nsupported;
783  for (uint32_t i = 0; i < numSampleRates; i++)
784  {
785  for (uint32_t j = 0; j < m_sampleCol; j++)
786  {
787  std::cout << m_sampleTable[i][j] << "\t";
788  }
789  std::cout << std::endl;
790  }
791 }
792 
793 void
795 {
796  NS_LOG_DEBUG ("PrintTable=" << station);
797 
798  for (uint32_t i = 0; i < m_nsupported; i++)
799  {
800  std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime << "\n";
801  }
802 }
803 
804 } // namespace ns3
805 
806 
807 
808 
809 
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
Return the number of modes supported by the given station.
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
hold per-remote-station state for Minstrel Wifi manager.
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
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
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
Return the number of receive antenna the station has.
WifiMode GetSupported(const WifiRemoteStation *station, uint32_t i) const
Return whether mode associated with the specified station at the specified index. ...
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)
This method is a pure virtual method that must be implemented by the sub-class.
virtual void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
bool GetStbc(const WifiRemoteStation *station) const
Return whether the given station supports space-time block coding (STBC).
uint32_t m_col
To keep track of the current position in the our random sample table going row by row from 1st column...
NS_LOG_COMPONENT_DEFINE("MinstrelWifiManager")
bool m_isSampling
a flag to indicate we are currently sampling
int64_t GetMicroSeconds(void) const
Definition: nstime.h:291
int m_sampleCount
how many packets we have sample so far
hold objects of type ns3::Time
Definition: nstime.h:961
void PrintSampleTable(MinstrelWifiRemoteStation *station)
printing Sample Table
virtual void SetupPhy(Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
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)
Add transmission time for the given mode to an internal list.
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
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)
Assign a fixed random variable stream number to the random variables used by this model...
uint32_t m_maxTpRate2
second highest throughput rate
virtual WifiMode GetMode(uint32_t mode) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
bool GetShortGuardInterval(const WifiRemoteStation *station) const
Return whether the given station supports short guard interval.
static Time Now(void)
Return the "current simulation time".
Definition: simulator.cc:180
uint32_t m_retry
total retries short + long
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
void SetMode(WifiMode mode)
Sets the selected payload transmission 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:440
double throughput
uint32_t GetLongRetryCount(const WifiRemoteStation *station) const
Return the long retry limit of the given station.
virtual void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t m_maxTpRate
the current throughput rate
#define NS_LOG_DEBUG(msg)
Definition: log.h:289
Time GetCalcTxTime(WifiMode mode) const
for estimating the TxTime of a packet with a given mode
virtual void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
std::vector< struct RateInfo > MinstrelRate
Data structure for a Minstrel Rate table A vector of a struct RateInfo.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:452
uint32_t GetShortRetryCount(const WifiRemoteStation *station) const
Return the short retry limit of the given station.
uint32_t m_sampleCol
number of sample columns
uint32_t m_shortRetry
short retries such as control packts
Hold a 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)
This method is a pure virtual method that must be implemented by the sub-class.
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:611
std::vector< std::vector< uint32_t > > SampleRate
Data structure for a Sample Rate table A vector of a vector uint32_t.
hold per-remote-station state.
Time m_nextStatsUpdate
10 times every second