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/interference-helper.h"
28 #include "ns3/log.h"
29 #include "ns3/assert.h"
30 
31 namespace ns3 {
32 
33 NS_LOG_COMPONENT_DEFINE ("VhtPhy");
34 
35 /*******************************************************
36  * VHT PHY (IEEE 802.11-2016, clause 21)
37  *******************************************************/
38 
39 /* *NS_CHECK_STYLE_OFF* */
43  WIFI_PPDU_FIELD_SIG_A, //VHT-SIG-A
44  WIFI_PPDU_FIELD_TRAINING, //VHT-STF + VHT-LTFs
48  WIFI_PPDU_FIELD_SIG_A, //VHT-SIG-A
49  WIFI_PPDU_FIELD_TRAINING, //VHT-STF + VHT-LTFs
50  WIFI_PPDU_FIELD_SIG_B, //VHT-SIG-B
52 };
53 
55  /* {BW,Nss,MCS} Nes */
56  { std::make_tuple ( 80, 7, 2), 3 }, //instead of 2
57  { std::make_tuple ( 80, 7, 7), 6 }, //instead of 4
58  { std::make_tuple ( 80, 7, 8), 6 }, //instead of 5
59  { std::make_tuple ( 80, 8, 7), 6 }, //instead of 5
60  { std::make_tuple (160, 4, 7), 6 }, //instead of 5
61  { std::make_tuple (160, 5, 8), 8 }, //instead of 7
62  { std::make_tuple (160, 6, 7), 8 }, //instead of 7
63  { std::make_tuple (160, 7, 3), 4 }, //instead of 3
64  { std::make_tuple (160, 7, 4), 6 }, //instead of 5
65  { std::make_tuple (160, 7, 5), 7 }, //instead of 6
66  { std::make_tuple (160, 7, 7), 9 }, //instead of 8
67  { std::make_tuple (160, 7, 8), 12 }, //instead of 9
68  { std::make_tuple (160, 7, 9), 12 } //instead of 10
69 };
70 /* *NS_CHECK_STYLE_ON* */
71 
72 VhtPhy::VhtPhy (bool buildModeList /* = true */)
73  : HtPhy (1, false) //don't add HT modes to list
74 {
75  NS_LOG_FUNCTION (this << buildModeList);
79  if (buildModeList)
80  {
81  BuildModeList ();
82  }
83 }
84 
86 {
87  NS_LOG_FUNCTION (this);
88 }
89 
90 void
92 {
93  NS_LOG_FUNCTION (this);
94  NS_ASSERT (m_modeList.empty ());
96  for (uint8_t index = 0; index <= m_maxSupportedMcsIndexPerSs; ++index)
97  {
98  NS_LOG_LOGIC ("Add VhtMcs" << +index << " to list");
99  m_modeList.emplace_back (CreateVhtMcs (index));
100  }
101 }
102 
105 {
106  return m_vhtPpduFormats;
107 }
108 
109 WifiMode
110 VhtPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
111 {
112  switch (field)
113  {
114  case WIFI_PPDU_FIELD_TRAINING: //consider SIG-A mode for training (useful for InterferenceHelper)
116  return GetSigAMode ();
118  return GetSigBMode (txVector);
119  default:
120  return HtPhy::GetSigMode (field, txVector);
121  }
122 }
123 
124 WifiMode
126 {
128  NS_FATAL_ERROR ("No HT-SIG");
129  return WifiMode ();
130 }
131 
132 WifiMode
134 {
135  return GetLSigMode (); //same number of data tones as OFDM (i.e. 48)
136 }
137 
138 WifiMode
139 VhtPhy::GetSigBMode (const WifiTxVector& txVector) const
140 {
141  NS_ABORT_MSG_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_VHT_MU, "VHT-SIG-B only available for VHT MU");
142  return GetVhtMcs0 ();
143 }
144 
145 Time
146 VhtPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
147 {
148  switch (field)
149  {
151  return GetSigADuration (txVector.GetPreambleType ());
153  return GetSigBDuration (txVector);
154  default:
155  return HtPhy::GetDuration (field, txVector);
156  }
157 }
158 
159 Time
160 VhtPhy::GetLSigDuration (WifiPreamble /* preamble */) const
161 {
162  return MicroSeconds (4); //L-SIG
163 }
164 
165 Time
167 {
168  return MicroSeconds (0); //no HT-SIG
169 }
170 
171 Time
173  uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
174 {
175  NS_ABORT_MSG_IF (nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
176  NS_ABORT_MSG_IF (nExtensionLtf > 0, "No extension LTFs expected for VHT");
177  return MicroSeconds (4 + 4 * nDataLtf); //VHT-STF + VHT-LTFs
178 }
179 
180 Time
181 VhtPhy::GetSigADuration (WifiPreamble /* preamble */) const
182 {
183  return MicroSeconds (8); //VHT-SIG-A (first and second symbol)
184 }
185 
186 Time
187 VhtPhy::GetSigBDuration (const WifiTxVector& txVector) const
188 {
189  return (txVector.GetPreambleType () == WIFI_PREAMBLE_VHT_MU) ? MicroSeconds (4) : MicroSeconds (0); //HE-SIG-B only for MU
190 }
191 
192 uint8_t
194 {
195  WifiMode payloadMode = txVector.GetMode ();
204  double maxRatePerCoder = (txVector.GetGuardInterval () == 800) ? 540e6 : 600e6;
205  uint8_t nes = ceil (payloadMode.GetDataRate (txVector) / maxRatePerCoder);
206 
207  //Handle exceptions to the rule
208  auto iter = m_exceptionsMap.find (std::make_tuple (txVector.GetChannelWidth (),
209  txVector.GetNss (),
210  payloadMode.GetMcsValue ()));
211  if (iter != m_exceptionsMap.end ())
212  {
213  nes = iter->second;
214  }
215  return nes;
216 }
217 
219 VhtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
220 {
221  NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
222  return Create<VhtPpdu> (psdus.begin ()->second, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
223  ObtainNextUid (txVector));
224 }
225 
228 {
229  NS_LOG_FUNCTION (this << field << *event);
230  switch (field)
231  {
233  return EndReceiveSigA (event);
235  return EndReceiveSigB (event);
236  default:
237  return HtPhy::DoEndReceiveField (field, event);
238  }
239 }
240 
243 {
244  NS_LOG_FUNCTION (this << *event);
245  NS_ASSERT (event->GetTxVector ().GetPreambleType () >= WIFI_PREAMBLE_VHT_SU);
247  NS_LOG_DEBUG ("SIG-A: SNR(dB)=" << RatioToDb (snrPer.snr) << ", PER=" << snrPer.per);
248  PhyFieldRxStatus status (GetRandomValue () > snrPer.per);
249  if (status.isSuccess)
250  {
251  NS_LOG_DEBUG ("Received SIG-A");
252  if (!IsAllConfigSupported (WIFI_PPDU_FIELD_SIG_A, event->GetPpdu ()))
253  {
254  status = PhyFieldRxStatus (false, UNSUPPORTED_SETTINGS, DROP);
255  }
256  status = ProcessSigA (event, status);
257  }
258  else
259  {
260  NS_LOG_DEBUG ("Drop packet because SIG-A reception failed");
261  status.reason = SIG_A_FAILURE;
262  status.actionIfFailure = DROP;
263  }
264  return status;
265 }
266 
269 {
270  NS_LOG_FUNCTION (this << *event << status);
271  //TODO see if something should be done here once MU-MIMO is supported
272  return status; //nothing special for VHT
273 }
274 
277 {
278  NS_LOG_FUNCTION (this << *event);
279  NS_ASSERT (event->GetPpdu ()->GetType () == WIFI_PPDU_TYPE_DL_MU);
281  NS_LOG_DEBUG ("SIG-B: SNR(dB)=" << RatioToDb (snrPer.snr) << ", PER=" << snrPer.per);
282  PhyFieldRxStatus status (GetRandomValue () > snrPer.per);
283  if (status.isSuccess)
284  {
285  NS_LOG_DEBUG ("Received SIG-B");
286  if (!IsAllConfigSupported (WIFI_PPDU_FIELD_SIG_A, event->GetPpdu ()))
287  {
288  status = PhyFieldRxStatus (false, UNSUPPORTED_SETTINGS, DROP);
289  }
290  status = ProcessSigB (event, status);
291  }
292  else
293  {
294  NS_LOG_DEBUG ("Drop reception because SIG-B reception failed");
295  status.reason = SIG_B_FAILURE;
296  status.actionIfFailure = DROP;
297  }
298  return status;
299 }
300 
303 {
304  NS_LOG_FUNCTION (this << *event << status);
305  //TODO see if something should be done here once MU-MIMO is supported
306  return status; //nothing special for VHT
307 }
308 
309 bool
311 {
312  if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU && field == WIFI_PPDU_FIELD_SIG_A)
313  {
314  return IsChannelWidthSupported (ppdu); //perform the full check after SIG-B
315  }
316  return HtPhy::IsAllConfigSupported (field, ppdu);
317 }
318 
319 void
321 {
322  for (uint8_t i = 0; i < 10; ++i)
323  {
324  GetVhtMcs (i);
325  }
326 }
327 
328 WifiMode
329 VhtPhy::GetVhtMcs (uint8_t index)
330 {
331 #define CASE(x) \
332 case x: \
333  return GetVhtMcs ## x (); \
334 
335  switch (index)
336  {
337  CASE ( 0)
338  CASE ( 1)
339  CASE ( 2)
340  CASE ( 3)
341  CASE ( 4)
342  CASE ( 5)
343  CASE ( 6)
344  CASE ( 7)
345  CASE ( 8)
346  CASE ( 9)
347  default:
348  NS_ABORT_MSG ("Inexistent index (" << +index << ") requested for VHT");
349  return WifiMode ();
350  }
351 #undef CASE
352 }
353 
354 #define GET_VHT_MCS(x) \
355 WifiMode \
356 VhtPhy::GetVhtMcs ## x (void) \
357 { \
358  static WifiMode mcs = CreateVhtMcs (x); \
359  return mcs; \
360 }; \
361 
362 GET_VHT_MCS (0)
363 GET_VHT_MCS (1)
364 GET_VHT_MCS (2)
365 GET_VHT_MCS (3)
366 GET_VHT_MCS (4)
367 GET_VHT_MCS (5)
368 GET_VHT_MCS (6)
369 GET_VHT_MCS (7)
370 GET_VHT_MCS (8)
371 GET_VHT_MCS (9)
372 #undef GET_VHT_MCS
373 
374 WifiMode
375 VhtPhy::CreateVhtMcs (uint8_t index)
376 {
377  NS_ASSERT_MSG (index <= 9, "VhtMcs index must be <= 9!");
378  return WifiModeFactory::CreateWifiMcs ("VhtMcs" + std::to_string (index),
379  index,
381  false,
382  MakeBoundCallback (&GetCodeRate, 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 (IsCombinationAllowed (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
501 {
502  return IsCombinationAllowed (txVector.GetMode ().GetMcsValue (),
503  txVector.GetChannelWidth (),
504  txVector.GetNss ());
505 }
506 
507 bool
508 VhtPhy::IsCombinationAllowed (uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
509 {
510  if (mcsValue == 9 && channelWidth == 20 && nss != 3)
511  {
512  return false;
513  }
514  if (mcsValue == 6 && channelWidth == 80 && nss == 3)
515  {
516  return false;
517  }
518  return true;
519 }
520 
521 uint32_t
523 {
524  return 4692480;
525 }
526 
527 } //namespace ns3
528 
529 namespace {
530 
534 static class ConstructorVht
535 {
536 public:
538  {
540  ns3::WifiPhy::AddStaticPhyEntity (ns3::WIFI_MOD_CLASS_VHT, ns3::Create<ns3::VhtPhy> ());
541  }
543 
544 }
Constructor class for VHT modes.
Definition: vht-phy.cc:535
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:627
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
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition: ht-phy.h:527
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:366
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition: ht-phy.h:525
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:408
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
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:200
static WifiMode GetLSigMode(void)
Definition: ht-phy.cc:147
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
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:569
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:131
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 uint16_t GetUsableSubcarriers(uint16_t channelWidth)
Definition: ht-phy.cc:684
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition: ht-phy.h:526
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
Definition: ofdm-phy.cc:318
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1027
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:791
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:997
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:477
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:794
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:252
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition: vht-phy.cc:500
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:391
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:508
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
Definition: vht-phy.cc:456
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:146
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition: vht-phy.h:355
Time GetHtSigDuration(void) const override
Definition: vht-phy.cc:166
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition: vht-phy.h:356
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:354
void BuildModeList(void) override
Build mode list.
Definition: vht-phy.cc:91
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:310
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:435
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:193
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:172
virtual WifiMode GetSigAMode(void) const
Definition: vht-phy.cc:133
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:187
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:426
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:329
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
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:302
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: vht-phy.cc:219
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
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:522
WifiMode GetHtSigMode(void) const override
Definition: vht-phy.cc:125
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:160
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:242
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:227
static void InitializeModes(void)
Initialize all VHT modes.
Definition: vht-phy.cc:320
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:268
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
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:375
virtual ~VhtPhy()
Destructor for VHT PHY.
Definition: vht-phy.cc:85
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:405
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:276
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
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:181
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition: vht-phy.cc:72
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:139
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:104
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:110
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:305
represent a single transmission mode
Definition: wifi-mode.h:48
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:155
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:114
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:887
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:652
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
WifiPreamble GetPreambleType(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.
uint16_t GetChannelWidth(void) const
uint16_t GetGuardInterval(void) const
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#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
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
#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:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1709
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1260
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
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_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
static class anonymous_namespace{vht-phy.cc}::ConstructorVht g_constructor_vht
the constructor for VHT modes
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Definition: json.h:25255
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:49
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
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:1648
Status of the reception of the PPDU field.
Definition: phy-entity.h:111
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:137
double snr
SNR in linear scale.
Definition: phy-entity.h:138
#define CASE(x)
#define GET_VHT_MCS(x)
Definition: vht-phy.cc:354
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.