A Discrete-Event Network Simulator
API
vht-phy.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2020 Orange Labs
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 * Authors: Rediet <getachew.redieteab@orange.com>
19 * S├ębastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
20 */
21
22#include "vht-phy.h"
23#include "vht-ppdu.h"
24#include "ns3/wifi-psdu.h"
25#include "ns3/wifi-phy.h" //only used for static mode constructor
26#include "ns3/wifi-utils.h"
27#include "ns3/interference-helper.h"
28#include "ns3/wifi-net-device.h"
29#include "vht-configuration.h"
30#include "ns3/log.h"
31#include "ns3/assert.h"
32
33namespace ns3 {
34
36
37/*******************************************************
38 * VHT PHY (IEEE 802.11-2016, clause 21)
39 *******************************************************/
40
41/* *NS_CHECK_STYLE_OFF* */
45 WIFI_PPDU_FIELD_SIG_A, //VHT-SIG-A
46 WIFI_PPDU_FIELD_TRAINING, //VHT-STF + VHT-LTFs
50 WIFI_PPDU_FIELD_SIG_A, //VHT-SIG-A
51 WIFI_PPDU_FIELD_TRAINING, //VHT-STF + VHT-LTFs
52 WIFI_PPDU_FIELD_SIG_B, //VHT-SIG-B
54};
55
57 /* {BW,Nss,MCS} Nes */
58 { std::make_tuple ( 80, 7, 2), 3 }, //instead of 2
59 { std::make_tuple ( 80, 7, 7), 6 }, //instead of 4
60 { std::make_tuple ( 80, 7, 8), 6 }, //instead of 5
61 { std::make_tuple ( 80, 8, 7), 6 }, //instead of 5
62 { std::make_tuple (160, 4, 7), 6 }, //instead of 5
63 { std::make_tuple (160, 5, 8), 8 }, //instead of 7
64 { std::make_tuple (160, 6, 7), 8 }, //instead of 7
65 { std::make_tuple (160, 7, 3), 4 }, //instead of 3
66 { std::make_tuple (160, 7, 4), 6 }, //instead of 5
67 { std::make_tuple (160, 7, 5), 7 }, //instead of 6
68 { std::make_tuple (160, 7, 7), 9 }, //instead of 8
69 { std::make_tuple (160, 7, 8), 12 }, //instead of 9
70 { std::make_tuple (160, 7, 9), 12 } //instead of 10
71};
72
76const std::map<WifiChannelListType, double> channelTypeToScalingFactorDbm {
81};
82
86const std::map<uint16_t, WifiChannelListType> secondaryChannels {
90};
91
92/* *NS_CHECK_STYLE_ON* */
93
94VhtPhy::VhtPhy (bool buildModeList /* = true */)
95 : HtPhy (1, false) //don't add HT modes to list
96{
97 NS_LOG_FUNCTION (this << buildModeList);
101 if (buildModeList)
102 {
103 BuildModeList ();
104 }
105}
106
108{
109 NS_LOG_FUNCTION (this);
110}
111
112void
114{
115 NS_LOG_FUNCTION (this);
116 NS_ASSERT (m_modeList.empty ());
118 for (uint8_t index = 0; index <= m_maxSupportedMcsIndexPerSs; ++index)
119 {
120 NS_LOG_LOGIC ("Add VhtMcs" << +index << " to list");
121 m_modeList.emplace_back (CreateVhtMcs (index));
122 }
123}
124
127{
128 return m_vhtPpduFormats;
129}
130
132VhtPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
133{
134 switch (field)
135 {
136 case WIFI_PPDU_FIELD_TRAINING: //consider SIG-A mode for training (useful for InterferenceHelper)
138 return GetSigAMode ();
140 return GetSigBMode (txVector);
141 default:
142 return HtPhy::GetSigMode (field, txVector);
143 }
144}
145
148{
150 NS_FATAL_ERROR ("No HT-SIG");
151 return WifiMode ();
152}
153
156{
157 return GetLSigMode (); //same number of data tones as OFDM (i.e. 48)
158}
159
161VhtPhy::GetSigBMode (const WifiTxVector& txVector) const
162{
163 NS_ABORT_MSG_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_VHT_MU, "VHT-SIG-B only available for VHT MU");
164 return GetVhtMcs0 ();
165}
166
167Time
168VhtPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
169{
170 switch (field)
171 {
173 return GetSigADuration (txVector.GetPreambleType ());
175 return GetSigBDuration (txVector);
176 default:
177 return HtPhy::GetDuration (field, txVector);
178 }
179}
180
181Time
183{
184 return MicroSeconds (4); //L-SIG
185}
186
187Time
189{
190 return MicroSeconds (0); //no HT-SIG
191}
192
193Time
195 uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
196{
197 NS_ABORT_MSG_IF (nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
198 NS_ABORT_MSG_IF (nExtensionLtf > 0, "No extension LTFs expected for VHT");
199 return MicroSeconds (4 + 4 * nDataLtf); //VHT-STF + VHT-LTFs
200}
201
202Time
204{
205 return MicroSeconds (8); //VHT-SIG-A (first and second symbol)
206}
207
208Time
210{
211 return (txVector.GetPreambleType () == WIFI_PREAMBLE_VHT_MU) ? MicroSeconds (4) : MicroSeconds (0); //HE-SIG-B only for MU
212}
213
214uint8_t
216{
217 WifiMode payloadMode = txVector.GetMode ();
226 double maxRatePerCoder = (txVector.GetGuardInterval () == 800) ? 540e6 : 600e6;
227 uint8_t nes = ceil (payloadMode.GetDataRate (txVector) / maxRatePerCoder);
228
229 //Handle exceptions to the rule
230 auto iter = m_exceptionsMap.find (std::make_tuple (txVector.GetChannelWidth (),
231 txVector.GetNss (),
232 payloadMode.GetMcsValue ()));
233 if (iter != m_exceptionsMap.end ())
234 {
235 nes = iter->second;
236 }
237 return nes;
238}
239
241VhtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
242{
243 NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
244 return Create<VhtPpdu> (psdus.begin ()->second, txVector,
246 ppduDuration, m_wifiPhy->GetPhyBand (),
247 ObtainNextUid (txVector));
248}
249
252{
253 NS_LOG_FUNCTION (this << field << *event);
254 switch (field)
255 {
257 [[fallthrough]];
259 return EndReceiveSig (event, field);
260 default:
261 return HtPhy::DoEndReceiveField (field, event);
262 }
263}
264
267{
268 NS_LOG_FUNCTION (this << *event << field);
269 SnrPer snrPer = GetPhyHeaderSnrPer (field, event);
270 NS_LOG_DEBUG (field << ": SNR(dB)=" << RatioToDb (snrPer.snr) << ", PER=" << snrPer.per);
271 PhyFieldRxStatus status (GetRandomValue () > snrPer.per);
272 if (status.isSuccess)
273 {
274 NS_LOG_DEBUG ("Received " << field);
275 if (!IsAllConfigSupported (WIFI_PPDU_FIELD_SIG_A, event->GetPpdu ()))
276 {
277 status = PhyFieldRxStatus (false, UNSUPPORTED_SETTINGS, DROP);
278 }
279 status = ProcessSig (event, status, field);
280 }
281 else
282 {
283 NS_LOG_DEBUG ("Drop packet because " << field << " reception failed");
284 status.reason = GetFailureReason (field);
285 status.actionIfFailure = DROP;
286 }
287 return status;
288}
289
292{
293 switch (field)
294 {
296 return SIG_A_FAILURE;
298 return SIG_B_FAILURE;
299 default:
300 NS_ASSERT_MSG (false, "Unknown PPDU field");
301 return UNKNOWN;
302 }
303}
304
307{
308 NS_LOG_FUNCTION (this << *event << status << field);
309 NS_ASSERT (event->GetTxVector ().GetPreambleType () >= WIFI_PREAMBLE_VHT_SU);
310 //TODO see if something should be done here once MU-MIMO is supported
311 return status; //nothing special for VHT
312}
313
314bool
316{
317 if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU && field == WIFI_PPDU_FIELD_SIG_A)
318 {
319 return IsChannelWidthSupported (ppdu); //perform the full check after SIG-B
320 }
321 return HtPhy::IsAllConfigSupported (field, ppdu);
322}
323
324void
326{
327 for (uint8_t i = 0; i < 10; ++i)
328 {
329 GetVhtMcs (i);
330 }
331}
332
334VhtPhy::GetVhtMcs (uint8_t index)
335{
336#define CASE(x) \
337case x: \
338 return GetVhtMcs ## x (); \
339
340 switch (index)
341 {
342 CASE ( 0)
343 CASE ( 1)
344 CASE ( 2)
345 CASE ( 3)
346 CASE ( 4)
347 CASE ( 5)
348 CASE ( 6)
349 CASE ( 7)
350 CASE ( 8)
351 CASE ( 9)
352 default:
353 NS_ABORT_MSG ("Inexistent index (" << +index << ") requested for VHT");
354 return WifiMode ();
355 }
356#undef CASE
357}
358
359#define GET_VHT_MCS(x) \
360WifiMode \
361VhtPhy::GetVhtMcs ## x (void) \
362{ \
363 static WifiMode mcs = CreateVhtMcs (x); \
364 return mcs; \
365}; \
366
367GET_VHT_MCS (0)
368GET_VHT_MCS (1)
369GET_VHT_MCS (2)
370GET_VHT_MCS (3)
371GET_VHT_MCS (4)
372GET_VHT_MCS (5)
373GET_VHT_MCS (6)
374GET_VHT_MCS (7)
375GET_VHT_MCS (8)
376GET_VHT_MCS (9)
377#undef GET_VHT_MCS
378
379WifiMode
380VhtPhy::CreateVhtMcs (uint8_t index)
381{
382 NS_ASSERT_MSG (index <= 9, "VhtMcs index must be <= 9!");
383 return WifiModeFactory::CreateWifiMcs ("VhtMcs" + std::to_string (index),
384 index,
386 false,
393}
394
396VhtPhy::GetCodeRate (uint8_t mcsValue)
397{
398 switch (mcsValue)
399 {
400 case 8:
401 return WIFI_CODE_RATE_3_4;
402 case 9:
403 return WIFI_CODE_RATE_5_6;
404 default:
405 return HtPhy::GetCodeRate (mcsValue);
406 }
407}
408
409uint16_t
411{
412 switch (mcsValue)
413 {
414 case 8:
415 case 9:
416 return 256;
417 default:
418 return HtPhy::GetConstellationSize (mcsValue);
419 }
420}
421
422uint64_t
423VhtPhy::GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
424{
425 WifiCodeRate codeRate = GetCodeRate (mcsValue);
426 uint64_t dataRate = GetDataRate (mcsValue, channelWidth, guardInterval, nss);
427 return HtPhy::CalculatePhyRate (codeRate, dataRate);
428}
429
430uint64_t
431VhtPhy::GetPhyRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
432{
433 return GetPhyRate (txVector.GetMode ().GetMcsValue (),
434 txVector.GetChannelWidth (),
435 txVector.GetGuardInterval (),
436 txVector.GetNss ());
437}
438
439uint64_t
440VhtPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
441{
442 return GetDataRate (txVector.GetMode ().GetMcsValue (),
443 txVector.GetChannelWidth (),
444 txVector.GetGuardInterval (),
445 txVector.GetNss ());
446}
447
448uint64_t
449VhtPhy::GetDataRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
450{
451 NS_ASSERT (guardInterval == 800 || guardInterval == 400);
452 NS_ASSERT (nss <= 8);
453 NS_ASSERT_MSG (IsCombinationAllowed (mcsValue, channelWidth, nss), "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is " << +nss);
455 GetUsableSubcarriers (channelWidth),
456 static_cast<uint16_t> (log2 (GetConstellationSize (mcsValue))),
457 HtPhy::GetCodeRatio (GetCodeRate (mcsValue)), nss);
458}
459
460uint16_t
461VhtPhy::GetUsableSubcarriers (uint16_t channelWidth)
462{
463 switch (channelWidth)
464 {
465 case 80:
466 return 234;
467 case 160:
468 return 468;
469 default:
470 return HtPhy::GetUsableSubcarriers (channelWidth);
471 }
472}
473
474uint64_t
476{
477 WifiCodeRate codeRate = GetCodeRate (mcsValue);
478 uint16_t constellationSize = GetConstellationSize (mcsValue);
479 return CalculateNonHtReferenceRate (codeRate, constellationSize);
480}
481
482uint64_t
483VhtPhy::CalculateNonHtReferenceRate (WifiCodeRate codeRate, uint16_t constellationSize)
484{
485 uint64_t dataRate;
486 switch (constellationSize)
487 {
488 case 256:
489 if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
490 {
491 dataRate = 54000000;
492 }
493 else
494 {
495 NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
496 }
497 break;
498 default:
499 dataRate = HtPhy::CalculateNonHtReferenceRate (codeRate, constellationSize);
500 }
501 return dataRate;
502}
503
504bool
506{
507 return IsCombinationAllowed (txVector.GetMode ().GetMcsValue (),
508 txVector.GetChannelWidth (),
509 txVector.GetNss ());
510}
511
512bool
513VhtPhy::IsCombinationAllowed (uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
514{
515 if (mcsValue == 9 && channelWidth == 20 && nss != 3)
516 {
517 return false;
518 }
519 if (mcsValue == 6 && channelWidth == 80 && nss == 3)
520 {
521 return false;
522 }
523 return true;
524}
525
528{
529 return 4692480;
530}
531
532double
534{
535 if (ppdu)
536 {
537 const uint16_t ppduBw = ppdu->GetTxVector ().GetChannelWidth ();
538 switch (channelType)
539 {
541 {
542 //Start of a PPDU for which its power measured within the primary 20 MHz channel is at or above the CCA sensitivy threshold.
544 }
546 NS_ASSERT_MSG (ppduBw == 20, "Invalid channel width " << ppduBw);
547 break;
549 NS_ASSERT_MSG (ppduBw <= 40, "Invalid channel width " << ppduBw);
550 break;
552 NS_ASSERT_MSG (ppduBw <= 80, "Invalid channel width " << ppduBw);
553 break;
554 default:
555 NS_ASSERT_MSG (false, "Invalid channel list type");
556 }
557 auto vhtConfiguration = m_wifiPhy->GetDevice ()->GetVhtConfiguration ();
558 NS_ASSERT (vhtConfiguration);
559 const auto thresholds = vhtConfiguration->GetSecondaryCcaSensitivityThresholdsPerBw ();
560 const auto it = thresholds.find (ppduBw);
561 NS_ASSERT_MSG (it != std::end (thresholds), "Invalid channel width " << ppduBw);
562 return it->second;
563 }
564 else
565 {
566 const auto it = channelTypeToScalingFactorDbm.find (channelType);
567 NS_ASSERT_MSG (it != std::end (channelTypeToScalingFactorDbm), "Invalid channel list type");
568 return m_wifiPhy->GetCcaEdThreshold () + it->second;
569 }
570}
571
574{
575 NS_LOG_FUNCTION (this);
576
577 if (m_wifiPhy->GetChannelWidth () < 80)
578 {
579 return HtPhy::GetCcaIndication (ppdu);
580 }
581
582 double ccaThresholdDbm = GetCcaThreshold (ppdu, WIFI_CHANLIST_PRIMARY);
583 Time delayUntilCcaEnd = GetDelayUntilCcaEnd (ccaThresholdDbm, GetPrimaryBand (20));
584 if (delayUntilCcaEnd.IsStrictlyPositive ())
585 {
586 return std::make_pair (delayUntilCcaEnd, WIFI_CHANLIST_PRIMARY); //if Primary is busy, ignore CCA for Secondary
587 }
588
589 if (ppdu)
590 {
591 const uint16_t primaryWidth = 20;
592 uint16_t p20MinFreq =
593 m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (primaryWidth) - (primaryWidth / 2);
594 uint16_t p20MaxFreq =
595 m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (primaryWidth) + (primaryWidth / 2);
596 if (ppdu->DoesOverlapChannel (p20MinFreq, p20MaxFreq))
597 {
598 /*
599 * PPDU occupies primary 20 MHz channel, hence we skip CCA sensitivity rules
600 * for signals not occupying the primary 20 MHz channel.
601 */
602 return std::nullopt;
603 }
604 }
605
606 std::vector<uint16_t> secondaryWidthsToCheck;
607 if (ppdu)
608 {
609 for (const auto& secondaryChannel : secondaryChannels)
610 {
611 uint16_t secondaryWidth = secondaryChannel.first;
612 uint16_t secondaryMinFreq =
613 m_wifiPhy->GetOperatingChannel ().GetSecondaryChannelCenterFrequency (secondaryWidth) - (secondaryWidth / 2);
614 uint16_t secondaryMaxFreq =
615 m_wifiPhy->GetOperatingChannel ().GetSecondaryChannelCenterFrequency (secondaryWidth) + (secondaryWidth / 2);
616 if ((m_wifiPhy->GetChannelWidth () > secondaryWidth) && ppdu->DoesOverlapChannel (secondaryMinFreq, secondaryMaxFreq))
617 {
618 secondaryWidthsToCheck.push_back (secondaryWidth);
619 }
620 }
621 }
622 else
623 {
624 secondaryWidthsToCheck.push_back (20);
625 secondaryWidthsToCheck.push_back (40);
626 if (m_wifiPhy->GetChannelWidth () > 80)
627 {
628 secondaryWidthsToCheck.push_back (80);
629 }
630 }
631
632 for (auto secondaryWidth : secondaryWidthsToCheck)
633 {
634 auto channelType = secondaryChannels.at (secondaryWidth);
635 ccaThresholdDbm = GetCcaThreshold (ppdu, channelType);
636 delayUntilCcaEnd = GetDelayUntilCcaEnd (ccaThresholdDbm, GetSecondaryBand (secondaryWidth));
637 if (delayUntilCcaEnd.IsStrictlyPositive ())
638 {
639 return std::make_pair (delayUntilCcaEnd, channelType);
640 }
641 }
642
643 return std::nullopt;
644}
645
646} //namespace ns3
647
648namespace {
649
653static class ConstructorVht
654{
655public:
657 {
659 ns3::WifiPhy::AddStaticPhyEntity (ns3::WIFI_MOD_CLASS_VHT, ns3::Create<ns3::VhtPhy> ());
660 }
662
663}
Constructor class for VHT modes.
Definition: vht-phy.cc:654
PHY entity for HT (11n)
Definition: ht-phy.h:51
static uint64_t CalculatePhyRate(WifiCodeRate codeRate, uint64_t dataRate)
Return the PHY rate corresponding to the supplied code rate and data rate.
Definition: ht-phy.cc:628
CcaIndication GetCcaIndication(const Ptr< const WifiPpdu > ppdu) override
Get CCA end time and its corresponding channel list type when a new signal has been received by the P...
Definition: ht-phy.cc:786
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied HT MCS index between 0 and 7,...
Definition: ht-phy.cc:598
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition: ht-phy.h:540
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
Definition: ht-phy.cc:368
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition: ht-phy.h:538
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
Definition: ht-phy.cc:410
static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
Return the rate (in bps) of the non-HT Reference Rate which corresponds to the supplied code rate and...
Definition: ht-phy.cc:706
Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const override
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
Definition: ht-phy.cc:200
static WifiMode GetLSigMode(void)
Definition: ht-phy.cc:147
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied HT MCS index between 0 and 7,...
Definition: ht-phy.cc:570
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
Definition: ht-phy.cc:131
static uint64_t CalculateDataRate(Time symbolDuration, uint16_t usableSubCarriers, uint16_t numberOfBitsPerSubcarrier, double codingRate, uint8_t nss)
Calculates data rate from the supplied parameters.
Definition: ht-phy.cc:675
static double GetCodeRatio(WifiCodeRate codeRate)
Convert WifiCodeRate to a ratio, e.g., code ratio of WIFI_CODE_RATE_1_2 is 0.5.
Definition: ht-phy.cc:643
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition: ht-phy.h:539
virtual Time GetSymbolDuration(const WifiTxVector &txVector) const
Definition: ht-phy.cc:350
static uint16_t GetUsableSubcarriers(void)
Definition: ofdm-phy.cc:585
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
Definition: ofdm-phy.cc:319
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1114
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:884
WifiSpectrumBand GetSecondaryBand(uint16_t bandWidth) const
If the channel bonding is used, return the start band index and the stop band index for the secondary...
Definition: phy-entity.cc:1047
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:1019
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:489
Time GetDelayUntilCcaEnd(double thresholdDbm, WifiSpectrumBand band)
Return the delay until CCA busy is ended for a given sensitivity threshold (in dBm) and a given band.
Definition: phy-entity.cc:1066
std::optional< std::pair< Time, WifiChannelListType > > CcaIndication
CCA end time and its corresponding channel list type (can be std::nullopt if IDLE)
Definition: phy-entity.h:873
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:887
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:253
WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth) const
If the operating channel width is a multiple of 20 MHz, return the start band index and the stop band...
Definition: phy-entity.cc:1037
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:104
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
bool IsStrictlyPositive(void) const
Exactly equivalent to t > 0.
Definition: nstime.h:333
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition: vht-phy.cc:505
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:396
static bool IsCombinationAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
Definition: vht-phy.cc:513
Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const override
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
Definition: vht-phy.cc:168
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition: vht-phy.h:347
Time GetHtSigDuration(void) const override
Definition: vht-phy.cc:188
double GetCcaThreshold(const Ptr< const WifiPpdu > ppdu, WifiChannelListType channelType) const override
Return the CCA threshold in dBm for a given channel type.
Definition: vht-phy.cc:533
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition: vht-phy.h:348
std::map< std::tuple< uint16_t, uint8_t, uint8_t >, uint8_t > NesExceptionMap
Typedef for storing exceptions in the number of BCC encoders for VHT MCSs.
Definition: vht-phy.h:346
void BuildModeList(void) override
Build mode list.
Definition: vht-phy.cc:113
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
Definition: vht-phy.cc:315
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:440
PhyFieldRxStatus EndReceiveSig(Ptr< Event > event, WifiPpduField field)
End receiving the SIG-A or SIG-B, perform VHT-specific actions, and provide the status of the recepti...
Definition: vht-phy.cc:266
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:215
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:194
virtual WifiMode GetSigAMode(void) const
Definition: vht-phy.cc:155
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:209
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:431
CcaIndication GetCcaIndication(const Ptr< const WifiPpdu > ppdu) override
Get CCA end time and its corresponding channel list type when a new signal has been received by the P...
Definition: vht-phy.cc:573
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:334
static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
Return the rate (in bps) of the non-HT Reference Rate which corresponds to the supplied code rate and...
Definition: vht-phy.cc:483
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: vht-phy.cc:241
static uint64_t GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition: vht-phy.cc:423
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:527
WifiMode GetHtSigMode(void) const override
Definition: vht-phy.cc:147
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:182
virtual PhyFieldRxStatus ProcessSig(Ptr< Event > event, PhyFieldRxStatus status, WifiPpduField field)
Process SIG-A or SIG-B, perform amendment-specific actions, and provide an updated status of the rece...
Definition: vht-phy.cc:306
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
Definition: vht-phy.cc:251
static void InitializeModes(void)
Initialize all VHT modes.
Definition: vht-phy.cc:325
static uint64_t GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition: vht-phy.cc:449
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:380
virtual ~VhtPhy()
Destructor for VHT PHY.
Definition: vht-phy.cc:107
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:410
static uint64_t GetNonHtReferenceRate(uint8_t mcsValue)
Calculate the rate in bps of the non-HT Reference Rate corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:475
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:203
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition: vht-phy.cc:94
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:161
virtual WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
Definition: vht-phy.cc:291
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:126
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
Definition: vht-phy.cc:132
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass, bool isMandatory, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, DataRateCallback dataRateCallback, NonHtReferenceRateCallback nonHtReferenceRateCallback, AllowedCallback isAllowedCallback)
Definition: wifi-mode.cc:305
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:114
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:951
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:938
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:575
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
Definition: wifi-phy.cc:692
double GetCcaEdThreshold(void) const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:461
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:969
double GetCcaSensitivityThreshold(void) const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:474
uint16_t GetSecondaryChannelCenterFrequency(uint16_t secondaryChannelWidth) const
Get the center frequency of the secondary channel of the given width.
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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.
WifiPreamble GetPreambleType(void) const
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
#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
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#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_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:714
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1261
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1269
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
WifiPpduField
The type of PPDU field (grouped for convenience)
@ UNSUPPORTED_SETTINGS
@ SIG_A_FAILURE
@ SIG_B_FAILURE
@ WIFI_PREAMBLE_VHT_MU
@ WIFI_PREAMBLE_VHT_SU
@ WIFI_PPDU_TYPE_DL_MU
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_CHANLIST_PRIMARY
@ WIFI_CHANLIST_SECONDARY40
@ WIFI_CHANLIST_SECONDARY
@ WIFI_CHANLIST_SECONDARY80
@ WIFI_PPDU_FIELD_SIG_B
SIG-B field.
@ WIFI_PPDU_FIELD_TRAINING
STF + LTF fields (excluding those in preamble for HT-GF)
@ WIFI_PPDU_FIELD_NON_HT_HEADER
PHY header field for DSSS or ERP, short PHY header field for HR/DSSS or ERP, field not present for HT...
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
@ WIFI_PPDU_FIELD_DATA
data field
@ WIFI_PPDU_FIELD_SIG_A
SIG-A field.
#define HT_PHY
This defines the BSS membership value for HT PHY.
Definition: ht-phy.h:38
static class anonymous_namespace{vht-phy.cc}::ConstructorVht g_constructor_vht
the constructor for VHT modes
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:49
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
const std::map< uint16_t, WifiChannelListType > secondaryChannels
map a given secondary channel width to its channel list type
Definition: vht-phy.cc:86
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:661
const std::map< WifiChannelListType, double > channelTypeToScalingFactorDbm
map a given channel list type to the corresponding scaling factor in dBm
Definition: vht-phy.cc:76
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
Status of the reception of the PPDU field.
Definition: phy-entity.h:113
WifiPhyRxfailureReason reason
failure reason
Definition: phy-entity.h:116
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition: phy-entity.h:117
bool isSuccess
outcome (true if success) of the reception
Definition: phy-entity.h:115
A struct for both SNR and PER.
Definition: phy-entity.h:139
double snr
SNR in linear scale.
Definition: phy-entity.h:140
#define CASE(x)
#define GET_VHT_MCS(x)
Definition: vht-phy.cc:359
Declaration of ns3::VhtPhy class.
#define VHT_PHY
This defines the BSS membership value for VHT PHY.
Definition: vht-phy.h:38
Declaration of ns3::VhtPpdu class.