A Discrete-Event Network Simulator
API
vht-phy.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Orange Labs
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 * Authors: Rediet <getachew.redieteab@orange.com>
18 * Sébastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
19 */
20
21#include "vht-phy.h"
22
23#include "vht-configuration.h"
24#include "vht-ppdu.h"
25
26#include "ns3/assert.h"
27#include "ns3/interference-helper.h"
28#include "ns3/log.h"
29#include "ns3/wifi-net-device.h"
30#include "ns3/wifi-phy.h" //only used for static mode constructor
31#include "ns3/wifi-psdu.h"
32#include "ns3/wifi-utils.h"
33
34namespace ns3
35{
36
38
39/*******************************************************
40 * VHT PHY (IEEE 802.11-2016, clause 21)
41 *******************************************************/
42
43// clang-format off
44
48 WIFI_PPDU_FIELD_SIG_A, // VHT-SIG-A
49 WIFI_PPDU_FIELD_TRAINING, // VHT-STF + VHT-LTFs
53 WIFI_PPDU_FIELD_SIG_A, // VHT-SIG-A
54 WIFI_PPDU_FIELD_TRAINING, // VHT-STF + VHT-LTFs
55 WIFI_PPDU_FIELD_SIG_B, // VHT-SIG-B
57};
58
60 /* {BW,Nss,MCS} Nes */
61 { std::make_tuple ( 80, 7, 2), 3 }, // instead of 2
62 { std::make_tuple ( 80, 7, 7), 6 }, // instead of 4
63 { std::make_tuple ( 80, 7, 8), 6 }, // instead of 5
64 { std::make_tuple ( 80, 8, 7), 6 }, // instead of 5
65 { std::make_tuple (160, 4, 7), 6 }, // instead of 5
66 { std::make_tuple (160, 5, 8), 8 }, // instead of 7
67 { std::make_tuple (160, 6, 7), 8 }, // instead of 7
68 { std::make_tuple (160, 7, 3), 4 }, // instead of 3
69 { std::make_tuple (160, 7, 4), 6 }, // instead of 5
70 { std::make_tuple (160, 7, 5), 7 }, // instead of 6
71 { std::make_tuple (160, 7, 7), 9 }, // instead of 8
72 { std::make_tuple (160, 7, 8), 12 }, // instead of 9
73 { std::make_tuple (160, 7, 9), 12 }, // instead of 10
74};
75
79const std::map<WifiChannelListType, double> channelTypeToScalingFactorDbm {
84};
85
89const std::map<uint16_t, WifiChannelListType> secondaryChannels {
93};
94
95// clang-format on
96
97VhtPhy::VhtPhy(bool buildModeList /* = true */)
98 : HtPhy(1, false) // don't add HT modes to list
99{
100 NS_LOG_FUNCTION(this << buildModeList);
104 if (buildModeList)
105 {
107 }
108}
109
111{
112 NS_LOG_FUNCTION(this);
113}
114
115void
117{
118 NS_LOG_FUNCTION(this);
119 NS_ASSERT(m_modeList.empty());
121 for (uint8_t index = 0; index <= m_maxSupportedMcsIndexPerSs; ++index)
122 {
123 NS_LOG_LOGIC("Add VhtMcs" << +index << " to list");
124 m_modeList.emplace_back(CreateVhtMcs(index));
125 }
126}
127
130{
131 return m_vhtPpduFormats;
132}
133
135VhtPhy::GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const
136{
137 switch (field)
138 {
139 case WIFI_PPDU_FIELD_TRAINING: // consider SIG-A mode for training (useful for
140 // InterferenceHelper)
142 return GetSigAMode();
144 return GetSigBMode(txVector);
145 default:
146 return HtPhy::GetSigMode(field, txVector);
147 }
148}
149
152{
154 NS_FATAL_ERROR("No HT-SIG");
155 return WifiMode();
156}
157
160{
161 return GetLSigMode(); // same number of data tones as OFDM (i.e. 48)
162}
163
165VhtPhy::GetSigBMode(const WifiTxVector& txVector) const
166{
168 "VHT-SIG-B only available for VHT MU");
169 return GetVhtMcs0();
170}
171
172Time
173VhtPhy::GetDuration(WifiPpduField field, const WifiTxVector& txVector) const
174{
175 switch (field)
176 {
178 return GetSigADuration(txVector.GetPreambleType());
180 return GetSigBDuration(txVector);
181 default:
182 return HtPhy::GetDuration(field, txVector);
183 }
184}
185
186Time
188{
189 return MicroSeconds(4); // L-SIG
190}
191
192Time
194{
195 return MicroSeconds(0); // no HT-SIG
196}
197
198Time
200 uint8_t nDataLtf,
201 uint8_t nExtensionLtf /* = 0 */) const
202{
203 NS_ABORT_MSG_IF(nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
204 NS_ABORT_MSG_IF(nExtensionLtf > 0, "No extension LTFs expected for VHT");
205 return MicroSeconds(4 + 4 * nDataLtf); // VHT-STF + VHT-LTFs
206}
207
208Time
210{
211 return MicroSeconds(8); // VHT-SIG-A (first and second symbol)
212}
213
214Time
216{
217 return (txVector.GetPreambleType() == WIFI_PREAMBLE_VHT_MU)
218 ? MicroSeconds(4)
219 : MicroSeconds(0); // HE-SIG-B only for MU
220}
221
222uint8_t
224{
225 WifiMode payloadMode = txVector.GetMode();
234 double maxRatePerCoder = (txVector.GetGuardInterval() == 800) ? 540e6 : 600e6;
235 uint8_t nes = ceil(payloadMode.GetDataRate(txVector) / maxRatePerCoder);
236
237 // Handle exceptions to the rule
238 auto iter = m_exceptionsMap.find(
239 std::make_tuple(txVector.GetChannelWidth(), txVector.GetNss(), payloadMode.GetMcsValue()));
240 if (iter != m_exceptionsMap.end())
241 {
242 nes = iter->second;
243 }
244 return nes;
245}
246
248VhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Time ppduDuration)
249{
250 NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
251 return Create<VhtPpdu>(psdus.begin()->second,
252 txVector,
254 txVector.GetChannelWidth()),
255 ppduDuration,
257 ObtainNextUid(txVector));
258}
259
262{
263 NS_LOG_FUNCTION(this << field << *event);
264 switch (field)
265 {
267 [[fallthrough]];
269 return EndReceiveSig(event, field);
270 default:
271 return HtPhy::DoEndReceiveField(field, event);
272 }
273}
274
277{
278 NS_LOG_FUNCTION(this << *event << field);
279 SnrPer snrPer = GetPhyHeaderSnrPer(field, event);
280 NS_LOG_DEBUG(field << ": SNR(dB)=" << RatioToDb(snrPer.snr) << ", PER=" << snrPer.per);
281 PhyFieldRxStatus status(GetRandomValue() > snrPer.per);
282 if (status.isSuccess)
283 {
284 NS_LOG_DEBUG("Received " << field);
285 if (!IsAllConfigSupported(WIFI_PPDU_FIELD_SIG_A, event->GetPpdu()))
286 {
288 }
289 status = ProcessSig(event, status, field);
290 }
291 else
292 {
293 NS_LOG_DEBUG("Drop packet because " << field << " reception failed");
294 status.reason = GetFailureReason(field);
295 status.actionIfFailure = DROP;
296 }
297 return status;
298}
299
302{
303 switch (field)
304 {
306 return SIG_A_FAILURE;
308 return SIG_B_FAILURE;
309 default:
310 NS_ASSERT_MSG(false, "Unknown PPDU field");
311 return UNKNOWN;
312 }
313}
314
317{
318 NS_LOG_FUNCTION(this << *event << status << field);
319 NS_ASSERT(event->GetTxVector().GetPreambleType() >= WIFI_PREAMBLE_VHT_SU);
320 // TODO see if something should be done here once MU-MIMO is supported
321 return status; // nothing special for VHT
322}
323
324bool
326{
327 if (ppdu->GetType() == WIFI_PPDU_TYPE_DL_MU && field == WIFI_PPDU_FIELD_SIG_A)
328 {
329 return IsChannelWidthSupported(ppdu); // perform the full check after SIG-B
330 }
331 return HtPhy::IsAllConfigSupported(field, ppdu);
332}
333
334void
336{
337 for (uint8_t i = 0; i < 10; ++i)
338 {
339 GetVhtMcs(i);
340 }
341}
342
344VhtPhy::GetVhtMcs(uint8_t index)
345{
346#define CASE(x) \
347 case x: \
348 return GetVhtMcs##x();
349
350 switch (index)
351 {
352 CASE(0)
353 CASE(1)
354 CASE(2)
355 CASE(3)
356 CASE(4)
357 CASE(5)
358 CASE(6)
359 CASE(7)
360 CASE(8)
361 CASE(9)
362 default:
363 NS_ABORT_MSG("Inexistent index (" << +index << ") requested for VHT");
364 return WifiMode();
365 }
366#undef CASE
367}
368
369#define GET_VHT_MCS(x) \
370 WifiMode VhtPhy::GetVhtMcs##x() \
371 { \
372 static WifiMode mcs = CreateVhtMcs(x); \
373 return mcs; \
374 };
375
386#undef GET_VHT_MCS
387
388WifiMode
390{
391 NS_ASSERT_MSG(index <= 9, "VhtMcs index must be <= 9!");
392 return WifiModeFactory::CreateWifiMcs("VhtMcs" + std::to_string(index),
393 index,
395 false,
402}
403
405VhtPhy::GetCodeRate(uint8_t mcsValue)
406{
407 switch (mcsValue)
408 {
409 case 8:
410 return WIFI_CODE_RATE_3_4;
411 case 9:
412 return WIFI_CODE_RATE_5_6;
413 default:
414 return HtPhy::GetCodeRate(mcsValue);
415 }
416}
417
418uint16_t
420{
421 switch (mcsValue)
422 {
423 case 8:
424 case 9:
425 return 256;
426 default:
427 return HtPhy::GetConstellationSize(mcsValue);
428 }
429}
430
431uint64_t
432VhtPhy::GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
433{
434 WifiCodeRate codeRate = GetCodeRate(mcsValue);
435 uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss);
436 return HtPhy::CalculatePhyRate(codeRate, dataRate);
437}
438
439uint64_t
440VhtPhy::GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
441{
442 return GetPhyRate(txVector.GetMode().GetMcsValue(),
443 txVector.GetChannelWidth(),
444 txVector.GetGuardInterval(),
445 txVector.GetNss());
446}
447
448uint64_t
449VhtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
450{
451 return GetDataRate(txVector.GetMode().GetMcsValue(),
452 txVector.GetChannelWidth(),
453 txVector.GetGuardInterval(),
454 txVector.GetNss());
455}
456
457uint64_t
458VhtPhy::GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
459{
460 NS_ASSERT(guardInterval == 800 || guardInterval == 400);
461 NS_ASSERT(nss <= 8);
462 NS_ASSERT_MSG(IsCombinationAllowed(mcsValue, channelWidth, nss),
463 "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is "
464 << +nss);
466 GetUsableSubcarriers(channelWidth),
467 static_cast<uint16_t>(log2(GetConstellationSize(mcsValue))),
469 nss);
470}
471
472uint16_t
473VhtPhy::GetUsableSubcarriers(uint16_t channelWidth)
474{
475 switch (channelWidth)
476 {
477 case 80:
478 return 234;
479 case 160:
480 return 468;
481 default:
482 return HtPhy::GetUsableSubcarriers(channelWidth);
483 }
484}
485
486uint64_t
488{
489 WifiCodeRate codeRate = GetCodeRate(mcsValue);
490 uint16_t constellationSize = GetConstellationSize(mcsValue);
491 return CalculateNonHtReferenceRate(codeRate, constellationSize);
492}
493
494uint64_t
495VhtPhy::CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
496{
497 uint64_t dataRate;
498 switch (constellationSize)
499 {
500 case 256:
501 if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
502 {
503 dataRate = 54000000;
504 }
505 else
506 {
507 NS_FATAL_ERROR("Trying to get reference rate for a MCS with wrong combination of "
508 "coding rate and modulation");
509 }
510 break;
511 default:
512 dataRate = HtPhy::CalculateNonHtReferenceRate(codeRate, constellationSize);
513 }
514 return dataRate;
515}
516
517bool
519{
520 return IsCombinationAllowed(txVector.GetMode().GetMcsValue(),
521 txVector.GetChannelWidth(),
522 txVector.GetNss());
523}
524
525bool
526VhtPhy::IsCombinationAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
527{
528 if (mcsValue == 9 && channelWidth == 20 && nss != 3)
529 {
530 return false;
531 }
532 if (mcsValue == 6 && channelWidth == 80 && nss == 3)
533 {
534 return false;
535 }
536 return true;
537}
538
541{
542 return 4692480;
543}
544
545double
547{
548 if (ppdu)
549 {
550 const uint16_t ppduBw = ppdu->GetTxVector().GetChannelWidth();
551 switch (channelType)
552 {
554 // Start of a PPDU for which its power measured within the primary 20 MHz channel is at
555 // or above the CCA sensitivy threshold.
557 }
559 NS_ASSERT_MSG(ppduBw == 20, "Invalid channel width " << ppduBw);
560 break;
562 NS_ASSERT_MSG(ppduBw <= 40, "Invalid channel width " << ppduBw);
563 break;
565 NS_ASSERT_MSG(ppduBw <= 80, "Invalid channel width " << ppduBw);
566 break;
567 default:
568 NS_ASSERT_MSG(false, "Invalid channel list type");
569 }
570 auto vhtConfiguration = m_wifiPhy->GetDevice()->GetVhtConfiguration();
571 NS_ASSERT(vhtConfiguration);
572 const auto thresholds = vhtConfiguration->GetSecondaryCcaSensitivityThresholdsPerBw();
573 const auto it = thresholds.find(ppduBw);
574 NS_ASSERT_MSG(it != std::end(thresholds), "Invalid channel width " << ppduBw);
575 return it->second;
576 }
577 else
578 {
579 const auto it = channelTypeToScalingFactorDbm.find(channelType);
580 NS_ASSERT_MSG(it != std::end(channelTypeToScalingFactorDbm), "Invalid channel list type");
581 return m_wifiPhy->GetCcaEdThreshold() + it->second;
582 }
583}
584
587{
588 NS_LOG_FUNCTION(this);
589
590 if (m_wifiPhy->GetChannelWidth() < 80)
591 {
592 return HtPhy::GetCcaIndication(ppdu);
593 }
594
595 double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
596 Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20));
597 if (delayUntilCcaEnd.IsStrictlyPositive())
598 {
599 return std::make_pair(
600 delayUntilCcaEnd,
601 WIFI_CHANLIST_PRIMARY); // if Primary is busy, ignore CCA for Secondary
602 }
603
604 if (ppdu)
605 {
606 const uint16_t primaryWidth = 20;
607 uint16_t p20MinFreq =
609 (primaryWidth / 2);
610 uint16_t p20MaxFreq =
612 (primaryWidth / 2);
613 if (ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq))
614 {
615 /*
616 * PPDU occupies primary 20 MHz channel, hence we skip CCA sensitivity rules
617 * for signals not occupying the primary 20 MHz channel.
618 */
619 return std::nullopt;
620 }
621 }
622
623 std::vector<uint16_t> secondaryWidthsToCheck;
624 if (ppdu)
625 {
626 for (const auto& secondaryChannel : secondaryChannels)
627 {
628 uint16_t secondaryWidth = secondaryChannel.first;
629 uint16_t secondaryMinFreq =
631 secondaryWidth) -
632 (secondaryWidth / 2);
633 uint16_t secondaryMaxFreq =
635 secondaryWidth) +
636 (secondaryWidth / 2);
637 if ((m_wifiPhy->GetChannelWidth() > secondaryWidth) &&
638 ppdu->DoesOverlapChannel(secondaryMinFreq, secondaryMaxFreq))
639 {
640 secondaryWidthsToCheck.push_back(secondaryWidth);
641 }
642 }
643 }
644 else
645 {
646 secondaryWidthsToCheck.push_back(20);
647 secondaryWidthsToCheck.push_back(40);
648 if (m_wifiPhy->GetChannelWidth() > 80)
649 {
650 secondaryWidthsToCheck.push_back(80);
651 }
652 }
653
654 for (auto secondaryWidth : secondaryWidthsToCheck)
655 {
656 auto channelType = secondaryChannels.at(secondaryWidth);
657 ccaThresholdDbm = GetCcaThreshold(ppdu, channelType);
658 delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(secondaryWidth));
659 if (delayUntilCcaEnd.IsStrictlyPositive())
660 {
661 return std::make_pair(delayUntilCcaEnd, channelType);
662 }
663 }
664
665 return std::nullopt;
666}
667
668} // namespace ns3
669
670namespace
671{
672
677{
678 public:
680 {
683 }
685
686} // namespace
Constructor class for VHT modes.
Definition: vht-phy.cc:677
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:660
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:825
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:630
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition: ht-phy.h:559
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:392
static WifiMode GetLSigMode()
Definition: ht-phy.cc:154
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition: ht-phy.h:557
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:434
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:741
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:210
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:602
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:136
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:708
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:675
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition: ht-phy.h:558
virtual Time GetSymbolDuration(const WifiTxVector &txVector) const
Definition: ht-phy.cc:371
static uint16_t GetUsableSubcarriers()
Definition: ofdm-phy.cc:616
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
Definition: ofdm-phy.cc:341
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1260
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:942
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:1185
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:524
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:1206
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:930
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:946
double GetRandomValue() const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:1156
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:272
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:1174
@ 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:105
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
Definition: nstime.h:350
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition: vht-phy.cc:518
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:405
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:526
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:173
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition: vht-phy.h:358
~VhtPhy() override
Destructor for VHT PHY.
Definition: vht-phy.cc:110
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:546
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition: vht-phy.h:360
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:357
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:325
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:449
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:276
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:223
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:199
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:215
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:440
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:586
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:344
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:495
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: vht-phy.cc:248
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:432
void BuildModeList() override
Build mode list.
Definition: vht-phy.cc:116
virtual WifiMode GetSigAMode() const
Definition: vht-phy.cc:159
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:187
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:316
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:261
static void InitializeModes()
Initialize all VHT modes.
Definition: vht-phy.cc:335
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:458
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:389
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:419
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:540
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:487
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:209
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:129
WifiMode GetHtSigMode() const override
Definition: vht-phy.cc:151
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition: vht-phy.cc:97
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:165
virtual WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
Definition: vht-phy.cc:301
Time GetHtSigDuration() const override
Definition: vht-phy.cc:193
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:135
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:318
represent a single transmission mode
Definition: wifi-mode.h:50
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
uint8_t GetMcsValue() const
Definition: wifi-mode.cc:163
Ptr< VhtConfiguration > GetVhtConfiguration() const
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:467
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:980
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:950
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:699
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:581
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:962
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:480
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...
uint16_t GetGuardInterval() const
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.
uint16_t GetChannelWidth() 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: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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:160
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#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:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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:752
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1374
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
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:52
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:89
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:691
const std::map< WifiChannelListType, double > channelTypeToScalingFactorDbm
map a given channel list type to the corresponding scaling factor in dBm
Definition: vht-phy.cc:79
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:115
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition: phy-entity.h:116
bool isSuccess
outcome (true if success) of the reception
Definition: phy-entity.h:114
A struct for both SNR and PER.
Definition: phy-entity.h:148
double snr
SNR in linear scale.
Definition: phy-entity.h:149
#define CASE(x)
#define GET_VHT_MCS(x)
Definition: vht-phy.cc:369
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.