A Discrete-Event Network Simulator
API
ideal-wifi-manager.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #include "ideal-wifi-manager.h"
21 
22 #include "ns3/log.h"
23 #include "ns3/wifi-phy.h"
24 
25 #include <algorithm>
26 
27 namespace ns3
28 {
29 
37 {
41  uint16_t m_lastNssObserved;
43  double m_lastSnrCached;
44  uint8_t m_lastNss;
46  uint16_t
48 };
49 
51 static const double CACHE_INITIAL_VALUE = -100;
52 
54 
55 NS_LOG_COMPONENT_DEFINE("IdealWifiManager");
56 
57 TypeId
59 {
60  static TypeId tid =
61  TypeId("ns3::IdealWifiManager")
63  .SetGroupName("Wifi")
64  .AddConstructor<IdealWifiManager>()
65  .AddAttribute("BerThreshold",
66  "The maximum Bit Error Rate acceptable at any transmission mode",
67  DoubleValue(1e-6),
69  MakeDoubleChecker<double>())
70  .AddTraceSource("Rate",
71  "Traced value for rate changes (b/s)",
73  "ns3::TracedValueCallback::Uint64");
74  return tid;
75 }
76 
78  : m_currentRate(0)
79 {
80  NS_LOG_FUNCTION(this);
81 }
82 
84 {
85  NS_LOG_FUNCTION(this);
86 }
87 
88 void
90 {
91  NS_LOG_FUNCTION(this << phy);
93 }
94 
95 uint16_t
97 {
101  {
102  return 22;
103  }
104  else
105  {
106  return 20;
107  }
108 }
109 
110 void
112 {
113  NS_LOG_FUNCTION(this);
115 }
116 
117 void
119 {
120  m_thresholds.clear();
121  WifiMode mode;
122  WifiTxVector txVector;
123  uint8_t nss = 1;
124  for (const auto& mode : GetPhy()->GetModeList())
125  {
127  txVector.SetNss(nss);
128  txVector.SetMode(mode);
129  NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName());
130  AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
131  }
132  // Add all MCSes
133  if (GetHtSupported())
134  {
135  for (const auto& mode : GetPhy()->GetMcsList())
136  {
137  for (uint16_t j = 20; j <= GetPhy()->GetChannelWidth(); j *= 2)
138  {
139  txVector.SetChannelWidth(j);
141  {
142  uint16_t guardInterval = GetShortGuardIntervalSupported() ? 400 : 800;
143  txVector.SetGuardInterval(guardInterval);
144  // derive NSS from the MCS index
145  nss = (mode.GetMcsValue() / 8) + 1;
146  NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName() << " channel width " << j
147  << " nss " << +nss << " GI " << guardInterval);
148  txVector.SetNss(nss);
149  txVector.SetMode(mode);
150  AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
151  }
152  else
153  {
154  uint16_t guardInterval;
156  {
157  guardInterval = GetShortGuardIntervalSupported() ? 400 : 800;
158  }
159  else
160  {
161  guardInterval = GetGuardInterval();
162  }
163  txVector.SetGuardInterval(guardInterval);
164  for (uint8_t k = 1; k <= GetPhy()->GetMaxSupportedTxSpatialStreams(); k++)
165  {
166  if (mode.IsAllowed(j, k))
167  {
168  NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName()
169  << " channel width " << j << " nss " << +k
170  << " GI " << guardInterval);
171  txVector.SetNss(k);
172  txVector.SetMode(mode);
173  AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
174  }
175  else
176  {
177  NS_LOG_DEBUG("Mode = " << mode.GetUniqueName() << " disallowed");
178  }
179  }
180  }
181  }
182  }
183  }
184 }
185 
186 double
188 {
189  NS_LOG_FUNCTION(this << txVector);
190  auto it = std::find_if(m_thresholds.begin(),
191  m_thresholds.end(),
192  [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
193  return ((txVector.GetMode() == p.second.GetMode()) &&
194  (txVector.GetNss() == p.second.GetNss()) &&
195  (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
196  });
197  if (it == m_thresholds.end())
198  {
199  // This means capabilities have changed in runtime, hence rebuild SNR thresholds
201  it = std::find_if(m_thresholds.begin(),
202  m_thresholds.end(),
203  [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
204  return ((txVector.GetMode() == p.second.GetMode()) &&
205  (txVector.GetNss() == p.second.GetNss()) &&
206  (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
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()
217  << snr);
218  m_thresholds.emplace_back(snr, txVector);
219 }
220 
223 {
224  NS_LOG_FUNCTION(this);
225  auto station = new IdealWifiRemoteStation();
226  Reset(station);
227  return station;
228 }
229 
230 void
232 {
233  NS_LOG_FUNCTION(this << station);
234  auto st = static_cast<IdealWifiRemoteStation*>(station);
235  st->m_lastSnrObserved = 0.0;
236  st->m_lastChannelWidthObserved = 0;
237  st->m_lastNssObserved = 1;
238  st->m_lastSnrCached = CACHE_INITIAL_VALUE;
239  st->m_lastMode = GetDefaultMode();
240  st->m_lastChannelWidth = 0;
241  st->m_lastNss = 1;
242 }
243 
244 void
246 {
247  NS_LOG_FUNCTION(this << station << rxSnr << txMode);
248 }
249 
250 void
252 {
253  NS_LOG_FUNCTION(this << station);
254 }
255 
256 void
258 {
259  NS_LOG_FUNCTION(this << station);
260 }
261 
262 void
264  double ctsSnr,
265  WifiMode ctsMode,
266  double rtsSnr)
267 {
268  NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode.GetUniqueName() << rtsSnr);
269  auto station = static_cast<IdealWifiRemoteStation*>(st);
270  station->m_lastSnrObserved = rtsSnr;
271  station->m_lastChannelWidthObserved =
272  GetPhy()->GetChannelWidth() >= 40 ? 20 : GetPhy()->GetChannelWidth();
273  station->m_lastNssObserved = 1;
274 }
275 
276 void
278  double ackSnr,
279  WifiMode ackMode,
280  double dataSnr,
281  uint16_t dataChannelWidth,
282  uint8_t dataNss)
283 {
284  NS_LOG_FUNCTION(this << st << ackSnr << ackMode.GetUniqueName() << dataSnr << dataChannelWidth
285  << +dataNss);
286  auto station = static_cast<IdealWifiRemoteStation*>(st);
287  if (dataSnr == 0)
288  {
289  NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
290  return;
291  }
292  station->m_lastSnrObserved = dataSnr;
293  station->m_lastChannelWidthObserved = dataChannelWidth;
294  station->m_lastNssObserved = dataNss;
295 }
296 
297 void
299  uint16_t nSuccessfulMpdus,
300  uint16_t nFailedMpdus,
301  double rxSnr,
302  double dataSnr,
303  uint16_t dataChannelWidth,
304  uint8_t dataNss)
305 {
306  NS_LOG_FUNCTION(this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr
307  << dataChannelWidth << +dataNss);
308  auto station = static_cast<IdealWifiRemoteStation*>(st);
309  if (dataSnr == 0)
310  {
311  NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
312  return;
313  }
314  station->m_lastSnrObserved = dataSnr;
315  station->m_lastChannelWidthObserved = dataChannelWidth;
316  station->m_lastNssObserved = dataNss;
317 }
318 
319 void
321 {
322  NS_LOG_FUNCTION(this << station);
323  Reset(station);
324 }
325 
326 void
328 {
329  NS_LOG_FUNCTION(this << station);
330  Reset(station);
331 }
332 
335 {
336  NS_LOG_FUNCTION(this << st << allowedWidth);
337  auto station = static_cast<IdealWifiRemoteStation*>(st);
338  // We search within the Supported rate set the mode with the
339  // highest data rate for which the SNR threshold is smaller than m_lastSnr
340  // to ensure correct packet delivery.
341  WifiMode maxMode = GetDefaultModeForSta(st);
342  WifiTxVector txVector;
343  uint64_t bestRate = 0;
344  uint8_t selectedNss = 1;
345  uint16_t guardInterval;
346  uint16_t channelWidth = std::min(GetChannelWidth(station), allowedWidth);
347  txVector.SetChannelWidth(channelWidth);
348  if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) &&
349  (station->m_lastSnrObserved == station->m_lastSnrCached) &&
350  (channelWidth == station->m_lastChannelWidth))
351  {
352  // SNR has not changed, so skip the search and use the last mode selected
353  maxMode = station->m_lastMode;
354  selectedNss = station->m_lastNss;
355  NS_LOG_DEBUG("Using cached mode = " << maxMode.GetUniqueName() << " last snr observed "
356  << station->m_lastSnrObserved << " cached "
357  << station->m_lastSnrCached << " channel width "
358  << station->m_lastChannelWidth << " nss "
359  << +selectedNss);
360  }
361  else
362  {
363  if (GetHtSupported() && GetHtSupported(st))
364  {
365  for (uint8_t i = 0; i < GetNMcsSupported(station); i++)
366  {
367  auto mode = GetMcsSupported(station, i);
368  if (!IsCandidateModulationClass(mode.GetModulationClass(), station))
369  {
370  continue;
371  }
372  txVector.SetMode(mode);
373  uint16_t guardInterval;
374  if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE)
375  {
376  guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
377  }
378  else
379  {
380  guardInterval = static_cast<uint16_t>(
381  std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
382  GetShortGuardIntervalSupported() ? 400 : 800));
383  }
384  txVector.SetGuardInterval(guardInterval);
385  if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT)
386  {
387  // Derive NSS from the MCS index. There is a different mode for each possible
388  // NSS value.
389  uint8_t nss = (mode.GetMcsValue() / 8) + 1;
390  txVector.SetNss(nss);
391  if (!txVector.IsValid() || nss > std::min(GetMaxNumberOfTransmitStreams(),
393  {
394  NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
395  << " width " << txVector.GetChannelWidth());
396  continue;
397  }
398  double threshold = GetSnrThreshold(txVector);
399  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
400  txVector.GetGuardInterval(),
401  nss);
402  NS_LOG_DEBUG("Testing mode " << mode.GetUniqueName() << " data rate "
403  << dataRate << " threshold " << threshold
404  << " last snr observed "
405  << station->m_lastSnrObserved << " cached "
406  << station->m_lastSnrCached);
407  double snr = GetLastObservedSnr(station, channelWidth, nss);
408  if (dataRate > bestRate && threshold < snr)
409  {
410  NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
411  << dataRate << " threshold " << threshold
412  << " channel width " << channelWidth
413  << " snr " << snr);
414  bestRate = dataRate;
415  maxMode = mode;
416  selectedNss = nss;
417  }
418  }
419  else
420  {
421  for (uint8_t nss = 1; nss <= std::min(GetMaxNumberOfTransmitStreams(),
422  GetNumberOfSupportedStreams(station));
423  nss++)
424  {
425  txVector.SetNss(nss);
426  if (!txVector.IsValid())
427  {
428  NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
429  << " width "
430  << +txVector.GetChannelWidth());
431  continue;
432  }
433  double threshold = GetSnrThreshold(txVector);
434  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
435  txVector.GetGuardInterval(),
436  nss);
437  NS_LOG_DEBUG("Testing mode = " << mode.GetUniqueName() << " data rate "
438  << dataRate << " threshold " << threshold
439  << " last snr observed "
440  << station->m_lastSnrObserved << " cached "
441  << station->m_lastSnrCached);
442  double snr = GetLastObservedSnr(station, channelWidth, nss);
443  if (dataRate > bestRate && threshold < snr)
444  {
445  NS_LOG_DEBUG("Candidate mode = "
446  << mode.GetUniqueName() << " data rate " << dataRate
447  << " threshold " << threshold << " channel width "
448  << channelWidth << " snr " << snr);
449  bestRate = dataRate;
450  maxMode = mode;
451  selectedNss = nss;
452  }
453  }
454  }
455  }
456  }
457  else
458  {
459  // Non-HT selection
460  selectedNss = 1;
461  for (uint8_t i = 0; i < GetNSupported(station); i++)
462  {
463  auto mode = GetSupported(station, i);
464  txVector.SetMode(mode);
465  txVector.SetNss(selectedNss);
466  uint16_t channelWidth = GetChannelWidthForNonHtMode(mode);
467  txVector.SetChannelWidth(channelWidth);
468  double threshold = GetSnrThreshold(txVector);
469  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
470  txVector.GetGuardInterval(),
471  txVector.GetNss());
472  NS_LOG_DEBUG("mode = " << mode.GetUniqueName() << " threshold " << threshold
473  << " last snr observed " << station->m_lastSnrObserved);
474  double snr = GetLastObservedSnr(station, channelWidth, 1);
475  if (dataRate > bestRate && threshold < snr)
476  {
477  NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
478  << dataRate << " threshold " << threshold
479  << " snr " << snr);
480  bestRate = dataRate;
481  maxMode = mode;
482  }
483  }
484  }
485  NS_LOG_DEBUG("Updating cached values for station to " << maxMode.GetUniqueName() << " snr "
486  << station->m_lastSnrObserved);
487  station->m_lastSnrCached = station->m_lastSnrObserved;
488  station->m_lastMode = maxMode;
489  station->m_lastNss = selectedNss;
490  }
491  NS_LOG_DEBUG("Found maxMode: " << maxMode << " channelWidth: " << channelWidth
492  << " nss: " << +selectedNss);
493  station->m_lastChannelWidth = channelWidth;
494  if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HE))
495  {
496  guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
497  }
498  else if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HT))
499  {
500  guardInterval =
501  static_cast<uint16_t>(std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
502  GetShortGuardIntervalSupported() ? 400 : 800));
503  }
504  else
505  {
506  guardInterval = 800;
507  }
508  WifiTxVector bestTxVector{
509  maxMode,
512  guardInterval,
514  selectedNss,
515  0,
516  GetPhy()->GetTxBandwidth(maxMode, channelWidth),
517  GetAggregation(station)};
518  uint64_t maxDataRate = maxMode.GetDataRate(bestTxVector);
519  if (m_currentRate != maxDataRate)
520  {
521  NS_LOG_DEBUG("New datarate: " << maxDataRate);
522  m_currentRate = maxDataRate;
523  }
524  return bestTxVector;
525 }
526 
529 {
530  NS_LOG_FUNCTION(this << st);
531  auto station = static_cast<IdealWifiRemoteStation*>(st);
532  // We search within the Basic rate set the mode with the highest
533  // SNR threshold possible which is smaller than m_lastSnr to
534  // ensure correct packet delivery.
535  double maxThreshold = 0.0;
536  WifiTxVector txVector;
537  WifiMode mode;
538  uint8_t nss = 1;
539  WifiMode maxMode = GetDefaultMode();
540  // RTS is sent in a non-HT frame
541  for (uint8_t i = 0; i < GetNBasicModes(); i++)
542  {
543  mode = GetBasicMode(i);
544  txVector.SetMode(mode);
545  txVector.SetNss(nss);
547  double threshold = GetSnrThreshold(txVector);
548  if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
549  {
550  maxThreshold = threshold;
551  maxMode = mode;
552  }
553  }
554  return WifiTxVector(
555  maxMode,
558  800,
560  nss,
561  0,
563  GetAggregation(station));
564 }
565 
566 double
568  uint16_t channelWidth,
569  uint8_t nss) const
570 {
571  double snr = station->m_lastSnrObserved;
572  if (channelWidth != station->m_lastChannelWidthObserved)
573  {
574  snr /= (static_cast<double>(channelWidth) / station->m_lastChannelWidthObserved);
575  }
576  if (nss != station->m_lastNssObserved)
577  {
578  snr /= (static_cast<double>(nss) / station->m_lastNssObserved);
579  }
580  NS_LOG_DEBUG("Last observed SNR is " << station->m_lastSnrObserved << " for channel width "
581  << station->m_lastChannelWidthObserved << " and nss "
582  << +station->m_lastNssObserved << "; computed SNR is "
583  << snr << " for channel width " << channelWidth
584  << " and nss " << +nss);
585  return snr;
586 }
587 
588 bool
590  IdealWifiRemoteStation* station)
591 {
592  switch (mc)
593  {
594  case WIFI_MOD_CLASS_HT:
595  return (GetHtSupported() && GetHtSupported(station));
596  case WIFI_MOD_CLASS_VHT:
597  return (GetVhtSupported() && GetVhtSupported(station));
598  case WIFI_MOD_CLASS_HE:
599  return (GetHeSupported() && GetHeSupported(station));
600  case WIFI_MOD_CLASS_EHT:
601  return (GetEhtSupported() && GetEhtSupported(station));
602  default:
603  NS_ABORT_MSG("Unknown modulation class: " << mc);
604  }
605 }
606 
607 bool
609  IdealWifiRemoteStation* station)
610 {
611  if (!IsModulationClassSupported(mc, station))
612  {
613  return false;
614  }
615  switch (mc)
616  {
617  case WIFI_MOD_CLASS_HT:
618  // If the node and peer are both VHT capable, skip non-VHT modes
619  if (GetVhtSupported() && GetVhtSupported(station))
620  {
621  return false;
622  }
623  [[fallthrough]];
624  case WIFI_MOD_CLASS_VHT:
625  // If the node and peer are both HE capable, skip non-HE modes
626  if (GetHeSupported() && GetHeSupported(station))
627  {
628  return false;
629  }
630  [[fallthrough]];
631  case WIFI_MOD_CLASS_HE:
632  // If the node and peer are both EHT capable, skip non-EHT modes
633  if (GetEhtSupported() && GetEhtSupported(station))
634  {
635  return false;
636  }
637  break;
638  case WIFI_MOD_CLASS_EHT:
639  break;
640  default:
641  NS_ABORT_MSG("Unknown modulation class: " << mc);
642  }
643  return true;
644 }
645 
646 } // namespace ns3
#define min(a, b)
Definition: 80211b.c:41
#define max(a, b)
Definition: 80211b.c:42
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Ideal rate control algorithm.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void AddSnrThreshold(WifiTxVector txVector, double snr)
Adds a pair of WifiTxVector and the minimum SNR for that given vector to the list.
void BuildSnrThresholds()
Construct the vector of minimum SNRs needed to successfully transmit for all possible combinations (r...
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth) override
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
void DoInitialize() override
Initialize() implementation.
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.
WifiRemoteStation * DoCreateStation() const override
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
static TypeId GetTypeId()
Get the type ID.
bool IsModulationClassSupported(WifiModulationClass mc, IdealWifiRemoteStation *station)
Check whether a given modulation class is supported by both the node and the peer.
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.
bool IsCandidateModulationClass(WifiModulationClass mc, IdealWifiRemoteStation *station)
Check whether a given modulation class is supported and that there are no higher modulation classes t...
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
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...
TracedValue< uint64_t > m_currentRate
Trace rate changes.
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 ...
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.
Thresholds m_thresholds
List of WifiTxVector and the minimum SNR pair.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
double GetSnrThreshold(WifiTxVector txVector)
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
represent a single transmission mode
Definition: wifi-mode.h:51
std::string GetUniqueName() const
Definition: wifi-mode.cc:148
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:185
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:68
uint8_t GetMcsValue() const
Definition: wifi-mode.cc:163
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1051
uint16_t GetTxBandwidth(WifiMode mode, uint16_t maxAllowedBandWidth=std::numeric_limits< uint16_t >::max()) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
Definition: wifi-phy.cc:1075
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1301
hold a list of per-remote-station state.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
WifiMode GetDefaultModeForSta(const WifiRemoteStation *st) const
Return the default MCS to use to transmit frames to the given station.
uint8_t GetNBasicModes() const
Return the number of basic modes we support.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Ptr< WifiPhy > GetPhy() const
Return the WifiPhy.
uint16_t GetGuardInterval() const
Return the supported HE guard interval duration (in nanoseconds).
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetHtSupported() const
Return whether the device has HT capability support enabled.
bool GetEhtSupported() const
Return whether the device has EHT capability support enabled.
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
bool GetShortGuardIntervalSupported() const
Return whether the device has SGI support enabled.
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...
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
void Reset()
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled.
bool GetShortPreambleEnabled() const
Return whether the device uses short PHY preambles.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
bool GetHeSupported() const
Return whether the device has HE capability support enabled.
WifiMode GetDefaultMode() const
Return the default transmission mode.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t GetGuardInterval() const
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
bool IsValid(WifiPhyBand band=WIFI_PHY_BAND_UNSPECIFIED) const
The standard disallows certain combinations of WifiMode, number of spatial streams,...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
uint16_t GetChannelWidth() const
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#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:86
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ WIFI_MOD_CLASS_DSSS
DSSS (Clause 15)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const double CACHE_INITIAL_VALUE
To avoid using the cache before a valid value has been cached.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
phy
Definition: third.py:89
hold per-remote-station state for Ideal Wifi manager.
WifiMode m_lastMode
Mode most recently used to the remote station.
double m_lastSnrObserved
SNR of most recently reported packet sent to the remote station.
double m_lastSnrCached
SNR most recently used to select a rate.
uint8_t m_lastNss
Number of spatial streams most recently used to the remote station.
uint16_t m_lastNssObserved
Number of spatial streams of most recently reported packet sent to the remote station.
uint16_t m_lastChannelWidth
Channel width (in MHz) most recently used to the remote station.
uint16_t m_lastChannelWidthObserved
Channel width (in MHz) of most recently reported packet sent to the remote station.
hold per-remote-station state.