A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
vht-phy.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Orange Labs
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Rediet <getachew.redieteab@orange.com>
7 * Sébastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
8 */
9
10#include "vht-phy.h"
11
12#include "vht-configuration.h"
13#include "vht-ppdu.h"
14
15#include "ns3/assert.h"
16#include "ns3/interference-helper.h"
17#include "ns3/log.h"
18#include "ns3/wifi-net-device.h"
19#include "ns3/wifi-phy.h" //only used for static mode constructor
20#include "ns3/wifi-psdu.h"
21#include "ns3/wifi-utils.h"
22
23#undef NS_LOG_APPEND_CONTEXT
24#define NS_LOG_APPEND_CONTEXT WIFI_PHY_NS_LOG_APPEND_CONTEXT(m_wifiPhy)
25
26namespace ns3
27{
28
30
31/*******************************************************
32 * VHT PHY (IEEE 802.11-2016, clause 21)
33 *******************************************************/
34
35// clang-format off
36
40 WIFI_PPDU_FIELD_SIG_A, // VHT-SIG-A
41 WIFI_PPDU_FIELD_TRAINING, // VHT-STF + VHT-LTFs
45 WIFI_PPDU_FIELD_SIG_A, // VHT-SIG-A
46 WIFI_PPDU_FIELD_TRAINING, // VHT-STF + VHT-LTFs
47 WIFI_PPDU_FIELD_SIG_B, // VHT-SIG-B
49};
50
52 /* {BW,Nss,MCS} Nes */
53 { std::make_tuple ( 80, 7, 2), 3 }, // instead of 2
54 { std::make_tuple ( 80, 7, 7), 6 }, // instead of 4
55 { std::make_tuple ( 80, 7, 8), 6 }, // instead of 5
56 { std::make_tuple ( 80, 8, 7), 6 }, // instead of 5
57 { std::make_tuple (160, 4, 7), 6 }, // instead of 5
58 { std::make_tuple (160, 5, 8), 8 }, // instead of 7
59 { std::make_tuple (160, 6, 7), 8 }, // instead of 7
60 { std::make_tuple (160, 7, 3), 4 }, // instead of 3
61 { std::make_tuple (160, 7, 4), 6 }, // instead of 5
62 { std::make_tuple (160, 7, 5), 7 }, // instead of 6
63 { std::make_tuple (160, 7, 7), 9 }, // instead of 8
64 { std::make_tuple (160, 7, 8), 12 }, // instead of 9
65 { std::make_tuple (160, 7, 9), 12 }, // instead of 10
66};
67
68// clang-format on
69
70/**
71 * \brief map a given channel list type to the corresponding scaling factor
72 */
73const std::map<WifiChannelListType, dBm_u> channelTypeToScalingFactor{
78};
79
80/**
81 * \brief map a given secondary channel width to its channel list type
82 */
83const std::map<MHz_u, WifiChannelListType> secondaryChannels{
87};
88
89VhtPhy::VhtPhy(bool buildModeList /* = true */)
90 : HtPhy(1, false) // don't add HT modes to list
91{
92 NS_LOG_FUNCTION(this << buildModeList);
96 if (buildModeList)
97 {
99 }
100}
101
103{
104 NS_LOG_FUNCTION(this);
105}
106
107void
109{
110 NS_LOG_FUNCTION(this);
111 NS_ASSERT(m_modeList.empty());
113 for (uint8_t index = 0; index <= m_maxSupportedMcsIndexPerSs; ++index)
114 {
115 NS_LOG_LOGIC("Add VhtMcs" << +index << " to list");
116 m_modeList.emplace_back(CreateVhtMcs(index));
117 }
118}
119
122{
123 return m_vhtPpduFormats;
124}
125
127VhtPhy::GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const
128{
129 switch (field)
130 {
131 case WIFI_PPDU_FIELD_TRAINING: // consider SIG-A mode for training (useful for
132 // InterferenceHelper)
134 return GetSigAMode();
136 return GetSigBMode(txVector);
137 default:
138 return HtPhy::GetSigMode(field, txVector);
139 }
140}
141
144{
146 NS_FATAL_ERROR("No HT-SIG");
147 return WifiMode();
148}
149
152{
153 return GetLSigMode(); // same number of data tones as OFDM (i.e. 48)
154}
155
157VhtPhy::GetSigBMode(const WifiTxVector& txVector) const
158{
160 "VHT-SIG-B only available for VHT MU");
161 return GetVhtMcs0();
162}
163
164Time
165VhtPhy::GetDuration(WifiPpduField field, const WifiTxVector& txVector) const
166{
167 switch (field)
168 {
170 return GetSigADuration(txVector.GetPreambleType());
172 return GetSigBDuration(txVector);
173 default:
174 return HtPhy::GetDuration(field, txVector);
175 }
176}
177
178Time
180{
181 return MicroSeconds(4); // L-SIG
182}
183
184Time
186{
187 return MicroSeconds(0); // no HT-SIG
188}
189
190Time
192 uint8_t nDataLtf,
193 uint8_t nExtensionLtf /* = 0 */) const
194{
195 NS_ABORT_MSG_IF(nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
196 NS_ABORT_MSG_IF(nExtensionLtf > 0, "No extension LTFs expected for VHT");
197 return MicroSeconds(4 + 4 * nDataLtf); // VHT-STF + VHT-LTFs
198}
199
200Time
202{
203 return MicroSeconds(8); // VHT-SIG-A (first and second symbol)
204}
205
206Time
208{
209 return (txVector.GetPreambleType() == WIFI_PREAMBLE_VHT_MU)
210 ? MicroSeconds(4)
211 : MicroSeconds(0); // HE-SIG-B only for MU
212}
213
214uint8_t
216{
217 WifiMode payloadMode = txVector.GetMode();
218 /**
219 * General rule: add an encoder when crossing maxRatePerCoder frontier
220 *
221 * The value of 540 Mbps and 600 Mbps for normal GI and short GI (resp.)
222 * were obtained by observing the rates for which Nes was incremented in tables
223 * 21-30 to 21-61 of IEEE 802.11-2016.
224 * These values are the last values before changing encoders.
225 */
226 double maxRatePerCoder = (txVector.GetGuardInterval().GetNanoSeconds() == 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(
231 std::make_tuple(txVector.GetChannelWidth(), txVector.GetNss(), payloadMode.GetMcsValue()));
232 if (iter != m_exceptionsMap.end())
233 {
234 nes = iter->second;
235 }
236 return nes;
237}
238
240VhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Time ppduDuration)
241{
242 NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
243 return Create<VhtPpdu>(psdus.begin()->second,
244 txVector,
246 ppduDuration,
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 {
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->GetPpdu()->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) \
337 case 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) \
360 WifiMode VhtPhy::GetVhtMcs##x() \
361 { \
362 static WifiMode mcs = CreateVhtMcs(x); \
363 return mcs; \
364 }
365
376#undef GET_VHT_MCS
377
378WifiMode
380{
381 NS_ASSERT_MSG(index <= 9, "VhtMcs index must be <= 9!");
382 return WifiModeFactory::CreateWifiMcs("VhtMcs" + std::to_string(index),
383 index,
385 false,
392}
393
395VhtPhy::GetCodeRate(uint8_t mcsValue)
396{
397 switch (mcsValue)
398 {
399 case 8:
400 return WIFI_CODE_RATE_3_4;
401 case 9:
402 return WIFI_CODE_RATE_5_6;
403 default:
404 return HtPhy::GetCodeRate(mcsValue);
405 }
406}
407
408uint16_t
410{
411 switch (mcsValue)
412 {
413 case 8:
414 case 9:
415 return 256;
416 default:
417 return HtPhy::GetConstellationSize(mcsValue);
418 }
419}
420
421uint64_t
422VhtPhy::GetPhyRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
423{
424 WifiCodeRate codeRate = GetCodeRate(mcsValue);
425 uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss);
426 return HtPhy::CalculatePhyRate(codeRate, dataRate);
427}
428
429uint64_t
430VhtPhy::GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
431{
432 return GetPhyRate(txVector.GetMode().GetMcsValue(),
433 txVector.GetChannelWidth(),
434 txVector.GetGuardInterval(),
435 txVector.GetNss());
436}
437
438uint64_t
439VhtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
440{
441 return GetDataRate(txVector.GetMode().GetMcsValue(),
442 txVector.GetChannelWidth(),
443 txVector.GetGuardInterval(),
444 txVector.GetNss());
445}
446
447uint64_t
448VhtPhy::GetDataRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
449{
450 [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds();
451 NS_ASSERT((gi == 800) || (gi == 400));
452 NS_ASSERT(nss <= 8);
453 NS_ASSERT_MSG(IsCombinationAllowed(mcsValue, channelWidth, nss),
454 "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is "
455 << +nss);
456 return HtPhy::CalculateDataRate(GetSymbolDuration(guardInterval),
457 GetUsableSubcarriers(channelWidth),
458 static_cast<uint16_t>(log2(GetConstellationSize(mcsValue))),
460 nss);
461}
462
463uint16_t
465{
466 switch (static_cast<uint16_t>(channelWidth))
467 {
468 case 80:
469 return 234;
470 case 160:
471 return 468;
472 default:
473 return HtPhy::GetUsableSubcarriers(channelWidth);
474 }
475}
476
477uint64_t
479{
480 const auto codeRate = GetCodeRate(mcsValue);
481 const auto constellationSize = GetConstellationSize(mcsValue);
482 return CalculateNonHtReferenceRate(codeRate, constellationSize);
483}
484
485uint64_t
486VhtPhy::CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
487{
488 uint64_t dataRate;
489 switch (constellationSize)
490 {
491 case 256:
492 if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
493 {
494 dataRate = 54000000;
495 }
496 else
497 {
498 NS_FATAL_ERROR("Trying to get reference rate for a MCS with wrong combination of "
499 "coding rate and modulation");
500 }
501 break;
502 default:
503 dataRate = HtPhy::CalculateNonHtReferenceRate(codeRate, constellationSize);
504 }
505 return dataRate;
506}
507
508bool
510{
511 return IsCombinationAllowed(txVector.GetMode().GetMcsValue(),
512 txVector.GetChannelWidth(),
513 txVector.GetNss());
514}
515
516bool
517VhtPhy::IsCombinationAllowed(uint8_t mcsValue, MHz_u channelWidth, uint8_t nss)
518{
519 if (mcsValue == 9 && channelWidth == 20 && nss != 3)
520 {
521 return false;
522 }
523 if (mcsValue == 6 && channelWidth == 80 && nss == 3)
524 {
525 return false;
526 }
527 return true;
528}
529
532{
533 return 4692480;
534}
535
536dBm_u
538{
539 if (ppdu)
540 {
541 const auto ppduBw = ppdu->GetTxVector().GetChannelWidth();
542 switch (channelType)
543 {
545 // Start of a PPDU for which its power measured within the primary 20 MHz channel is at
546 // or above the CCA sensitivity threshold.
548 }
550 NS_ASSERT_MSG(ppduBw == 20, "Invalid channel width " << ppduBw);
551 break;
553 NS_ASSERT_MSG(ppduBw <= 40, "Invalid channel width " << ppduBw);
554 break;
556 NS_ASSERT_MSG(ppduBw <= 80, "Invalid channel width " << ppduBw);
557 break;
558 default:
559 NS_ASSERT_MSG(false, "Invalid channel list type");
560 }
561 auto vhtConfiguration = m_wifiPhy->GetDevice()->GetVhtConfiguration();
562 NS_ASSERT(vhtConfiguration);
563 const auto thresholds = vhtConfiguration->GetSecondaryCcaSensitivityThresholdsPerBw();
564 const auto it = thresholds.find(ppduBw);
565 NS_ASSERT_MSG(it != std::end(thresholds), "Invalid channel width " << ppduBw);
566 return it->second;
567 }
568 else
569 {
570 const auto it = channelTypeToScalingFactor.find(channelType);
571 NS_ASSERT_MSG(it != std::end(channelTypeToScalingFactor), "Invalid channel list type");
572 return m_wifiPhy->GetCcaEdThreshold() + it->second;
573 }
574}
575
578{
579 if (m_wifiPhy->GetChannelWidth() < 80)
580 {
581 return HtPhy::GetCcaIndication(ppdu);
582 }
583
584 auto ccaThreshold = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
585 auto delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThreshold, GetPrimaryBand(20));
586 if (delayUntilCcaEnd.IsStrictlyPositive())
587 {
588 return std::make_pair(
589 delayUntilCcaEnd,
590 WIFI_CHANLIST_PRIMARY); // if Primary is busy, ignore CCA for Secondary
591 }
592
593 if (ppdu)
594 {
595 const MHz_u primaryWidth = 20;
596 const MHz_u p20MinFreq =
598 (primaryWidth / 2);
599 const MHz_u p20MaxFreq =
601 (primaryWidth / 2);
602 if (ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq))
603 {
604 /*
605 * PPDU occupies primary 20 MHz channel, hence we skip CCA sensitivity rules
606 * for signals not occupying the primary 20 MHz channel.
607 */
608 return std::nullopt;
609 }
610 }
611
612 std::vector<MHz_u> secondaryWidthsToCheck;
613 if (ppdu)
614 {
615 for (const auto& secondaryChannel : secondaryChannels)
616 {
617 const auto secondaryWidth = secondaryChannel.first;
618 const MHz_u secondaryMinFreq =
620 secondaryWidth) -
621 (secondaryWidth / 2);
622 const MHz_u secondaryMaxFreq =
624 secondaryWidth) +
625 (secondaryWidth / 2);
626 if ((m_wifiPhy->GetChannelWidth() > secondaryWidth) &&
627 ppdu->DoesOverlapChannel(secondaryMinFreq, secondaryMaxFreq))
628 {
629 secondaryWidthsToCheck.push_back(secondaryWidth);
630 }
631 }
632 }
633 else
634 {
635 secondaryWidthsToCheck.push_back(20);
636 secondaryWidthsToCheck.push_back(40);
637 if (m_wifiPhy->GetChannelWidth() > 80)
638 {
639 secondaryWidthsToCheck.push_back(80);
640 }
641 }
642
643 for (auto secondaryWidth : secondaryWidthsToCheck)
644 {
645 auto channelType = secondaryChannels.at(secondaryWidth);
646 ccaThreshold = GetCcaThreshold(ppdu, channelType);
647 delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThreshold, GetSecondaryBand(secondaryWidth));
648 if (delayUntilCcaEnd.IsStrictlyPositive())
649 {
650 return std::make_pair(delayUntilCcaEnd, channelType);
651 }
652 }
653
654 return std::nullopt;
655}
656
657} // namespace ns3
658
659namespace
660{
661
662/**
663 * Constructor class for VHT modes
664 */
674
675} // namespace
Constructor class for VHT modes.
Definition vht-phy.cc:666
PHY entity for HT (11n)
Definition ht-phy.h:43
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:651
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:817
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:621
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition ht-phy.h:544
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:383
static WifiMode GetLSigMode()
Definition ht-phy.cc:146
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition ht-phy.h:542
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:425
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:733
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:202
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:593
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:128
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:700
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:666
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition ht-phy.h:543
virtual Time GetSymbolDuration(const WifiTxVector &txVector) const
Definition ht-phy.cc:363
static uint16_t GetUsableSubcarriers()
Definition ofdm-phy.cc:624
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
Definition ofdm-phy.cc:334
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition phy-entity.h:939
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:924
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition phy-entity.h:529
WifiSpectrumBandInfo GetPrimaryBand(MHz_u bandWidth) const
If the operating channel width is a multiple of 20 MHz, return the info corresponding to the primary ...
Time GetDelayUntilCcaEnd(dBm_u threshold, const WifiSpectrumBandInfo &band)
Return the delay until CCA busy is ended for a given sensitivity threshold and a given band.
std::list< WifiMode > m_modeList
the list of supported modes
Definition phy-entity.h:943
double GetRandomValue() const
Obtain a random value from the WifiPhy's generator.
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
@ DROP
drop PPDU and set CCA_BUSY
Definition phy-entity.h:71
WifiSpectrumBandInfo GetSecondaryBand(MHz_u bandWidth) const
If the channel bonding is used, return the info corresponding to the secondary channel of the given b...
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:407
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition vht-phy.cc:509
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition vht-phy.cc:395
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:165
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition vht-phy.h:347
~VhtPhy() override
Destructor for VHT PHY.
Definition vht-phy.cc:102
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition vht-phy.h:349
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:439
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:191
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition vht-phy.cc:207
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition vht-phy.cc:430
static bool IsCombinationAllowed(uint8_t mcsValue, MHz_u channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
Definition vht-phy.cc:517
static uint64_t GetDataRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition vht-phy.cc:448
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:577
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:486
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition vht-phy.cc:240
dBm_u GetCcaThreshold(const Ptr< const WifiPpdu > ppdu, WifiChannelListType channelType) const override
Return the CCA threshold for a given channel type.
Definition vht-phy.cc:537
static uint64_t GetPhyRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition vht-phy.cc:422
void BuildModeList() override
Build mode list.
Definition vht-phy.cc:108
virtual WifiMode GetSigAMode() const
Definition vht-phy.cc:151
Time GetLSigDuration(WifiPreamble preamble) const override
Definition vht-phy.cc:179
std::map< std::tuple< MHz_u, 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
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()
Initialize all VHT modes.
Definition vht-phy.cc:325
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition vht-phy.cc:379
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition vht-phy.cc:409
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
Definition vht-phy.cc:531
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:478
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition vht-phy.cc:201
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
Definition vht-phy.cc:121
WifiMode GetHtSigMode() const override
Definition vht-phy.cc:143
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition vht-phy.cc:89
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition vht-phy.cc:157
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
Time GetHtSigDuration() const override
Definition vht-phy.cc:185
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:127
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:307
represent a single transmission mode
Definition wifi-mode.h:40
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
Definition wifi-mode.cc:111
uint8_t GetMcsValue() const
Definition wifi-mode.cc:152
dBm_u GetCcaEdThreshold() const
Return the CCA energy detection threshold.
Definition wifi-phy.cc:527
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:795
MHz_u GetChannelWidth() const
Definition wifi-phy.cc:1093
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition wifi-phy.cc:641
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition wifi-phy.cc:1075
dBm_u GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold.
Definition wifi-phy.cc:540
MHz_u GetSecondaryChannelCenterFrequency(MHz_u secondaryChannelWidth) const
Get the center frequency of the secondary channel of the given width.
MHz_u GetPrimaryChannelCenterFrequency(MHz_u 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() 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.
MHz_u GetChannelWidth() const
Time GetGuardInterval() const
#define CASE(x)
#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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:97
#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_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#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:745
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1332
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:27
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.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
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:684
const std::map< WifiChannelListType, dBm_u > channelTypeToScalingFactor
map a given channel list type to the corresponding scaling factor
Definition vht-phy.cc:73
dB_u RatioToDb(double ratio)
Convert from ratio to dB.
Definition wifi-utils.cc:44
double dBm_u
dBm weak type
Definition wifi-units.h:27
const std::map< MHz_u, WifiChannelListType > secondaryChannels
map a given secondary channel width to its channel list type
Definition vht-phy.cc:83
WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
@ WIFI_CODE_RATE_3_4
3/4 coding rate
@ WIFI_CODE_RATE_5_6
5/6 coding rate
Status of the reception of the PPDU field.
Definition phy-entity.h:80
WifiPhyRxfailureReason reason
failure reason
Definition phy-entity.h:82
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition phy-entity.h:83
bool isSuccess
outcome (true if success) of the reception
Definition phy-entity.h:81
A struct for both SNR and PER.
Definition phy-entity.h:115
double snr
SNR in linear scale.
Definition phy-entity.h:116
#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:27
Declaration of ns3::VhtPpdu class.