A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ideal-wifi-manager.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
10
11#include "ns3/ht-configuration.h"
12#include "ns3/log.h"
13#include "ns3/wifi-net-device.h"
14#include "ns3/wifi-phy.h"
15
16#include <algorithm>
17
18namespace ns3
19{
20
21/**
22 * @brief hold per-remote-station state for Ideal Wifi manager.
23 *
24 * This struct extends from WifiRemoteStation struct to hold additional
25 * information required by the Ideal Wifi manager
26 */
28{
29 double m_lastSnrObserved; //!< SNR of most recently reported packet sent to the remote station
30 MHz_u m_lastChannelWidthObserved; //!< Channel width of most recently
31 //!< reported packet sent to the remote station
32 uint16_t m_lastNssObserved; //!< Number of spatial streams of most recently reported packet
33 //!< sent to the remote station
34 double m_lastSnrCached; //!< SNR most recently used to select a rate
35 uint8_t m_lastNss; //!< Number of spatial streams most recently used to the remote station
36 WifiMode m_lastMode; //!< Mode most recently used to the remote station
37 MHz_u m_lastChannelWidth; //!< Channel width most recently used to the remote station
38};
39
40/// To avoid using the cache before a valid value has been cached
41static const double CACHE_INITIAL_VALUE = -100;
42
44
45NS_LOG_COMPONENT_DEFINE("IdealWifiManager");
46
49{
50 static TypeId tid =
51 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-6),
60 .AddTraceSource("Rate",
61 "Traced value for rate changes (b/s)",
63 "ns3::TracedValueCallback::Uint64");
64 return tid;
65}
66
68 : m_currentRate(0)
69{
70 NS_LOG_FUNCTION(this);
71}
72
77
78void
84
87{
91 {
92 return MHz_u{22};
93 }
94 else
95 {
96 return MHz_u{20};
97 }
98}
99
100void
106
107void
109{
110 m_thresholds.clear();
111 WifiMode mode;
112 WifiTxVector txVector;
113 uint8_t nss = 1;
114 for (const auto& mode : GetPhy()->GetModeList())
115 {
117 txVector.SetNss(nss);
118 txVector.SetMode(mode);
119 NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName());
120 AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
121 }
122 // Add all MCSes
123 if (GetPhy()->GetDevice()->GetHtConfiguration())
124 {
125 for (const auto& mode : GetPhy()->GetMcsList())
126 {
127 for (MHz_u j{20}; j <= GetPhy()->GetChannelWidth(); j *= 2)
128 {
129 txVector.SetChannelWidth(j);
131 {
132 const auto guardInterval =
134 txVector.SetGuardInterval(guardInterval);
135 // derive NSS from the MCS index
136 nss = (mode.GetMcsValue() / 8) + 1;
137 txVector.SetNss(nss);
138 txVector.SetMode(mode);
139 if (txVector.IsValid(GetPhy()->GetPhyBand()))
140 {
141 NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName() << " channel width "
142 << j << " nss " << +nss << " GI "
143 << guardInterval);
144 AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
145 }
146 else
147 {
148 NS_LOG_DEBUG("Skipping mode = " << mode.GetUniqueName() << " channel width "
149 << j << " nss " << +nss << " GI "
150 << guardInterval);
151 }
152 }
153 else
154 {
155 Time guardInterval{};
157 {
158 guardInterval = NanoSeconds(GetShortGuardIntervalSupported() ? 400 : 800);
159 }
160 else
161 {
162 guardInterval = GetGuardInterval();
163 }
164 txVector.SetGuardInterval(guardInterval);
165 for (uint8_t k = 1; k <= GetPhy()->GetMaxSupportedTxSpatialStreams(); k++)
166 {
167 if (mode.IsAllowed(j, k))
168 {
169 txVector.SetNss(k);
170 txVector.SetMode(mode);
171 if (txVector.IsValid(GetPhy()->GetPhyBand()))
172 {
173 NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName()
174 << " channel width " << j << " nss "
175 << +k << " GI " << guardInterval);
176 AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
177 }
178 else
179 {
180 NS_LOG_DEBUG("Skipping mode = " << mode.GetUniqueName()
181 << " channel width " << j << " nss "
182 << +k << " GI " << guardInterval);
183 }
184 }
185 else
186 {
187 NS_LOG_DEBUG("Mode = " << mode.GetUniqueName() << " disallowed");
188 }
189 }
190 }
191 }
192 }
193 }
194}
195
196double
198{
199 NS_LOG_FUNCTION(this << txVector);
200 auto it = std::find_if(m_thresholds.begin(),
201 m_thresholds.end(),
202 [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
203 return ((txVector.GetMode() == p.second.GetMode()) &&
204 (txVector.GetNss() == p.second.GetNss()) &&
205 (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
206 });
207 if (it == m_thresholds.end())
208 {
209 // This means capabilities have changed in runtime, hence rebuild SNR thresholds
211 it = std::find_if(m_thresholds.begin(),
212 m_thresholds.end(),
213 [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
214 return ((txVector.GetMode() == p.second.GetMode()) &&
215 (txVector.GetNss() == p.second.GetNss()) &&
216 (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
217 });
218 NS_ASSERT_MSG(it != m_thresholds.end(), "SNR threshold not found");
219 }
220 return it->first;
221}
222
223void
225{
226 NS_LOG_FUNCTION(this << txVector.GetMode().GetUniqueName() << txVector.GetChannelWidth()
227 << snr);
228 m_thresholds.emplace_back(snr, txVector);
229}
230
233{
234 NS_LOG_FUNCTION(this);
235 auto station = new IdealWifiRemoteStation();
236 Reset(station);
237 return station;
238}
239
240void
242{
243 NS_LOG_FUNCTION(this << station);
244 auto st = static_cast<IdealWifiRemoteStation*>(station);
245 st->m_lastSnrObserved = 0.0;
246 st->m_lastChannelWidthObserved = MHz_u{0};
247 st->m_lastNssObserved = 1;
248 st->m_lastSnrCached = CACHE_INITIAL_VALUE;
249 st->m_lastMode = GetDefaultMode();
250 st->m_lastChannelWidth = MHz_u{0};
251 st->m_lastNss = 1;
252}
253
254void
256{
257 NS_LOG_FUNCTION(this << station << rxSnr << txMode);
258}
259
260void
265
266void
271
272void
274 double ctsSnr,
275 WifiMode ctsMode,
276 double rtsSnr)
277{
278 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode.GetUniqueName() << rtsSnr);
279 auto station = static_cast<IdealWifiRemoteStation*>(st);
280 station->m_lastSnrObserved = rtsSnr;
281 station->m_lastChannelWidthObserved =
282 GetPhy()->GetChannelWidth() >= MHz_u{42} ? MHz_u{20} : GetPhy()->GetChannelWidth();
283 station->m_lastNssObserved = 1;
284}
285
286void
288 double ackSnr,
289 WifiMode ackMode,
290 double dataSnr,
291 MHz_u dataChannelWidth,
292 uint8_t dataNss)
293{
294 NS_LOG_FUNCTION(this << st << ackSnr << ackMode.GetUniqueName() << dataSnr << dataChannelWidth
295 << +dataNss);
296 auto station = static_cast<IdealWifiRemoteStation*>(st);
297 if (dataSnr == 0)
298 {
299 NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
300 return;
301 }
302 station->m_lastSnrObserved = dataSnr;
303 station->m_lastChannelWidthObserved = dataChannelWidth;
304 station->m_lastNssObserved = dataNss;
305}
306
307void
309 uint16_t nSuccessfulMpdus,
310 uint16_t nFailedMpdus,
311 double rxSnr,
312 double dataSnr,
313 MHz_u dataChannelWidth,
314 uint8_t dataNss)
315{
316 NS_LOG_FUNCTION(this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr
317 << dataChannelWidth << +dataNss);
318 auto station = static_cast<IdealWifiRemoteStation*>(st);
319 if (dataSnr == 0)
320 {
321 NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
322 return;
323 }
324 station->m_lastSnrObserved = dataSnr;
325 station->m_lastChannelWidthObserved = dataChannelWidth;
326 station->m_lastNssObserved = dataNss;
327}
328
329void
331{
332 NS_LOG_FUNCTION(this << station);
333 Reset(station);
334}
335
336void
338{
339 NS_LOG_FUNCTION(this << station);
340 Reset(station);
341}
342
345{
346 NS_LOG_FUNCTION(this << st << allowedWidth);
347 auto station = static_cast<IdealWifiRemoteStation*>(st);
348 // We search within the Supported rate set the mode with the
349 // highest data rate for which the SNR threshold is smaller than m_lastSnr
350 // to ensure correct packet delivery.
351 WifiMode maxMode = GetDefaultModeForSta(st);
352 WifiTxVector txVector;
353 uint64_t bestRate = 0;
354 uint8_t selectedNss = 1;
355 Time guardInterval{};
356 const auto channelWidth = std::min(GetChannelWidth(station), allowedWidth);
357 txVector.SetChannelWidth(channelWidth);
358 if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) &&
359 (station->m_lastSnrObserved == station->m_lastSnrCached) &&
360 (channelWidth == station->m_lastChannelWidth))
361 {
362 // SNR has not changed, so skip the search and use the last mode selected
363 maxMode = station->m_lastMode;
364 selectedNss = station->m_lastNss;
365 NS_LOG_DEBUG("Using cached mode = " << maxMode.GetUniqueName() << " last snr observed "
366 << station->m_lastSnrObserved << " cached "
367 << station->m_lastSnrCached << " channel width "
368 << station->m_lastChannelWidth << " nss "
369 << +selectedNss);
370 }
371 else
372 {
373 if (GetPhy()->GetDevice()->GetHtConfiguration() &&
375 {
376 for (uint8_t i = 0; i < GetNMcsSupported(station); i++)
377 {
378 auto mode = GetMcsSupported(station, i);
379 if (!IsCandidateModulationClass(mode.GetModulationClass(), station))
380 {
381 continue;
382 }
383 txVector.SetMode(mode);
384 Time guardInterval{};
385 if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE)
386 {
387 guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
388 }
389 else
390 {
391 guardInterval =
392 std::max(NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800),
394 }
395 txVector.SetGuardInterval(guardInterval);
396 if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT)
397 {
398 // Derive NSS from the MCS index. There is a different mode for each possible
399 // NSS value.
400 uint8_t nss = (mode.GetMcsValue() / 8) + 1;
401 txVector.SetNss(nss);
402 if (!txVector.IsValid() || nss > std::min(GetMaxNumberOfTransmitStreams(),
404 {
405 NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
406 << " width " << txVector.GetChannelWidth());
407 continue;
408 }
409 double threshold = GetSnrThreshold(txVector);
410 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
411 txVector.GetGuardInterval(),
412 nss);
413 NS_LOG_DEBUG("Testing mode " << mode.GetUniqueName() << " data rate "
414 << dataRate << " threshold " << threshold
415 << " last snr observed "
416 << station->m_lastSnrObserved << " cached "
417 << station->m_lastSnrCached);
418 double snr = GetLastObservedSnr(station, channelWidth, nss);
419 if (dataRate > bestRate && threshold < snr)
420 {
421 NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
422 << dataRate << " threshold " << threshold
423 << " channel width " << channelWidth
424 << " snr " << snr);
425 bestRate = dataRate;
426 maxMode = mode;
427 selectedNss = nss;
428 }
429 }
430 else
431 {
432 for (uint8_t nss = 1; nss <= std::min(GetMaxNumberOfTransmitStreams(),
434 nss++)
435 {
436 txVector.SetNss(nss);
437 if (!txVector.IsValid())
438 {
439 NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
440 << " width "
441 << +txVector.GetChannelWidth());
442 continue;
443 }
444 double threshold = GetSnrThreshold(txVector);
445 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
446 txVector.GetGuardInterval(),
447 nss);
448 NS_LOG_DEBUG("Testing mode = " << mode.GetUniqueName() << " data rate "
449 << dataRate << " threshold " << threshold
450 << " last snr observed "
451 << station->m_lastSnrObserved << " cached "
452 << station->m_lastSnrCached);
453 double snr = GetLastObservedSnr(station, channelWidth, nss);
454 if (dataRate > bestRate && threshold < snr)
455 {
456 NS_LOG_DEBUG("Candidate mode = "
457 << mode.GetUniqueName() << " data rate " << dataRate
458 << " threshold " << threshold << " channel width "
459 << channelWidth << " snr " << snr);
460 bestRate = dataRate;
461 maxMode = mode;
462 selectedNss = nss;
463 }
464 }
465 }
466 }
467 }
468 else
469 {
470 // Non-HT selection
471 selectedNss = 1;
472 for (uint8_t i = 0; i < GetNSupported(station); i++)
473 {
474 auto mode = GetSupported(station, i);
475 txVector.SetMode(mode);
476 txVector.SetNss(selectedNss);
477 const auto channelWidth = GetChannelWidthForNonHtMode(mode);
478 txVector.SetChannelWidth(channelWidth);
479 double threshold = GetSnrThreshold(txVector);
480 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
481 txVector.GetGuardInterval(),
482 txVector.GetNss());
483 NS_LOG_DEBUG("mode = " << mode.GetUniqueName() << " threshold " << threshold
484 << " last snr observed " << station->m_lastSnrObserved);
485 double snr = GetLastObservedSnr(station, channelWidth, 1);
486 if (dataRate > bestRate && threshold < snr)
487 {
488 NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
489 << dataRate << " threshold " << threshold
490 << " snr " << snr);
491 bestRate = dataRate;
492 maxMode = mode;
493 }
494 }
495 }
496 NS_LOG_DEBUG("Updating cached values for station to " << maxMode.GetUniqueName() << " snr "
497 << station->m_lastSnrObserved);
498 station->m_lastSnrCached = station->m_lastSnrObserved;
499 station->m_lastMode = maxMode;
500 station->m_lastNss = selectedNss;
501 }
502 NS_LOG_DEBUG("Found maxMode: " << maxMode << " channelWidth: " << channelWidth
503 << " nss: " << +selectedNss);
504 station->m_lastChannelWidth = channelWidth;
505 if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HE))
506 {
507 guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
508 }
509 else if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HT))
510 {
511 guardInterval = std::max(NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800),
513 }
514 else
515 {
516 guardInterval = NanoSeconds(800);
517 }
518 WifiTxVector bestTxVector{
519 maxMode,
522 guardInterval,
524 selectedNss,
525 0,
526 GetPhy()->GetTxBandwidth(maxMode, channelWidth),
527 GetAggregation(station)};
528 uint64_t maxDataRate = maxMode.GetDataRate(bestTxVector);
529 if (m_currentRate != maxDataRate)
530 {
531 NS_LOG_DEBUG("New datarate: " << maxDataRate);
532 m_currentRate = maxDataRate;
533 }
534 return bestTxVector;
535}
536
539{
540 NS_LOG_FUNCTION(this << st);
541 auto station = static_cast<IdealWifiRemoteStation*>(st);
542 // We search within the Basic rate set the mode with the highest
543 // SNR threshold possible which is smaller than m_lastSnr to
544 // ensure correct packet delivery.
545 double maxThreshold = 0.0;
546 WifiTxVector txVector;
547 WifiMode mode;
548 uint8_t nss = 1;
549 WifiMode maxMode = GetDefaultMode();
550 // RTS is sent in a non-HT frame
551 for (uint8_t i = 0; i < GetNBasicModes(); i++)
552 {
553 mode = GetBasicMode(i);
554 txVector.SetMode(mode);
555 txVector.SetNss(nss);
557 double threshold = GetSnrThreshold(txVector);
558 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
559 {
560 maxThreshold = threshold;
561 maxMode = mode;
562 }
563 }
564 return WifiTxVector(
565 maxMode,
568 NanoSeconds(800),
570 nss,
571 0,
573 GetAggregation(station));
574}
575
576double
578 MHz_u channelWidth,
579 uint8_t nss) const
580{
581 double snr = station->m_lastSnrObserved;
582 if (channelWidth != station->m_lastChannelWidthObserved)
583 {
584 snr /= (static_cast<double>(channelWidth) / station->m_lastChannelWidthObserved);
585 }
586 if (nss != station->m_lastNssObserved)
587 {
588 snr /= (static_cast<double>(nss) / station->m_lastNssObserved);
589 }
590 NS_LOG_DEBUG("Last observed SNR is " << station->m_lastSnrObserved << " for channel width "
591 << station->m_lastChannelWidthObserved << " and nss "
592 << +station->m_lastNssObserved << "; computed SNR is "
593 << snr << " for channel width " << channelWidth
594 << " and nss " << +nss);
595 return snr;
596}
597
598bool
600 IdealWifiRemoteStation* station)
601{
602 switch (mc)
603 {
605 return (GetHtSupported() && GetHtSupported(station));
607 return (GetVhtSupported() && GetVhtSupported(station));
609 return (GetHeSupported() && GetHeSupported(station));
611 return (GetEhtSupported() && GetEhtSupported(station));
612 default:
613 NS_ABORT_MSG("Unknown modulation class: " << mc);
614 }
615}
616
617bool
619 IdealWifiRemoteStation* station)
620{
621 if (!IsModulationClassSupported(mc, station))
622 {
623 return false;
624 }
625 switch (mc)
626 {
628 // If the node and peer are both VHT capable, skip non-VHT modes
629 if (GetVhtSupported() && GetVhtSupported(station))
630 {
631 return false;
632 }
633 [[fallthrough]];
635 // If the node and peer are both HE capable, skip non-HE modes
636 if (GetHeSupported() && GetHeSupported(station))
637 {
638 return false;
639 }
640 [[fallthrough]];
642 // If the node and peer are both EHT capable, skip non-EHT modes
643 if (GetEhtSupported() && GetEhtSupported(station))
644 {
645 return false;
646 }
647 break;
649 break;
650 default:
651 NS_ABORT_MSG("Unknown modulation class: " << mc);
652 }
653 return true;
654}
655
656} // namespace ns3
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
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...
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
void DoInitialize() override
Initialize() implementation.
double m_ber
The maximum Bit Error Rate acceptable at any transmission mode.
WifiRemoteStation * DoCreateStation() const override
MHz_u GetChannelWidthForNonHtMode(WifiMode mode) const
Convenience function for selecting a channel width for non-HT mode.
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.
double GetLastObservedSnr(IdealWifiRemoteStation *station, MHz_u channelWidth, uint8_t nss) const
Convenience function to get the last observed SNR from a given station for a given channel width and ...
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss) override
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
bool IsModulationClassSupported(WifiModulationClass mc, IdealWifiRemoteStation *station)
Check whether a given modulation class is supported by both the node and the peer.
bool IsCandidateModulationClass(WifiModulationClass mc, IdealWifiRemoteStation *station)
Check whether a given modulation class is supported and that there are no higher modulation classes t...
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
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.
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.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
represent a single transmission mode
Definition wifi-mode.h:40
const std::string & GetUniqueName() const
Definition wifi-mode.cc:137
WifiModulationClass GetModulationClass() const
Definition wifi-mode.cc:174
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
Definition wifi-mode.cc:111
bool IsAllowed(MHz_u channelWidth, uint8_t nss) const
Definition wifi-mode.cc:57
uint8_t GetMcsValue() const
Definition wifi-mode.cc:152
MHz_u GetTxBandwidth(WifiMode mode, MHz_u maxAllowedBandWidth=MHz_u{ std::numeric_limits< double >::max()}) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
Definition wifi-phy.cc:1123
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition wifi-phy.cc:1069
MHz_u GetChannelWidth() const
Definition wifi-phy.cc:1099
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition wifi-phy.cc:1378
std::list< WifiMode > GetMcsList() const
The WifiPhy::GetMcsList() method is used (e.g., by a WifiRemoteStationManager) to determine the set o...
Definition wifi-phy.cc:2113
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition wifi-phy.cc:2064
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.
Time GetGuardInterval() const
Return the shortest supported HE guard interval duration.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Ptr< WifiPhy > GetPhy() const
Return the WifiPhy.
MHz_u GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
Ptr< const He6GhzBandCapabilities > GetStationHe6GhzCapabilities(const Mac48Address &from) const
Return the HE 6 GHz Band Capabilities sent by a remote station.
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 on the link this manager is associated wi...
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 on the link this manager is associated w...
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...
void SetGuardInterval(Time 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.
void SetChannelWidth(MHz_u channelWidth)
Sets the selected channelWidth.
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.
MHz_u GetChannelWidth() const
Time GetGuardInterval() 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:55
#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:75
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
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:32
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#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:250
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1380
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.
double MHz_u
MHz weak type.
Definition wifi-units.h:31
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
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.
MHz_u m_lastChannelWidth
Channel width most recently used to the remote station.
MHz_u m_lastChannelWidthObserved
Channel width of most recently reported packet sent to the remote station.
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.
hold per-remote-station state.
WifiRemoteStationState * m_state
Remote station state.
Mac48Address m_address
Mac48Address of the remote station.