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  if (mode.GetModulationClass() == WIFI_MOD_CLASS_DSSS ||
103  {
104  return 22;
105  }
106  else
107  {
108  return 20;
109  }
110 }
111 
112 void
114 {
115  NS_LOG_FUNCTION(this);
117 }
118 
119 void
121 {
122  m_thresholds.clear();
123  WifiMode mode;
124  WifiTxVector txVector;
125  uint8_t nss = 1;
126  for (const auto& mode : GetPhy()->GetModeList())
127  {
129  txVector.SetNss(nss);
130  txVector.SetMode(mode);
131  NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName());
132  AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
133  }
134  // Add all MCSes
135  if (GetHtSupported())
136  {
137  for (const auto& mode : GetPhy()->GetMcsList())
138  {
139  for (uint16_t j = 20; j <= GetPhy()->GetChannelWidth(); j *= 2)
140  {
141  txVector.SetChannelWidth(j);
143  {
144  uint16_t guardInterval = GetShortGuardIntervalSupported() ? 400 : 800;
145  txVector.SetGuardInterval(guardInterval);
146  // derive NSS from the MCS index
147  nss = (mode.GetMcsValue() / 8) + 1;
148  NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName() << " channel width " << j
149  << " nss " << +nss << " GI " << guardInterval);
150  txVector.SetNss(nss);
151  txVector.SetMode(mode);
152  AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
153  }
154  else // VHT or HE
155  {
156  uint16_t guardInterval;
158  {
159  guardInterval = GetShortGuardIntervalSupported() ? 400 : 800;
160  }
161  else
162  {
163  guardInterval = GetGuardInterval();
164  }
165  txVector.SetGuardInterval(guardInterval);
166  for (uint8_t k = 1; k <= GetPhy()->GetMaxSupportedTxSpatialStreams(); k++)
167  {
168  if (mode.IsAllowed(j, k))
169  {
170  NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName()
171  << " channel width " << j << " nss " << +k
172  << " GI " << guardInterval);
173  txVector.SetNss(k);
174  txVector.SetMode(mode);
175  AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
176  }
177  else
178  {
179  NS_LOG_DEBUG("Mode = " << mode.GetUniqueName() << " disallowed");
180  }
181  }
182  }
183  }
184  }
185  }
186 }
187 
188 double
190 {
191  NS_LOG_FUNCTION(this << txVector);
192  auto it = std::find_if(m_thresholds.begin(),
193  m_thresholds.end(),
194  [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
195  return ((txVector.GetMode() == p.second.GetMode()) &&
196  (txVector.GetNss() == p.second.GetNss()) &&
197  (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
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(),
204  m_thresholds.end(),
205  [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
206  return ((txVector.GetMode() == p.second.GetMode()) &&
207  (txVector.GetNss() == p.second.GetNss()) &&
208  (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
209  });
210  NS_ASSERT_MSG(it != m_thresholds.end(), "SNR threshold not found");
211  }
212  return it->first;
213 }
214 
215 void
217 {
218  NS_LOG_FUNCTION(this << txVector.GetMode().GetUniqueName() << txVector.GetChannelWidth()
219  << snr);
220  m_thresholds.emplace_back(snr, txVector);
221 }
222 
225 {
226  NS_LOG_FUNCTION(this);
228  Reset(station);
229  return station;
230 }
231 
232 void
234 {
235  NS_LOG_FUNCTION(this << station);
236  IdealWifiRemoteStation* st = static_cast<IdealWifiRemoteStation*>(station);
237  st->m_lastSnrObserved = 0.0;
239  st->m_lastNssObserved = 1;
241  st->m_lastMode = GetDefaultMode();
242  st->m_lastChannelWidth = 0;
243  st->m_lastNss = 1;
244 }
245 
246 void
248 {
249  NS_LOG_FUNCTION(this << station << rxSnr << txMode);
250 }
251 
252 void
254 {
255  NS_LOG_FUNCTION(this << station);
256 }
257 
258 void
260 {
261  NS_LOG_FUNCTION(this << station);
262 }
263 
264 void
266  double ctsSnr,
267  WifiMode ctsMode,
268  double rtsSnr)
269 {
270  NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode.GetUniqueName() << rtsSnr);
271  IdealWifiRemoteStation* station = static_cast<IdealWifiRemoteStation*>(st);
272  station->m_lastSnrObserved = rtsSnr;
273  station->m_lastChannelWidthObserved =
274  GetPhy()->GetChannelWidth() >= 40 ? 20 : GetPhy()->GetChannelWidth();
275  station->m_lastNssObserved = 1;
276 }
277 
278 void
280  double ackSnr,
281  WifiMode ackMode,
282  double dataSnr,
283  uint16_t dataChannelWidth,
284  uint8_t dataNss)
285 {
286  NS_LOG_FUNCTION(this << st << ackSnr << ackMode.GetUniqueName() << dataSnr << dataChannelWidth
287  << +dataNss);
288  IdealWifiRemoteStation* station = static_cast<IdealWifiRemoteStation*>(st);
289  if (dataSnr == 0)
290  {
291  NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
292  return;
293  }
294  station->m_lastSnrObserved = dataSnr;
295  station->m_lastChannelWidthObserved = dataChannelWidth;
296  station->m_lastNssObserved = dataNss;
297 }
298 
299 void
301  uint16_t nSuccessfulMpdus,
302  uint16_t nFailedMpdus,
303  double rxSnr,
304  double dataSnr,
305  uint16_t dataChannelWidth,
306  uint8_t dataNss)
307 {
308  NS_LOG_FUNCTION(this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr
309  << dataChannelWidth << +dataNss);
310  IdealWifiRemoteStation* station = static_cast<IdealWifiRemoteStation*>(st);
311  if (dataSnr == 0)
312  {
313  NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
314  return;
315  }
316  station->m_lastSnrObserved = dataSnr;
317  station->m_lastChannelWidthObserved = dataChannelWidth;
318  station->m_lastNssObserved = dataNss;
319 }
320 
321 void
323 {
324  NS_LOG_FUNCTION(this << station);
325  Reset(station);
326 }
327 
328 void
330 {
331  NS_LOG_FUNCTION(this << station);
332  Reset(station);
333 }
334 
337 {
338  NS_LOG_FUNCTION(this << st << allowedWidth);
339  IdealWifiRemoteStation* station = static_cast<IdealWifiRemoteStation*>(st);
340  // We search within the Supported rate set the mode with the
341  // highest data rate for which the SNR threshold is smaller than m_lastSnr
342  // to ensure correct packet delivery.
343  WifiMode maxMode = GetDefaultModeForSta(st);
344  WifiTxVector txVector;
345  WifiMode mode;
346  uint64_t bestRate = 0;
347  uint8_t selectedNss = 1;
348  uint16_t guardInterval;
349  uint16_t channelWidth = std::min(GetChannelWidth(station), allowedWidth);
350  txVector.SetChannelWidth(channelWidth);
351  if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) &&
352  (station->m_lastSnrObserved == station->m_lastSnrCached) &&
353  (channelWidth == station->m_lastChannelWidth))
354  {
355  // SNR has not changed, so skip the search and use the last mode selected
356  maxMode = station->m_lastMode;
357  selectedNss = station->m_lastNss;
358  NS_LOG_DEBUG("Using cached mode = " << maxMode.GetUniqueName() << " last snr observed "
359  << station->m_lastSnrObserved << " cached "
360  << station->m_lastSnrCached << " channel width "
361  << station->m_lastChannelWidth << " nss "
362  << +selectedNss);
363  }
364  else
365  {
366  if (GetHtSupported() && GetHtSupported(st))
367  {
368  for (uint8_t i = 0; i < GetNMcsSupported(station); i++)
369  {
370  mode = GetMcsSupported(station, i);
371  txVector.SetMode(mode);
373  {
374  guardInterval = static_cast<uint16_t>(
375  std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
376  GetShortGuardIntervalSupported() ? 400 : 800));
377  txVector.SetGuardInterval(guardInterval);
378  // If the node and peer are both VHT capable, only search VHT modes
379  if (GetVhtSupported() && GetVhtSupported(station))
380  {
381  continue;
382  }
383  // If the node and peer are both HE capable, only search HE modes
384  if (GetHeSupported() && GetHeSupported(station))
385  {
386  continue;
387  }
388  // Derive NSS from the MCS index. There is a different mode for each possible
389  // NSS value.
390  uint8_t nss = (mode.GetMcsValue() / 8) + 1;
391  txVector.SetNss(nss);
392  if (!txVector.IsValid() || nss > std::min(GetMaxNumberOfTransmitStreams(),
394  {
395  NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
396  << " width " << txVector.GetChannelWidth());
397  continue;
398  }
399  double threshold = GetSnrThreshold(txVector);
400  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
401  txVector.GetGuardInterval(),
402  nss);
403  NS_LOG_DEBUG("Testing mode " << mode.GetUniqueName() << " data rate "
404  << dataRate << " threshold " << threshold
405  << " last snr observed "
406  << station->m_lastSnrObserved << " cached "
407  << station->m_lastSnrCached);
408  double snr = GetLastObservedSnr(station, channelWidth, nss);
409  if (dataRate > bestRate && threshold < snr)
410  {
411  NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
412  << dataRate << " threshold " << threshold
413  << " channel width " << channelWidth
414  << " snr " << snr);
415  bestRate = dataRate;
416  maxMode = mode;
417  selectedNss = nss;
418  }
419  }
420  else if (mode.GetModulationClass() == WIFI_MOD_CLASS_VHT)
421  {
422  guardInterval = static_cast<uint16_t>(
423  std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
424  GetShortGuardIntervalSupported() ? 400 : 800));
425  txVector.SetGuardInterval(guardInterval);
426  // If the node and peer are both HE capable, only search HE modes
427  if (GetHeSupported() && GetHeSupported(station))
428  {
429  continue;
430  }
431  // If the node and peer are not both VHT capable, only search HT modes
432  if (!GetVhtSupported() || !GetVhtSupported(station))
433  {
434  continue;
435  }
436  for (uint8_t nss = 1; nss <= std::min(GetMaxNumberOfTransmitStreams(),
437  GetNumberOfSupportedStreams(station));
438  nss++)
439  {
440  txVector.SetNss(nss);
441  if (!txVector.IsValid())
442  {
443  NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
444  << " width "
445  << txVector.GetChannelWidth());
446  continue;
447  }
448  double threshold = GetSnrThreshold(txVector);
449  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
450  txVector.GetGuardInterval(),
451  nss);
452  NS_LOG_DEBUG("Testing mode = " << mode.GetUniqueName() << " data rate "
453  << dataRate << " threshold " << threshold
454  << " last snr observed "
455  << station->m_lastSnrObserved << " cached "
456  << station->m_lastSnrCached);
457  double snr = GetLastObservedSnr(station, channelWidth, nss);
458  if (dataRate > bestRate && threshold < snr)
459  {
460  NS_LOG_DEBUG("Candidate mode = "
461  << mode.GetUniqueName() << " data rate " << dataRate
462  << " channel width " << channelWidth << " snr " << snr);
463  bestRate = dataRate;
464  maxMode = mode;
465  selectedNss = nss;
466  }
467  }
468  }
469  else // HE
470  {
471  guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
472  txVector.SetGuardInterval(guardInterval);
473  // If the node and peer are not both HE capable, only search (V)HT modes
474  if (!GetHeSupported() || !GetHeSupported(station))
475  {
476  continue;
477  }
478  for (uint8_t nss = 1; nss <= std::min(GetMaxNumberOfTransmitStreams(),
479  GetNumberOfSupportedStreams(station));
480  nss++)
481  {
482  txVector.SetNss(nss);
483  if (!txVector.IsValid())
484  {
485  NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
486  << " width "
487  << +txVector.GetChannelWidth());
488  continue;
489  }
490  double threshold = GetSnrThreshold(txVector);
491  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
492  txVector.GetGuardInterval(),
493  nss);
494  NS_LOG_DEBUG("Testing mode = " << mode.GetUniqueName() << " data rate "
495  << dataRate << " threshold " << threshold
496  << " last snr observed "
497  << station->m_lastSnrObserved << " cached "
498  << station->m_lastSnrCached);
499  double snr = GetLastObservedSnr(station, channelWidth, nss);
500  if (dataRate > bestRate && threshold < snr)
501  {
502  NS_LOG_DEBUG("Candidate mode = "
503  << mode.GetUniqueName() << " data rate " << dataRate
504  << " threshold " << threshold << " channel width "
505  << channelWidth << " snr " << snr);
506  bestRate = dataRate;
507  maxMode = mode;
508  selectedNss = nss;
509  }
510  }
511  }
512  }
513  }
514  else
515  {
516  // Non-HT selection
517  selectedNss = 1;
518  for (uint8_t i = 0; i < GetNSupported(station); i++)
519  {
520  mode = GetSupported(station, i);
521  txVector.SetMode(mode);
522  txVector.SetNss(selectedNss);
523  uint16_t channelWidth = GetChannelWidthForNonHtMode(mode);
524  txVector.SetChannelWidth(channelWidth);
525  double threshold = GetSnrThreshold(txVector);
526  uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
527  txVector.GetGuardInterval(),
528  txVector.GetNss());
529  NS_LOG_DEBUG("mode = " << mode.GetUniqueName() << " threshold " << threshold
530  << " last snr observed " << station->m_lastSnrObserved);
531  double snr = GetLastObservedSnr(station, channelWidth, 1);
532  if (dataRate > bestRate && threshold < snr)
533  {
534  NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
535  << dataRate << " threshold " << threshold
536  << " snr " << snr);
537  bestRate = dataRate;
538  maxMode = mode;
539  }
540  }
541  }
542  NS_LOG_DEBUG("Updating cached values for station to " << maxMode.GetUniqueName() << " snr "
543  << station->m_lastSnrObserved);
544  station->m_lastSnrCached = station->m_lastSnrObserved;
545  station->m_lastMode = maxMode;
546  station->m_lastNss = selectedNss;
547  }
548  NS_LOG_DEBUG("Found maxMode: " << maxMode << " channelWidth: " << channelWidth
549  << " nss: " << +selectedNss);
550  station->m_lastChannelWidth = channelWidth;
551  if (maxMode.GetModulationClass() == WIFI_MOD_CLASS_HE)
552  {
553  guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
554  }
555  else if ((maxMode.GetModulationClass() == WIFI_MOD_CLASS_HT) ||
556  (maxMode.GetModulationClass() == WIFI_MOD_CLASS_VHT))
557  {
558  guardInterval =
559  static_cast<uint16_t>(std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
560  GetShortGuardIntervalSupported() ? 400 : 800));
561  }
562  else
563  {
564  guardInterval = 800;
565  }
566  WifiTxVector bestTxVector{
567  maxMode,
570  guardInterval,
572  selectedNss,
573  0,
574  GetPhy()->GetTxBandwidth(maxMode, channelWidth),
575  GetAggregation(station)};
576  uint64_t maxDataRate = maxMode.GetDataRate(bestTxVector);
577  if (m_currentRate != maxDataRate)
578  {
579  NS_LOG_DEBUG("New datarate: " << maxDataRate);
580  m_currentRate = maxDataRate;
581  }
582  return bestTxVector;
583 }
584 
587 {
588  NS_LOG_FUNCTION(this << st);
589  IdealWifiRemoteStation* station = static_cast<IdealWifiRemoteStation*>(st);
590  // We search within the Basic rate set the mode with the highest
591  // SNR threshold possible which is smaller than m_lastSnr to
592  // ensure correct packet delivery.
593  double maxThreshold = 0.0;
594  WifiTxVector txVector;
595  WifiMode mode;
596  uint8_t nss = 1;
597  WifiMode maxMode = GetDefaultMode();
598  // RTS is sent in a non-HT frame
599  for (uint8_t i = 0; i < GetNBasicModes(); i++)
600  {
601  mode = GetBasicMode(i);
602  txVector.SetMode(mode);
603  txVector.SetNss(nss);
605  double threshold = GetSnrThreshold(txVector);
606  if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
607  {
608  maxThreshold = threshold;
609  maxMode = mode;
610  }
611  }
612  return WifiTxVector(
613  maxMode,
616  800,
618  nss,
619  0,
621  GetAggregation(station));
622 }
623 
624 double
626  uint16_t channelWidth,
627  uint8_t nss) const
628 {
629  double snr = station->m_lastSnrObserved;
630  if (channelWidth != station->m_lastChannelWidthObserved)
631  {
632  snr /= (static_cast<double>(channelWidth) / station->m_lastChannelWidthObserved);
633  }
634  if (nss != station->m_lastNssObserved)
635  {
636  snr /= (static_cast<double>(nss) / station->m_lastNssObserved);
637  }
638  NS_LOG_DEBUG("Last observed SNR is " << station->m_lastSnrObserved << " for channel width "
639  << station->m_lastChannelWidthObserved << " and nss "
640  << +station->m_lastNssObserved << "; computed SNR is "
641  << snr << " for channel width " << channelWidth
642  << " and nss " << +nss);
643  return snr;
644 }
645 
646 } // namespace ns3
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
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.
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.
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:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
represent a single transmission mode
Definition: wifi-mode.h:50
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:1026
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:1050
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1277
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.
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
bool IsValid() const
The standard disallows certain combinations of WifiMode, number of spatial streams,...
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
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
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:43
#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.
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ 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.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
phy
Definition: third.py:82
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.