A Discrete-Event Network Simulator
API
ideal-wifi-manager.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2006 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */
20
21#include <algorithm>
22#include "ns3/log.h"
23#include "ideal-wifi-manager.h"
24#include "ns3/wifi-phy.h"
25
26namespace ns3 {
27
35{
40 uint8_t m_lastNss;
43};
44
46static const double CACHE_INITIAL_VALUE = -100;
47
49
50NS_LOG_COMPONENT_DEFINE ("IdealWifiManager");
51
54{
55 static TypeId tid = TypeId ("ns3::IdealWifiManager")
57 .SetGroupName ("Wifi")
58 .AddConstructor<IdealWifiManager> ()
59 .AddAttribute ("BerThreshold",
60 "The maximum Bit Error Rate acceptable at any transmission mode",
61 DoubleValue (1e-6),
63 MakeDoubleChecker<double> ())
64 .AddTraceSource ("Rate",
65 "Traced value for rate changes (b/s)",
67 "ns3::TracedValueCallback::Uint64")
68 ;
69 return tid;
70}
71
73 : m_currentRate (0)
74{
75 NS_LOG_FUNCTION (this);
76}
77
79{
80 NS_LOG_FUNCTION (this);
81}
82
83void
85{
86 NS_LOG_FUNCTION (this << phy);
88}
89
90uint16_t
92{
98 {
99 return 22;
100 }
101 else
102 {
103 return 20;
104 }
105}
106
107void
109{
110 NS_LOG_FUNCTION (this);
112}
113
114void
116{
117 m_thresholds.clear ();
118 WifiMode mode;
119 WifiTxVector txVector;
120 uint8_t nss = 1;
121 for (const auto & mode : GetPhy ()->GetModeList ())
122 {
124 txVector.SetNss (nss);
125 txVector.SetMode (mode);
126 NS_LOG_DEBUG ("Adding mode = " << mode.GetUniqueName ());
127 AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
128 }
129 // Add all MCSes
130 if (GetHtSupported ())
131 {
132 for (const auto & mode : GetPhy ()->GetMcsList ())
133 {
134 for (uint16_t j = 20; j <= GetPhy ()->GetChannelWidth (); j *= 2)
135 {
136 txVector.SetChannelWidth (j);
138 {
139 uint16_t guardInterval = GetShortGuardIntervalSupported () ? 400 : 800;
140 txVector.SetGuardInterval (guardInterval);
141 //derive NSS from the MCS index
142 nss = (mode.GetMcsValue () / 8) + 1;
143 NS_LOG_DEBUG ("Adding mode = " << mode.GetUniqueName () <<
144 " channel width " << j <<
145 " nss " << +nss <<
146 " GI " << guardInterval);
147 txVector.SetNss (nss);
148 txVector.SetMode (mode);
149 AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
150 }
151 else //VHT or HE
152 {
153 uint16_t guardInterval;
155 {
156 guardInterval = GetShortGuardIntervalSupported () ? 400 : 800;
157 }
158 else
159 {
160 guardInterval = GetGuardInterval ();
161 }
162 txVector.SetGuardInterval (guardInterval);
163 for (uint8_t k = 1; k <= GetPhy ()->GetMaxSupportedTxSpatialStreams (); k++)
164 {
165 if (mode.IsAllowed (j, k))
166 {
167 NS_LOG_DEBUG ("Adding mode = " << mode.GetUniqueName () <<
168 " channel width " << j <<
169 " nss " << +k <<
170 " GI " << guardInterval);
171 txVector.SetNss (k);
172 txVector.SetMode (mode);
173 AddSnrThreshold (txVector, GetPhy ()->CalculateSnr (txVector, m_ber));
174 }
175 else
176 {
177 NS_LOG_DEBUG ("Mode = " << mode.GetUniqueName () << " disallowed");
178 }
179 }
180 }
181 }
182 }
183 }
184}
185
186double
188{
189 NS_LOG_FUNCTION (this << txVector);
190 auto it = std::find_if (m_thresholds.begin (), m_thresholds.end (),
191 [&txVector] (const std::pair<double, WifiTxVector>& p) -> bool {
192 return ((txVector.GetMode () == p.second.GetMode ()) && (txVector.GetNss () == p.second.GetNss ()) && (txVector.GetChannelWidth () == p.second.GetChannelWidth ()));
193 }
194 );
195 if (it == m_thresholds.end ())
196 {
197 //This means capabilities have changed in runtime, hence rebuild SNR thresholds
199 it = std::find_if (m_thresholds.begin (), m_thresholds.end (),
200 [&txVector] (const std::pair<double, WifiTxVector>& p) -> bool {
201 return ((txVector.GetMode () == p.second.GetMode ()) && (txVector.GetNss () == p.second.GetNss ()) && (txVector.GetChannelWidth () == p.second.GetChannelWidth ()));
202 }
203 );
204 NS_ASSERT_MSG (it != m_thresholds.end (), "SNR threshold not found");
205 }
206 return it->first;
207}
208
209void
211{
212 NS_LOG_FUNCTION (this << txVector.GetMode ().GetUniqueName () << txVector.GetChannelWidth () << snr);
213 m_thresholds.push_back (std::make_pair (snr, txVector));
214}
215
218{
219 NS_LOG_FUNCTION (this);
221 Reset (station);
222 return station;
223}
224
225void
227{
228 NS_LOG_FUNCTION (this << station);
229 IdealWifiRemoteStation *st = static_cast<IdealWifiRemoteStation*> (station);
230 st->m_lastSnrObserved = 0.0;
232 st->m_lastNssObserved = 1;
234 st->m_lastMode = GetDefaultMode ();
235 st->m_lastChannelWidth = 0;
236 st->m_lastNss = 1;
237}
238
239void
241{
242 NS_LOG_FUNCTION (this << station << rxSnr << txMode);
243}
244
245void
247{
248 NS_LOG_FUNCTION (this << station);
249}
250
251void
253{
254 NS_LOG_FUNCTION (this << station);
255}
256
257void
259 double ctsSnr, WifiMode ctsMode, double rtsSnr)
260{
261 NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode.GetUniqueName () << rtsSnr);
262 IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
263 station->m_lastSnrObserved = rtsSnr;
264 station->m_lastChannelWidthObserved = GetPhy ()->GetChannelWidth () >= 40 ? 20 : GetPhy ()->GetChannelWidth ();
265 station->m_lastNssObserved = 1;
266}
267
268void
270 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
271{
272 NS_LOG_FUNCTION (this << st << ackSnr << ackMode.GetUniqueName () << dataSnr << dataChannelWidth << +dataNss);
273 IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
274 if (dataSnr == 0)
275 {
276 NS_LOG_WARN ("DataSnr reported to be zero; not saving this report.");
277 return;
278 }
279 station->m_lastSnrObserved = dataSnr;
280 station->m_lastChannelWidthObserved = dataChannelWidth;
281 station->m_lastNssObserved = dataNss;
282}
283
284void
285IdealWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus,
286 double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
287{
288 NS_LOG_FUNCTION (this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr << dataChannelWidth << +dataNss);
289 IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
290 if (dataSnr == 0)
291 {
292 NS_LOG_WARN ("DataSnr reported to be zero; not saving this report.");
293 return;
294 }
295 station->m_lastSnrObserved = dataSnr;
296 station->m_lastChannelWidthObserved = dataChannelWidth;
297 station->m_lastNssObserved = dataNss;
298}
299
300void
302{
303 NS_LOG_FUNCTION (this << station);
304 Reset (station);
305}
306
307void
309{
310 NS_LOG_FUNCTION (this << station);
311 Reset (station);
312}
313
316{
317 NS_LOG_FUNCTION (this << st);
318 IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
319 //We search within the Supported rate set the mode with the
320 //highest data rate for which the SNR threshold is smaller than m_lastSnr
321 //to ensure correct packet delivery.
322 WifiMode maxMode = GetDefaultMode ();
323 WifiTxVector txVector;
324 WifiMode mode;
325 uint64_t bestRate = 0;
326 uint8_t selectedNss = 1;
327 uint16_t guardInterval;
328 uint16_t channelWidth = std::min (GetChannelWidth (station), GetPhy ()->GetChannelWidth ());
329 txVector.SetChannelWidth (channelWidth);
330 if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) && (station->m_lastSnrObserved == station->m_lastSnrCached) && (channelWidth == station->m_lastChannelWidth))
331 {
332 // SNR has not changed, so skip the search and use the last mode selected
333 maxMode = station->m_lastMode;
334 selectedNss = station->m_lastNss;
335 NS_LOG_DEBUG ("Using cached mode = " << maxMode.GetUniqueName () <<
336 " last snr observed " << station->m_lastSnrObserved <<
337 " cached " << station->m_lastSnrCached <<
338 " channel width " << station->m_lastChannelWidth <<
339 " nss " << +selectedNss);
340 }
341 else
342 {
343 if (GetHtSupported () && GetHtSupported (st))
344 {
345 for (uint8_t i = 0; i < GetNMcsSupported (station); i++)
346 {
347 mode = GetMcsSupported (station, i);
348 txVector.SetMode (mode);
350 {
351 guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
352 txVector.SetGuardInterval (guardInterval);
353 // If the node and peer are both VHT capable, only search VHT modes
354 if (GetVhtSupported () && GetVhtSupported (station))
355 {
356 continue;
357 }
358 // If the node and peer are both HE capable, only search HE modes
359 if (GetHeSupported () && GetHeSupported (station))
360 {
361 continue;
362 }
363 // Derive NSS from the MCS index. There is a different mode for each possible NSS value.
364 uint8_t nss = (mode.GetMcsValue () / 8) + 1;
365 txVector.SetNss (nss);
366 if (!txVector.IsValid ()
368 {
369 NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
370 " nss " << +nss <<
371 " width " << txVector.GetChannelWidth ());
372 continue;
373 }
374 double threshold = GetSnrThreshold (txVector);
375 uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
376 NS_LOG_DEBUG ("Testing mode " << mode.GetUniqueName () <<
377 " data rate " << dataRate <<
378 " threshold " << threshold << " last snr observed " <<
379 station->m_lastSnrObserved << " cached " <<
380 station->m_lastSnrCached);
381 double snr = GetLastObservedSnr (station, channelWidth, nss);
382 if (dataRate > bestRate && threshold < snr)
383 {
384 NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
385 " data rate " << dataRate <<
386 " threshold " << threshold <<
387 " channel width " << channelWidth <<
388 " snr " << snr);
389 bestRate = dataRate;
390 maxMode = mode;
391 selectedNss = nss;
392 }
393 }
394 else if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT)
395 {
396 guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
397 txVector.SetGuardInterval (guardInterval);
398 // If the node and peer are both HE capable, only search HE modes
399 if (GetHeSupported () && GetHeSupported (station))
400 {
401 continue;
402 }
403 // If the node and peer are not both VHT capable, only search HT modes
404 if (!GetVhtSupported () || !GetVhtSupported (station))
405 {
406 continue;
407 }
408 for (uint8_t nss = 1; nss <= std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (station)); nss++)
409 {
410 txVector.SetNss (nss);
411 if (!txVector.IsValid ())
412 {
413 NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
414 " nss " << +nss <<
415 " width " << txVector.GetChannelWidth ());
416 continue;
417 }
418 double threshold = GetSnrThreshold (txVector);
419 uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
420 NS_LOG_DEBUG ("Testing mode = " << mode.GetUniqueName () <<
421 " data rate " << dataRate <<
422 " threshold " << threshold << " last snr observed " <<
423 station->m_lastSnrObserved << " cached " <<
424 station->m_lastSnrCached);
425 double snr = GetLastObservedSnr (station, channelWidth, nss);
426 if (dataRate > bestRate && threshold < snr)
427 {
428 NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
429 " data rate " << dataRate <<
430 " channel width " << channelWidth <<
431 " snr " << snr);
432 bestRate = dataRate;
433 maxMode = mode;
434 selectedNss = nss;
435 }
436 }
437 }
438 else //HE
439 {
440 guardInterval = std::max (GetGuardInterval (station), GetGuardInterval ());
441 txVector.SetGuardInterval (guardInterval);
442 // If the node and peer are not both HE capable, only search (V)HT modes
443 if (!GetHeSupported () || !GetHeSupported (station))
444 {
445 continue;
446 }
447 for (uint8_t nss = 1; nss <= std::min (GetMaxNumberOfTransmitStreams (), GetNumberOfSupportedStreams (station)); nss++)
448 {
449 txVector.SetNss (nss);
450 if (!txVector.IsValid ())
451 {
452 NS_LOG_DEBUG ("Skipping mode " << mode.GetUniqueName () <<
453 " nss " << +nss <<
454 " width " << +txVector.GetChannelWidth ());
455 continue;
456 }
457 double threshold = GetSnrThreshold (txVector);
458 uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), nss);
459 NS_LOG_DEBUG ("Testing mode = " << mode.GetUniqueName () <<
460 " data rate " << dataRate <<
461 " threshold " << threshold << " last snr observed " <<
462 station->m_lastSnrObserved << " cached " <<
463 station->m_lastSnrCached);
464 double snr = GetLastObservedSnr (station, channelWidth, nss);
465 if (dataRate > bestRate && threshold < snr)
466 {
467 NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
468 " data rate " << dataRate <<
469 " threshold " << threshold <<
470 " channel width " << channelWidth <<
471 " snr " << snr);
472 bestRate = dataRate;
473 maxMode = mode;
474 selectedNss = nss;
475 }
476 }
477 }
478 }
479 }
480 else
481 {
482 // Non-HT selection
483 selectedNss = 1;
484 for (uint8_t i = 0; i < GetNSupported (station); i++)
485 {
486 mode = GetSupported (station, i);
487 txVector.SetMode (mode);
488 txVector.SetNss (selectedNss);
489 uint16_t channelWidth = GetChannelWidthForNonHtMode (mode);
490 txVector.SetChannelWidth (channelWidth);
491 double threshold = GetSnrThreshold (txVector);
492 uint64_t dataRate = mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), txVector.GetNss ());
493 NS_LOG_DEBUG ("mode = " << mode.GetUniqueName () <<
494 " threshold " << threshold <<
495 " last snr observed " <<
496 station->m_lastSnrObserved);
497 double snr = GetLastObservedSnr (station, channelWidth, 1);
498 if (dataRate > bestRate && threshold < snr)
499 {
500 NS_LOG_DEBUG ("Candidate mode = " << mode.GetUniqueName () <<
501 " data rate " << dataRate <<
502 " threshold " << threshold <<
503 " snr " << snr);
504 bestRate = dataRate;
505 maxMode = mode;
506 }
507 }
508 }
509 NS_LOG_DEBUG ("Updating cached values for station to " << maxMode.GetUniqueName () << " snr " << station->m_lastSnrObserved);
510 station->m_lastSnrCached = station->m_lastSnrObserved;
511 station->m_lastMode = maxMode;
512 station->m_lastNss = selectedNss;
513 }
514 NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << channelWidth << " nss: " << +selectedNss);
515 station->m_lastChannelWidth = channelWidth;
516 if (maxMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
517 {
518 guardInterval = std::max (GetGuardInterval (station), GetGuardInterval ());
519 }
520 else if ((maxMode.GetModulationClass () == WIFI_MOD_CLASS_HT) || (maxMode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
521 {
522 guardInterval = static_cast<uint16_t> (std::max (GetShortGuardIntervalSupported (station) ? 400 : 800, GetShortGuardIntervalSupported () ? 400 : 800));
523 }
524 else
525 {
526 guardInterval = 800;
527 }
528 WifiTxVector bestTxVector {maxMode, GetDefaultTxPowerLevel (), GetPreambleForTransmission (maxMode.GetModulationClass (), GetShortPreambleEnabled ()), guardInterval, GetNumberOfAntennas (), selectedNss, 0, GetChannelWidthForTransmission (maxMode, channelWidth), GetAggregation (station)};
529 uint64_t maxDataRate = maxMode.GetDataRate (bestTxVector);
530 if (m_currentRate != maxDataRate)
531 {
532 NS_LOG_DEBUG ("New datarate: " << maxDataRate);
533 m_currentRate = maxDataRate;
534 }
535 return bestTxVector;
536}
537
540{
541 NS_LOG_FUNCTION (this << st);
542 IdealWifiRemoteStation *station = static_cast<IdealWifiRemoteStation*> (st);
543 //We search within the Basic rate set the mode with the highest
544 //SNR threshold possible which is smaller than m_lastSnr to
545 //ensure correct packet delivery.
546 double maxThreshold = 0.0;
547 WifiTxVector txVector;
548 WifiMode mode;
549 uint8_t nss = 1;
550 WifiMode maxMode = GetDefaultMode ();
551 //RTS is sent in a non-HT frame
552 for (uint8_t i = 0; i < GetNBasicModes (); i++)
553 {
554 mode = GetBasicMode (i);
555 txVector.SetMode (mode);
556 txVector.SetNss (nss);
558 double threshold = GetSnrThreshold (txVector);
559 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
560 {
561 maxThreshold = threshold;
562 maxMode = mode;
563 }
564 }
566}
567
568double
569IdealWifiManager::GetLastObservedSnr (IdealWifiRemoteStation *station, uint16_t channelWidth, uint8_t nss) const
570{
571 double snr = station->m_lastSnrObserved;
572 if (channelWidth != station->m_lastChannelWidthObserved)
573 {
574 snr /= (static_cast<double> (channelWidth) / station->m_lastChannelWidthObserved);
575 }
576 if (nss != station->m_lastNssObserved)
577 {
578 snr /= (static_cast<double> (nss) / station->m_lastNssObserved);
579 }
580 NS_LOG_DEBUG ("Last observed SNR is " << station->m_lastSnrObserved <<
581 " for channel width " << station->m_lastChannelWidthObserved <<
582 " and nss " << +station->m_lastNssObserved <<
583 "; computed SNR is " << snr <<
584 " for channel width " << channelWidth <<
585 " and nss " << +nss);
586 return snr;
587}
588
589} //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:41
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.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
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.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoInitialize(void) override
Initialize() implementation.
void BuildSnrThresholds(void)
Construct the vector of minimum SNRs needed to successfully transmit for all possible combinations (r...
static TypeId GetTypeId(void)
Get the type ID.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
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...
WifiRemoteStation * DoCreateStation(void) const override
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:177
std::string GetUniqueName(void) const
Definition: wifi-mode.cc:140
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:114
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
Definition: wifi-mode.cc:60
uint8_t GetMaxSupportedTxSpatialStreams(void) const
Definition: wifi-phy.cc:1099
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:901
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 GetDefaultMode(void) const
Return the default transmission mode.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
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.
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...
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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.
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams,...
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(void) const
uint16_t GetGuardInterval(void) 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:67
#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:88
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:42
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#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:265
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
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.
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY's default ...
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
phy
Definition: third.py:93
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.