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 * 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
34#undef NS_LOG_APPEND_CONTEXT
35#define NS_LOG_APPEND_CONTEXT WIFI_PHY_NS_LOG_APPEND_CONTEXT(m_wifiPhy)
36
37namespace ns3
38{
39
41
42/*******************************************************
43 * VHT PHY (IEEE 802.11-2016, clause 21)
44 *******************************************************/
45
46// clang-format off
47
51 WIFI_PPDU_FIELD_SIG_A, // VHT-SIG-A
52 WIFI_PPDU_FIELD_TRAINING, // VHT-STF + VHT-LTFs
56 WIFI_PPDU_FIELD_SIG_A, // VHT-SIG-A
57 WIFI_PPDU_FIELD_TRAINING, // VHT-STF + VHT-LTFs
58 WIFI_PPDU_FIELD_SIG_B, // VHT-SIG-B
60};
61
63 /* {BW,Nss,MCS} Nes */
64 { std::make_tuple ( 80, 7, 2), 3 }, // instead of 2
65 { std::make_tuple ( 80, 7, 7), 6 }, // instead of 4
66 { std::make_tuple ( 80, 7, 8), 6 }, // instead of 5
67 { std::make_tuple ( 80, 8, 7), 6 }, // instead of 5
68 { std::make_tuple (160, 4, 7), 6 }, // instead of 5
69 { std::make_tuple (160, 5, 8), 8 }, // instead of 7
70 { std::make_tuple (160, 6, 7), 8 }, // instead of 7
71 { std::make_tuple (160, 7, 3), 4 }, // instead of 3
72 { std::make_tuple (160, 7, 4), 6 }, // instead of 5
73 { std::make_tuple (160, 7, 5), 7 }, // instead of 6
74 { std::make_tuple (160, 7, 7), 9 }, // instead of 8
75 { std::make_tuple (160, 7, 8), 12 }, // instead of 9
76 { std::make_tuple (160, 7, 9), 12 }, // instead of 10
77};
78
79/**
80 * \brief map a given channel list type to the corresponding scaling factor in dBm
81 */
82const std::map<WifiChannelListType, double> channelTypeToScalingFactorDbm {
87};
88
89/**
90 * \brief map a given secondary channel width to its channel list type
91 */
92const std::map<uint16_t, WifiChannelListType> secondaryChannels {
96};
97
98// clang-format on
99
100VhtPhy::VhtPhy(bool buildModeList /* = true */)
101 : HtPhy(1, false) // don't add HT modes to list
102{
103 NS_LOG_FUNCTION(this << buildModeList);
107 if (buildModeList)
108 {
110 }
111}
112
114{
115 NS_LOG_FUNCTION(this);
116}
117
118void
120{
121 NS_LOG_FUNCTION(this);
122 NS_ASSERT(m_modeList.empty());
124 for (uint8_t index = 0; index <= m_maxSupportedMcsIndexPerSs; ++index)
125 {
126 NS_LOG_LOGIC("Add VhtMcs" << +index << " to list");
127 m_modeList.emplace_back(CreateVhtMcs(index));
128 }
129}
130
133{
134 return m_vhtPpduFormats;
135}
136
138VhtPhy::GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const
139{
140 switch (field)
141 {
142 case WIFI_PPDU_FIELD_TRAINING: // consider SIG-A mode for training (useful for
143 // InterferenceHelper)
145 return GetSigAMode();
147 return GetSigBMode(txVector);
148 default:
149 return HtPhy::GetSigMode(field, txVector);
150 }
151}
152
155{
157 NS_FATAL_ERROR("No HT-SIG");
158 return WifiMode();
159}
160
163{
164 return GetLSigMode(); // same number of data tones as OFDM (i.e. 48)
165}
166
168VhtPhy::GetSigBMode(const WifiTxVector& txVector) const
169{
171 "VHT-SIG-B only available for VHT MU");
172 return GetVhtMcs0();
173}
174
175Time
176VhtPhy::GetDuration(WifiPpduField field, const WifiTxVector& txVector) const
177{
178 switch (field)
179 {
181 return GetSigADuration(txVector.GetPreambleType());
183 return GetSigBDuration(txVector);
184 default:
185 return HtPhy::GetDuration(field, txVector);
186 }
187}
188
189Time
191{
192 return MicroSeconds(4); // L-SIG
193}
194
195Time
197{
198 return MicroSeconds(0); // no HT-SIG
199}
200
201Time
203 uint8_t nDataLtf,
204 uint8_t nExtensionLtf /* = 0 */) const
205{
206 NS_ABORT_MSG_IF(nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
207 NS_ABORT_MSG_IF(nExtensionLtf > 0, "No extension LTFs expected for VHT");
208 return MicroSeconds(4 + 4 * nDataLtf); // VHT-STF + VHT-LTFs
209}
210
211Time
213{
214 return MicroSeconds(8); // VHT-SIG-A (first and second symbol)
215}
216
217Time
219{
220 return (txVector.GetPreambleType() == WIFI_PREAMBLE_VHT_MU)
221 ? MicroSeconds(4)
222 : MicroSeconds(0); // HE-SIG-B only for MU
223}
224
225uint8_t
227{
228 WifiMode payloadMode = txVector.GetMode();
229 /**
230 * General rule: add an encoder when crossing maxRatePerCoder frontier
231 *
232 * The value of 540 Mbps and 600 Mbps for normal GI and short GI (resp.)
233 * were obtained by observing the rates for which Nes was incremented in tables
234 * 21-30 to 21-61 of IEEE 802.11-2016.
235 * These values are the last values before changing encoders.
236 */
237 double maxRatePerCoder = (txVector.GetGuardInterval() == 800) ? 540e6 : 600e6;
238 uint8_t nes = ceil(payloadMode.GetDataRate(txVector) / maxRatePerCoder);
239
240 // Handle exceptions to the rule
241 auto iter = m_exceptionsMap.find(
242 std::make_tuple(txVector.GetChannelWidth(), txVector.GetNss(), payloadMode.GetMcsValue()));
243 if (iter != m_exceptionsMap.end())
244 {
245 nes = iter->second;
246 }
247 return nes;
248}
249
251VhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Time ppduDuration)
252{
253 NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
254 return Create<VhtPpdu>(psdus.begin()->second,
255 txVector,
257 ppduDuration,
258 ObtainNextUid(txVector));
259}
260
263{
264 NS_LOG_FUNCTION(this << field << *event);
265 switch (field)
266 {
268 [[fallthrough]];
270 return EndReceiveSig(event, field);
271 default:
272 return HtPhy::DoEndReceiveField(field, event);
273 }
274}
275
278{
279 NS_LOG_FUNCTION(this << *event << field);
280 SnrPer snrPer = GetPhyHeaderSnrPer(field, event);
281 NS_LOG_DEBUG(field << ": SNR(dB)=" << RatioToDb(snrPer.snr) << ", PER=" << snrPer.per);
282 PhyFieldRxStatus status(GetRandomValue() > snrPer.per);
283 if (status.isSuccess)
284 {
285 NS_LOG_DEBUG("Received " << field);
286 if (!IsAllConfigSupported(WIFI_PPDU_FIELD_SIG_A, event->GetPpdu()))
287 {
289 }
290 status = ProcessSig(event, status, field);
291 }
292 else
293 {
294 NS_LOG_DEBUG("Drop packet because " << field << " reception failed");
295 status.reason = GetFailureReason(field);
296 status.actionIfFailure = DROP;
297 }
298 return status;
299}
300
303{
304 switch (field)
305 {
307 return SIG_A_FAILURE;
309 return SIG_B_FAILURE;
310 default:
311 NS_ASSERT_MSG(false, "Unknown PPDU field");
312 return UNKNOWN;
313 }
314}
315
318{
319 NS_LOG_FUNCTION(this << *event << status << field);
320 NS_ASSERT(event->GetPpdu()->GetTxVector().GetPreambleType() >= WIFI_PREAMBLE_VHT_SU);
321 // TODO see if something should be done here once MU-MIMO is supported
322 return status; // nothing special for VHT
323}
324
325bool
327{
328 if (ppdu->GetType() == WIFI_PPDU_TYPE_DL_MU && field == WIFI_PPDU_FIELD_SIG_A)
329 {
330 return IsChannelWidthSupported(ppdu); // perform the full check after SIG-B
331 }
332 return HtPhy::IsAllConfigSupported(field, ppdu);
333}
334
335void
337{
338 for (uint8_t i = 0; i < 10; ++i)
339 {
340 GetVhtMcs(i);
341 }
342}
343
345VhtPhy::GetVhtMcs(uint8_t index)
346{
347#define CASE(x) \
348 case x: \
349 return GetVhtMcs##x();
350
351 switch (index)
352 {
353 CASE(0)
354 CASE(1)
355 CASE(2)
356 CASE(3)
357 CASE(4)
358 CASE(5)
359 CASE(6)
360 CASE(7)
361 CASE(8)
362 CASE(9)
363 default:
364 NS_ABORT_MSG("Inexistent index (" << +index << ") requested for VHT");
365 return WifiMode();
366 }
367#undef CASE
368}
369
370#define GET_VHT_MCS(x) \
371 WifiMode VhtPhy::GetVhtMcs##x() \
372 { \
373 static WifiMode mcs = CreateVhtMcs(x); \
374 return mcs; \
375 }
376
387#undef GET_VHT_MCS
388
389WifiMode
391{
392 NS_ASSERT_MSG(index <= 9, "VhtMcs index must be <= 9!");
393 return WifiModeFactory::CreateWifiMcs("VhtMcs" + std::to_string(index),
394 index,
396 false,
403}
404
406VhtPhy::GetCodeRate(uint8_t mcsValue)
407{
408 switch (mcsValue)
409 {
410 case 8:
411 return WIFI_CODE_RATE_3_4;
412 case 9:
413 return WIFI_CODE_RATE_5_6;
414 default:
415 return HtPhy::GetCodeRate(mcsValue);
416 }
417}
418
419uint16_t
421{
422 switch (mcsValue)
423 {
424 case 8:
425 case 9:
426 return 256;
427 default:
428 return HtPhy::GetConstellationSize(mcsValue);
429 }
430}
431
432uint64_t
433VhtPhy::GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
434{
435 WifiCodeRate codeRate = GetCodeRate(mcsValue);
436 uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss);
437 return HtPhy::CalculatePhyRate(codeRate, dataRate);
438}
439
440uint64_t
441VhtPhy::GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
442{
443 return GetPhyRate(txVector.GetMode().GetMcsValue(),
444 txVector.GetChannelWidth(),
445 txVector.GetGuardInterval(),
446 txVector.GetNss());
447}
448
449uint64_t
450VhtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
451{
452 return GetDataRate(txVector.GetMode().GetMcsValue(),
453 txVector.GetChannelWidth(),
454 txVector.GetGuardInterval(),
455 txVector.GetNss());
456}
457
458uint64_t
459VhtPhy::GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
460{
461 NS_ASSERT(guardInterval == 800 || guardInterval == 400);
462 NS_ASSERT(nss <= 8);
463 NS_ASSERT_MSG(IsCombinationAllowed(mcsValue, channelWidth, nss),
464 "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is "
465 << +nss);
467 GetUsableSubcarriers(channelWidth),
468 static_cast<uint16_t>(log2(GetConstellationSize(mcsValue))),
470 nss);
471}
472
473uint16_t
474VhtPhy::GetUsableSubcarriers(uint16_t channelWidth)
475{
476 switch (channelWidth)
477 {
478 case 80:
479 return 234;
480 case 160:
481 return 468;
482 default:
483 return HtPhy::GetUsableSubcarriers(channelWidth);
484 }
485}
486
487uint64_t
489{
490 WifiCodeRate codeRate = GetCodeRate(mcsValue);
491 uint16_t constellationSize = GetConstellationSize(mcsValue);
492 return CalculateNonHtReferenceRate(codeRate, constellationSize);
493}
494
495uint64_t
496VhtPhy::CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
497{
498 uint64_t dataRate;
499 switch (constellationSize)
500 {
501 case 256:
502 if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
503 {
504 dataRate = 54000000;
505 }
506 else
507 {
508 NS_FATAL_ERROR("Trying to get reference rate for a MCS with wrong combination of "
509 "coding rate and modulation");
510 }
511 break;
512 default:
513 dataRate = HtPhy::CalculateNonHtReferenceRate(codeRate, constellationSize);
514 }
515 return dataRate;
516}
517
518bool
520{
521 return IsCombinationAllowed(txVector.GetMode().GetMcsValue(),
522 txVector.GetChannelWidth(),
523 txVector.GetNss());
524}
525
526bool
527VhtPhy::IsCombinationAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
528{
529 if (mcsValue == 9 && channelWidth == 20 && nss != 3)
530 {
531 return false;
532 }
533 if (mcsValue == 6 && channelWidth == 80 && nss == 3)
534 {
535 return false;
536 }
537 return true;
538}
539
542{
543 return 4692480;
544}
545
546double
548{
549 if (ppdu)
550 {
551 const uint16_t ppduBw = ppdu->GetTxVector().GetChannelWidth();
552 switch (channelType)
553 {
555 // Start of a PPDU for which its power measured within the primary 20 MHz channel is at
556 // or above the CCA sensitivity threshold.
558 }
560 NS_ASSERT_MSG(ppduBw == 20, "Invalid channel width " << ppduBw);
561 break;
563 NS_ASSERT_MSG(ppduBw <= 40, "Invalid channel width " << ppduBw);
564 break;
566 NS_ASSERT_MSG(ppduBw <= 80, "Invalid channel width " << ppduBw);
567 break;
568 default:
569 NS_ASSERT_MSG(false, "Invalid channel list type");
570 }
571 auto vhtConfiguration = m_wifiPhy->GetDevice()->GetVhtConfiguration();
572 NS_ASSERT(vhtConfiguration);
573 const auto thresholds = vhtConfiguration->GetSecondaryCcaSensitivityThresholdsPerBw();
574 const auto it = thresholds.find(ppduBw);
575 NS_ASSERT_MSG(it != std::end(thresholds), "Invalid channel width " << ppduBw);
576 return it->second;
577 }
578 else
579 {
580 const auto it = channelTypeToScalingFactorDbm.find(channelType);
581 NS_ASSERT_MSG(it != std::end(channelTypeToScalingFactorDbm), "Invalid channel list type");
582 return m_wifiPhy->GetCcaEdThreshold() + it->second;
583 }
584}
585
588{
589 if (m_wifiPhy->GetChannelWidth() < 80)
590 {
591 return HtPhy::GetCcaIndication(ppdu);
592 }
593
594 double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
595 Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20));
596 if (delayUntilCcaEnd.IsStrictlyPositive())
597 {
598 return std::make_pair(
599 delayUntilCcaEnd,
600 WIFI_CHANLIST_PRIMARY); // if Primary is busy, ignore CCA for Secondary
601 }
602
603 if (ppdu)
604 {
605 const uint16_t primaryWidth = 20;
606 uint16_t p20MinFreq =
608 (primaryWidth / 2);
609 uint16_t p20MaxFreq =
611 (primaryWidth / 2);
612 if (ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq))
613 {
614 /*
615 * PPDU occupies primary 20 MHz channel, hence we skip CCA sensitivity rules
616 * for signals not occupying the primary 20 MHz channel.
617 */
618 return std::nullopt;
619 }
620 }
621
622 std::vector<uint16_t> secondaryWidthsToCheck;
623 if (ppdu)
624 {
625 for (const auto& secondaryChannel : secondaryChannels)
626 {
627 uint16_t secondaryWidth = secondaryChannel.first;
628 uint16_t secondaryMinFreq =
630 secondaryWidth) -
631 (secondaryWidth / 2);
632 uint16_t secondaryMaxFreq =
634 secondaryWidth) +
635 (secondaryWidth / 2);
636 if ((m_wifiPhy->GetChannelWidth() > secondaryWidth) &&
637 ppdu->DoesOverlapChannel(secondaryMinFreq, secondaryMaxFreq))
638 {
639 secondaryWidthsToCheck.push_back(secondaryWidth);
640 }
641 }
642 }
643 else
644 {
645 secondaryWidthsToCheck.push_back(20);
646 secondaryWidthsToCheck.push_back(40);
647 if (m_wifiPhy->GetChannelWidth() > 80)
648 {
649 secondaryWidthsToCheck.push_back(80);
650 }
651 }
652
653 for (auto secondaryWidth : secondaryWidthsToCheck)
654 {
655 auto channelType = secondaryChannels.at(secondaryWidth);
656 ccaThresholdDbm = GetCcaThreshold(ppdu, channelType);
657 delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(secondaryWidth));
658 if (delayUntilCcaEnd.IsStrictlyPositive())
659 {
660 return std::make_pair(delayUntilCcaEnd, channelType);
661 }
662 }
663
664 return std::nullopt;
665}
666
667} // namespace ns3
668
669namespace
670{
671
672/**
673 * Constructor class for VHT modes
674 */
676{
677 public:
679 {
682 }
683} g_constructor_vht; ///< the constructor for VHT modes
684
685} // namespace
Constructor class for VHT modes.
Definition: vht-phy.cc:676
PHY entity for HT (11n)
Definition: ht-phy.h:54
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:561
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:393
static WifiMode GetLSigMode()
Definition: ht-phy.cc:157
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition: ht-phy.h:559
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:435
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:213
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:139
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:560
virtual Time GetSymbolDuration(const WifiTxVector &txVector) const
Definition: ht-phy.cc:374
static uint16_t GetUsableSubcarriers()
Definition: ofdm-phy.cc:634
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
Definition: ofdm-phy.cc:345
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1289
Time GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandInfo &band)
Return the delay until CCA busy is ended for a given sensitivity threshold (in dBm) and a given band.
Definition: phy-entity.cc:1235
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:981
WifiSpectrumBandInfo GetSecondaryBand(uint16_t bandWidth) const
If the channel bonding is used, return the info corresponding to the secondary channel of the given b...
Definition: phy-entity.cc:1214
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:561
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:969
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:985
double GetRandomValue() const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:1185
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:271
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:103
WifiSpectrumBandInfo GetPrimaryBand(uint16_t bandWidth) const
If the operating channel width is a multiple of 20 MHz, return the info corresponding to the primary ...
Definition: phy-entity.cc:1203
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
Definition: nstime.h:351
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition: vht-phy.cc:519
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:406
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:527
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:176
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:113
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:547
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:326
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:450
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:277
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:226
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:202
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:218
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:441
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:587
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:345
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:496
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: vht-phy.cc:251
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:433
void BuildModeList() override
Build mode list.
Definition: vht-phy.cc:119
virtual WifiMode GetSigAMode() const
Definition: vht-phy.cc:162
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:190
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:317
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:262
static void InitializeModes()
Initialize all VHT modes.
Definition: vht-phy.cc:336
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:459
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:390
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:420
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:541
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:488
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:212
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:132
WifiMode GetHtSigMode() const override
Definition: vht-phy.cc:154
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition: vht-phy.cc:100
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:168
virtual WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
Definition: vht-phy.cc:302
Time GetHtSigDuration() const override
Definition: vht-phy.cc:196
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:138
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:51
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:507
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1073
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:775
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:621
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1055
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:520
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 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: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:179
#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:765
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
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
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:92
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:704
const std::map< WifiChannelListType, double > channelTypeToScalingFactorDbm
map a given channel list type to the corresponding scaling factor in dBm
Definition: vht-phy.cc:82
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:112
WifiPhyRxfailureReason reason
failure reason
Definition: phy-entity.h:114
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition: phy-entity.h:115
bool isSuccess
outcome (true if success) of the reception
Definition: phy-entity.h:113
A struct for both SNR and PER.
Definition: phy-entity.h:147
double snr
SNR in linear scale.
Definition: phy-entity.h:148
#define GET_VHT_MCS(x)
Definition: vht-phy.cc:370
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.