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 22;
93 }
94 else
95 {
96 return 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 NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName() << " channel width " << j
138 << " nss " << +nss << " GI " << guardInterval);
139 txVector.SetNss(nss);
140 txVector.SetMode(mode);
141 AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
142 }
143 else
144 {
145 Time guardInterval{};
147 {
148 guardInterval = NanoSeconds(GetShortGuardIntervalSupported() ? 400 : 800);
149 }
150 else
151 {
152 guardInterval = GetGuardInterval();
153 }
154 txVector.SetGuardInterval(guardInterval);
155 for (uint8_t k = 1; k <= GetPhy()->GetMaxSupportedTxSpatialStreams(); k++)
156 {
157 if (mode.IsAllowed(j, k))
158 {
159 NS_LOG_DEBUG("Adding mode = " << mode.GetUniqueName()
160 << " channel width " << j << " nss " << +k
161 << " GI " << guardInterval);
162 txVector.SetNss(k);
163 txVector.SetMode(mode);
164 AddSnrThreshold(txVector, GetPhy()->CalculateSnr(txVector, m_ber));
165 }
166 else
167 {
168 NS_LOG_DEBUG("Mode = " << mode.GetUniqueName() << " disallowed");
169 }
170 }
171 }
172 }
173 }
174 }
175}
176
177double
179{
180 NS_LOG_FUNCTION(this << txVector);
181 auto it = std::find_if(m_thresholds.begin(),
182 m_thresholds.end(),
183 [&txVector](const std::pair<double, WifiTxVector>& p) -> bool {
184 return ((txVector.GetMode() == p.second.GetMode()) &&
185 (txVector.GetNss() == p.second.GetNss()) &&
186 (txVector.GetChannelWidth() == p.second.GetChannelWidth()));
187 });
188 if (it == m_thresholds.end())
189 {
190 // This means capabilities have changed in runtime, hence rebuild SNR thresholds
192 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 NS_ASSERT_MSG(it != m_thresholds.end(), "SNR threshold not found");
200 }
201 return it->first;
202}
203
204void
206{
207 NS_LOG_FUNCTION(this << txVector.GetMode().GetUniqueName() << txVector.GetChannelWidth()
208 << snr);
209 m_thresholds.emplace_back(snr, txVector);
210}
211
214{
215 NS_LOG_FUNCTION(this);
216 auto station = new IdealWifiRemoteStation();
217 Reset(station);
218 return station;
219}
220
221void
223{
224 NS_LOG_FUNCTION(this << station);
225 auto st = static_cast<IdealWifiRemoteStation*>(station);
226 st->m_lastSnrObserved = 0.0;
227 st->m_lastChannelWidthObserved = 0;
228 st->m_lastNssObserved = 1;
229 st->m_lastSnrCached = CACHE_INITIAL_VALUE;
230 st->m_lastMode = GetDefaultMode();
231 st->m_lastChannelWidth = 0;
232 st->m_lastNss = 1;
233}
234
235void
237{
238 NS_LOG_FUNCTION(this << station << rxSnr << txMode);
239}
240
241void
246
247void
252
253void
255 double ctsSnr,
256 WifiMode ctsMode,
257 double rtsSnr)
258{
259 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode.GetUniqueName() << rtsSnr);
260 auto station = static_cast<IdealWifiRemoteStation*>(st);
261 station->m_lastSnrObserved = rtsSnr;
262 station->m_lastChannelWidthObserved =
263 GetPhy()->GetChannelWidth() >= 40 ? 20 : GetPhy()->GetChannelWidth();
264 station->m_lastNssObserved = 1;
265}
266
267void
269 double ackSnr,
270 WifiMode ackMode,
271 double dataSnr,
272 MHz_u dataChannelWidth,
273 uint8_t dataNss)
274{
275 NS_LOG_FUNCTION(this << st << ackSnr << ackMode.GetUniqueName() << dataSnr << dataChannelWidth
276 << +dataNss);
277 auto station = static_cast<IdealWifiRemoteStation*>(st);
278 if (dataSnr == 0)
279 {
280 NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
281 return;
282 }
283 station->m_lastSnrObserved = dataSnr;
284 station->m_lastChannelWidthObserved = dataChannelWidth;
285 station->m_lastNssObserved = dataNss;
286}
287
288void
290 uint16_t nSuccessfulMpdus,
291 uint16_t nFailedMpdus,
292 double rxSnr,
293 double dataSnr,
294 MHz_u dataChannelWidth,
295 uint8_t dataNss)
296{
297 NS_LOG_FUNCTION(this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr
298 << dataChannelWidth << +dataNss);
299 auto station = static_cast<IdealWifiRemoteStation*>(st);
300 if (dataSnr == 0)
301 {
302 NS_LOG_WARN("DataSnr reported to be zero; not saving this report.");
303 return;
304 }
305 station->m_lastSnrObserved = dataSnr;
306 station->m_lastChannelWidthObserved = dataChannelWidth;
307 station->m_lastNssObserved = dataNss;
308}
309
310void
312{
313 NS_LOG_FUNCTION(this << station);
314 Reset(station);
315}
316
317void
319{
320 NS_LOG_FUNCTION(this << station);
321 Reset(station);
322}
323
326{
327 NS_LOG_FUNCTION(this << st << allowedWidth);
328 auto station = static_cast<IdealWifiRemoteStation*>(st);
329 // We search within the Supported rate set the mode with the
330 // highest data rate for which the SNR threshold is smaller than m_lastSnr
331 // to ensure correct packet delivery.
332 WifiMode maxMode = GetDefaultModeForSta(st);
333 WifiTxVector txVector;
334 uint64_t bestRate = 0;
335 uint8_t selectedNss = 1;
336 Time guardInterval{};
337 const auto channelWidth = std::min(GetChannelWidth(station), allowedWidth);
338 txVector.SetChannelWidth(channelWidth);
339 if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) &&
340 (station->m_lastSnrObserved == station->m_lastSnrCached) &&
341 (channelWidth == station->m_lastChannelWidth))
342 {
343 // SNR has not changed, so skip the search and use the last mode selected
344 maxMode = station->m_lastMode;
345 selectedNss = station->m_lastNss;
346 NS_LOG_DEBUG("Using cached mode = " << maxMode.GetUniqueName() << " last snr observed "
347 << station->m_lastSnrObserved << " cached "
348 << station->m_lastSnrCached << " channel width "
349 << station->m_lastChannelWidth << " nss "
350 << +selectedNss);
351 }
352 else
353 {
354 if (GetPhy()->GetDevice()->GetHtConfiguration() &&
356 {
357 for (uint8_t i = 0; i < GetNMcsSupported(station); i++)
358 {
359 auto mode = GetMcsSupported(station, i);
360 if (!IsCandidateModulationClass(mode.GetModulationClass(), station))
361 {
362 continue;
363 }
364 txVector.SetMode(mode);
365 Time guardInterval{};
366 if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE)
367 {
368 guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
369 }
370 else
371 {
372 guardInterval =
373 std::max(NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800),
375 }
376 txVector.SetGuardInterval(guardInterval);
377 if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT)
378 {
379 // Derive NSS from the MCS index. There is a different mode for each possible
380 // NSS value.
381 uint8_t nss = (mode.GetMcsValue() / 8) + 1;
382 txVector.SetNss(nss);
383 if (!txVector.IsValid() || nss > std::min(GetMaxNumberOfTransmitStreams(),
385 {
386 NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
387 << " width " << txVector.GetChannelWidth());
388 continue;
389 }
390 double threshold = GetSnrThreshold(txVector);
391 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
392 txVector.GetGuardInterval(),
393 nss);
394 NS_LOG_DEBUG("Testing mode " << mode.GetUniqueName() << " data rate "
395 << dataRate << " threshold " << threshold
396 << " last snr observed "
397 << station->m_lastSnrObserved << " cached "
398 << station->m_lastSnrCached);
399 double snr = GetLastObservedSnr(station, channelWidth, nss);
400 if (dataRate > bestRate && threshold < snr)
401 {
402 NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
403 << dataRate << " threshold " << threshold
404 << " channel width " << channelWidth
405 << " snr " << snr);
406 bestRate = dataRate;
407 maxMode = mode;
408 selectedNss = nss;
409 }
410 }
411 else
412 {
413 for (uint8_t nss = 1; nss <= std::min(GetMaxNumberOfTransmitStreams(),
415 nss++)
416 {
417 txVector.SetNss(nss);
418 if (!txVector.IsValid())
419 {
420 NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
421 << " width "
422 << +txVector.GetChannelWidth());
423 continue;
424 }
425 double threshold = GetSnrThreshold(txVector);
426 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
427 txVector.GetGuardInterval(),
428 nss);
429 NS_LOG_DEBUG("Testing mode = " << mode.GetUniqueName() << " data rate "
430 << dataRate << " threshold " << threshold
431 << " last snr observed "
432 << station->m_lastSnrObserved << " cached "
433 << station->m_lastSnrCached);
434 double snr = GetLastObservedSnr(station, channelWidth, nss);
435 if (dataRate > bestRate && threshold < snr)
436 {
437 NS_LOG_DEBUG("Candidate mode = "
438 << mode.GetUniqueName() << " data rate " << dataRate
439 << " threshold " << threshold << " channel width "
440 << channelWidth << " snr " << snr);
441 bestRate = dataRate;
442 maxMode = mode;
443 selectedNss = nss;
444 }
445 }
446 }
447 }
448 }
449 else
450 {
451 // Non-HT selection
452 selectedNss = 1;
453 for (uint8_t i = 0; i < GetNSupported(station); i++)
454 {
455 auto mode = GetSupported(station, i);
456 txVector.SetMode(mode);
457 txVector.SetNss(selectedNss);
458 const auto channelWidth = GetChannelWidthForNonHtMode(mode);
459 txVector.SetChannelWidth(channelWidth);
460 double threshold = GetSnrThreshold(txVector);
461 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
462 txVector.GetGuardInterval(),
463 txVector.GetNss());
464 NS_LOG_DEBUG("mode = " << mode.GetUniqueName() << " threshold " << threshold
465 << " last snr observed " << station->m_lastSnrObserved);
466 double snr = GetLastObservedSnr(station, channelWidth, 1);
467 if (dataRate > bestRate && threshold < snr)
468 {
469 NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
470 << dataRate << " threshold " << threshold
471 << " snr " << snr);
472 bestRate = dataRate;
473 maxMode = mode;
474 }
475 }
476 }
477 NS_LOG_DEBUG("Updating cached values for station to " << maxMode.GetUniqueName() << " snr "
478 << station->m_lastSnrObserved);
479 station->m_lastSnrCached = station->m_lastSnrObserved;
480 station->m_lastMode = maxMode;
481 station->m_lastNss = selectedNss;
482 }
483 NS_LOG_DEBUG("Found maxMode: " << maxMode << " channelWidth: " << channelWidth
484 << " nss: " << +selectedNss);
485 station->m_lastChannelWidth = channelWidth;
486 if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HE))
487 {
488 guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
489 }
490 else if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HT))
491 {
492 guardInterval = std::max(NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800),
494 }
495 else
496 {
497 guardInterval = NanoSeconds(800);
498 }
499 WifiTxVector bestTxVector{
500 maxMode,
503 guardInterval,
505 selectedNss,
506 0,
507 GetPhy()->GetTxBandwidth(maxMode, channelWidth),
508 GetAggregation(station)};
509 uint64_t maxDataRate = maxMode.GetDataRate(bestTxVector);
510 if (m_currentRate != maxDataRate)
511 {
512 NS_LOG_DEBUG("New datarate: " << maxDataRate);
513 m_currentRate = maxDataRate;
514 }
515 return bestTxVector;
516}
517
520{
521 NS_LOG_FUNCTION(this << st);
522 auto station = static_cast<IdealWifiRemoteStation*>(st);
523 // We search within the Basic rate set the mode with the highest
524 // SNR threshold possible which is smaller than m_lastSnr to
525 // ensure correct packet delivery.
526 double maxThreshold = 0.0;
527 WifiTxVector txVector;
528 WifiMode mode;
529 uint8_t nss = 1;
530 WifiMode maxMode = GetDefaultMode();
531 // RTS is sent in a non-HT frame
532 for (uint8_t i = 0; i < GetNBasicModes(); i++)
533 {
534 mode = GetBasicMode(i);
535 txVector.SetMode(mode);
536 txVector.SetNss(nss);
538 double threshold = GetSnrThreshold(txVector);
539 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
540 {
541 maxThreshold = threshold;
542 maxMode = mode;
543 }
544 }
545 return WifiTxVector(
546 maxMode,
549 NanoSeconds(800),
551 nss,
552 0,
554 GetAggregation(station));
555}
556
557double
559 MHz_u channelWidth,
560 uint8_t nss) const
561{
562 double snr = station->m_lastSnrObserved;
563 if (channelWidth != station->m_lastChannelWidthObserved)
564 {
565 snr /= (static_cast<double>(channelWidth) / station->m_lastChannelWidthObserved);
566 }
567 if (nss != station->m_lastNssObserved)
568 {
569 snr /= (static_cast<double>(nss) / station->m_lastNssObserved);
570 }
571 NS_LOG_DEBUG("Last observed SNR is " << station->m_lastSnrObserved << " for channel width "
572 << station->m_lastChannelWidthObserved << " and nss "
573 << +station->m_lastNssObserved << "; computed SNR is "
574 << snr << " for channel width " << channelWidth
575 << " and nss " << +nss);
576 return snr;
577}
578
579bool
581 IdealWifiRemoteStation* station)
582{
583 switch (mc)
584 {
586 return (GetHtSupported() && GetHtSupported(station));
588 return (GetVhtSupported() && GetVhtSupported(station));
590 return (GetHeSupported() && GetHeSupported(station));
592 return (GetEhtSupported() && GetEhtSupported(station));
593 default:
594 NS_ABORT_MSG("Unknown modulation class: " << mc);
595 }
596}
597
598bool
600 IdealWifiRemoteStation* station)
601{
602 if (!IsModulationClassSupported(mc, station))
603 {
604 return false;
605 }
606 switch (mc)
607 {
609 // If the node and peer are both VHT capable, skip non-VHT modes
610 if (GetVhtSupported() && GetVhtSupported(station))
611 {
612 return false;
613 }
614 [[fallthrough]];
616 // If the node and peer are both HE capable, skip non-HE modes
617 if (GetHeSupported() && GetHeSupported(station))
618 {
619 return false;
620 }
621 [[fallthrough]];
623 // If the node and peer are both EHT capable, skip non-EHT modes
624 if (GetEhtSupported() && GetEhtSupported(station))
625 {
626 return false;
627 }
628 break;
630 break;
631 default:
632 NS_ABORT_MSG("Unknown modulation class: " << mc);
633 }
634 return true;
635}
636
637} // 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=std::numeric_limits< MHz_u >::max()) const
Get the bandwidth for a transmission occurring on the current operating channel and using the given W...
Definition wifi-phy.cc:1117
MHz_u GetChannelWidth() const
Definition wifi-phy.cc:1093
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition wifi-phy.cc:1372
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:2098
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition wifi-phy.cc:2049
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 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
#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:1344
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 AttributeChecker > MakeDoubleChecker()
Definition double.h:82
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.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
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.