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 "ns3/log.h"
22 #include "ideal-wifi-manager.h"
23 #include "wifi-phy.h"
24 
25 namespace ns3 {
26 
34 {
36  double m_lastSnrCached;
37  uint8_t m_nss;
39 };
40 
42 static const double CACHE_INITIAL_VALUE = -100;
43 
45 
46 NS_LOG_COMPONENT_DEFINE ("IdealWifiManager");
47 
48 TypeId
50 {
51  static TypeId tid = TypeId ("ns3::IdealWifiManager")
53  .SetGroupName ("Wifi")
54  .AddConstructor<IdealWifiManager> ()
55  .AddAttribute ("BerThreshold",
56  "The maximum Bit Error Rate acceptable at any transmission mode",
57  DoubleValue (1e-5),
59  MakeDoubleChecker<double> ())
60  .AddTraceSource ("Rate",
61  "Traced value for rate changes (b/s)",
63  "ns3::TracedValueCallback::Uint64")
64  ;
65  return tid;
66 }
67 
69  : m_currentRate (0)
70 {
71  NS_LOG_FUNCTION (this);
72 }
73 
75 {
76  NS_LOG_FUNCTION (this);
77 }
78 
79 void
81 {
82  NS_LOG_FUNCTION (this << phy);
84 }
85 
86 uint16_t
88 {
94  {
95  return 22;
96  }
97  else
98  {
99  return 20;
100  }
101 }
102 
103 void
105 {
106  NS_LOG_FUNCTION (this);
107  WifiMode mode;
108  WifiTxVector txVector;
109  uint8_t nss = 1;
110  uint8_t nModes = GetPhy ()->GetNModes ();
111  for (uint8_t i = 0; i < nModes; i++)
112  {
113  mode = GetPhy ()->GetMode (i);
114  txVector.SetChannelWidth (GetChannelWidthForMode (mode));
115  txVector.SetNss (nss);
116  txVector.SetMode (mode);
117  NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName ());
118  AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
119  }
120  // Add all Ht and Vht MCSes
121  if (HasVhtSupported () == true || HasHtSupported () == true || HasHeSupported () == true)
122  {
123  nModes = GetPhy ()->GetNMcs ();
124  for (uint8_t i = 0; i < nModes; i++)
125  {
126  for (uint16_t j = 20; j <= GetPhy ()->GetChannelWidth (); j *= 2)
127  {
128  txVector.SetChannelWidth (j);
129  mode = GetPhy ()->GetMcs (i);
130  if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
131  {
132  uint16_t guardInterval = GetPhy ()->GetShortGuardInterval () ? 400 : 800;
133  txVector.SetGuardInterval (guardInterval);
134  //derive NSS from the MCS index
135  nss = (mode.GetMcsValue () / 8) + 1;
136  NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName () <<
137  " channel width " << j <<
138  " nss " << +nss <<
139  " GI " << guardInterval);
140  NS_LOG_DEBUG ("In SetupPhy, adding mode = " << mode.GetUniqueName ());
141  txVector.SetNss (nss);
142  txVector.SetMode (mode);
143  AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
144  }
145  else //VHT or HE
146  {
147  uint16_t guardInterval;
148  if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
149  {
150  guardInterval = GetPhy ()->GetShortGuardInterval () ? 400 : 800;
151  }
152  else
153  {
154  guardInterval = static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ());
155  }
156  txVector.SetGuardInterval (guardInterval);
157  for (uint8_t k = 1; k <= GetPhy ()->GetMaxSupportedTxSpatialStreams (); k++)
158  {
159  NS_LOG_DEBUG ("Initialize, adding mode = " << mode.GetUniqueName () <<
160  " channel width " << j <<
161  " nss " << +k <<
162  " GI " << guardInterval);
163  NS_LOG_DEBUG ("In SetupPhy, adding mode = " << mode.GetUniqueName ());
164  txVector.SetNss (k);
165  txVector.SetMode (mode);
166  AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
167  }
168  }
169  }
170  }
171  }
172 }
173 
174 double
176 {
177  NS_LOG_FUNCTION (this << txVector.GetMode ().GetUniqueName ());
178  for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); i++)
179  {
180  NS_LOG_DEBUG ("Checking " << i->second.GetMode ().GetUniqueName () <<
181  " nss " << +i->second.GetNss () <<
182  " GI " << i->second.GetGuardInterval () <<
183  " width " << i->second.GetChannelWidth ());
184  NS_LOG_DEBUG ("against TxVector " << txVector.GetMode ().GetUniqueName () <<
185  " nss " << +txVector.GetNss () <<
186  " GI " << txVector.GetGuardInterval () <<
187  " width " << txVector.GetChannelWidth ());
188  if (txVector.GetMode () == i->second.GetMode ()
189  && txVector.GetNss () == i->second.GetNss ()
190  && txVector.GetChannelWidth () == i->second.GetChannelWidth ())
191  {
192  return i->first;
193  }
194  }
195  NS_ASSERT (false);
196  return 0.0;
197 }
198 
199 void
201 {
202  NS_LOG_FUNCTION (this << txVector.GetMode ().GetUniqueName () << snr);
203  m_thresholds.push_back (std::make_pair (snr, txVector));
204 }
205 
208 {
209  NS_LOG_FUNCTION (this);
211  station->m_lastSnrObserved = 0.0;
213  station->m_lastMode = GetDefaultMode ();
214  station->m_nss = 1;
215  return station;
216 }
217 
218 
219 void
221 {
222  NS_LOG_FUNCTION (this << station << rxSnr << txMode);
223 }
224 
225 void
227 {
228  NS_LOG_FUNCTION (this << station);
229 }
230 
231 void
233 {
234  NS_LOG_FUNCTION (this << station);
235 }
236 
237 void
239  double ctsSnr, WifiMode ctsMode, double rtsSnr)
240 {
241  NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode.GetUniqueName () << rtsSnr);
243  station->m_lastSnrObserved = rtsSnr;
244 }
245 
246 void
248  double ackSnr, WifiMode ackMode, double dataSnr)
249 {
250  NS_LOG_FUNCTION (this << st << ackSnr << ackMode.GetUniqueName () << dataSnr);
252  if (dataSnr == 0)
253  {
254  NS_LOG_WARN ("DataSnr reported to be zero; not saving this report.");
255  return;
256  }
257  station->m_lastSnrObserved = dataSnr;
258 }
259 
260 void
261 IdealWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr)
262 {
263  NS_LOG_FUNCTION (this << st << +nSuccessfulMpdus << +nFailedMpdus << rxSnr << dataSnr);
265  if (dataSnr == 0)
266  {
267  NS_LOG_WARN ("DataSnr reported to be zero; not saving this report.");
268  return;
269  }
270  station->m_lastSnrObserved = dataSnr;
271 }
272 
273 
274 void
276 {
277  NS_LOG_FUNCTION (this << station);
279  st->m_lastSnrObserved = 0.0;
280 }
281 
282 void
284 {
285  NS_LOG_FUNCTION (this << station);
287  st->m_lastSnrObserved = 0.0;
288 }
289 
292 {
293  NS_LOG_FUNCTION (this << st);
295  //We search within the Supported rate set the mode with the
296  //highest data rate for which the snr threshold is smaller than m_lastSnr
297  //to ensure correct packet delivery.
298  WifiMode maxMode = GetDefaultMode ();
299  WifiTxVector txVector;
300  WifiMode mode;
301  uint64_t bestRate = 0;
302  uint8_t selectedNss = 1;
303  uint16_t guardInterval;
304  uint16_t channelWidth = std::min (GetChannelWidth (station), GetPhy ()->GetChannelWidth ());
305  txVector.SetChannelWidth (channelWidth);
306  if (station->m_lastSnrCached != CACHE_INITIAL_VALUE && station->m_lastSnrObserved == station->m_lastSnrCached)
307  {
308  // SNR has not changed, so skip the search and use the last
309  // mode selected
310  maxMode = station->m_lastMode;
311  selectedNss = station->m_nss;
312  NS_LOG_DEBUG ("Using cached mode = " << maxMode.GetUniqueName () <<
313  " last snr observed " << station->m_lastSnrObserved <<
314  " cached " << station->m_lastSnrCached <<
315  " nss " << +selectedNss);
316  }
317  else
318  {
319  if ((HasVhtSupported () == true || HasHtSupported () == true || HasHeSupported () == true)
320  && (GetHtSupported (st) == true || GetVhtSupported (st) == true || GetHeSupported (st) == true))
321  {
322  for (uint8_t i = 0; i < GetNMcsSupported (station); i++)
323  {
324  mode = GetMcsSupported (station, i);
325  txVector.SetMode (mode);
326  if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
327  {
328  guardInterval = static_cast<uint16_t> (std::max (GetShortGuardInterval (station) ? 400 : 800, GetPhy ()->GetShortGuardInterval () ? 400 : 800));
329  txVector.SetGuardInterval (guardInterval);
330  // If the node and peer are both VHT capable, only search VHT modes
331  if (HasVhtSupported () && GetVhtSupported (station))
332  {
333  continue;
334  }
335  // If the node and peer are both HE capable, only search HE modes
336  if (HasHeSupported () && GetHeSupported (station))
337  {
338  continue;
339  }
340  // Derive NSS from the MCS index. There is a different mode for each possible NSS value.
341  uint8_t nss = (mode.GetMcsValue () / 8) + 1;
342  txVector.SetNss (nss);
343  if (!txVector.IsValid ()
345  {
346  NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
347  " nss " << +nss <<
348  " width " << txVector.GetChannelWidth ());
349  continue;
350  }
351  double threshold = GetSnrThreshold (txVector);
352  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
353  NS_LOG_DEBUG ("Testing mode " << mode.GetUniqueName () <<
354  " data rate " << dataRate <<
355  " threshold " << threshold << " last snr observed " <<
356  station->m_lastSnrObserved << " cached " <<
357  station->m_lastSnrCached);
358  if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
359  {
360  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
361  " data rate " << dataRate <<
362  " threshold " << threshold <<
363  " last snr observed " <<
364  station->m_lastSnrObserved);
365  bestRate = dataRate;
366  maxMode = mode;
367  selectedNss = nss;
368  }
369  }
370  else if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
371  {
372  guardInterval = static_cast<uint16_t> (std::max (GetShortGuardInterval (station) ? 400 : 800, GetPhy ()->GetShortGuardInterval () ? 400 : 800));
373  txVector.SetGuardInterval (guardInterval);
374  // If the node and peer are both HE capable, only search HE modes
375  if (HasHeSupported () && GetHeSupported (station))
376  {
377  continue;
378  }
379  // If the node and peer are not both VHT capable, only search HT modes
380  if (!HasVhtSupported () || !GetVhtSupported (station))
381  {
382  continue;
383  }
384  for (uint8_t nss = 1; nss <= std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (station)); nss++)
385  {
386  txVector.SetNss (nss);
387  if (!txVector.IsValid ())
388  {
389  NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
390  " nss " << +nss <<
391  " width " << txVector.GetChannelWidth ());
392  continue;
393  }
394  double threshold = GetSnrThreshold (txVector);
395  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
396  NS_LOG_DEBUG ("Testing mode = " << mode.GetUniqueName () <<
397  " data rate " << dataRate <<
398  " threshold " << threshold << " last snr observed " <<
399  station->m_lastSnrObserved << " cached " <<
400  station->m_lastSnrCached);
401  if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
402  {
403  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
404  " data rate " << dataRate <<
405  " threshold " << threshold <<
406  " last snr observed " <<
407  station->m_lastSnrObserved);
408  bestRate = dataRate;
409  maxMode = mode;
410  selectedNss = nss;
411  }
412  }
413  }
414  else //HE
415  {
416  guardInterval = std::max (GetGuardInterval (station), static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ()));
417  txVector.SetGuardInterval (guardInterval);
418  // If the node and peer are not both HE capable, only search (V)HT modes
419  if (!HasHeSupported () || !GetHeSupported (station))
420  {
421  continue;
422  }
423  for (uint8_t nss = 1; nss <= GetNumberOfSupportedStreams (station); nss++)
424  {
425  txVector.SetNss (nss);
426  if (!txVector.IsValid ())
427  {
428  NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
429  " nss " << +nss <<
430  " width " << +txVector.GetChannelWidth ());
431  continue;
432  }
433  double threshold = GetSnrThreshold (txVector);
434  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
435  NS_LOG_DEBUG ("Testing mode = " << mode.GetUniqueName () <<
436  " data rate " << dataRate <<
437  " threshold " << threshold << " last snr observed " <<
438  station->m_lastSnrObserved << " cached " <<
439  station->m_lastSnrCached);
440  if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
441  {
442  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
443  " data rate " << dataRate <<
444  " threshold " << threshold <<
445  " last snr observed " <<
446  station->m_lastSnrObserved);
447  bestRate = dataRate;
448  maxMode = mode;
449  selectedNss = nss;
450  }
451  }
452  }
453  }
454  }
455  else
456  {
457  // Non-HT selection
458  selectedNss = 1;
459  for (uint8_t i = 0; i < GetNSupported (station); i++)
460  {
461  mode = GetSupported (station, i);
462  txVector.SetMode (mode);
463  txVector.SetNss (selectedNss);
464  txVector.SetChannelWidth (GetChannelWidthForMode (mode));
465  double threshold = GetSnrThreshold (txVector);
466  uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), txVector.GetNss ());
467  NS_LOG_DEBUG ("mode = " << mode.GetUniqueName () <<
468  " threshold " << threshold <<
469  " last snr observed " <<
470  station->m_lastSnrObserved);
471  if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
472  {
473  NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
474  " data rate " << dataRate <<
475  " threshold " << threshold <<
476  " last snr observed " <<
477  station->m_lastSnrObserved);
478  bestRate = dataRate;
479  maxMode = mode;
480  }
481  }
482  }
483  NS_LOG_DEBUG ("Updating cached values for station to " << maxMode.GetUniqueName () << " snr " << station->m_lastSnrObserved);
484  station->m_lastSnrCached = station->m_lastSnrObserved;
485  station->m_lastMode = maxMode;
486  station->m_nss = selectedNss;
487  }
488  NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << channelWidth);
489  if (maxMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
490  {
491  guardInterval = std::max (GetGuardInterval (station), static_cast<uint16_t> (GetPhy ()->GetGuardInterval ().GetNanoSeconds ()));
492  }
493  else
494  {
495  guardInterval = static_cast<uint16_t> (std::max (GetShortGuardInterval (station) ? 400 : 800, GetPhy ()->GetShortGuardInterval () ? 400 : 800));
496  }
497  if (m_currentRate != maxMode.GetDataRate (channelWidth, guardInterval, selectedNss))
498  {
499  NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, guardInterval, selectedNss));
500  m_currentRate = maxMode.GetDataRate (channelWidth, guardInterval, selectedNss);
501  }
502  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (maxMode, GetAddress (station)), guardInterval, GetNumberOfAntennas (), selectedNss, 0, GetChannelWidthForTransmission (maxMode, channelWidth), GetAggregation (station), false);
503 }
504 
507 {
508  NS_LOG_FUNCTION (this << st);
510  //We search within the Basic rate set the mode with the highest
511  //snr threshold possible which is smaller than m_lastSnr to
512  //ensure correct packet delivery.
513  double maxThreshold = 0.0;
514  WifiTxVector txVector;
515  WifiMode mode;
516  uint8_t nss = 1;
517  WifiMode maxMode = GetDefaultMode ();
518  //avoid to use legacy rate adaptation algorithms for IEEE 802.11n/ac/ax
519  //RTS is sent in a legacy frame; RTS with HT/VHT/HE is not yet supported
520  for (uint8_t i = 0; i < GetNBasicModes (); i++)
521  {
522  mode = GetBasicMode (i);
523  txVector.SetMode (mode);
524  txVector.SetNss (nss);
525  txVector.SetChannelWidth (GetChannelWidthForMode (mode));
526  double threshold = GetSnrThreshold (txVector);
527  if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
528  {
529  maxThreshold = threshold;
530  maxMode = mode;
531  }
532  }
533  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (maxMode, GetAddress (station)), 800, GetNumberOfAntennas (), nss, 0, GetChannelWidthForMode (maxMode), GetAggregation (station), false);
534 }
535 
536 bool
538 {
539  return true;
540 }
541 
542 } //namespace ns3
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
bool HasVhtSupported(void) const
Return whether the device has VHT capability support enabled.
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
#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:3523
#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
bool GetShortGuardInterval(void) const
Return whether short guard interval is supported.
Definition: wifi-phy.cc:617
#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:202
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 GetGuardInterval(void) const
uint16_t GetGuardInterval(const WifiRemoteStation *station) const
Return the HE guard interval duration supported by the station.
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
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
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:86
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:1263
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:3517
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
static TypeId GetTypeId(void)
Get the type ID.
bool GetVhtSupported(Mac48Address address) const
Return whether the station supports VHT or not.
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
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
WifiPreamble GetPreambleForTransmission(WifiMode mode, Mac48Address dest)
Return the preamble to be used for the transmission.
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:500
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:463
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.
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.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
uint16_t GetChannelWidthForMode(WifiMode mode) const
Convenience function for selecting a channel width for legacy mode.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool HasHeSupported(void) const
Return whether the device has HE capability support enabled.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:367
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
WifiRemoteStation * DoCreateStation(void) const
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool HasHtSupported(void) const
Return whether the device has HT capability support enabled.
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:3505
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.
bool GetHeSupported(const WifiRemoteStation *station) const
Return whether the given station is HE capable.
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Definition: wifi-phy.cc:3511
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
bool GetHtSupported(Mac48Address address) const
Return whether the station supports HT or not.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:262
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:270
uint8_t m_nss
Number of spacial streams.
bool IsLowLatency(void) const
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.
bool GetShortGuardInterval(Mac48Address address) const
Return whether the station supports HT/VHT short guard interval.
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...
static 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 ...
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
double GetSnrThreshold(WifiTxVector txVector) const
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:478
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1296
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:915
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:156
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.
Time GetGuardInterval(void) const
Definition: wifi-phy.cc:631