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 * 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/ht-configuration.h"
23#include "ns3/log.h"
24#include "ns3/wifi-net-device.h"
25#include "ns3/wifi-phy.h"
26
27#include <algorithm>
28
29namespace ns3
30{
31
32/**
33 * \brief hold per-remote-station state for Ideal Wifi manager.
34 *
35 * This struct extends from WifiRemoteStation struct to hold additional
36 * information required by the Ideal Wifi manager
37 */
39{
40 double m_lastSnrObserved; //!< SNR of most recently reported packet sent to the remote station
41 uint16_t m_lastChannelWidthObserved; //!< Channel width (in MHz) of most recently reported
42 //!< packet sent to the remote station
43 uint16_t m_lastNssObserved; //!< Number of spatial streams of most recently reported packet
44 //!< sent to the remote station
45 double m_lastSnrCached; //!< SNR most recently used to select a rate
46 uint8_t m_lastNss; //!< Number of spatial streams most recently used to the remote station
47 WifiMode m_lastMode; //!< Mode most recently used to the remote station
48 uint16_t
49 m_lastChannelWidth; //!< Channel width (in MHz) most recently used to the remote station
50};
51
52/// To avoid using the cache before a valid value has been cached
53static const double CACHE_INITIAL_VALUE = -100;
54
56
57NS_LOG_COMPONENT_DEFINE("IdealWifiManager");
58
61{
62 static TypeId tid =
63 TypeId("ns3::IdealWifiManager")
65 .SetGroupName("Wifi")
66 .AddConstructor<IdealWifiManager>()
67 .AddAttribute("BerThreshold",
68 "The maximum Bit Error Rate acceptable at any transmission mode",
69 DoubleValue(1e-6),
71 MakeDoubleChecker<double>())
72 .AddTraceSource("Rate",
73 "Traced value for rate changes (b/s)",
75 "ns3::TracedValueCallback::Uint64");
76 return tid;
77}
78
80 : m_currentRate(0)
81{
82 NS_LOG_FUNCTION(this);
83}
84
86{
87 NS_LOG_FUNCTION(this);
88}
89
90void
92{
93 NS_LOG_FUNCTION(this << phy);
95}
96
97uint16_t
99{
103 {
104 return 22;
105 }
106 else
107 {
108 return 20;
109 }
110}
111
112void
114{
115 NS_LOG_FUNCTION(this);
117}
118
119void
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 (GetPhy()->GetDevice()->GetHtConfiguration())
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
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
188double
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
215void
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);
227 auto station = new IdealWifiRemoteStation();
228 Reset(station);
229 return station;
230}
231
232void
234{
235 NS_LOG_FUNCTION(this << station);
236 auto st = static_cast<IdealWifiRemoteStation*>(station);
237 st->m_lastSnrObserved = 0.0;
238 st->m_lastChannelWidthObserved = 0;
239 st->m_lastNssObserved = 1;
240 st->m_lastSnrCached = CACHE_INITIAL_VALUE;
241 st->m_lastMode = GetDefaultMode();
242 st->m_lastChannelWidth = 0;
243 st->m_lastNss = 1;
244}
245
246void
248{
249 NS_LOG_FUNCTION(this << station << rxSnr << txMode);
250}
251
252void
254{
255 NS_LOG_FUNCTION(this << station);
256}
257
258void
260{
261 NS_LOG_FUNCTION(this << station);
262}
263
264void
266 double ctsSnr,
267 WifiMode ctsMode,
268 double rtsSnr)
269{
270 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode.GetUniqueName() << rtsSnr);
271 auto 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
278void
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 auto 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
299void
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 auto 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
321void
323{
324 NS_LOG_FUNCTION(this << station);
325 Reset(station);
326}
327
328void
330{
331 NS_LOG_FUNCTION(this << station);
332 Reset(station);
333}
334
337{
338 NS_LOG_FUNCTION(this << st << allowedWidth);
339 auto 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 uint64_t bestRate = 0;
346 uint8_t selectedNss = 1;
347 uint16_t guardInterval;
348 uint16_t channelWidth = std::min(GetChannelWidth(station), allowedWidth);
349 txVector.SetChannelWidth(channelWidth);
350 if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) &&
351 (station->m_lastSnrObserved == station->m_lastSnrCached) &&
352 (channelWidth == station->m_lastChannelWidth))
353 {
354 // SNR has not changed, so skip the search and use the last mode selected
355 maxMode = station->m_lastMode;
356 selectedNss = station->m_lastNss;
357 NS_LOG_DEBUG("Using cached mode = " << maxMode.GetUniqueName() << " last snr observed "
358 << station->m_lastSnrObserved << " cached "
359 << station->m_lastSnrCached << " channel width "
360 << station->m_lastChannelWidth << " nss "
361 << +selectedNss);
362 }
363 else
364 {
365 if (GetPhy()->GetDevice()->GetHtConfiguration() &&
367 {
368 for (uint8_t i = 0; i < GetNMcsSupported(station); i++)
369 {
370 auto mode = GetMcsSupported(station, i);
371 if (!IsCandidateModulationClass(mode.GetModulationClass(), station))
372 {
373 continue;
374 }
375 txVector.SetMode(mode);
376 uint16_t guardInterval;
377 if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE)
378 {
379 guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
380 }
381 else
382 {
383 guardInterval = static_cast<uint16_t>(
384 std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
385 GetShortGuardIntervalSupported() ? 400 : 800));
386 }
387 txVector.SetGuardInterval(guardInterval);
388 if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT)
389 {
390 // Derive NSS from the MCS index. There is a different mode for each possible
391 // NSS value.
392 uint8_t nss = (mode.GetMcsValue() / 8) + 1;
393 txVector.SetNss(nss);
394 if (!txVector.IsValid() || nss > std::min(GetMaxNumberOfTransmitStreams(),
396 {
397 NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
398 << " width " << txVector.GetChannelWidth());
399 continue;
400 }
401 double threshold = GetSnrThreshold(txVector);
402 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
403 txVector.GetGuardInterval(),
404 nss);
405 NS_LOG_DEBUG("Testing mode " << mode.GetUniqueName() << " data rate "
406 << dataRate << " threshold " << threshold
407 << " last snr observed "
408 << station->m_lastSnrObserved << " cached "
409 << station->m_lastSnrCached);
410 double snr = GetLastObservedSnr(station, channelWidth, nss);
411 if (dataRate > bestRate && threshold < snr)
412 {
413 NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
414 << dataRate << " threshold " << threshold
415 << " channel width " << channelWidth
416 << " snr " << snr);
417 bestRate = dataRate;
418 maxMode = mode;
419 selectedNss = nss;
420 }
421 }
422 else
423 {
424 for (uint8_t nss = 1; nss <= std::min(GetMaxNumberOfTransmitStreams(),
426 nss++)
427 {
428 txVector.SetNss(nss);
429 if (!txVector.IsValid())
430 {
431 NS_LOG_DEBUG("Skipping mode " << mode.GetUniqueName() << " nss " << +nss
432 << " width "
433 << +txVector.GetChannelWidth());
434 continue;
435 }
436 double threshold = GetSnrThreshold(txVector);
437 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
438 txVector.GetGuardInterval(),
439 nss);
440 NS_LOG_DEBUG("Testing mode = " << mode.GetUniqueName() << " data rate "
441 << dataRate << " threshold " << threshold
442 << " last snr observed "
443 << station->m_lastSnrObserved << " cached "
444 << station->m_lastSnrCached);
445 double snr = GetLastObservedSnr(station, channelWidth, nss);
446 if (dataRate > bestRate && threshold < snr)
447 {
448 NS_LOG_DEBUG("Candidate mode = "
449 << mode.GetUniqueName() << " data rate " << dataRate
450 << " threshold " << threshold << " channel width "
451 << channelWidth << " snr " << snr);
452 bestRate = dataRate;
453 maxMode = mode;
454 selectedNss = nss;
455 }
456 }
457 }
458 }
459 }
460 else
461 {
462 // Non-HT selection
463 selectedNss = 1;
464 for (uint8_t i = 0; i < GetNSupported(station); i++)
465 {
466 auto mode = GetSupported(station, i);
467 txVector.SetMode(mode);
468 txVector.SetNss(selectedNss);
469 uint16_t channelWidth = GetChannelWidthForNonHtMode(mode);
470 txVector.SetChannelWidth(channelWidth);
471 double threshold = GetSnrThreshold(txVector);
472 uint64_t dataRate = mode.GetDataRate(txVector.GetChannelWidth(),
473 txVector.GetGuardInterval(),
474 txVector.GetNss());
475 NS_LOG_DEBUG("mode = " << mode.GetUniqueName() << " threshold " << threshold
476 << " last snr observed " << station->m_lastSnrObserved);
477 double snr = GetLastObservedSnr(station, channelWidth, 1);
478 if (dataRate > bestRate && threshold < snr)
479 {
480 NS_LOG_DEBUG("Candidate mode = " << mode.GetUniqueName() << " data rate "
481 << dataRate << " threshold " << threshold
482 << " snr " << snr);
483 bestRate = dataRate;
484 maxMode = mode;
485 }
486 }
487 }
488 NS_LOG_DEBUG("Updating cached values for station to " << maxMode.GetUniqueName() << " snr "
489 << station->m_lastSnrObserved);
490 station->m_lastSnrCached = station->m_lastSnrObserved;
491 station->m_lastMode = maxMode;
492 station->m_lastNss = selectedNss;
493 }
494 NS_LOG_DEBUG("Found maxMode: " << maxMode << " channelWidth: " << channelWidth
495 << " nss: " << +selectedNss);
496 station->m_lastChannelWidth = channelWidth;
497 if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HE))
498 {
499 guardInterval = std::max(GetGuardInterval(station), GetGuardInterval());
500 }
501 else if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HT))
502 {
503 guardInterval =
504 static_cast<uint16_t>(std::max(GetShortGuardIntervalSupported(station) ? 400 : 800,
505 GetShortGuardIntervalSupported() ? 400 : 800));
506 }
507 else
508 {
509 guardInterval = 800;
510 }
511 WifiTxVector bestTxVector{
512 maxMode,
515 guardInterval,
517 selectedNss,
518 0,
519 GetPhy()->GetTxBandwidth(maxMode, channelWidth),
520 GetAggregation(station)};
521 uint64_t maxDataRate = maxMode.GetDataRate(bestTxVector);
522 if (m_currentRate != maxDataRate)
523 {
524 NS_LOG_DEBUG("New datarate: " << maxDataRate);
525 m_currentRate = maxDataRate;
526 }
527 return bestTxVector;
528}
529
532{
533 NS_LOG_FUNCTION(this << st);
534 auto station = static_cast<IdealWifiRemoteStation*>(st);
535 // We search within the Basic rate set the mode with the highest
536 // SNR threshold possible which is smaller than m_lastSnr to
537 // ensure correct packet delivery.
538 double maxThreshold = 0.0;
539 WifiTxVector txVector;
540 WifiMode mode;
541 uint8_t nss = 1;
542 WifiMode maxMode = GetDefaultMode();
543 // RTS is sent in a non-HT frame
544 for (uint8_t i = 0; i < GetNBasicModes(); i++)
545 {
546 mode = GetBasicMode(i);
547 txVector.SetMode(mode);
548 txVector.SetNss(nss);
550 double threshold = GetSnrThreshold(txVector);
551 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
552 {
553 maxThreshold = threshold;
554 maxMode = mode;
555 }
556 }
557 return WifiTxVector(
558 maxMode,
561 800,
563 nss,
564 0,
566 GetAggregation(station));
567}
568
569double
571 uint16_t channelWidth,
572 uint8_t nss) const
573{
574 double snr = station->m_lastSnrObserved;
575 if (channelWidth != station->m_lastChannelWidthObserved)
576 {
577 snr /= (static_cast<double>(channelWidth) / station->m_lastChannelWidthObserved);
578 }
579 if (nss != station->m_lastNssObserved)
580 {
581 snr /= (static_cast<double>(nss) / station->m_lastNssObserved);
582 }
583 NS_LOG_DEBUG("Last observed SNR is " << station->m_lastSnrObserved << " for channel width "
584 << station->m_lastChannelWidthObserved << " and nss "
585 << +station->m_lastNssObserved << "; computed SNR is "
586 << snr << " for channel width " << channelWidth
587 << " and nss " << +nss);
588 return snr;
589}
590
591bool
593 IdealWifiRemoteStation* station)
594{
595 switch (mc)
596 {
598 return (GetHtSupported() && GetHtSupported(station));
600 return (GetVhtSupported() && GetVhtSupported(station));
602 return (GetHeSupported() && GetHeSupported(station));
604 return (GetEhtSupported() && GetEhtSupported(station));
605 default:
606 NS_ABORT_MSG("Unknown modulation class: " << mc);
607 }
608}
609
610bool
612 IdealWifiRemoteStation* station)
613{
614 if (!IsModulationClassSupported(mc, station))
615 {
616 return false;
617 }
618 switch (mc)
619 {
621 // If the node and peer are both VHT capable, skip non-VHT modes
622 if (GetVhtSupported() && GetVhtSupported(station))
623 {
624 return false;
625 }
626 [[fallthrough]];
628 // If the node and peer are both HE capable, skip non-HE modes
629 if (GetHeSupported() && GetHeSupported(station))
630 {
631 return false;
632 }
633 [[fallthrough]];
635 // If the node and peer are both EHT capable, skip non-EHT modes
636 if (GetEhtSupported() && GetEhtSupported(station))
637 {
638 return false;
639 }
640 break;
642 break;
643 default:
644 NS_ABORT_MSG("Unknown modulation class: " << mc);
645 }
646 return true;
647}
648
649} // namespace ns3
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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
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:1083
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:1107
uint8_t GetMaxSupportedTxSpatialStreams() const
Definition: wifi-phy.cc:1333
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).
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...
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.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
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.
WifiRemoteStationState * m_state
Remote station state.
Mac48Address m_address
Mac48Address of the remote station.