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
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 ppduDuration,
255 ObtainNextUid(txVector));
256}
257
260{
261 NS_LOG_FUNCTION(this << field << *event);
262 switch (field)
263 {
265 [[fallthrough]];
267 return EndReceiveSig(event, field);
268 default:
269 return HtPhy::DoEndReceiveField(field, event);
270 }
271}
272
275{
276 NS_LOG_FUNCTION(this << *event << field);
277 SnrPer snrPer = GetPhyHeaderSnrPer(field, event);
278 NS_LOG_DEBUG(field << ": SNR(dB)=" << RatioToDb(snrPer.snr) << ", PER=" << snrPer.per);
279 PhyFieldRxStatus status(GetRandomValue() > snrPer.per);
280 if (status.isSuccess)
281 {
282 NS_LOG_DEBUG("Received " << field);
283 if (!IsAllConfigSupported(WIFI_PPDU_FIELD_SIG_A, event->GetPpdu()))
284 {
286 }
287 status = ProcessSig(event, status, field);
288 }
289 else
290 {
291 NS_LOG_DEBUG("Drop packet because " << field << " reception failed");
292 status.reason = GetFailureReason(field);
293 status.actionIfFailure = DROP;
294 }
295 return status;
296}
297
300{
301 switch (field)
302 {
304 return SIG_A_FAILURE;
306 return SIG_B_FAILURE;
307 default:
308 NS_ASSERT_MSG(false, "Unknown PPDU field");
309 return UNKNOWN;
310 }
311}
312
315{
316 NS_LOG_FUNCTION(this << *event << status << field);
317 NS_ASSERT(event->GetTxVector().GetPreambleType() >= WIFI_PREAMBLE_VHT_SU);
318 // TODO see if something should be done here once MU-MIMO is supported
319 return status; // nothing special for VHT
320}
321
322bool
324{
325 if (ppdu->GetType() == WIFI_PPDU_TYPE_DL_MU && field == WIFI_PPDU_FIELD_SIG_A)
326 {
327 return IsChannelWidthSupported(ppdu); // perform the full check after SIG-B
328 }
329 return HtPhy::IsAllConfigSupported(field, ppdu);
330}
331
332void
334{
335 for (uint8_t i = 0; i < 10; ++i)
336 {
337 GetVhtMcs(i);
338 }
339}
340
342VhtPhy::GetVhtMcs(uint8_t index)
343{
344#define CASE(x) \
345 case x: \
346 return GetVhtMcs##x();
347
348 switch (index)
349 {
350 CASE(0)
351 CASE(1)
352 CASE(2)
353 CASE(3)
354 CASE(4)
355 CASE(5)
356 CASE(6)
357 CASE(7)
358 CASE(8)
359 CASE(9)
360 default:
361 NS_ABORT_MSG("Inexistent index (" << +index << ") requested for VHT");
362 return WifiMode();
363 }
364#undef CASE
365}
366
367#define GET_VHT_MCS(x) \
368 WifiMode VhtPhy::GetVhtMcs##x() \
369 { \
370 static WifiMode mcs = CreateVhtMcs(x); \
371 return mcs; \
372 };
373
384#undef GET_VHT_MCS
385
386WifiMode
388{
389 NS_ASSERT_MSG(index <= 9, "VhtMcs index must be <= 9!");
390 return WifiModeFactory::CreateWifiMcs("VhtMcs" + std::to_string(index),
391 index,
393 false,
400}
401
403VhtPhy::GetCodeRate(uint8_t mcsValue)
404{
405 switch (mcsValue)
406 {
407 case 8:
408 return WIFI_CODE_RATE_3_4;
409 case 9:
410 return WIFI_CODE_RATE_5_6;
411 default:
412 return HtPhy::GetCodeRate(mcsValue);
413 }
414}
415
416uint16_t
418{
419 switch (mcsValue)
420 {
421 case 8:
422 case 9:
423 return 256;
424 default:
425 return HtPhy::GetConstellationSize(mcsValue);
426 }
427}
428
429uint64_t
430VhtPhy::GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
431{
432 WifiCodeRate codeRate = GetCodeRate(mcsValue);
433 uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss);
434 return HtPhy::CalculatePhyRate(codeRate, dataRate);
435}
436
437uint64_t
438VhtPhy::GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
439{
440 return GetPhyRate(txVector.GetMode().GetMcsValue(),
441 txVector.GetChannelWidth(),
442 txVector.GetGuardInterval(),
443 txVector.GetNss());
444}
445
446uint64_t
447VhtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId */)
448{
449 return GetDataRate(txVector.GetMode().GetMcsValue(),
450 txVector.GetChannelWidth(),
451 txVector.GetGuardInterval(),
452 txVector.GetNss());
453}
454
455uint64_t
456VhtPhy::GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
457{
458 NS_ASSERT(guardInterval == 800 || guardInterval == 400);
459 NS_ASSERT(nss <= 8);
460 NS_ASSERT_MSG(IsCombinationAllowed(mcsValue, channelWidth, nss),
461 "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is "
462 << +nss);
464 GetUsableSubcarriers(channelWidth),
465 static_cast<uint16_t>(log2(GetConstellationSize(mcsValue))),
467 nss);
468}
469
470uint16_t
471VhtPhy::GetUsableSubcarriers(uint16_t channelWidth)
472{
473 switch (channelWidth)
474 {
475 case 80:
476 return 234;
477 case 160:
478 return 468;
479 default:
480 return HtPhy::GetUsableSubcarriers(channelWidth);
481 }
482}
483
484uint64_t
486{
487 WifiCodeRate codeRate = GetCodeRate(mcsValue);
488 uint16_t constellationSize = GetConstellationSize(mcsValue);
489 return CalculateNonHtReferenceRate(codeRate, constellationSize);
490}
491
492uint64_t
493VhtPhy::CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
494{
495 uint64_t dataRate;
496 switch (constellationSize)
497 {
498 case 256:
499 if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
500 {
501 dataRate = 54000000;
502 }
503 else
504 {
505 NS_FATAL_ERROR("Trying to get reference rate for a MCS with wrong combination of "
506 "coding rate and modulation");
507 }
508 break;
509 default:
510 dataRate = HtPhy::CalculateNonHtReferenceRate(codeRate, constellationSize);
511 }
512 return dataRate;
513}
514
515bool
517{
518 return IsCombinationAllowed(txVector.GetMode().GetMcsValue(),
519 txVector.GetChannelWidth(),
520 txVector.GetNss());
521}
522
523bool
524VhtPhy::IsCombinationAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
525{
526 if (mcsValue == 9 && channelWidth == 20 && nss != 3)
527 {
528 return false;
529 }
530 if (mcsValue == 6 && channelWidth == 80 && nss == 3)
531 {
532 return false;
533 }
534 return true;
535}
536
539{
540 return 4692480;
541}
542
543double
545{
546 if (ppdu)
547 {
548 const uint16_t ppduBw = ppdu->GetTxVector().GetChannelWidth();
549 switch (channelType)
550 {
552 // Start of a PPDU for which its power measured within the primary 20 MHz channel is at
553 // or above the CCA sensitivity threshold.
555 }
557 NS_ASSERT_MSG(ppduBw == 20, "Invalid channel width " << ppduBw);
558 break;
560 NS_ASSERT_MSG(ppduBw <= 40, "Invalid channel width " << ppduBw);
561 break;
563 NS_ASSERT_MSG(ppduBw <= 80, "Invalid channel width " << ppduBw);
564 break;
565 default:
566 NS_ASSERT_MSG(false, "Invalid channel list type");
567 }
568 auto vhtConfiguration = m_wifiPhy->GetDevice()->GetVhtConfiguration();
569 NS_ASSERT(vhtConfiguration);
570 const auto thresholds = vhtConfiguration->GetSecondaryCcaSensitivityThresholdsPerBw();
571 const auto it = thresholds.find(ppduBw);
572 NS_ASSERT_MSG(it != std::end(thresholds), "Invalid channel width " << ppduBw);
573 return it->second;
574 }
575 else
576 {
577 const auto it = channelTypeToScalingFactorDbm.find(channelType);
578 NS_ASSERT_MSG(it != std::end(channelTypeToScalingFactorDbm), "Invalid channel list type");
579 return m_wifiPhy->GetCcaEdThreshold() + it->second;
580 }
581}
582
585{
586 NS_LOG_FUNCTION(this);
587
588 if (m_wifiPhy->GetChannelWidth() < 80)
589 {
590 return HtPhy::GetCcaIndication(ppdu);
591 }
592
593 double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
594 Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20));
595 if (delayUntilCcaEnd.IsStrictlyPositive())
596 {
597 return std::make_pair(
598 delayUntilCcaEnd,
599 WIFI_CHANLIST_PRIMARY); // if Primary is busy, ignore CCA for Secondary
600 }
601
602 if (ppdu)
603 {
604 const uint16_t primaryWidth = 20;
605 uint16_t p20MinFreq =
607 (primaryWidth / 2);
608 uint16_t p20MaxFreq =
610 (primaryWidth / 2);
611 if (ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq))
612 {
613 /*
614 * PPDU occupies primary 20 MHz channel, hence we skip CCA sensitivity rules
615 * for signals not occupying the primary 20 MHz channel.
616 */
617 return std::nullopt;
618 }
619 }
620
621 std::vector<uint16_t> secondaryWidthsToCheck;
622 if (ppdu)
623 {
624 for (const auto& secondaryChannel : secondaryChannels)
625 {
626 uint16_t secondaryWidth = secondaryChannel.first;
627 uint16_t secondaryMinFreq =
629 secondaryWidth) -
630 (secondaryWidth / 2);
631 uint16_t secondaryMaxFreq =
633 secondaryWidth) +
634 (secondaryWidth / 2);
635 if ((m_wifiPhy->GetChannelWidth() > secondaryWidth) &&
636 ppdu->DoesOverlapChannel(secondaryMinFreq, secondaryMaxFreq))
637 {
638 secondaryWidthsToCheck.push_back(secondaryWidth);
639 }
640 }
641 }
642 else
643 {
644 secondaryWidthsToCheck.push_back(20);
645 secondaryWidthsToCheck.push_back(40);
646 if (m_wifiPhy->GetChannelWidth() > 80)
647 {
648 secondaryWidthsToCheck.push_back(80);
649 }
650 }
651
652 for (auto secondaryWidth : secondaryWidthsToCheck)
653 {
654 auto channelType = secondaryChannels.at(secondaryWidth);
655 ccaThresholdDbm = GetCcaThreshold(ppdu, channelType);
656 delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(secondaryWidth));
657 if (delayUntilCcaEnd.IsStrictlyPositive())
658 {
659 return std::make_pair(delayUntilCcaEnd, channelType);
660 }
661 }
662
663 return std::nullopt;
664}
665
666} // namespace ns3
667
668namespace
669{
670
675{
676 public:
678 {
681 }
683
684} // namespace
Constructor class for VHT modes.
Definition: vht-phy.cc:675
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:657
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:822
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:627
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition: ht-phy.h:558
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:390
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:556
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:432
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:738
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:599
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:705
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:672
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition: ht-phy.h:557
virtual Time GetSymbolDuration(const WifiTxVector &txVector) const
Definition: ht-phy.cc:371
static uint16_t GetUsableSubcarriers()
Definition: ofdm-phy.cc:631
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
Definition: ofdm-phy.cc:342
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1286
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:1232
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:977
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:1211
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:565
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:965
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:981
double GetRandomValue() const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:1182
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:269
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:104
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:1200
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:516
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:403
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:524
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:544
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:323
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:447
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:274
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:438
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:584
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:342
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:493
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:430
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:314
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:259
static void InitializeModes()
Initialize all VHT modes.
Definition: vht-phy.cc:333
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:456
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:387
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:417
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:538
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:485
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:299
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: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:501
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1035
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:754
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:615
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1017
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:514
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:763
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1360
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1372
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: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:702
const std::map< WifiChannelListType, double > channelTypeToScalingFactorDbm
map a given channel list type to the corresponding scaling factor in dBm
Definition: vht-phy.cc:79
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: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 GET_VHT_MCS(x)
Definition: vht-phy.cc:367
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.