A Discrete-Event Network Simulator
API
ideal-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) 2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include <algorithm>
22 #include "ns3/log.h"
23 #include "ideal-wifi-manager.h"
24 #include "wifi-phy.h"
25 
26 namespace ns3 {
27 
35 {
38  uint16_t m_lastNssObserved;
39  double m_lastSnrCached;
40  uint8_t m_lastNss;
42  uint16_t m_lastChannelWidth;
43 };
44 
46 static const double CACHE_INITIAL_VALUE = -100;
47 
49 
50 NS_LOG_COMPONENT_DEFINE ("IdealWifiManager");
51 
52 TypeId
54 {
55  static TypeId tid = TypeId ("ns3::IdealWifiManager")
57  .SetGroupName ("Wifi")
58  .AddConstructor<IdealWifiManager> ()
59  .AddAttribute ("BerThreshold",
60  "The maximum Bit Error Rate acceptable at any transmission mode",
61  DoubleValue (1e-5),
63  MakeDoubleChecker<double> ())
64  .AddTraceSource ("Rate",
65  "Traced value for rate changes (b/s)",
67  "ns3::TracedValueCallback::Uint64")
68  ;
69  return tid;
70 }
71 
73  : m_currentRate (0)
74 {
75  NS_LOG_FUNCTION (this);
76 }
77 
79 {
80  NS_LOG_FUNCTION (this);
81 }
82 
83 void
85 {
86  NS_LOG_FUNCTION (this << phy);
88 }
89 
90 uint16_t
92 {
98  {
99  return 22;
100  }
101  else
102  {
103  return 20;
104  }
105 }
106 
107 void
109 {
110  NS_LOG_FUNCTION (this);
112 }
113 
114 void
116 {
117  m_thresholds.clear ();
118  WifiMode mode;
119  WifiTxVector txVector;
120  uint8_t nss = 1;
121  uint8_t nModes = GetPhy ()->GetNModes ();
122  for (uint8_t i = 0; i < nModes; i++)
123  {
124  mode = GetPhy ()->GetMode (i);
126  txVector.SetNss (nss);
127  txVector.SetMode (mode);
128  NS_LOG_DEBUG ("Adding mode = " << mode.GetUniqueName ());
129  AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
130  }
131  // Add all MCSes
132  if (GetHtSupported ())
133  {
134  nModes = GetPhy ()->GetNMcs ();
135  for (uint8_t i = 0; i < nModes; i++)
136  {
137  for (uint16_t j = 20; j <= GetPhy ()->GetChannelWidth (); j *= 2)
138  {
139  txVector.SetChannelWidth (j);
140  mode = GetPhy ()->GetMcs (i);
141  if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
142  {
143  uint16_t guardInterval = GetShortGuardIntervalSupported () ? 400 : 800;
144  txVector.SetGuardInterval (guardInterval);
145  //derive NSS from the MCS index
146  nss = (mode.GetMcsValue () / 8) + 1;
147  NS_LOG_DEBUG ("Adding mode = " << mode.GetUniqueName () <<
148  " channel width " << j <<
149  " nss " << +nss <<
150  " GI " << guardInterval);
151  txVector.SetNss (nss);
152  txVector.SetMode (mode);
153  AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
154  }
155  else //VHT or HE
156  {
157  uint16_t guardInterval;
158  if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
159  {
160  guardInterval = GetShortGuardIntervalSupported () ? 400 : 800;
161  }
162  else
163  {
164  guardInterval = GetGuardInterval ();
165  }
166  txVector.SetGuardInterval (guardInterval);
167  for (uint8_t k = 1; k <= GetPhy ()->GetMaxSupportedTxSpatialStreams (); k++)
168  {
169  if (mode.IsAllowed (j, k))
170  {
171  NS_LOG_DEBUG ("Adding mode = " << mode.GetUniqueName () <<
172  " channel width " << j <<
173  " nss " << +k <<
174  " GI " << guardInterval);
175  txVector.SetNss (k);
176  txVector.SetMode (mode);
177  AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
178  }
179  else
180  {
181  NS_LOG_DEBUG ("Mode = " << mode.GetUniqueName () << " disallowed");
182  }
183  }
184  }
185  }
186  }
187  }
188 }
189 
190 double
192 {
193  NS_LOG_FUNCTION (this << txVector);
194  auto it = std::find_if (m_thresholds.begin (), m_thresholds.end (),
195  [&txVector] (const std::pair<double, WifiTxVector>& p) -> bool {
196  return ((txVector.GetMode () == p.second.GetMode ()) && (txVector.GetNss () == p.second.GetNss ()) && (txVector.GetChannelWidth () == p.second.GetChannelWidth ()));
197  }
198  );
199  if (it == m_thresholds.end ())
200  {
201  //This means capabilities have changed in runtime, hence rebuild SNR thresholds
203  it = std::find_if (m_thresholds.begin (), m_thresholds.end (),
204  [&txVector] (const std::pair<double, WifiTxVector>& p) -> bool {
205  return ((txVector.GetMode () == p.second.GetMode ()) && (txVector.GetNss () == p.second.GetNss ()) && (txVector.GetChannelWidth () == p.second.GetChannelWidth ()));
206  }
207  );
208  NS_ASSERT_MSG (it != m_thresholds.end (), "SNR threshold not found");
209  }
210  return it->first;
211 }
212 
213 void
215 {
216  NS_LOG_FUNCTION (this << txVector.GetMode ().GetUniqueName () << txVector.GetChannelWidth () << snr);
217  m_thresholds.push_back (std::make_pair (snr, txVector));
218 }
219 
222 {
223  NS_LOG_FUNCTION (this);
225  Reset (station);
226  return station;
227 }
228 
229 void
231 {
232  NS_LOG_FUNCTION (this << station);
233  IdealWifiRemoteStation *st = static_cast<IdealWifiRemoteStation*> (station);
234  st->m_lastSnrObserved = 0.0;
236  st->m_lastNssObserved = 1;
238  st->m_lastMode = GetDefaultMode ();
239  st->m_lastChannelWidth = 0;
240  st->m_lastNss = 1;
241 }
242 
243 void
245 {
246  NS_LOG_FUNCTION (this << station << rxSnr << txMode);
247 }
248 
249 void
251 {
252  NS_LOG_FUNCTION (this << station);
253 }
254 
255 void
257 {
258  NS_LOG_FUNCTION (this << station);
259 }
260 
261 void
263  double ctsSnr, WifiMode ctsMode, double rtsSnr)
264 {
265  NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode.GetUniqueName () << rtsSnr);
266  IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
267  station->m_lastSnrObserved = rtsSnr;
268  station->m_lastChannelWidthObserved = GetPhy ()->GetChannelWidth () >= 40 ? 20 : GetPhy ()->GetChannelWidth ();
269  station->m_lastNssObserved = 1;
270 }
271 
272 void
274  double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
275 {
276  NS_LOG_FUNCTION (this << st << ackSnr << ackMode.GetUniqueName () << dataSnr << dataChannelWidth << +dataNss);
277  IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
278  if (dataSnr == 0)
279  {
280  NS_LOG_WARN ("DataSnr reported to be zero; not saving this report.");
281  return;
282  }
283  station->m_lastSnrObserved = dataSnr;
284  station->m_lastChannelWidthObserved = dataChannelWidth;
285  station->m_lastNssObserved = dataNss;
286 }
287 
288 void
289 IdealWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus,
290  double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
291 {
292  NS_LOG_FUNCTION (this << st << +nSuccessfulMpdus << +nFailedMpdus << rxSnr << dataSnr << dataChannelWidth << +dataNss);
293  IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
294  if (dataSnr == 0)
295  {
296  NS_LOG_WARN ("DataSnr reported to be zero; not saving this report.");
297  return;
298  }
299  station->m_lastSnrObserved = dataSnr;
300  station->m_lastChannelWidthObserved = dataChannelWidth;
301  station->m_lastNssObserved = dataNss;
302 }
303 
304 void
306 {
307  NS_LOG_FUNCTION (this << station);
308  Reset (station);
309 }
310 
311 void
313 {
314  NS_LOG_FUNCTION (this << station);
315  Reset (station);
316 }
317 
320 {
321  NS_LOG_FUNCTION (this << st);
322  IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
323  //We search within the Supported rate set the mode with the
324  //highest data rate for which the SNR threshold is smaller than m_lastSnr
325  //to ensure correct packet delivery.
326  WifiMode maxMode = GetDefaultMode ();
327  WifiTxVector txVector;
328  WifiMode mode;
329  uint64_t bestRate = 0;
330  uint8_t selectedNss = 1;
331  uint16_t guardInterval;
332  uint16_t channelWidth = std::min (GetChannelWidth (station), GetPhy ()->GetChannelWidth ());
333  txVector.SetChannelWidth (channelWidth);
334  if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) && (station->m_lastSnrObserved == station->m_lastSnrCached) && (channelWidth == station->m_lastChannelWidth))
335  {
336  // SNR has not changed, so skip the search and use the last mode selected
337  maxMode = station->m_lastMode;
338  selectedNss = station->m_lastNss;
339  NS_LOG_DEBUG ("Using cached mode = " << maxMode.GetUniqueName () <<
340  " last snr observed " << station->m_lastSnrObserved <<
341  " cached " << station->m_lastSnrCached <<
342  " channel width " << station->m_lastChannelWidth <<
343  " nss " << +selectedNss);
344  }
345  else
346  {
347  if (GetHtSupported () && GetHtSupported (st))
348  {
349  for (uint8_t i = 0; i < GetNMcsSupported (station); i++)
350  {
351  mode = GetMcsSupported (station, i);
352  txVector.SetMode (mode);
353  if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
354  {
355  guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
356  txVector.SetGuardInterval (guardInterval);
357  // If the node and peer are both VHT capable, only search VHT modes
358  if (GetVhtSupported () && GetVhtSupported (station))
359  {
360  continue;
361  }
362  // If the node and peer are both HE capable, only search HE modes
363  if (GetHeSupported () && GetHeSupported (station))
364  {
365  continue;
366  }
367  // Derive NSS from the MCS index. There is a different mode for each possible NSS value.
368  uint8_t nss = (mode.GetMcsValue () / 8) + 1;
369  txVector.SetNss (nss);
370  if (!txVector.IsValid ()
372  {
373  NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
374  " nss " << +nss <<
375  " width " << txVector.GetChannelWidth ());
376  continue;
377  }
378  double threshold = GetSnrThreshold (txVector);
379  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
380  NS_LOG_DEBUG ("Testing mode " << mode.GetUniqueName () <<
381  " data rate " << dataRate <<
382  " threshold " << threshold << " last snr observed " <<
383  station->m_lastSnrObserved << " cached " <<
384  station->m_lastSnrCached);
385  double snr = GetLastObservedSnr (station, channelWidth, nss);
386  if (dataRate > bestRate && threshold < snr)
387  {
388  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
389  " data rate " << dataRate <<
390  " threshold " << threshold <<
391  " channel width " << channelWidth <<
392  " snr " << snr);
393  bestRate = dataRate;
394  maxMode = mode;
395  selectedNss = nss;
396  }
397  }
398  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
399  {
400  guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
401  txVector.SetGuardInterval (guardInterval);
402  // If the node and peer are both HE capable, only search HE modes
403  if (GetHeSupported () && GetHeSupported (station))
404  {
405  continue;
406  }
407  // If the node and peer are not both VHT capable, only search HT modes
408  if (!GetVhtSupported () || !GetVhtSupported (station))
409  {
410  continue;
411  }
412  for (uint8_t nss = 1; nss <= std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (station)); nss++)
413  {
414  txVector.SetNss (nss);
415  if (!txVector.IsValid ())
416  {
417  NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
418  " nss " << +nss <<
419  " width " << txVector.GetChannelWidth ());
420  continue;
421  }
422  double threshold = GetSnrThreshold (txVector);
423  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
424  NS_LOG_DEBUG ("Testing mode = " << mode.GetUniqueName () <<
425  " data rate " << dataRate <<
426  " threshold " << threshold << " last snr observed " <<
427  station->m_lastSnrObserved << " cached " <<
428  station->m_lastSnrCached);
429  double snr = GetLastObservedSnr (station, channelWidth, nss);
430  if (dataRate > bestRate && threshold < snr)
431  {
432  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
433  " data rate " << dataRate <<
434  " channel width " << channelWidth <<
435  " snr " << snr);
436  bestRate = dataRate;
437  maxMode = mode;
438  selectedNss = nss;
439  }
440  }
441  }
442  else //HE
443  {
444  guardInterval = std::max (GetGuardInterval (station), GetGuardInterval ());
445  txVector.SetGuardInterval (guardInterval);
446  // If the node and peer are not both HE capable, only search (V)HT modes
447  if (!GetHeSupported () || !GetHeSupported (station))
448  {
449  continue;
450  }
451  for (uint8_t nss = 1; nss <= std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (station)); nss++)
452  {
453  txVector.SetNss (nss);
454  if (!txVector.IsValid ())
455  {
456  NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
457  " nss " << +nss <<
458  " width " << +txVector.GetChannelWidth ());
459  continue;
460  }
461  double threshold = GetSnrThreshold (txVector);
462  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
463  NS_LOG_DEBUG ("Testing mode = " << mode.GetUniqueName () <<
464  " data rate " << dataRate <<
465  " threshold " << threshold << " last snr observed " <<
466  station->m_lastSnrObserved << " cached " <<
467  station->m_lastSnrCached);
468  double snr = GetLastObservedSnr (station, channelWidth, nss);
469  if (dataRate > bestRate && threshold < snr)
470  {
471  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
472  " data rate " << dataRate <<
473  " threshold " << threshold <<
474  " channel width " << channelWidth <<
475  " snr " << snr);
476  bestRate = dataRate;
477  maxMode = mode;
478  selectedNss = nss;
479  }
480  }
481  }
482  }
483  }
484  else
485  {
486  // Non-HT selection
487  selectedNss = 1;
488  for (uint8_t i = 0; i < GetNSupported (station); i++)
489  {
490  mode = GetSupported (station, i);
491  txVector.SetMode (mode);
492  txVector.SetNss (selectedNss);
493  uint16_t channelWidth = GetChannelWidthForNonHtMode (mode);
494  txVector.SetChannelWidth (channelWidth);
495  double threshold = GetSnrThreshold (txVector);
496  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), txVector.GetNss ());
497  NS_LOG_DEBUG ("mode = " << mode.GetUniqueName () <<
498  " threshold " << threshold <<
499  " last snr observed " <<
500  station->m_lastSnrObserved);
501  double snr = GetLastObservedSnr (station, channelWidth, 1);
502  if (dataRate > bestRate && threshold < snr)
503  {
504  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
505  " data rate " << dataRate <<
506  " threshold " << threshold <<
507  " snr " << snr);
508  bestRate = dataRate;
509  maxMode = mode;
510  }
511  }
512  }
513  NS_LOG_DEBUG ("Updating cached values for station to " << maxMode.GetUniqueName () << " snr " << station->m_lastSnrObserved);
514  station->m_lastSnrCached = station->m_lastSnrObserved;
515  station->m_lastMode = maxMode;
516  station->m_lastNss = selectedNss;
517  }
518  NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << channelWidth << " nss: " << +selectedNss);
519  station->m_lastChannelWidth = channelWidth;
520  if (maxMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
521  {
522  guardInterval = std::max (GetGuardInterval (station), GetGuardInterval ());
523  }
524  else if ((maxMode.GetModulationClass () == WIFI_MOD_CLASS_HT) || (maxMode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
525  {
526  guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
527  }
528  else
529  {
530  guardInterval = 800;
531  }
532  if (m_currentRate != maxMode.GetDataRate (channelWidth, guardInterval, selectedNss))
533  {
534  NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, guardInterval, selectedNss));
535  m_currentRate = maxMode.GetDataRate (channelWidth, guardInterval, selectedNss);
536  }
537  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (maxMode.GetModulationClass (), GetShortPreambleEnabled (), UseGreenfieldForDestination (GetAddress (station))), guardInterval, GetNumberOfAntennas (), selectedNss, 0, GetChannelWidthForTransmission (maxMode, channelWidth), GetAggregation (station), false);
538 }
539 
542 {
543  NS_LOG_FUNCTION (this << st);
544  IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
545  //We search within the Basic rate set the mode with the highest
546  //SNR threshold possible which is smaller than m_lastSnr to
547  //ensure correct packet delivery.
548  double maxThreshold = 0.0;
549  WifiTxVector txVector;
550  WifiMode mode;
551  uint8_t nss = 1;
552  WifiMode maxMode = GetDefaultMode ();
553  //RTS is sent in a non-HT frame
554  for (uint8_t i = 0; i < GetNBasicModes (); i++)
555  {
556  mode = GetBasicMode (i);
557  txVector.SetMode (mode);
558  txVector.SetNss (nss);
560  double threshold = GetSnrThreshold (txVector);
561  if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
562  {
563  maxThreshold = threshold;
564  maxMode = mode;
565  }
566  }
568 }
569 
570 double
571 IdealWifiManager::GetLastObservedSnr (IdealWifiRemoteStation *station, uint16_t channelWidth, uint8_t nss) const
572 {
573  double snr = station->m_lastSnrObserved;
574  if (channelWidth != station->m_lastChannelWidthObserved)
575  {
576  snr /= (static_cast<double> (channelWidth) / station->m_lastChannelWidthObserved);
577  }
578  if (nss != station->m_lastNssObserved)
579  {
580  snr /= (static_cast<double> (nss) / station->m_lastNssObserved);
581  }
582  NS_LOG_DEBUG ("Last observed SNR is " << station->m_lastSnrObserved <<
583  " for channel width " << station->m_lastChannelWidthObserved <<
584  " and nss " << +station->m_lastNssObserved <<
585  "; computed SNR is " << snr <<
586  " for channel width " << channelWidth <<
587  " and nss " << +nss);
588  return snr;
589 }
590 
591 } //namespace ns3
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static const double CACHE_INITIAL_VALUE
To avoid using the cache before a valid value has been cached.
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
Definition: wifi-phy.cc:4138
uint16_t m_lastNssObserved
Number of spatial streams of most recently reported packet sent to the remote station.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
#define min(a, b)
Definition: 80211b.c:42
uint16_t m_lastChannelWidth
Channel width (in MHz) most recently used to the remote station.
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:54
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
#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
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
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.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
uint16_t m_lastChannelWidthObserved
Channel width (in MHz) of most recently reported packet sent to the remote station.
uint16_t GetGuardInterval(void) const
hold per-remote-station state for Ideal Wifi manager.
VHT PHY (Clause 22)
Definition: wifi-mode.h:60
HR/DSSS PHY (Clause 18)
Definition: wifi-mode.h:48
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble, bool useGreenfield)
Return the preamble to be used for the transmission.
Definition: wifi-utils.cc:116
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index. ...
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
uint8_t m_lastNss
Number of spatial streams most recently used to the remote station.
void DoInitialize(void)
Initialize() implementation.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
phy
Definition: third.py:93
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1515
double GetLastObservedSnr(IdealWifiRemoteStation *station, uint16_t channelWidth, uint8_t nss) const
Convenience function to get the last observed SNR from a given station for a given channel width and ...
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
Definition: wifi-phy.cc:4132
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
static TypeId GetTypeId(void)
Get the type ID.
uint16_t GetChannelWidthForNonHtMode(WifiMode mode) const
Convenience function for selecting a channel width for non-HT mode.
double m_ber
The maximum Bit Error Rate acceptable at any transmission mode.
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
#define max(a, b)
Definition: 80211b.c:43
double GetSnrThreshold(WifiTxVector txVector)
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
void BuildSnrThresholds(void)
Construct the vector of minimum SNRs needed to successfully transmit for all possible combinations (r...
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
This method is a pure virtual method that must be implemented by the sub-class.
WifiMode GetMode(void) const
HT PHY (Clause 20)
Definition: wifi-mode.h:58
Thresholds m_thresholds
List of WifiTxVector and the minimum SNR pair.
double m_lastSnrObserved
SNR of most recently reported packet sent to the remote station.
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...
hold a list of per-remote-station state.
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:463
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:426
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY&#39;s default ...
Definition: wifi-utils.cc:97
bool UseGreenfieldForDestination(Mac48Address dest) const
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
WifiRemoteStation * DoCreateStation(void) const
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
double m_lastSnrCached
SNR most recently used to select a rate.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:4120
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
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
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:4126
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot. ...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Ideal rate control algorithmThis class implements an &#39;ideal&#39; rate control algorithm similar to RBAR i...
WifiMode m_lastMode
Mode most recently used to the remote station.
uint16_t GetChannelWidth(void) const
void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
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...
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:441
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1548
a unique identifier for an interface.
Definition: type-id.h:58
void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
HE PHY (Clause 26)
Definition: wifi-mode.h:62
hold per-remote-station state.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:119
DSSS PHY (Clause 15)
Definition: wifi-mode.h:46
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
void AddSnrThreshold(WifiTxVector txVector, double snr)
Adds a pair of WifiTxVector and the minimum SNR for that given vector to the list.
uint8_t GetNss(void) const
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.