A Discrete-Event Network Simulator
API
rrpaa-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) 2017 Universidad de la República - Uruguay
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: Matías Richart <mrichart@fing.edu.uy>
19  */
20 
21 #include "ns3/packet.h"
22 #include "ns3/log.h"
23 #include "ns3/boolean.h"
24 #include "ns3/double.h"
25 #include "ns3/uinteger.h"
26 #include "ns3/simulator.h"
27 #include "ns3/data-rate.h"
28 #include "rrpaa-wifi-manager.h"
29 #include "ns3/wifi-phy.h"
30 #include "ns3/wifi-mac.h"
31 
32 NS_LOG_COMPONENT_DEFINE ("RrpaaWifiManager");
33 
34 namespace ns3 {
35 
43 {
44  uint32_t m_counter;
45  uint32_t m_nFailed;
46  uint32_t m_adaptiveRtsWnd;
47  uint32_t m_rtsCounter;
52  uint8_t m_nRate;
53  uint8_t m_prevRateIndex;
54  uint8_t m_rateIndex;
55  uint8_t m_prevPowerLevel;
56  uint8_t m_powerLevel;
59 };
60 
62 
63 TypeId
65 {
66  static TypeId tid = TypeId ("ns3::RrpaaWifiManager")
68  .SetGroupName ("Wifi")
69  .AddConstructor<RrpaaWifiManager> ()
70  .AddAttribute ("Basic",
71  "If true the RRPAA-BASIC algorithm will be used, otherwise the RRPAA will be used.",
72  BooleanValue (true),
75  .AddAttribute ("Timeout",
76  "Timeout for the RRPAA-BASIC loss estimation block.",
77  TimeValue (MilliSeconds (500)),
79  MakeTimeChecker ())
80  .AddAttribute ("FrameLength",
81  "The Data frame length (in bytes) used for calculating mode TxTime.",
82  UintegerValue (1420),
84  MakeUintegerChecker <uint32_t> ())
85  .AddAttribute ("AckFrameLength",
86  "The Ack frame length (in bytes) used for calculating mode TxTime.",
87  UintegerValue (14),
89  MakeUintegerChecker <uint32_t> ())
90  .AddAttribute ("Alpha",
91  "Constant for calculating the MTL threshold.",
92  DoubleValue (1.25),
94  MakeDoubleChecker<double> (1))
95  .AddAttribute ("Beta",
96  "Constant for calculating the ORI threshold.",
97  DoubleValue (2),
99  MakeDoubleChecker<double> (1))
100  .AddAttribute ("Tau",
101  "Constant for calculating the EWND size.",
102  DoubleValue (0.015),
104  MakeDoubleChecker<double> (0))
105  .AddAttribute ("Gamma",
106  "Constant for Probabilistic Decision Table decrements.",
107  DoubleValue (2),
109  MakeDoubleChecker<double> (1))
110  .AddAttribute ("Delta",
111  "Constant for Probabilistic Decision Table increments.",
112  DoubleValue (1.0905),
114  MakeDoubleChecker<double> (1))
115  .AddTraceSource ("RateChange",
116  "The transmission rate has change.",
118  "ns3::WifiRemoteStationManager::RateChangeTracedCallback")
119  .AddTraceSource ("PowerChange",
120  "The transmission power has change.",
122  "ns3::WifiRemoteStationManager::PowerChangeTracedCallback")
123  ;
124  return tid;
125 }
126 
127 
129 {
130  NS_LOG_FUNCTION (this);
131  m_uniformRandomVariable = CreateObject<UniformRandomVariable> ();
132 }
133 
135 {
136  NS_LOG_FUNCTION (this);
137 }
138 
139 int64_t
141 {
142  NS_LOG_FUNCTION (this << stream);
144  return 1;
145 }
146 
147 void
149 {
150  NS_LOG_FUNCTION (this << phy);
151  m_sifs = phy->GetSifs ();
152  m_difs = m_sifs + 2 * phy->GetSlot ();
153  m_nPowerLevels = phy->GetNTxPower ();
155  m_minPowerLevel = 0;
156  for (const auto & mode : phy->GetModeList ())
157  {
158  WifiTxVector txVector;
159  txVector.SetMode (mode);
161  /* Calculate the TX Time of the Data and the corresponding Ack */
162  Time dataTxTime = phy->CalculateTxDuration (m_frameLength, txVector, phy->GetPhyBand ());
163  Time ackTxTime = phy->CalculateTxDuration (m_ackLength, txVector, phy->GetPhyBand ());
164  NS_LOG_DEBUG ("Calculating TX times: Mode= " << mode << " DataTxTime= " << dataTxTime << " AckTxTime= " << ackTxTime);
165  AddCalcTxTime (mode, dataTxTime + ackTxTime);
166  }
168 }
169 
170 void
172 {
173  NS_LOG_FUNCTION (this << mac);
175 }
176 
177 void
179 {
180  NS_LOG_FUNCTION (this);
181  if (GetHtSupported ())
182  {
183  NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HT rates");
184  }
185  if (GetVhtSupported ())
186  {
187  NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support VHT rates");
188  }
189  if (GetHeSupported ())
190  {
191  NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rates");
192  }
193 }
194 
195 Time
197 {
198  NS_LOG_FUNCTION (this << mode);
199  for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++)
200  {
201  if (mode == i->second)
202  {
203  return i->first;
204  }
205  }
206  NS_ASSERT (false);
207  return Seconds (0);
208 }
209 
210 void
212 {
213  NS_LOG_FUNCTION (this << mode << t);
214  m_calcTxTime.push_back (std::make_pair (t, mode));
215 }
216 
219 {
220  NS_LOG_FUNCTION (this << station << mode);
221  struct WifiRrpaaThresholds threshold;
222  for (RrpaaThresholdsTable::const_iterator i = station->m_thresholds.begin (); i != station->m_thresholds.end (); i++)
223  {
224  if (mode == i->second)
225  {
226  return i->first;
227  }
228  }
229  NS_ABORT_MSG ("No thresholds for mode " << mode << " found");
230  return threshold; // Silence compiler warning
231 }
232 
235 {
236  NS_LOG_FUNCTION (this);
238  station->m_adaptiveRtsWnd = 0;
239  station->m_rtsCounter = 0;
240  station->m_adaptiveRtsOn = false;
241  station->m_lastFrameFail = false;
242  station->m_initialized = false;
243  return station;
244 }
245 
246 void
248 {
249  NS_LOG_FUNCTION (this << station);
250  if (!station->m_initialized)
251  {
252  //Note: we appear to be doing late initialization of the table
253  //to make sure that the set of supported rates has been initialized
254  //before we perform our own initialization.
255  station->m_nRate = GetNSupported (station);
256  //Initialize at minimal rate and maximal power.
257  station->m_prevRateIndex = 0;
258  station->m_rateIndex = 0;
260  station->m_powerLevel = m_maxPowerLevel;
261  WifiMode mode = GetSupported (station, 0);
262  uint16_t channelWidth = GetChannelWidth (station);
263  DataRate rate = DataRate (mode.GetDataRate (channelWidth));
264  double power = GetPhy ()->GetPowerDbm (station->m_powerLevel);
265  m_rateChange (rate, rate, station->m_state->m_address);
266  m_powerChange (power, power, station->m_state->m_address);
267 
268  station->m_pdTable = RrpaaProbabilitiesTable (station->m_nRate, std::vector<double> (m_nPowerLevels));
269  NS_LOG_DEBUG ("Initializing pdTable");
270  for (uint8_t i = 0; i < station->m_nRate; i++)
271  {
272  for (uint8_t j = 0; j < m_nPowerLevels; j++)
273  {
274  station->m_pdTable[i][j] = 1;
275  }
276  }
277 
278  station->m_initialized = true;
279 
280  station->m_thresholds = RrpaaThresholdsTable (station->m_nRate);
281  InitThresholds (station);
282  ResetCountersBasic (station);
283  }
284 }
285 
286 void
288 {
289  NS_LOG_FUNCTION (this << station);
290  double nextCritical = 0;
291  double nextMtl = 0;
292  double mtl = 0;
293  double ori = 0;
294  for (uint8_t i = 0; i < station->m_nRate; i++)
295  {
296  WifiMode mode = GetSupported (station, i);
297  Time totalTxTime = GetCalcTxTime (mode) + m_sifs + m_difs;
298  if (i == station->m_nRate - 1)
299  {
300  ori = 0;
301  }
302  else
303  {
304  WifiMode nextMode = GetSupported (station, i + 1);
305  Time nextTotalTxTime = GetCalcTxTime (nextMode) + m_sifs + m_difs;
306  nextCritical = 1 - (nextTotalTxTime.GetSeconds () / totalTxTime.GetSeconds ());
307  nextMtl = m_alpha * nextCritical;
308  ori = nextMtl / m_beta;
309  }
310  if (i == 0)
311  {
312  mtl = nextMtl;
313  }
315  th.m_ewnd = static_cast<uint32_t> (ceil (m_tau / totalTxTime.GetSeconds ()));
316  th.m_ori = ori;
317  th.m_mtl = mtl;
318  station->m_thresholds.push_back (std::make_pair (th, mode));
319  mtl = nextMtl;
320  NS_LOG_DEBUG (mode << " " << th.m_ewnd << " " << th.m_mtl << " " << th.m_ori);
321  }
322 }
323 
324 void
326 {
327  NS_LOG_FUNCTION (this << station);
328  station->m_nFailed = 0;
329  station->m_counter = GetThresholds (station, station->m_rateIndex).m_ewnd;
330  station->m_lastReset = Simulator::Now ();
331 }
332 
333 void
335 {
336  NS_LOG_FUNCTION (this << st);
337 }
338 
339 void
341 {
342  NS_LOG_FUNCTION (this << st);
343  RrpaaWifiRemoteStation *station = static_cast<RrpaaWifiRemoteStation*> (st);
344  CheckInit (station);
345  station->m_lastFrameFail = true;
346  CheckTimeout (station);
347  station->m_counter--;
348  station->m_nFailed++;
349  RunBasicAlgorithm (station);
350 }
351 
352 void
354  double rxSnr, WifiMode txMode)
355 {
356  NS_LOG_FUNCTION (this << st << rxSnr << txMode);
357 }
358 
359 void
361  double ctsSnr, WifiMode ctsMode, double rtsSnr)
362 {
363  NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
364 }
365 
366 void
368  double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
369 {
370  NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
371  RrpaaWifiRemoteStation *station = static_cast<RrpaaWifiRemoteStation*> (st);
372  CheckInit (station);
373  station->m_lastFrameFail = false;
374  CheckTimeout (station);
375  station->m_counter--;
376  RunBasicAlgorithm (station);
377 }
378 void
380 {
381  NS_LOG_FUNCTION (this << st);
382 }
383 void
385 {
386  NS_LOG_FUNCTION (this << st);
387 }
388 
391 {
392  NS_LOG_FUNCTION (this << st);
393  RrpaaWifiRemoteStation *station = static_cast<RrpaaWifiRemoteStation*> (st);
394  uint16_t channelWidth = GetChannelWidth (station);
395  if (channelWidth > 20 && channelWidth != 22)
396  {
397  channelWidth = 20;
398  }
399  CheckInit (station);
400  WifiMode mode = GetSupported (station, station->m_rateIndex);
401  DataRate rate = DataRate (mode.GetDataRate (channelWidth));
402  DataRate prevRate = DataRate (GetSupported (station, station->m_prevRateIndex).GetDataRate (channelWidth));
403  double power = GetPhy ()->GetPowerDbm (station->m_powerLevel);
404  double prevPower = GetPhy ()->GetPowerDbm (station->m_prevPowerLevel);
405  if (station->m_prevRateIndex != station->m_rateIndex)
406  {
407  m_rateChange (prevRate, rate, station->m_state->m_address);
408  station->m_prevRateIndex = station->m_rateIndex;
409  }
410  if (station->m_prevPowerLevel != station->m_powerLevel)
411  {
412  m_powerChange (prevPower, power, station->m_state->m_address);
413  station->m_prevPowerLevel = station->m_powerLevel;
414  }
415  return WifiTxVector (mode, station->m_powerLevel, GetPreambleForTransmission (mode.GetModulationClass (), GetShortPreambleEnabled ()), 800, 1, 1, 0, channelWidth, GetAggregation (station));
416 }
419 {
420  NS_LOG_FUNCTION (this << st);
421  RrpaaWifiRemoteStation *station = static_cast<RrpaaWifiRemoteStation*> (st);
422  uint16_t channelWidth = GetChannelWidth (station);
423  if (channelWidth > 20 && channelWidth != 22)
424  {
425  channelWidth = 20;
426  }
427  WifiTxVector rtsTxVector;
428  WifiMode mode;
429  if (GetUseNonErpProtection () == false)
430  {
431  mode = GetSupported (station, 0);
432  }
433  else
434  {
435  mode = GetNonErpSupported (station, 0);
436  }
437  rtsTxVector = WifiTxVector (mode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (mode.GetModulationClass (), GetShortPreambleEnabled ()), 800, 1, 1, 0, channelWidth, GetAggregation (station));
438  return rtsTxVector;
439 }
440 
441 bool
443  uint32_t size, bool normally)
444 {
445  NS_LOG_FUNCTION (this << st << size << normally);
446  RrpaaWifiRemoteStation *station = static_cast<RrpaaWifiRemoteStation*> (st);
447  CheckInit (station);
448  if (m_basic)
449  {
450  return normally;
451  }
452  RunAdaptiveRtsAlgorithm (station);
453  return station->m_adaptiveRtsOn;
454 }
455 
456 void
458 {
459  NS_LOG_FUNCTION (this << station);
460  Time d = Simulator::Now () - station->m_lastReset;
461  if (station->m_counter == 0 || d > m_timeout)
462  {
463  ResetCountersBasic (station);
464  }
465 }
466 
467 void
469 {
470  NS_LOG_FUNCTION (this << station);
471  WifiRrpaaThresholds thresholds = GetThresholds (station, station->m_rateIndex);
472  double bploss = (static_cast<double> (station->m_nFailed) / thresholds.m_ewnd);
473  double wploss = (static_cast<double> (station->m_counter + station->m_nFailed) / thresholds.m_ewnd);
474  NS_LOG_DEBUG ("Best loss prob= " << bploss);
475  NS_LOG_DEBUG ("Worst loss prob= " << wploss);
476  if (bploss >= thresholds.m_mtl)
477  {
478  if (station->m_powerLevel < m_maxPowerLevel)
479  {
480  NS_LOG_DEBUG ("bploss >= MTL and power < maxPower => Increase Power");
481  station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
482  NS_LOG_DEBUG ("pdTable[" << +station->m_rateIndex << "][" << station->m_powerLevel << "] = " << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
483  station->m_powerLevel++;
484  ResetCountersBasic (station);
485  }
486  else if (station->m_rateIndex != 0)
487  {
488  NS_LOG_DEBUG ("bploss >= MTL and power = maxPower => Decrease Rate");
489  station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
490  NS_LOG_DEBUG ("pdTable[" << +station->m_rateIndex << "][" << station->m_powerLevel << "] = " << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
491  station->m_rateIndex--;
492  ResetCountersBasic (station);
493  }
494  else
495  {
496  NS_LOG_DEBUG ("bploss >= MTL but already at maxPower and minRate");
497  }
498  }
499  else if (wploss <= thresholds.m_ori)
500  {
501  if (station->m_rateIndex < station->m_nRate - 1)
502  {
503  NS_LOG_DEBUG ("wploss <= ORI and rate < maxRate => Probabilistic Rate Increase");
504 
505  // Recalculate probabilities of lower rates.
506  for (uint8_t i = 0; i <= station->m_rateIndex; i++)
507  {
508  station->m_pdTable[i][station->m_powerLevel] *= m_delta;
509  if (station->m_pdTable[i][station->m_powerLevel] > 1)
510  {
511  station->m_pdTable[i][station->m_powerLevel] = 1;
512  }
513  NS_LOG_DEBUG ("pdTable[" << i << "][" << (int)station->m_powerLevel << "] = " << station->m_pdTable[i][station->m_powerLevel]);
514  }
515  double rand = m_uniformRandomVariable->GetValue (0,1);
516  if (rand < station->m_pdTable[station->m_rateIndex + 1][station->m_powerLevel])
517  {
518  NS_LOG_DEBUG ("Increase Rate");
519  station->m_rateIndex++;
520  }
521  }
522  else if (station->m_powerLevel > m_minPowerLevel)
523  {
524  NS_LOG_DEBUG ("wploss <= ORI and rate = maxRate => Probabilistic Power Decrease");
525 
526  // Recalculate probabilities of higher powers.
527  for (uint32_t i = m_maxPowerLevel; i > station->m_powerLevel; i--)
528  {
529  station->m_pdTable[station->m_rateIndex][i] *= m_delta;
530  if (station->m_pdTable[station->m_rateIndex][i] > 1)
531  {
532  station->m_pdTable[station->m_rateIndex][i] = 1;
533  }
534  NS_LOG_DEBUG ("pdTable[" << +station->m_rateIndex << "][" << i << "] = " << station->m_pdTable[station->m_rateIndex][i]);
535  }
536  double rand = m_uniformRandomVariable->GetValue (0,1);
537  if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
538  {
539  NS_LOG_DEBUG ("Decrease Power");
540  station->m_powerLevel--;
541  }
542  }
543  ResetCountersBasic (station);
544  }
545  else if (bploss > thresholds.m_ori && wploss < thresholds.m_mtl)
546  {
547  if (station->m_powerLevel > m_minPowerLevel)
548  {
549  NS_LOG_DEBUG ("loss between ORI and MTL and power > minPowerLevel => Probabilistic Power Decrease");
550 
551  // Recalculate probabilities of higher powers.
552  for (uint32_t i = m_maxPowerLevel; i >= station->m_powerLevel; i--)
553  {
554  station->m_pdTable[station->m_rateIndex][i] *= m_delta;
555  if (station->m_pdTable[station->m_rateIndex][i] > 1)
556  {
557  station->m_pdTable[station->m_rateIndex][i] = 1;
558  }
559  NS_LOG_DEBUG ("pdTable[" << +station->m_rateIndex << "][" << i << "] = " << station->m_pdTable[station->m_rateIndex][i]);
560  }
561  double rand = m_uniformRandomVariable->GetValue (0,1);
562  if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
563  {
564  NS_LOG_DEBUG ("Decrease Power");
565  station->m_powerLevel--;
566  }
567  ResetCountersBasic (station);
568  }
569  }
570  if (station->m_counter == 0)
571  {
572  ResetCountersBasic (station);
573  }
574 }
575 
576 void
578 {
579  NS_LOG_FUNCTION (this << station);
580  if (!station->m_adaptiveRtsOn
581  && station->m_lastFrameFail)
582  {
583  station->m_adaptiveRtsWnd += 2;
584  station->m_rtsCounter = station->m_adaptiveRtsWnd;
585  }
586  else if ((station->m_adaptiveRtsOn && station->m_lastFrameFail)
587  || (!station->m_adaptiveRtsOn && !station->m_lastFrameFail))
588  {
589  station->m_adaptiveRtsWnd = station->m_adaptiveRtsWnd / 2;
590  station->m_rtsCounter = station->m_adaptiveRtsWnd;
591  }
592  if (station->m_rtsCounter > 0)
593  {
594  station->m_adaptiveRtsOn = true;
595  station->m_rtsCounter--;
596  }
597  else
598  {
599  station->m_adaptiveRtsOn = false;
600  }
601 }
602 
605 {
606  NS_LOG_FUNCTION (this << station << +index);
607  WifiMode mode = GetSupported (station, index);
608  return GetThresholds (station, mode);
609 }
610 
611 } // namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::WifiRemoteStationManager::GetDefaultTxPowerLevel
uint8_t GetDefaultTxPowerLevel(void) const
Definition: wifi-remote-station-manager.cc:1206
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::RrpaaWifiManager::m_alpha
double m_alpha
Alpha value for RRPAA (value for calculating MTL threshold)
Definition: rrpaa-wifi-manager.h:209
ns3::RrpaaWifiRemoteStation::m_lastReset
Time m_lastReset
Time of the last reset.
Definition: rrpaa-wifi-manager.cc:48
ns3::RrpaaWifiManager::DoReportRxOk
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:353
ns3::RrpaaWifiManager::m_timeout
Time m_timeout
Timeout for the RRAA BASIC loss estimation block.
Definition: rrpaa-wifi-manager.h:208
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
ns3::RrpaaWifiManager::GetThresholds
WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
Definition: rrpaa-wifi-manager.cc:218
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::RrpaaWifiManager::CheckTimeout
void CheckTimeout(RrpaaWifiRemoteStation *station)
Check if the counter should be reset.
Definition: rrpaa-wifi-manager.cc:457
ns3::RrpaaWifiManager::RrpaaWifiManager
RrpaaWifiManager()
Definition: rrpaa-wifi-manager.cc:128
ns3::WifiRemoteStationManager::GetUseNonErpProtection
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
Definition: wifi-remote-station-manager.cc:1051
ns3::RrpaaWifiManager::m_ackLength
uint32_t m_ackLength
Ack frame length used for calculate mode TxTime (in bytes).
Definition: rrpaa-wifi-manager.h:205
ns3::RrpaaWifiManager::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: rrpaa-wifi-manager.cc:178
ns3::RrpaaWifiManager::DoGetRtsTxVector
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
Definition: rrpaa-wifi-manager.cc:418
ns3::WifiRrpaaThresholds::m_mtl
double m_mtl
The Maximum Tolerable Loss threshold.
Definition: rrpaa-wifi-manager.h:60
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiRemoteStationManager::GetSupported
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
Definition: wifi-remote-station-manager.cc:1635
ns3::RrpaaThresholdsTable
std::vector< std::pair< WifiRrpaaThresholds, WifiMode > > RrpaaThresholdsTable
List of thresholds for each mode.
Definition: rrpaa-wifi-manager.h:67
ns3::RrpaaWifiRemoteStation::m_rtsCounter
uint32_t m_rtsCounter
Counter for RTS transmission attempts.
Definition: rrpaa-wifi-manager.cc:47
ns3::RrpaaWifiRemoteStation::m_prevRateIndex
uint8_t m_prevRateIndex
Rate index of the previous transmission.
Definition: rrpaa-wifi-manager.cc:53
ns3::RrpaaWifiManager::~RrpaaWifiManager
virtual ~RrpaaWifiManager()
Definition: rrpaa-wifi-manager.cc:134
ns3::WifiMode::GetModulationClass
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:159
ns3::RrpaaWifiManager::DoReportFinalDataFailed
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:384
ns3::WifiRemoteStationManager
hold a list of per-remote-station state.
Definition: wifi-remote-station-manager.h:121
ns3::RrpaaWifiManager::m_basic
bool m_basic
If using the basic algorithm (without RTS/CTS).
Definition: rrpaa-wifi-manager.h:207
ns3::WifiRemoteStationManager::GetHtSupported
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
Definition: wifi-remote-station-manager.cc:232
ns3::RrpaaWifiRemoteStation::m_lastFrameFail
bool m_lastFrameFail
Flag if the last frame sent has failed.
Definition: rrpaa-wifi-manager.cc:50
ns3::WifiRemoteStationManager::GetVhtSupported
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
Definition: wifi-remote-station-manager.cc:244
ns3::WifiTxVector::SetMode
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
Definition: wifi-tx-vector.cc:226
ns3::WifiRemoteStationManager::GetNSupported
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Definition: wifi-remote-station-manager.cc:1743
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::RrpaaWifiManager::m_sifs
Time m_sifs
Value of SIFS configured in the device.
Definition: rrpaa-wifi-manager.h:201
third.mac
mac
Definition: third.py:99
rrpaa-wifi-manager.h
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::WifiPhy::GetPowerDbm
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:840
ns3::RrpaaWifiManager::CheckInit
void CheckInit(RrpaaWifiRemoteStation *station)
Check for initializations.
Definition: rrpaa-wifi-manager.cc:247
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::WifiRemoteStationManager::GetShortPreambleEnabled
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
Definition: wifi-remote-station-manager.cc:226
ns3::RrpaaWifiRemoteStation::m_powerLevel
uint8_t m_powerLevel
Current power level.
Definition: rrpaa-wifi-manager.cc:56
ns3::RrpaaWifiManager::ResetCountersBasic
void ResetCountersBasic(RrpaaWifiRemoteStation *station)
Reset the counters of the given station.
Definition: rrpaa-wifi-manager.cc:325
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::RrpaaWifiManager::DoGetDataTxVector
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
Definition: rrpaa-wifi-manager.cc:390
ns3::RrpaaWifiManager::DoReportDataFailed
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:340
ns3::WifiRrpaaThresholds
Robust Rate and Power Adaptation Algorithm.
Definition: rrpaa-wifi-manager.h:58
ns3::RrpaaWifiManager::DoReportFinalRtsFailed
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:379
ns3::RrpaaWifiRemoteStation
Hold per-remote-station state for RRPAA Wifi manager.
Definition: rrpaa-wifi-manager.cc:43
ns3::RrpaaWifiRemoteStation::m_thresholds
RrpaaThresholdsTable m_thresholds
RRPAA thresholds for this station.
Definition: rrpaa-wifi-manager.cc:57
ns3::WifiRrpaaThresholds::m_ori
double m_ori
The Opportunistic Rate Increase threshold.
Definition: rrpaa-wifi-manager.h:59
ns3::WifiRemoteStationManager::GetPhy
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
Definition: wifi-remote-station-manager.cc:1731
ns3::RrpaaWifiRemoteStation::m_adaptiveRtsWnd
uint32_t m_adaptiveRtsWnd
Window size for the Adaptive RTS mechanism.
Definition: rrpaa-wifi-manager.cc:46
ns3::Ptr< WifiPhy >
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
ns3::RrpaaWifiManager::AddCalcTxTime
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
Definition: rrpaa-wifi-manager.cc:211
ns3::RrpaaWifiRemoteStation::m_counter
uint32_t m_counter
Counter for transmission attempts.
Definition: rrpaa-wifi-manager.cc:44
ns3::RrpaaWifiManager::AssignStreams
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition: rrpaa-wifi-manager.cc:140
ns3::RrpaaWifiRemoteStation::m_adaptiveRtsOn
bool m_adaptiveRtsOn
Check if Adaptive RTS mechanism is on.
Definition: rrpaa-wifi-manager.cc:49
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::RrpaaWifiRemoteStation::m_rateIndex
uint8_t m_rateIndex
Current rate index.
Definition: rrpaa-wifi-manager.cc:54
ns3::RrpaaWifiManager
Definition: rrpaa-wifi-manager.h:75
ns3::RrpaaWifiManager::RunBasicAlgorithm
void RunBasicAlgorithm(RrpaaWifiRemoteStation *station)
Find an appropriate rate and power for the given station, using a basic algorithm.
Definition: rrpaa-wifi-manager.cc:468
ns3::RrpaaWifiManager::RunAdaptiveRtsAlgorithm
void RunAdaptiveRtsAlgorithm(RrpaaWifiRemoteStation *station)
Run an enhanced algorithm which activates the use of RTS for the given station if the conditions are ...
Definition: rrpaa-wifi-manager.cc:577
ns3::RrpaaWifiManager::m_uniformRandomVariable
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables for probabilistic changes.
Definition: rrpaa-wifi-manager.h:232
ns3::RrpaaWifiManager::m_minPowerLevel
uint8_t m_minPowerLevel
Differently form rate, power levels do not depend on the remote station.
Definition: rrpaa-wifi-manager.h:219
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
ns3::RrpaaWifiRemoteStation::m_pdTable
RrpaaProbabilitiesTable m_pdTable
Probability table for power and rate changes.
Definition: rrpaa-wifi-manager.cc:58
ns3::RrpaaWifiManager::m_gamma
double m_gamma
Gamma value for RRPAA (value for pdTable decrements).
Definition: rrpaa-wifi-manager.h:212
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::RrpaaWifiManager::m_beta
double m_beta
Beta value for RRPAA (value for calculating ORI threshold).
Definition: rrpaa-wifi-manager.h:210
ns3::RrpaaWifiManager::SetupPhy
void SetupPhy(const Ptr< WifiPhy > phy) override
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
Definition: rrpaa-wifi-manager.cc:148
ns3::WifiRemoteStationManager::SetupPhy
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
Definition: wifi-remote-station-manager.cc:142
ns3::RrpaaWifiManager::m_nPowerLevels
uint8_t m_nPowerLevels
Number of power levels.
Definition: rrpaa-wifi-manager.h:221
ns3::RrpaaWifiManager::m_calcTxTime
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
Definition: rrpaa-wifi-manager.h:200
ns3::RrpaaWifiRemoteStation::m_initialized
bool m_initialized
For initializing variables.
Definition: rrpaa-wifi-manager.cc:51
ns3::MakeDoubleAccessor
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: double.h:42
ns3::GetPreambleForTransmission
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Definition: wifi-phy-common.cc:87
ns3::WIFI_PREAMBLE_LONG
@ WIFI_PREAMBLE_LONG
Definition: wifi-phy-common.h:69
ns3::WifiRemoteStation
hold per-remote-station state.
Definition: wifi-remote-station-manager.h:62
ns3::RrpaaWifiManager::m_maxPowerLevel
uint8_t m_maxPowerLevel
Maximal power level.
Definition: rrpaa-wifi-manager.h:220
ns3::WifiRemoteStationManager::GetAggregation
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
Definition: wifi-remote-station-manager.cc:1707
ns3::RrpaaWifiRemoteStation::m_nFailed
uint32_t m_nFailed
Number of failed transmission attempts.
Definition: rrpaa-wifi-manager.cc:45
ns3::RrpaaWifiManager::DoReportRtsOk
void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:360
ns3::RrpaaWifiManager::DoReportRtsFailed
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:334
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::TracedValueCallback::DataRate
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:329
ns3::WifiRemoteStation::m_state
WifiRemoteStationState * m_state
Remote station state.
Definition: wifi-remote-station-manager.h:63
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::WifiRemoteStationManager::GetNonErpSupported
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index.
Definition: wifi-remote-station-manager.cc:1649
ns3::RrpaaWifiRemoteStation::m_prevPowerLevel
uint8_t m_prevPowerLevel
Power level of the previous transmission.
Definition: rrpaa-wifi-manager.cc:55
ns3::RrpaaWifiManager::DoCreateStation
WifiRemoteStation * DoCreateStation(void) const override
Definition: rrpaa-wifi-manager.cc:234
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::RrpaaWifiManager::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: rrpaa-wifi-manager.cc:64
ns3::WifiRrpaaThresholds::m_ewnd
uint32_t m_ewnd
The Estimation Window size.
Definition: rrpaa-wifi-manager.h:61
ns3::RrpaaWifiManager::SetupMac
void SetupMac(const Ptr< WifiMac > mac) override
Set up MAC associated with this device since it is the object that knows the full set of timing param...
Definition: rrpaa-wifi-manager.cc:171
ns3::RrpaaWifiManager::m_frameLength
uint32_t m_frameLength
Data frame length used for calculate mode TxTime (in bytes).
Definition: rrpaa-wifi-manager.h:204
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::RrpaaWifiManager::m_difs
Time m_difs
Value of DIFS configured in the device.
Definition: rrpaa-wifi-manager.h:202
ns3::RrpaaWifiManager::m_tau
double m_tau
Tau value for RRPAA (value for calculating EWND size).
Definition: rrpaa-wifi-manager.h:211
ns3::RrpaaProbabilitiesTable
std::vector< std::vector< double > > RrpaaProbabilitiesTable
List of probabilities.
Definition: rrpaa-wifi-manager.h:72
ns3::WifiRemoteStationState::m_address
Mac48Address m_address
Mac48Address of the remote station.
Definition: wifi-remote-station-manager.h:95
ns3::RrpaaWifiManager::DoNeedRts
bool DoNeedRts(WifiRemoteStation *st, uint32_t size, bool normally) override
Definition: rrpaa-wifi-manager.cc:442
ns3::WifiRemoteStationManager::GetChannelWidth
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
Definition: wifi-remote-station-manager.cc:1683
ns3::WifiMode::GetDataRate
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
ns3::RrpaaWifiManager::InitThresholds
void InitThresholds(RrpaaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
Definition: rrpaa-wifi-manager.cc:287
ns3::WifiRemoteStationManager::SetupMac
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
Definition: wifi-remote-station-manager.cc:161
ns3::RrpaaWifiManager::DoReportDataOk
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:367
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition: random-variable-stream.cc:182
ns3::RrpaaWifiManager::GetCalcTxTime
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
Definition: rrpaa-wifi-manager.cc:196
ns3::WifiTxVector::SetPreambleType
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
Definition: wifi-tx-vector.cc:248
ns3::RrpaaWifiManager::m_delta
double m_delta
Delta value for RRPAA (value for pdTable increments).
Definition: rrpaa-wifi-manager.h:213
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
ns3::WifiRemoteStationManager::GetHeSupported
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
Definition: wifi-remote-station-manager.cc:256
third.phy
phy
Definition: third.py:93
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1354
ns3::RrpaaWifiRemoteStation::m_nRate
uint8_t m_nRate
Number of supported rates.
Definition: rrpaa-wifi-manager.cc:52
ns3::RrpaaWifiManager::m_rateChange
TracedCallback< DataRate, DataRate, Mac48Address > m_rateChange
The trace source fired when the transmission rate change.
Definition: rrpaa-wifi-manager.h:230
ns3::RrpaaWifiManager::m_powerChange
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power change.
Definition: rrpaa-wifi-manager.h:226
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50