A Discrete-Event Network Simulator
API
vht-phy.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 Orange Labs
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Rediet <getachew.redieteab@orange.com>
19  * Sébastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
20  */
21 
22 #include "vht-phy.h"
23 #include "vht-ppdu.h"
24 #include "ns3/wifi-psdu.h"
25 #include "ns3/wifi-phy.h" //only used for static mode constructor
26 #include "ns3/wifi-utils.h"
27 #include "ns3/log.h"
28 #include "ns3/assert.h"
29 
30 namespace ns3 {
31 
32 NS_LOG_COMPONENT_DEFINE ("VhtPhy");
33 
34 /*******************************************************
35  * VHT PHY (IEEE 802.11-2016, clause 21)
36  *******************************************************/
37 
38 /* *NS_CHECK_STYLE_OFF* */
42  WIFI_PPDU_FIELD_SIG_A, //VHT-SIG-A
43  WIFI_PPDU_FIELD_TRAINING, //VHT-STF + VHT-LTFs
47  WIFI_PPDU_FIELD_SIG_A, //VHT-SIG-A
48  WIFI_PPDU_FIELD_TRAINING, //VHT-STF + VHT-LTFs
49  WIFI_PPDU_FIELD_SIG_B, //VHT-SIG-B
51 };
52 
54  /* {BW,Nss,MCS} Nes */
55  { std::make_tuple ( 80, 7, 2), 3 }, //instead of 2
56  { std::make_tuple ( 80, 7, 7), 6 }, //instead of 4
57  { std::make_tuple ( 80, 7, 8), 6 }, //instead of 5
58  { std::make_tuple ( 80, 8, 7), 6 }, //instead of 5
59  { std::make_tuple (160, 4, 7), 6 }, //instead of 5
60  { std::make_tuple (160, 5, 8), 8 }, //instead of 7
61  { std::make_tuple (160, 6, 7), 8 }, //instead of 7
62  { std::make_tuple (160, 7, 3), 4 }, //instead of 3
63  { std::make_tuple (160, 7, 4), 6 }, //instead of 5
64  { std::make_tuple (160, 7, 5), 7 }, //instead of 6
65  { std::make_tuple (160, 7, 7), 9 }, //instead of 8
66  { std::make_tuple (160, 7, 8), 12 }, //instead of 9
67  { std::make_tuple (160, 7, 9), 12 } //instead of 10
68 };
69 /* *NS_CHECK_STYLE_ON* */
70 
71 VhtPhy::VhtPhy (bool buildModeList /* = true */)
72  : HtPhy (1, false) //don't add HT modes to list
73 {
74  NS_LOG_FUNCTION (this << buildModeList);
78  if (buildModeList)
79  {
80  BuildModeList ();
81  }
82 }
83 
85 {
86  NS_LOG_FUNCTION (this);
87 }
88 
89 void
91 {
92  NS_LOG_FUNCTION (this);
93  NS_ASSERT (m_modeList.empty ());
95  for (uint8_t index = 0; index <= m_maxSupportedMcsIndexPerSs; ++index)
96  {
97  NS_LOG_LOGIC ("Add VhtMcs" << +index << " to list");
98  m_modeList.emplace_back (CreateVhtMcs (index));
99  }
100 }
101 
104 {
105  return m_vhtPpduFormats;
106 }
107 
108 WifiMode
109 VhtPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
110 {
111  switch (field)
112  {
113  case WIFI_PPDU_FIELD_TRAINING: //consider SIG-A mode for training (useful for InterferenceHelper)
115  return GetSigAMode ();
117  return GetSigBMode (txVector);
118  default:
119  return HtPhy::GetSigMode (field, txVector);
120  }
121 }
122 
123 WifiMode
125 {
127  NS_FATAL_ERROR ("No HT-SIG");
128  return WifiMode ();
129 }
130 
131 WifiMode
133 {
134  return GetLSigMode (); //same number of data tones as OFDM (i.e. 48)
135 }
136 
137 WifiMode
138 VhtPhy::GetSigBMode (const WifiTxVector& txVector) const
139 {
140  NS_ABORT_MSG_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_VHT_MU, "VHT-SIG-B only available for VHT MU");
141  return GetVhtMcs0 ();
142 }
143 
144 Time
145 VhtPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
146 {
147  switch (field)
148  {
150  return GetSigADuration (txVector.GetPreambleType ());
152  return GetSigBDuration (txVector);
153  default:
154  return HtPhy::GetDuration (field, txVector);
155  }
156 }
157 
158 Time
159 VhtPhy::GetLSigDuration (WifiPreamble /* preamble */) const
160 {
161  return MicroSeconds (4); //L-SIG
162 }
163 
164 Time
166 {
167  return MicroSeconds (0); //no HT-SIG
168 }
169 
170 Time
172  uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
173 {
174  NS_ABORT_MSG_IF (nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
175  NS_ABORT_MSG_IF (nExtensionLtf > 0, "No extension LTFs expected for VHT");
176  return MicroSeconds (4 + 4 * nDataLtf); //VHT-STF + VHT-LTFs
177 }
178 
179 Time
180 VhtPhy::GetSigADuration (WifiPreamble /* preamble */) const
181 {
182  return MicroSeconds (8); //VHT-SIG-A (first and second symbol)
183 }
184 
185 Time
186 VhtPhy::GetSigBDuration (const WifiTxVector& txVector) const
187 {
188  return (txVector.GetPreambleType () == WIFI_PREAMBLE_VHT_MU) ? MicroSeconds (4) : MicroSeconds (0); //HE-SIG-B only for MU
189 }
190 
191 uint8_t
193 {
194  WifiMode payloadMode = txVector.GetMode ();
203  double maxRatePerCoder = (txVector.GetGuardInterval () == 800) ? 540e6 : 600e6;
204  uint8_t nes = ceil (payloadMode.GetDataRate (txVector) / maxRatePerCoder);
205 
206  //Handle exceptions to the rule
207  auto iter = m_exceptionsMap.find (std::make_tuple (txVector.GetChannelWidth (),
208  txVector.GetNss (),
209  payloadMode.GetMcsValue ()));
210  if (iter != m_exceptionsMap.end ())
211  {
212  nes = iter->second;
213  }
214  return nes;
215 }
216 
218 VhtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
219 {
220  NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
221  return Create<VhtPpdu> (psdus.begin ()->second, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
222  ObtainNextUid (txVector));
223 }
224 
227 {
228  NS_LOG_FUNCTION (this << field << *event);
229  switch (field)
230  {
232  return EndReceiveSigA (event);
234  return EndReceiveSigB (event);
235  default:
236  return HtPhy::DoEndReceiveField (field, event);
237  }
238 }
239 
242 {
243  NS_LOG_FUNCTION (this << *event);
244  NS_ASSERT (event->GetTxVector ().GetPreambleType () >= WIFI_PREAMBLE_VHT_SU);
246  NS_LOG_DEBUG ("SIG-A: SNR(dB)=" << RatioToDb (snrPer.snr) << ", PER=" << snrPer.per);
247  PhyFieldRxStatus status (GetRandomValue () > snrPer.per);
248  if (status.isSuccess)
249  {
250  NS_LOG_DEBUG ("Received SIG-A");
251  if (!IsAllConfigSupported (WIFI_PPDU_FIELD_SIG_A, event->GetPpdu ()))
252  {
253  status = PhyFieldRxStatus (false, UNSUPPORTED_SETTINGS, DROP);
254  }
255  status = ProcessSigA (event, status);
256  }
257  else
258  {
259  NS_LOG_DEBUG ("Drop packet because SIG-A reception failed");
260  status.reason = SIG_A_FAILURE;
261  status.actionIfFailure = DROP;
262  }
263  return status;
264 }
265 
268 {
269  NS_LOG_FUNCTION (this << *event << status);
270  //TODO see if something should be done here once MU-MIMO is supported
271  return status; //nothing special for VHT
272 }
273 
276 {
277  NS_LOG_FUNCTION (this << *event);
278  NS_ASSERT (event->GetPpdu ()->GetType () == WIFI_PPDU_TYPE_DL_MU);
280  NS_LOG_DEBUG ("SIG-B: SNR(dB)=" << RatioToDb (snrPer.snr) << ", PER=" << snrPer.per);
281  PhyFieldRxStatus status (GetRandomValue () > snrPer.per);
282  if (status.isSuccess)
283  {
284  NS_LOG_DEBUG ("Received SIG-B");
285  if (!IsAllConfigSupported (WIFI_PPDU_FIELD_SIG_A, event->GetPpdu ()))
286  {
287  status = PhyFieldRxStatus (false, UNSUPPORTED_SETTINGS, DROP);
288  }
289  status = ProcessSigB (event, status);
290  }
291  else
292  {
293  NS_LOG_DEBUG ("Drop reception because SIG-B reception failed");
294  status.reason = SIG_B_FAILURE;
295  status.actionIfFailure = DROP;
296  }
297  return status;
298 }
299 
302 {
303  NS_LOG_FUNCTION (this << *event << status);
304  //TODO see if something should be done here once MU-MIMO is supported
305  return status; //nothing special for VHT
306 }
307 
308 bool
310 {
311  if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU && field == WIFI_PPDU_FIELD_SIG_A)
312  {
313  return IsChannelWidthSupported (ppdu); //perform the full check after SIG-B
314  }
315  return HtPhy::IsAllConfigSupported (field, ppdu);
316 }
317 
318 void
320 {
321  for (uint8_t i = 0; i < 10; ++i)
322  {
323  GetVhtMcs (i);
324  }
325 }
326 
327 WifiMode
328 VhtPhy::GetVhtMcs (uint8_t index)
329 {
330 #define CASE(x) \
331 case x: \
332  return GetVhtMcs ## x (); \
333 
334  switch (index)
335  {
336  CASE ( 0)
337  CASE ( 1)
338  CASE ( 2)
339  CASE ( 3)
340  CASE ( 4)
341  CASE ( 5)
342  CASE ( 6)
343  CASE ( 7)
344  CASE ( 8)
345  CASE ( 9)
346  default:
347  NS_ABORT_MSG ("Inexistent index (" << +index << ") requested for VHT");
348  return WifiMode ();
349  }
350 #undef CASE
351 }
352 
353 #define GET_VHT_MCS(x) \
354 WifiMode \
355 VhtPhy::GetVhtMcs ## x (void) \
356 { \
357  static WifiMode mcs = CreateVhtMcs (x); \
358  return mcs; \
359 }; \
360 
361 GET_VHT_MCS (0)
362 GET_VHT_MCS (1)
363 GET_VHT_MCS (2)
364 GET_VHT_MCS (3)
365 GET_VHT_MCS (4)
366 GET_VHT_MCS (5)
367 GET_VHT_MCS (6)
368 GET_VHT_MCS (7)
369 GET_VHT_MCS (8)
370 GET_VHT_MCS (9)
371 #undef GET_VHT_MCS
372 
373 WifiMode
374 VhtPhy::CreateVhtMcs (uint8_t index)
375 {
376  NS_ASSERT_MSG (index <= 9, "VhtMcs index must be <= 9!");
377  return WifiModeFactory::CreateWifiMcs ("VhtMcs" + std::to_string (index),
378  index,
380  MakeBoundCallback (&GetCodeRate, index),
382  MakeBoundCallback (&GetPhyRate, index),
384  MakeBoundCallback (&GetDataRate, index),
387  MakeBoundCallback (&IsModeAllowed, index));
388 }
389 
391 VhtPhy::GetCodeRate (uint8_t mcsValue)
392 {
393  switch (mcsValue)
394  {
395  case 8:
396  return WIFI_CODE_RATE_3_4;
397  case 9:
398  return WIFI_CODE_RATE_5_6;
399  default:
400  return HtPhy::GetCodeRate (mcsValue);
401  }
402 }
403 
404 uint16_t
406 {
407  switch (mcsValue)
408  {
409  case 8:
410  case 9:
411  return 256;
412  default:
413  return HtPhy::GetConstellationSize (mcsValue);
414  }
415 }
416 
417 uint64_t
418 VhtPhy::GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
419 {
420  WifiCodeRate codeRate = GetCodeRate (mcsValue);
421  uint64_t dataRate = GetDataRate (mcsValue, channelWidth, guardInterval, nss);
422  return HtPhy::CalculatePhyRate (codeRate, dataRate);
423 }
424 
425 uint64_t
426 VhtPhy::GetPhyRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
427 {
428  return GetPhyRate (txVector.GetMode ().GetMcsValue (),
429  txVector.GetChannelWidth (),
430  txVector.GetGuardInterval (),
431  txVector.GetNss ());
432 }
433 
434 uint64_t
435 VhtPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
436 {
437  return GetDataRate (txVector.GetMode ().GetMcsValue (),
438  txVector.GetChannelWidth (),
439  txVector.GetGuardInterval (),
440  txVector.GetNss ());
441 }
442 
443 uint64_t
444 VhtPhy::GetDataRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
445 {
446  NS_ASSERT (guardInterval == 800 || guardInterval == 400);
447  NS_ASSERT (nss <= 8);
448  NS_ASSERT_MSG (IsModeAllowed (mcsValue, channelWidth, nss), "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is " << +nss);
449  return HtPhy::CalculateDataRate (3.2, guardInterval,
450  GetUsableSubcarriers (channelWidth),
451  static_cast<uint16_t> (log2 (GetConstellationSize (mcsValue))),
452  HtPhy::GetCodeRatio (GetCodeRate (mcsValue)), nss);
453 }
454 
455 uint16_t
456 VhtPhy::GetUsableSubcarriers (uint16_t channelWidth)
457 {
458  switch (channelWidth)
459  {
460  case 80:
461  return 234;
462  case 160:
463  return 468;
464  default:
465  return HtPhy::GetUsableSubcarriers (channelWidth);
466  }
467 }
468 
469 uint64_t
471 {
472  WifiCodeRate codeRate = GetCodeRate (mcsValue);
473  uint16_t constellationSize = GetConstellationSize (mcsValue);
474  return CalculateNonHtReferenceRate (codeRate, constellationSize);
475 }
476 
477 uint64_t
478 VhtPhy::CalculateNonHtReferenceRate (WifiCodeRate codeRate, uint16_t constellationSize)
479 {
480  uint64_t dataRate;
481  switch (constellationSize)
482  {
483  case 256:
484  if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
485  {
486  dataRate = 54000000;
487  }
488  else
489  {
490  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
491  }
492  break;
493  default:
494  dataRate = HtPhy::CalculateNonHtReferenceRate (codeRate, constellationSize);
495  }
496  return dataRate;
497 }
498 
499 bool
500 VhtPhy::IsModeAllowed (uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
501 {
502  if (mcsValue == 9 && channelWidth == 20 && nss != 3)
503  {
504  return false;
505  }
506  if (mcsValue == 6 && channelWidth == 80 && nss == 3)
507  {
508  return false;
509  }
510  return true;
511 }
512 
513 uint32_t
515 {
516  return 4692480;
517 }
518 
519 } //namespace ns3
520 
521 namespace {
522 
526 static class ConstructorVht
527 {
528 public:
530  {
532  ns3::WifiPhy::AddStaticPhyEntity (ns3::WIFI_MOD_CLASS_VHT, ns3::Create<ns3::VhtPhy> ());
533  }
535 
536 }
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:192
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:514
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:328
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual WifiMode GetSigAMode(void) const
Definition: vht-phy.cc:132
static uint64_t CalculateDataRate(double symbolDuration, uint16_t guardInterval, uint16_t usableSubCarriers, uint16_t numberOfBitsPerSubcarrier, double codingRate, uint8_t nss)
Calculates data rate from the supplied parameters.
Definition: ht-phy.cc:674
WifiMode GetHtSigMode(void) const override
Definition: vht-phy.cc:124
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:391
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition: phy-entity.h:115
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition: vht-phy.h:347
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:627
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:186
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
WifiPhyRxfailureReason reason
failure reason
Definition: phy-entity.h:114
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:470
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:374
#define HT_PHY
This defines the BSS membership value for HT PHY.
Definition: ht-phy.h:38
uint16_t GetGuardInterval(void) const
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:47
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
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:698
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:407
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU&#39;s bandwidth is supported by the PHY.
Definition: ofdm-phy.cc:317
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode...
WifiPreamble GetPreambleType(void) const
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP, HT-GF-STF + HT-GF-LTF1 fields for HT-GF, L-STF + L-LTF fields otherwise.
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:426
virtual PhyFieldRxStatus ProcessSigA(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-A, perform amendment-specific actions, and provide an updated status of the reception...
Definition: vht-phy.cc:267
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, PhyRateFromTxVectorCallback phyRateFromTxVectorCallback, DataRateCallback dataRateCallback, DataRateFromTxVectorCallback dataRateFromTxVectorCallback, NonHtReferenceRateCallback nonHtReferenceRateCallback, ModeAllowedCallback isModeAllowedCallback)
Definition: wifi-mode.cc:291
PHY entity for HT (11n)HT PHY is based on OFDM PHY.
Definition: ht-phy.h:50
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy&#39;s InterferenceHelper class.
Definition: phy-entity.cc:250
Status of the reception of the PPDU field.
Definition: phy-entity.h:110
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:435
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:171
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:103
#define VHT_PHY
This defines the BSS membership value for VHT PHY.
Definition: vht-phy.h:38
static bool IsModeAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
Definition: vht-phy.cc:500
WifiPpduField
The type of PPDU field (grouped for convenience)
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition: ht-phy.h:527
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:418
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1021
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
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:136
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
Definition: vht-phy.cc:456
static class anonymous_namespace{vht-phy.cc}::ConstructorVht g_constructor_vht
the constructor for VHT modes
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:199
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
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:478
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:365
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:180
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of ns3::VhtPhy class.
void BuildModeList(void) override
Build mode list.
Definition: vht-phy.cc:90
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:597
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:405
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:159
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:886
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition: ht-phy.h:528
PhyFieldRxStatus EndReceiveSigB(Ptr< Event > event)
End receiving the SIG-B, perform VHT-specific actions, and provide the status of the reception...
Definition: vht-phy.cc:275
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:309
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:102
PhyFieldRxStatus EndReceiveSigA(Ptr< Event > event)
End receiving the SIG-A, perform VHT-specific actions, and provide the status of the reception...
Definition: vht-phy.cc:241
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:53
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied HT MCS index between 0 and 7, since HT MCS index > 8 is used for higher NSS.
Definition: ht-phy.cc:569
virtual PhyFieldRxStatus ProcessSigB(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-B, perform amendment-specific actions, and provide an updated status of the reception...
Definition: vht-phy.cc:301
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:642
static WifiMode GetLSigMode(void)
Definition: ht-phy.cc:146
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
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:226
Time GetHtSigDuration(void) const override
Definition: vht-phy.cc:165
static void InitializeModes(void)
Initialize all VHT modes.
Definition: vht-phy.cc:319
#define CASE(x)
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:477
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition: vht-phy.h:348
#define GET_VHT_MCS(x)
Definition: vht-phy.cc:353
virtual ~VhtPhy()
Destructor for VHT PHY.
Definition: vht-phy.cc:84
STF + LTF fields (excluding those in preamble for HT-GF)
double GetRandomValue(void) const
Obtain a random value from the WifiPhy&#39;s generator.
Definition: phy-entity.cc:991
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:130
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:138
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
uint16_t GetChannelWidth(void) const
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition: ht-phy.h:529
Constructor class for VHT modes.
Definition: vht-phy.cc:526
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: vht-phy.cc:218
PHY header field for DSSS or ERP, short PHY header field for HR/DSSS or ERP, field not present for HT...
std::map< std::tuple< uint16_t, uint8_t, uint8_t >, uint8_t > NesExceptionMap
Typedef for storing exceptions in the number of BCC encoders for VHT MCSs.
Definition: vht-phy.h:346
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:109
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:137
Declaration of ns3::VhtPpdu class.
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:145
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
Definition: ht-phy.cc:684
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition: vht-phy.cc:71
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:786
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:783
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:444