A Discrete-Event Network Simulator
API
he-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 and spectrum-wifi-phy)
20  */
21 
22 #include "he-phy.h"
23 #include "he-ppdu.h"
24 #include "ns3/wifi-psdu.h"
25 #include "ns3/wifi-phy.h"
26 #include "he-configuration.h"
27 #include "ns3/wifi-net-device.h"
28 #include "ns3/sta-wifi-mac.h"
29 #include "ns3/ap-wifi-mac.h"
30 #include "ns3/wifi-utils.h"
31 #include "ns3/simulator.h"
32 #include "ns3/log.h"
33 #include "ns3/assert.h"
34 #include <algorithm>
35 
36 namespace ns3 {
37 
38 NS_LOG_COMPONENT_DEFINE ("HePhy");
39 
40 /*******************************************************
41  * HE PHY (P802.11ax/D4.0, clause 27)
42  *******************************************************/
43 
44 /* *NS_CHECK_STYLE_OFF* */
45 const PhyEntity::PpduFormats HePhy::m_hePpduFormats { //Ignoring PE (Packet Extension)
46  { WIFI_PREAMBLE_HE_SU, { WIFI_PPDU_FIELD_PREAMBLE, //L-STF + L-LTF
47  WIFI_PPDU_FIELD_NON_HT_HEADER, //L-SIG + RL-SIG
48  WIFI_PPDU_FIELD_SIG_A, //HE-SIG-A
49  WIFI_PPDU_FIELD_TRAINING, //HE-STF + HE-LTFs
51  { WIFI_PREAMBLE_HE_MU, { WIFI_PPDU_FIELD_PREAMBLE, //L-STF + L-LTF
52  WIFI_PPDU_FIELD_NON_HT_HEADER, //L-SIG + RL-SIG
53  WIFI_PPDU_FIELD_SIG_A, //HE-SIG-A
54  WIFI_PPDU_FIELD_SIG_B, //HE-SIG-B
55  WIFI_PPDU_FIELD_TRAINING, //HE-STF + HE-LTFs
57  { WIFI_PREAMBLE_HE_TB, { WIFI_PPDU_FIELD_PREAMBLE, //L-STF + L-LTF
58  WIFI_PPDU_FIELD_NON_HT_HEADER, //L-SIG + RL-SIG
59  WIFI_PPDU_FIELD_SIG_A, //HE-SIG-A
60  WIFI_PPDU_FIELD_TRAINING, //HE-STF + HE-LTFs
63  WIFI_PPDU_FIELD_NON_HT_HEADER, //L-SIG + RL-SIG
64  WIFI_PPDU_FIELD_SIG_A, //HE-SIG-A
65  WIFI_PPDU_FIELD_TRAINING, //HE-STF + HE-LTFs
67 };
68 /* *NS_CHECK_STYLE_ON* */
69 
70 HePhy::HePhy (bool buildModeList /* = true */)
71  : VhtPhy (false) //don't add VHT modes to list
72 {
73  NS_LOG_FUNCTION (this << buildModeList);
75  m_maxMcsIndexPerSs = 11;
77  m_currentHeTbPpduUid = UINT64_MAX;
78  m_previouslyTxPpduUid = UINT64_MAX;
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 HeMcs" << +index << " to list");
99  m_modeList.emplace_back (CreateHeMcs (index));
100  }
101 }
102 
103 WifiMode
104 HePhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
105 {
106  switch (field)
107  {
108  case WIFI_PPDU_FIELD_TRAINING: //consider SIG-A (SIG-B) mode for training for the time being for SU/ER-SU/TB (MU) (useful for InterferenceHelper)
109  if (txVector.IsDlMu ())
110  {
112  //Training comes after SIG-B
113  return GetSigBMode (txVector);
114  }
115  else
116  {
117  //Training comes after SIG-A
118  return GetSigAMode ();
119  }
120  default:
121  return VhtPhy::GetSigMode (field, txVector);
122  }
123 }
124 
125 WifiMode
126 HePhy::GetSigAMode (void) const
127 {
128  return GetVhtMcs0 (); //same number of data tones as VHT for 20 MHz (i.e. 52)
129 }
130 
131 WifiMode
132 HePhy::GetSigBMode (const WifiTxVector& txVector) const
133 {
134  NS_ABORT_MSG_IF (!txVector.IsDlMu () || (txVector.GetModulationClass () != WIFI_MOD_CLASS_HE), "HE-SIG-B only available for HE MU");
141  uint8_t smallestMcs = 5; //maximum MCS for HE-SIG-B
142  for (auto & info : txVector.GetHeMuUserInfoMap ())
143  {
144  smallestMcs = std::min (smallestMcs, info.second.mcs.GetMcsValue ());
145  }
146  switch (smallestMcs) //GetVhtMcs (mcs) is not static
147  {
148  case 0:
149  return GetVhtMcs0 ();
150  case 1:
151  return GetVhtMcs1 ();
152  case 2:
153  return GetVhtMcs2 ();
154  case 3:
155  return GetVhtMcs3 ();
156  case 4:
157  return GetVhtMcs4 ();
158  case 5:
159  default:
160  return GetVhtMcs5 ();
161  }
162 }
163 
166 {
167  return m_hePpduFormats;
168 }
169 
170 Time
171 HePhy::GetLSigDuration (WifiPreamble /* preamble */) const
172 {
173  return MicroSeconds (8); //L-SIG + RL-SIG
174 }
175 
176 Time
178  uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
179 {
180  Time ltfDuration = MicroSeconds (8); //TODO extract from TxVector when available
181  Time stfDuration;
182  if (txVector.IsUlMu ())
183  {
185  stfDuration = MicroSeconds (8);
186  }
187  else
188  {
189  stfDuration = MicroSeconds (4);
190  }
191  NS_ABORT_MSG_IF (nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for HE");
192  NS_ABORT_MSG_IF (nExtensionLtf > 0, "No extension LTFs expected for HE");
193  return stfDuration + ltfDuration * nDataLtf; //HE-STF + HE-LTFs
194 }
195 
196 Time
198 {
199  return (preamble == WIFI_PREAMBLE_HE_ER_SU) ? MicroSeconds (16) : MicroSeconds (8); //HE-SIG-A (first and second symbol)
200 }
201 
202 Time
203 HePhy::GetSigBDuration (const WifiTxVector& txVector) const
204 {
205  if (txVector.IsDlMu ()) //See section 27.3.10.8 of IEEE 802.11ax draft 4.0.
206  {
208  /*
209  * Compute the number of bits used by common field.
210  * Assume that compression bit in HE-SIG-A is not set (i.e. not
211  * full band MU-MIMO); the field is present.
212  */
213  uint16_t bw = txVector.GetChannelWidth ();
214  std::size_t commonFieldSize = 4 /* CRC */ + 6 /* tail */;
215  if (bw <= 40)
216  {
217  commonFieldSize += 8; //only one allocation subfield
218  }
219  else
220  {
221  commonFieldSize += 8 * (bw / 40) /* one allocation field per 40 MHz */ + 1 /* center RU */;
222  }
223 
224  /*
225  * Compute the number of bits used by user-specific field.
226  * MU-MIMO is not supported; only one station per RU.
227  * The user-specific field is composed of N user block fields
228  * spread over each corresponding HE-SIG-B content channel.
229  * Each user block field contains either two or one users' data
230  * (the latter being for odd number of stations per content channel).
231  * Padding will be handled further down in the code.
232  */
233  std::pair<std::size_t, std::size_t> numStaPerContentChannel = txVector.GetNumRusPerHeSigBContentChannel ();
234  std::size_t maxNumStaPerContentChannel = std::max (numStaPerContentChannel.first, numStaPerContentChannel.second);
235  std::size_t maxNumUserBlockFields = maxNumStaPerContentChannel / 2; //handle last user block with single user, if any, further down
236  std::size_t userSpecificFieldSize = maxNumUserBlockFields * (2 * 21 /* user fields (2 users) */ + 4 /* tail */ + 6 /* CRC */);
237  if (maxNumStaPerContentChannel % 2 != 0)
238  {
239  userSpecificFieldSize += 21 /* last user field */ + 4 /* CRC */ + 6 /* tail */;
240  }
241 
242  /*
243  * Compute duration of HE-SIG-B considering that padding
244  * is added up to the next OFDM symbol.
245  * Nss = 1 and GI = 800 ns for HE-SIG-B.
246  */
247  Time symbolDuration = MicroSeconds (4);
248  double numDataBitsPerSymbol = GetSigBMode (txVector).GetDataRate (20, 800, 1) * symbolDuration.GetNanoSeconds () / 1e9;
249  double numSymbols = ceil ((commonFieldSize + userSpecificFieldSize) / numDataBitsPerSymbol);
250 
251  return FemtoSeconds (static_cast<uint64_t> (numSymbols * symbolDuration.GetFemtoSeconds ()));
252  }
253  else
254  {
255  // no SIG-B
256  return MicroSeconds (0);
257  }
258 }
259 
260 uint16_t
262 {
263  uint8_t sigExtension = 0;
264  if (band == WIFI_PHY_BAND_2_4GHZ)
265  {
266  sigExtension = 6;
267  }
268  uint8_t m = 2; //HE TB PPDU so m is set to 2
269  uint16_t length = ((ceil ((static_cast<double> (ppduDuration.GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3 - m);
270  return length;
271 }
272 
273 Time
275 {
276  NS_ABORT_IF (!txVector.IsUlMu () || (txVector.GetModulationClass () != WIFI_MOD_CLASS_HE));
277  Time tSymbol = NanoSeconds (12800 + txVector.GetGuardInterval ());
278  Time preambleDuration = WifiPhy::GetStaticPhyEntity (WIFI_MOD_CLASS_HE)->CalculatePhyPreambleAndHeaderDuration (txVector); //this is quite convoluted but only way of keeping the method static
279  uint8_t sigExtension = 0;
280  if (band == WIFI_PHY_BAND_2_4GHZ)
281  {
282  sigExtension = 6;
283  }
284  uint8_t m = 2; //HE TB PPDU so m is set to 2
285  //Equation 27-11 of IEEE P802.11ax/D4.0
286  Time calculatedDuration = MicroSeconds (((ceil (static_cast<double> (length + 3 + m) / 3)) * 4) + 20 + sigExtension);
287  uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds () - (sigExtension * 1000)) / tSymbol.GetNanoSeconds ());
288  Time ppduDuration = preambleDuration + (nSymbols * tSymbol) + MicroSeconds (sigExtension);
289  return ppduDuration;
290 }
291 
292 Time
294 {
295  NS_ABORT_IF (!txVector.IsUlMu () || (txVector.GetModulationClass () != WIFI_MOD_CLASS_HE));
296  Time duration = GetDuration (WIFI_PPDU_FIELD_PREAMBLE, txVector)
298  + GetDuration (WIFI_PPDU_FIELD_SIG_A, txVector);
299  return duration;
300 }
301 
302 uint8_t
303 HePhy::GetNumberBccEncoders (const WifiTxVector& /* txVector */) const
304 {
305  return 1; //only 1 BCC encoder for HE since higher rates are obtained using LDPC
306 }
307 
308 Time
309 HePhy::GetSymbolDuration (const WifiTxVector& txVector) const
310 {
311  uint16_t gi = txVector.GetGuardInterval ();
312  NS_ASSERT (gi == 800 || gi == 1600 || gi == 3200);
313  return NanoSeconds (12800 + gi);
314 }
315 
317 HePhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
318 {
319  NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
320  HePpdu::TxPsdFlag flag;
321  if (txVector.IsUlMu ())
322  {
325  }
326  else
327  {
328  flag = HePpdu::PSD_NON_HE_TB;
329  }
330  return Create<HePpdu> (psdus, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
331  ObtainNextUid (txVector), flag);
332 }
333 
334 void
336  Time rxDuration)
337 {
338  NS_LOG_FUNCTION (this << ppdu << rxDuration);
339  const WifiTxVector& txVector = ppdu->GetTxVector ();
340  auto hePpdu = DynamicCast<HePpdu> (ppdu);
341  NS_ASSERT (hePpdu);
342  HePpdu::TxPsdFlag psdFlag = hePpdu->GetTxPsdFlag ();
343  if (txVector.IsUlMu () && psdFlag == HePpdu::PSD_HE_TB_OFDMA_PORTION)
344  {
346  if (m_currentHeTbPpduUid == ppdu->GetUid ()
347  && GetCurrentEvent () != 0)
348  {
349  //AP or STA has already received non-OFDMA part, switch to OFDMA part, and schedule reception of payload (will be canceled for STAs by StartPayload)
350  bool ofdmaStarted = !m_beginOfdmaPayloadRxEvents.empty ();
351  NS_LOG_INFO ("Switch to OFDMA part (already started? " << (ofdmaStarted ? "Y" : "N") << ") " <<
352  "and schedule OFDMA payload reception in " << GetDuration (WIFI_PPDU_FIELD_TRAINING, txVector).As (Time::NS));
353  Ptr<Event> event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW, !ofdmaStarted);
354  uint16_t staId = GetStaId (ppdu);
357  &HePhy::StartReceiveOfdmaPayload, this, event);
358  }
359  else
360  {
361  //PHY receives the OFDMA payload while having dropped the preamble
362  NS_LOG_INFO ("Consider OFDMA part of the HE TB PPDU as interference since device dropped the preamble");
363  CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW);
364  //the OFDMA part of the HE TB PPDUs will be noise _after_ the completion of the current event
365  ErasePreambleEvent (ppdu, rxDuration);
366  }
367  }
368  else
369  {
370  PhyEntity::StartReceivePreamble (ppdu, rxPowersW, rxDuration);
371  }
372 }
373 
374 void
376 {
377  NS_LOG_FUNCTION (this);
378  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
379  {
380  beginOfdmaPayloadRxEvent.second.Cancel ();
381  }
384 }
385 
386 void
388 {
389  NS_LOG_FUNCTION (this << reason);
390  if (reason != OBSS_PD_CCA_RESET)
391  {
392  for (auto & endMpduEvent : m_endOfMpduEvents)
393  {
394  endMpduEvent.Cancel ();
395  }
396  m_endOfMpduEvents.clear ();
397  }
398  else
399  {
401  }
402 }
403 
404 void
406 {
407  NS_LOG_FUNCTION (this << *event);
408  if (event->GetPpdu ()->GetType () != WIFI_PPDU_TYPE_UL_MU)
409  {
410  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
411  }
412  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
413  {
414  beginOfdmaPayloadRxEvent.second.Cancel ();
415  }
417 }
418 
421 {
422  Ptr<Event> event;
423  //We store all incoming preamble events, and a decision is made at the end of the preamble detection window.
424  //If a preamble is received after the preamble detection window, it is stored anyway because this is needed for HE TB PPDUs in
425  //order to properly update the received power in InterferenceHelper. The map is cleaned anyway at the end of the current reception.
426  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
427  {
428  auto uidPreamblePair = std::make_pair (ppdu->GetUid (), ppdu->GetPreamble ());
429  const WifiTxVector& txVector = ppdu->GetTxVector ();
430  Time rxDuration = CalculateNonOfdmaDurationForHeTb (txVector); //the OFDMA part of the transmission will be added later on
431  const auto & currentPreambleEvents = GetCurrentPreambleEvents ();
432  auto it = currentPreambleEvents.find (uidPreamblePair);
433  if (it != currentPreambleEvents.end ())
434  {
435  NS_LOG_DEBUG ("Received another HE TB PPDU for UID " << ppdu->GetUid () << " from STA-ID " << ppdu->GetStaId () << " and BSS color " << +txVector.GetBssColor ());
436  event = it->second;
437  if (Simulator::Now () - event->GetStartTime () > NanoSeconds (400))
438  {
439  //Section 27.3.14.3 from 802.11ax Draft 4.0: Pre-correction accuracy requirements.
440  //A STA that transmits an HE TB PPDU, non-HT PPDU, or non-HT duplicate PPDU in response to a triggering PPDU
441  //shall ensure that the transmission start time of the HE TB PPDU, non-HT PPDU, or non-HT duplicate PPDU is
442  //within ±0.4 µs + 16 µs from the end, at the STA’s antenna connector, of the last OFDM symbol of the triggering
443  //PPDU (if it contains no PE field) or of the PE field of the triggering PPDU (if the PE field is present).
444  //As a result, if an HE TB PPDU arrives later than 0.4 µs, it is added as an interference but PPDU is dropped.
445  event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW);
446  NS_LOG_DEBUG ("Drop packet because not received within the 400ns window");
448  }
449  else
450  {
451  //Update received power of the event associated to that UL MU transmission
452  UpdateInterferenceEvent (event, rxPowersW);
453  }
454  if ((GetCurrentEvent () != 0) && (GetCurrentEvent ()->GetPpdu ()->GetUid () != ppdu->GetUid ()))
455  {
456  NS_LOG_DEBUG ("Drop packet because already receiving another HE TB PPDU");
458  }
459  return nullptr;
460  }
461  else
462  {
463  NS_LOG_DEBUG ("Received a new HE TB PPDU for UID " << ppdu->GetUid () << " from STA-ID " << ppdu->GetStaId () << " and BSS color " << +txVector.GetBssColor ());
464  event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW);
465  AddPreambleEvent (event);
466  }
467  }
468  else
469  {
470  event = PhyEntity::DoGetEvent (ppdu, rxPowersW);
471  }
472  return event;
473 }
474 
477 {
478  if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU || ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
479  {
480  auto hePpdu = DynamicCast<const HePpdu> (ppdu);
481  NS_ASSERT (hePpdu);
482  return hePpdu->GetPsdu (GetBssColor (), GetStaId (ppdu));
483  }
484  return PhyEntity::GetAddressedPsduInPpdu (ppdu);
485 }
486 
487 uint8_t
488 HePhy::GetBssColor (void) const
489 {
490  uint8_t bssColor = 0;
491  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
492  if (device)
493  {
494  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
495  if (heConfiguration)
496  {
497  bssColor = heConfiguration->GetBssColor ();
498  }
499  }
500  return bssColor;
501 }
502 
503 uint16_t
505 {
506  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
507  {
508  return ppdu->GetStaId ();
509  }
510  else if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU)
511  {
512  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
513  if (device)
514  {
515  Ptr<StaWifiMac> mac = DynamicCast<StaWifiMac> (device->GetMac ());
516  if (mac && mac->IsAssociated ())
517  {
518  return mac->GetAssociationId ();
519  }
520  }
521  }
522  return PhyEntity::GetStaId (ppdu);
523 }
524 
527 {
528  NS_LOG_FUNCTION (this << *event << status);
529  //Notify end of SIG-A (in all cases)
530  WifiTxVector txVector = event->GetTxVector ();
531  HeSigAParameters params;
532  params.rssiW = GetRxPowerWForPpdu (event);
533  params.bssColor = txVector.GetBssColor ();
534  NotifyEndOfHeSigA (params); //if OBSS_PD CCA_RESET, set power restriction first and wait till field is processed before switching to IDLE
535 
536  if (status.isSuccess)
537  {
538  //Check if PPDU is filtered based on the BSS color
539  uint8_t myBssColor = GetBssColor ();
540  uint8_t rxBssColor = txVector.GetBssColor ();
541  if (myBssColor != 0 && rxBssColor != 0 && myBssColor != rxBssColor)
542  {
543  NS_LOG_DEBUG ("The BSS color of this PPDU (" << +rxBssColor << ") does not match the device's (" << +myBssColor << "). The PPDU is filtered.");
544  return PhyFieldRxStatus (false, FILTERED, DROP);
545  }
546 
547  Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
548  if (txVector.IsUlMu ())
549  {
551  m_currentHeTbPpduUid = ppdu->GetUid (); //to be able to correctly schedule start of OFDMA payload
552  }
553 
554  if (ppdu->GetType () != WIFI_PPDU_TYPE_DL_MU && !GetAddressedPsduInPpdu (ppdu)) //Final decision on STA-ID correspondence of DL MU is delayed to end of SIG-B
555  {
556  NS_ASSERT (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU);
557  NS_LOG_DEBUG ("No PSDU addressed to that PHY in the received MU PPDU. The PPDU is filtered.");
558  return PhyFieldRxStatus (false, FILTERED, DROP);
559  }
560  }
561  return status;
562 }
563 
564 void
566 {
567  m_endOfHeSigACallback = callback;
568 }
569 
570 void
572 {
574  {
575  m_endOfHeSigACallback (params);
576  }
577 }
578 
581 {
582  NS_LOG_FUNCTION (this << *event << status);
583  if (status.isSuccess)
584  {
585  //Check if PPDU is filtered only if the SIG-B content is supported (not explicitly stated but assumed based on behavior for SIG-A)
586  if (!GetAddressedPsduInPpdu (event->GetPpdu ()))
587  {
588  NS_LOG_DEBUG ("No PSDU addressed to that PHY in the received MU PPDU. The PPDU is filtered.");
589  return PhyFieldRxStatus (false, FILTERED, DROP);
590  }
591  }
592  return status;
593 }
594 
595 bool
597 {
598  const WifiTxVector& txVector = ppdu->GetTxVector ();
599  uint16_t staId = GetStaId (ppdu);
600  WifiMode txMode = txVector.GetMode (staId);
601  uint8_t nss = txVector.GetNssMax ();
602  if (txVector.IsDlMu ())
603  {
605  for (auto info : txVector.GetHeMuUserInfoMap ())
606  {
607  if (info.first == staId)
608  {
609  nss = info.second.nss; //no need to look at other PSDUs
610  break;
611  }
612  }
613  }
614 
616  {
617  NS_LOG_DEBUG ("Packet reception could not be started because not enough RX antennas");
618  return false;
619  }
620  if (!IsModeSupported (txMode))
621  {
622  NS_LOG_DEBUG ("Drop packet because it was sent using an unsupported mode (" << txVector.GetMode () << ")");
623  return false;
624  }
625  return true;
626 }
627 
628 void
630 {
631  NS_LOG_FUNCTION (this << *event);
632  const WifiTxVector& txVector = event->GetTxVector ();
633  Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
634  if (txVector.IsUlMu ())
635  {
637  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
638  bool isAp = device != 0 && (DynamicCast<ApWifiMac> (device->GetMac ()) != 0);
639  if (!isAp)
640  {
641  NS_LOG_DEBUG ("Ignore HE TB PPDU payload received by STA but keep state in Rx");
642  m_endRxPayloadEvents.push_back (Simulator::Schedule (ppdu->GetTxDuration () - CalculatePhyPreambleAndHeaderDuration (txVector),
643  &PhyEntity::ResetReceive, this, event));
644  //Cancel all scheduled events for OFDMA payload reception
645  NS_ASSERT (!m_beginOfdmaPayloadRxEvents.empty () && m_beginOfdmaPayloadRxEvents.begin ()->second.IsRunning ());
646  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
647  {
648  beginOfdmaPayloadRxEvent.second.Cancel ();
649  }
651  }
652  else
653  {
654  NS_LOG_DEBUG ("Receiving PSDU in HE TB PPDU");
655  uint16_t staId = GetStaId (ppdu);
656  m_signalNoiseMap.insert ({std::make_pair (ppdu->GetUid (), staId), SignalNoiseDbm ()});
657  m_statusPerMpduMap.insert ({std::make_pair (ppdu->GetUid (), staId), std::vector<bool> ()});
658  //for HE TB PPDUs, ScheduleEndOfMpdus and EndReceive are scheduled by StartReceiveOfdmaPayload
659  NS_ASSERT (isAp);
661  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
662  {
663  NS_ASSERT (beginOfdmaPayloadRxEvent.second.IsRunning ());
664  }
665  }
666  }
667  else
668  {
670  }
671 }
672 
673 void
675 {
676  NS_LOG_FUNCTION (this << ppdu);
677  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
678  {
679  for (auto it = m_endRxPayloadEvents.begin (); it != m_endRxPayloadEvents.end (); )
680  {
681  if (it->IsExpired ())
682  {
683  it = m_endRxPayloadEvents.erase (it);
684  }
685  else
686  {
687  it++;
688  }
689  }
690  if (m_endRxPayloadEvents.empty ())
691  {
692  //We've got the last PPDU of the UL-OFDMA transmission
693  NotifyInterferenceRxEndAndClear (true); //reset WifiPhy
694  }
695  }
696  else
697  {
700  }
701 }
702 
703 void
705 {
706  Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
707  const RxPowerWattPerChannelBand& rxPowersW = event->GetRxPowerWPerBand ();
708  //The total RX power corresponds to the maximum over all the bands.
709  //Only perform this computation if the result needs to be logged.
710  auto it = rxPowersW.end ();
711  if (g_log.IsEnabled (ns3::LOG_FUNCTION))
712  {
713  it = std::max_element (rxPowersW.begin (), rxPowersW.end (),
714  [] (const std::pair<WifiSpectrumBand, double> &p1, const std::pair<WifiSpectrumBand, double> &p2) {
715  return p1.second < p2.second;
716  });
717 
718  }
719  NS_LOG_FUNCTION (this << *event << it->second);
720  NS_ASSERT (GetCurrentEvent () != 0);
721  auto itEvent = m_beginOfdmaPayloadRxEvents.find (GetStaId (ppdu));
727  NS_ASSERT (itEvent != m_beginOfdmaPayloadRxEvents.end () && itEvent->second.IsExpired ());
728  m_beginOfdmaPayloadRxEvents.erase (itEvent);
729 
730  Time payloadDuration = ppdu->GetTxDuration () - CalculatePhyPreambleAndHeaderDuration (ppdu->GetTxVector ());
732  ScheduleEndOfMpdus (event);
733  m_endRxPayloadEvents.push_back (Simulator::Schedule (payloadDuration, &PhyEntity::EndReceivePayload, this, event));
734  m_signalNoiseMap.insert ({std::make_pair (ppdu->GetUid (), ppdu->GetStaId ()), SignalNoiseDbm ()});
735  m_statusPerMpduMap.insert ({std::make_pair (ppdu->GetUid (), ppdu->GetStaId ()), std::vector<bool> ()});
736 }
737 
738 std::pair<uint16_t, WifiSpectrumBand>
739 HePhy::GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t staId) const
740 {
741  if (txVector.IsMu ())
742  {
743  return std::make_pair (HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ()),
744  GetRuBandForRx (txVector, staId));
745  }
746  else
747  {
748  return PhyEntity::GetChannelWidthAndBand (txVector, staId);
749  }
750 }
751 
753 HePhy::GetRuBandForTx (const WifiTxVector& txVector, uint16_t staId) const
754 {
755  NS_ASSERT (txVector.IsMu ());
756  WifiSpectrumBand band;
757  HeRu::RuSpec ru = txVector.GetRu (staId);
758  uint16_t channelWidth = txVector.GetChannelWidth ();
759  NS_ASSERT (channelWidth <= m_wifiPhy->GetChannelWidth ());
760  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (channelWidth, ru.GetRuType (), ru.GetPhyIndex ());
761  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
762  // for a TX spectrum, the guard bandwidth is a function of the transmission channel width
763  // and the spectrum width equals the transmission channel width (hence bandIndex equals 0)
764  band = m_wifiPhy->ConvertHeRuSubcarriers (channelWidth, GetGuardBandwidth (channelWidth),
765  range, 0);
766  return band;
767 }
768 
770 HePhy::GetRuBandForRx (const WifiTxVector& txVector, uint16_t staId) const
771 {
772  NS_ASSERT (txVector.IsMu ());
773  WifiSpectrumBand band;
774  HeRu::RuSpec ru = txVector.GetRu (staId);
775  uint16_t channelWidth = txVector.GetChannelWidth ();
776  NS_ASSERT (channelWidth <= m_wifiPhy->GetChannelWidth ());
777  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (channelWidth, ru.GetRuType (), ru.GetPhyIndex ());
778  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
779  // for an RX spectrum, the guard bandwidth is a function of the operating channel width
780  // and the spectrum width equals the operating channel width
782  range, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (channelWidth));
783  return band;
784 }
785 
787 HePhy::GetNonOfdmaBand (const WifiTxVector& txVector, uint16_t staId) const
788 {
789  NS_ASSERT (txVector.IsUlMu () && (txVector.GetModulationClass () == WIFI_MOD_CLASS_HE));
790  uint16_t channelWidth = txVector.GetChannelWidth ();
791  NS_ASSERT (channelWidth <= m_wifiPhy->GetChannelWidth ());
792 
793  HeRu::RuSpec ru = txVector.GetRu (staId);
794  uint16_t nonOfdmaWidth = GetNonOfdmaWidth (ru);
795 
796  // Find the RU that encompasses the non-OFDMA part of the HE TB PPDU for the STA-ID
797  HeRu::RuSpec nonOfdmaRu = HeRu::FindOverlappingRu (channelWidth, ru, HeRu::GetRuType (nonOfdmaWidth));
798  nonOfdmaRu.SetPhyIndex (channelWidth, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (20));
799 
800  HeRu::SubcarrierGroup groupPreamble = HeRu::GetSubcarrierGroup (channelWidth, nonOfdmaRu.GetRuType (), nonOfdmaRu.GetPhyIndex ());
801  HeRu::SubcarrierRange range = std::make_pair (groupPreamble.front ().first, groupPreamble.back ().second);
802  return m_wifiPhy->ConvertHeRuSubcarriers (channelWidth, GetGuardBandwidth (m_wifiPhy->GetChannelWidth ()), range,
804 }
805 
806 uint16_t
808 {
809  if (ru.GetRuType () == HeRu::RU_26_TONE && ru.GetIndex () == 19)
810  {
811  // the center 26-tone RU in an 80 MHz channel is not fully covered by
812  // any 20 MHz channel, but only by an 80 MHz channel
813  return 80;
814  }
815  return std::max<uint16_t> (HeRu::GetBandwidth (ru.GetRuType ()), 20);
816 }
817 
818 uint64_t
820 {
821  return m_currentHeTbPpduUid;
822 }
823 
824 uint16_t
826 {
827  uint16_t channelWidth = PhyEntity::GetMeasurementChannelWidth (ppdu);
835  if (channelWidth >= 40 && ppdu->GetUid () != m_previouslyTxPpduUid)
836  {
837  channelWidth = 20;
838  }
839  return channelWidth;
840 }
841 
842 uint64_t
844 {
845  NS_LOG_FUNCTION (this << txVector);
846  uint64_t uid;
847  if (txVector.IsUlMu ())
848  {
850  //Use UID of PPDU containing trigger frame to identify resulting HE TB PPDUs, since the latter should immediately follow the former
852  NS_ASSERT (uid != UINT64_MAX);
853  }
854  else
855  {
856  uid = m_globalPpduUid++;
857  }
858  m_previouslyTxPpduUid = uid; //to be able to identify solicited HE TB PPDUs
859  return uid;
860 }
861 
864 {
865  const WifiTxVector& txVector = ppdu->GetTxVector ();
866  uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
867  uint16_t channelWidth = txVector.GetChannelWidth ();
868  NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW);
869  auto hePpdu = DynamicCast<const HePpdu> (ppdu);
870  NS_ASSERT (hePpdu);
871  HePpdu::TxPsdFlag flag = hePpdu->GetTxPsdFlag ();
874  {
875  WifiSpectrumBand band = GetRuBandForTx (txVector, GetStaId (hePpdu));
876  v = WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity (centerFrequency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth), band);
877  }
878  else
879  {
881  {
882  //non-OFDMA portion is sent only on the 20 MHz channels covering the RU
883  uint16_t staId = GetStaId (hePpdu);
884  centerFrequency = GetCenterFrequencyForNonOfdmaPart (txVector, staId);
885  uint16_t ruWidth = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
886  channelWidth = ruWidth < 20 ? 20 : ruWidth;
887  }
888  const auto & txMaskRejectionParams = GetTxMaskRejectionParams ();
889  v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFrequency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth),
890  std::get<0> (txMaskRejectionParams), std::get<1> (txMaskRejectionParams), std::get<2> (txMaskRejectionParams));
891  }
892  return v;
893 }
894 
895 uint16_t
896 HePhy::GetCenterFrequencyForNonOfdmaPart (const WifiTxVector& txVector, uint16_t staId) const
897 {
898  NS_LOG_FUNCTION (this << txVector << staId);
899  NS_ASSERT (txVector.IsUlMu () && (txVector.GetModulationClass () == WIFI_MOD_CLASS_HE));
900  uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
901  uint16_t currentWidth = txVector.GetChannelWidth ();
902 
903  HeRu::RuSpec ru = txVector.GetRu (staId);
904  uint16_t nonOfdmaWidth = GetNonOfdmaWidth (ru);
905  if (nonOfdmaWidth != currentWidth)
906  {
907  //Obtain the index of the non-OFDMA portion
908  HeRu::RuSpec nonOfdmaRu = HeRu::FindOverlappingRu (currentWidth, ru, HeRu::GetRuType (nonOfdmaWidth));
909  nonOfdmaRu.SetPhyIndex (currentWidth, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (20));
910 
911  uint16_t startingFrequency = centerFrequency - (currentWidth / 2);
912  centerFrequency = startingFrequency + nonOfdmaWidth * (nonOfdmaRu.GetPhyIndex () - 1) + nonOfdmaWidth / 2;
913  }
914  return centerFrequency;
915 }
916 
917 void
919 {
920  NS_LOG_FUNCTION (this << ppdu);
921  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
922  {
923  //non-OFDMA part
924  Time nonOfdmaDuration = CalculateNonOfdmaDurationForHeTb (ppdu->GetTxVector ());
925  Transmit (nonOfdmaDuration, ppdu, "non-OFDMA transmission");
926 
927  //OFDMA part
928  auto hePpdu = DynamicCast<HePpdu> (ppdu->Copy ()); //since flag will be modified
929  NS_ASSERT (hePpdu);
930  hePpdu->SetTxPsdFlag (HePpdu::PSD_HE_TB_OFDMA_PORTION);
931  Time ofdmaDuration = ppdu->GetTxDuration () - nonOfdmaDuration;
932  Simulator::Schedule (nonOfdmaDuration, &PhyEntity::Transmit, this, ofdmaDuration, hePpdu, "OFDMA transmission");
933  }
934  else
935  {
936  PhyEntity::StartTx (ppdu);
937  }
938 }
939 
940 Time
942 {
943  if (txVector.IsUlMu ())
944  {
946  return ConvertLSigLengthToHeTbPpduDuration (txVector.GetLength (), txVector, band);
947  }
948 
949  Time maxDuration = Seconds (0);
950  for (auto & staIdPsdu : psduMap)
951  {
952  if (txVector.IsDlMu ())
953  {
955  WifiTxVector::HeMuUserInfoMap userInfoMap = txVector.GetHeMuUserInfoMap ();
956  NS_ABORT_MSG_IF (userInfoMap.find (staIdPsdu.first) == userInfoMap.end (), "STA-ID in psduMap (" << staIdPsdu.first << ") should be referenced in txVector");
957  }
958  Time current = WifiPhy::CalculateTxDuration (staIdPsdu.second->GetSize (), txVector, band,
959  staIdPsdu.first);
960  if (current > maxDuration)
961  {
962  maxDuration = current;
963  }
964  }
965  NS_ASSERT (maxDuration.IsStrictlyPositive ());
966  return maxDuration;
967 }
968 
969 void
971 {
972  for (uint8_t i = 0; i < 12; ++i)
973  {
974  GetHeMcs (i);
975  }
976 }
977 
978 WifiMode
979 HePhy::GetHeMcs (uint8_t index)
980 {
981 #define CASE(x) \
982 case x: \
983  return GetHeMcs ## x (); \
984 
985  switch (index)
986  {
987  CASE ( 0)
988  CASE ( 1)
989  CASE ( 2)
990  CASE ( 3)
991  CASE ( 4)
992  CASE ( 5)
993  CASE ( 6)
994  CASE ( 7)
995  CASE ( 8)
996  CASE ( 9)
997  CASE (10)
998  CASE (11)
999  default:
1000  NS_ABORT_MSG ("Inexistent index (" << +index << ") requested for HE");
1001  return WifiMode ();
1002  }
1003 #undef CASE
1004 }
1005 
1006 #define GET_HE_MCS(x) \
1007 WifiMode \
1008 HePhy::GetHeMcs ## x (void) \
1009 { \
1010  static WifiMode mcs = CreateHeMcs (x); \
1011  return mcs; \
1012 }; \
1013 
1014 GET_HE_MCS (0)
1015 GET_HE_MCS (1)
1016 GET_HE_MCS (2)
1017 GET_HE_MCS (3)
1018 GET_HE_MCS (4)
1019 GET_HE_MCS (5)
1020 GET_HE_MCS (6)
1021 GET_HE_MCS (7)
1022 GET_HE_MCS (8)
1023 GET_HE_MCS (9)
1024 GET_HE_MCS (10)
1025 GET_HE_MCS (11)
1026 #undef GET_HE_MCS
1027 
1028 WifiMode
1029 HePhy::CreateHeMcs (uint8_t index)
1030 {
1031  NS_ASSERT_MSG (index <= 11, "HeMcs index must be <= 11!");
1032  return WifiModeFactory::CreateWifiMcs ("HeMcs" + std::to_string (index),
1033  index,
1035  MakeBoundCallback (&GetCodeRate, index),
1037  MakeBoundCallback (&GetPhyRate, index),
1039  MakeBoundCallback (&GetDataRate, index),
1043 }
1044 
1046 HePhy::GetCodeRate (uint8_t mcsValue)
1047 {
1048  switch (mcsValue)
1049  {
1050  case 10:
1051  return WIFI_CODE_RATE_3_4;
1052  case 11:
1053  return WIFI_CODE_RATE_5_6;
1054  default:
1055  return VhtPhy::GetCodeRate (mcsValue);
1056  }
1057 }
1058 
1059 uint16_t
1061 {
1062  switch (mcsValue)
1063  {
1064  case 10:
1065  case 11:
1066  return 1024;
1067  default:
1068  return VhtPhy::GetConstellationSize (mcsValue);
1069  }
1070 }
1071 
1072 uint64_t
1073 HePhy::GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
1074 {
1075  WifiCodeRate codeRate = GetCodeRate (mcsValue);
1076  uint64_t dataRate = GetDataRate (mcsValue, channelWidth, guardInterval, nss);
1077  return HtPhy::CalculatePhyRate (codeRate, dataRate);
1078 }
1079 
1080 uint64_t
1081 HePhy::GetPhyRateFromTxVector (const WifiTxVector& txVector, uint16_t staId /* = SU_STA_ID */)
1082 {
1083  uint16_t bw = txVector.GetChannelWidth ();
1084  if (txVector.IsMu ())
1085  {
1086  bw = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
1087  }
1088  return HePhy::GetPhyRate (txVector.GetMode (staId).GetMcsValue (),
1089  bw,
1090  txVector.GetGuardInterval (),
1091  txVector.GetNss (staId));
1092 }
1093 
1094 uint64_t
1095 HePhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId /* = SU_STA_ID */)
1096 {
1097  uint16_t bw = txVector.GetChannelWidth ();
1098  if (txVector.IsMu ())
1099  {
1100  bw = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
1101  }
1102  return HePhy::GetDataRate (txVector.GetMode (staId).GetMcsValue (),
1103  bw,
1104  txVector.GetGuardInterval (),
1105  txVector.GetNss (staId));
1106 }
1107 
1108 uint64_t
1109 HePhy::GetDataRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
1110 {
1111  NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
1112  NS_ASSERT (nss <= 8);
1113  return HtPhy::CalculateDataRate (12.8, guardInterval,
1114  GetUsableSubcarriers (channelWidth),
1115  static_cast<uint16_t> (log2 (GetConstellationSize (mcsValue))),
1116  HtPhy::GetCodeRatio (GetCodeRate (mcsValue)), nss);
1117 }
1118 
1119 uint16_t
1120 HePhy::GetUsableSubcarriers (uint16_t channelWidth)
1121 {
1122  switch (channelWidth)
1123  {
1124  case 2: //26-tone RU
1125  return 24;
1126  case 4: //52-tone RU
1127  return 48;
1128  case 8: //106-tone RU
1129  return 102;
1130  case 20:
1131  default:
1132  return 234;
1133  case 40:
1134  return 468;
1135  case 80:
1136  return 980;
1137  case 160:
1138  return 1960;
1139  }
1140 }
1141 
1142 uint64_t
1144 {
1145  WifiCodeRate codeRate = GetCodeRate (mcsValue);
1146  uint16_t constellationSize = GetConstellationSize (mcsValue);
1147  return CalculateNonHtReferenceRate (codeRate, constellationSize);
1148 }
1149 
1150 uint64_t
1151 HePhy::CalculateNonHtReferenceRate (WifiCodeRate codeRate, uint16_t constellationSize)
1152 {
1153  uint64_t dataRate;
1154  switch (constellationSize)
1155  {
1156  case 1024:
1157  if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
1158  {
1159  dataRate = 54000000;
1160  }
1161  else
1162  {
1163  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
1164  }
1165  break;
1166  default:
1167  dataRate = VhtPhy::CalculateNonHtReferenceRate (codeRate, constellationSize);
1168  }
1169  return dataRate;
1170 }
1171 
1172 bool
1173 HePhy::IsModeAllowed (uint16_t /* channelWidth */, uint8_t /* nss */)
1174 {
1175  return true;
1176 }
1177 
1180 {
1181  uint16_t staId = SU_STA_ID;
1182 
1183  if (txVector.IsUlMu ())
1184  {
1185  NS_ASSERT (txVector.GetHeMuUserInfoMap ().size () == 1);
1186  staId = txVector.GetHeMuUserInfoMap ().begin ()->first;
1187  }
1188 
1189  return WifiConstPsduMap ({std::make_pair (staId, psdu)});
1190 }
1191 
1192 uint32_t
1194 {
1195  return 6500631;
1196 }
1197 
1198 } //namespace ns3
1199 
1200 namespace {
1201 
1205 static class ConstructorHe
1206 {
1207 public:
1209  {
1211  ns3::WifiPhy::AddStaticPhyEntity (ns3::WIFI_MOD_CLASS_HE, ns3::Create<ns3::HePhy> ());
1212  }
1214 
1215 }
ns3::HePhy::m_currentHeTbPpduUid
uint64_t m_currentHeTbPpduUid
UID of the HE TB PPDU being received.
Definition: he-phy.h:414
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::PhyEntity::PpduFormats
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:477
ns3::WifiTxVector::GetBssColor
uint8_t GetBssColor(void) const
Get the BSS color.
Definition: wifi-tx-vector.cc:316
NS_ASSERT
#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
ns3::HePhy::ProcessSigA
PhyFieldRxStatus ProcessSigA(Ptr< Event > event, PhyFieldRxStatus status) override
Process SIG-A, perform amendment-specific actions, and provide an updated status of the reception.
Definition: he-phy.cc:526
ns3::HePhy::GetAddressedPsduInPpdu
Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const override
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Definition: he-phy.cc:476
ns3::HePpdu::TxPsdFlag
TxPsdFlag
The transmit power spectral density flag, namely used to correctly build PSD for HE TB PPDU non-OFDMA...
Definition: he-ppdu.h:159
ns3::HePhy::GetNonOfdmaWidth
uint16_t GetNonOfdmaWidth(HeRu::RuSpec ru) const
Get the width in MHz of the non-OFDMA portion of an HE TB PPDU.
Definition: he-phy.cc:807
ns3::HePhy::GetNonOfdmaBand
WifiSpectrumBand GetNonOfdmaBand(const WifiTxVector &txVector, uint16_t staId) const
Get the band used to transmit the non-OFDMA part of an HE TB PPDU.
Definition: he-phy.cc:787
ns3::HePhy::GetSigMode
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
Definition: he-phy.cc:104
ns3::HeSigAParameters::bssColor
uint8_t bssColor
BSS color.
Definition: he-phy.h:49
ns3::HePhy::GetSigAMode
WifiMode GetSigAMode(void) const override
Definition: he-phy.cc:126
ns3::Time::GetFemtoSeconds
int64_t GetFemtoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:400
ns3::Time::NS
@ NS
nanosecond
Definition: nstime.h:118
ns3::WIFI_PPDU_FIELD_SIG_A
@ WIFI_PPDU_FIELD_SIG_A
SIG-A field.
Definition: wifi-phy-common.h:188
ns3::HePhy::IsConfigSupported
bool IsConfigSupported(Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (excluding bandwidth) is supported by the PHY.
Definition: he-phy.cc:596
ns3::HePhy::CalculateNonOfdmaDurationForHeTb
Time CalculateNonOfdmaDurationForHeTb(const WifiTxVector &txVector) const
Definition: he-phy.cc:293
ns3::PhyEntity::CalculatePhyPreambleAndHeaderDuration
Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector) const
Definition: phy-entity.cc:186
ns3::WifiSpectrumBand
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
Definition: wifi-spectrum-value-helper.h:34
min
#define min(a, b)
Definition: 80211b.c:42
ns3::WifiTxVector::GetRu
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
Definition: wifi-tx-vector.cc:388
ns3::LOG_FUNCTION
@ LOG_FUNCTION
Function tracing.
Definition: log.h:109
ns3::PhyEntity::ErasePreambleEvent
void ErasePreambleEvent(Ptr< const WifiPpdu > ppdu, Time rxDuration)
Erase the event corresponding to the PPDU from the list of preamble events, but consider it as noise ...
Definition: phy-entity.cc:498
ns3::PhyEntity::DoEndReceivePayload
virtual void DoEndReceivePayload(Ptr< const WifiPpdu > ppdu)
Perform amendment-specific actions at the end of the reception of the payload.
Definition: phy-entity.cc:670
ns3::PhyEntity::m_modeList
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:786
ns3::VhtPhy::CalculateNonHtReferenceRate
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
ns3::HePhy::StartReceiveOfdmaPayload
void StartReceiveOfdmaPayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Definition: he-phy.cc:704
ns3::Callback< void, HeSigAParameters >
ns3::WIFI_CODE_RATE_5_6
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
Definition: wifi-phy-common.h:61
ns3::PhyEntity::m_signalNoiseMap
std::map< UidStaIdPair, SignalNoiseDbm > m_signalNoiseMap
Map of the latest signal power and noise power in dBm (noise power includes the noise figure)
Definition: phy-entity.h:799
ns3::HePhy::GetTrainingDuration
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: he-phy.cc:177
ns3::PhyEntity::GetCenterFrequencyForChannelWidth
uint16_t GetCenterFrequencyForChannelWidth(const WifiTxVector &txVector) const
Get the center frequency of the channel corresponding the current TxVector rather than that of the su...
Definition: phy-entity.cc:1026
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::PhyEntity::m_statusPerMpduMap
std::map< UidStaIdPair, std::vector< bool > > m_statusPerMpduMap
Map of the current reception status per MPDU that is filled in as long as MPDUs are being processed b...
Definition: phy-entity.h:798
ns3::PhyEntity::GetGuardBandwidth
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const
Definition: phy-entity.cc:1059
ns3::WifiPhy::CalculateTxDuration
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1610
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
ns3::WIFI_MOD_CLASS_HE
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
Definition: wifi-phy-common.h:132
ns3::HePhy::IsModeAllowed
static bool IsModeAllowed(uint16_t channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
Definition: he-phy.cc:1173
ns3::PhyEntity::EndReceivePayload
void EndReceivePayload(Ptr< Event > event)
The last symbol of the PPDU has arrived.
Definition: phy-entity.cc:631
ns3::HeRu::SubcarrierGroup
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
ns3::HePhy::m_hePpduFormats
static const PpduFormats m_hePpduFormats
HE PPDU formats.
Definition: he-phy.h:435
ns3::PhyEntity::ScheduleEndOfMpdus
void ScheduleEndOfMpdus(Ptr< Event > event)
Schedule end of MPDUs events.
Definition: phy-entity.cc:554
ns3::WifiTxVector::GetNssMax
uint8_t GetNssMax(void) const
Definition: wifi-tx-vector.cc:184
ns3::FemtoSeconds
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1329
ns3::PhyEntity::IsModeSupported
virtual bool IsModeSupported(WifiMode mode) const
Check if the WifiMode is supported.
Definition: phy-entity.cc:90
ns3::HePhy::BuildModeList
void BuildModeList(void) override
Build mode list.
Definition: he-phy.cc:91
ns3::PhyEntity::CreateInterferenceEvent
Ptr< Event > CreateInterferenceEvent(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector, Time duration, RxPowerWattPerChannelBand &rxPower, bool isStartOfdmaRxing=false)
Create an event using WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:749
ns3::Time::IsStrictlyPositive
bool IsStrictlyPositive(void) const
Exactly equivalent to t > 0.
Definition: nstime.h:333
anonymous_namespace{he-phy.cc}::g_constructor_he
static class anonymous_namespace{he-phy.cc}::ConstructorHe g_constructor_he
the constructor for HE modes
ns3::PhyEntity::GetStaId
virtual uint16_t GetStaId(const Ptr< const WifiPpdu > ppdu) const
Return the STA ID that has been assigned to the station this PHY belongs to.
Definition: phy-entity.cc:519
ns3::HePhy::GetMaxPsduSize
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
Definition: he-phy.cc:1193
ns3::HePhy::ProcessSigB
PhyFieldRxStatus ProcessSigB(Ptr< Event > event, PhyFieldRxStatus status) override
Process SIG-B, perform amendment-specific actions, and provide an updated status of the reception.
Definition: he-phy.cc:580
ns3::OBSS_PD_CCA_RESET
@ OBSS_PD_CCA_RESET
Definition: wifi-phy-common.h:279
ns3::PhyEntity::GetRxPowerWForPpdu
double GetRxPowerWForPpdu(Ptr< Event > event) const
Obtain the received power (W) for a given band.
Definition: phy-entity.cc:995
GET_HE_MCS
#define GET_HE_MCS(x)
Definition: he-phy.cc:1006
ns3::PhyEntity::DoGetEvent
virtual Ptr< Event > DoGetEvent(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW)
Get the event corresponding to the incoming PPDU.
Definition: phy-entity.cc:737
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
third.mac
mac
Definition: third.py:99
ns3::HePhy::GetLSigDuration
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: he-phy.cc:171
ns3::HePhy::CancelAllEvents
void CancelAllEvents(void) override
Cancel and clear all running events.
Definition: he-phy.cc:375
ns3::WIFI_PPDU_FIELD_PREAMBLE
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
Definition: wifi-phy-common.h:178
ns3::WifiConstPsduMap
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:43
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::HePhy::GetCodeRate
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied HE MCS index.
Definition: he-phy.cc:1046
ns3::WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity
static Ptr< SpectrumValue > CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, WifiSpectrumBand ru)
Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given R...
Definition: wifi-spectrum-value-helper.cc:425
ns3::WIFI_PREAMBLE_HE_SU
@ WIFI_PREAMBLE_HE_SU
Definition: wifi-phy-common.h:74
he-phy.h
Declaration of ns3::HePhy class and ns3::HeSigAParameters struct.
ns3::PhyEntity::StartTx
virtual void StartTx(Ptr< WifiPpdu > ppdu)
This function is called by SpectrumWifiPhy to send the PPDU while performing amendment-specific actio...
Definition: phy-entity.cc:1034
ns3::HePhy::GetRuBandForTx
WifiSpectrumBand GetRuBandForTx(const WifiTxVector &txVector, uint16_t staId) const
Get the band in the TX spectrum associated with the RU used by the PSDU transmitted to/by a given STA...
Definition: he-phy.cc:753
ns3::PhyEntity::AddPreambleEvent
void AddPreambleEvent(Ptr< Event > event)
Add an entry to the map of current preamble events (stored in WifiPhy).
Definition: phy-entity.cc:729
ns3::HePhy::CalculateNonHtReferenceRate
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: he-phy.cc:1151
ns3::PhyEntity::Transmit
void Transmit(Time txDuration, Ptr< WifiPpdu > ppdu, std::string type)
This function prepares most of the WifiSpectrumSignalParameters parameters and invokes SpectrumWifiPh...
Definition: phy-entity.cc:1041
ns3::WifiPhy::AddStaticPhyEntity
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
ns3::HePhy::m_previouslyTxPpduUid
uint64_t m_previouslyTxPpduUid
UID of the previously sent PPDU, used by AP to recognize response HE TB PPDUs.
Definition: he-phy.h:413
anonymous_namespace{he-phy.cc}::ConstructorHe::ConstructorHe
ConstructorHe()
Definition: he-phy.cc:1208
ns3::VhtPhy::GetDuration
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
ns3::SignalNoiseDbm
SignalNoiseDbm structure.
Definition: phy-entity.h:53
ns3::RXING
@ RXING
Definition: wifi-phy-common.h:267
ns3::HeRu::RuSpec::GetPhyIndex
std::size_t GetPhyIndex(void) const
Get the RU PHY index.
Definition: he-ru.cc:212
ns3::HeRu::GetBandwidth
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:487
ns3::HePhy::GetChannelWidthAndBand
std::pair< uint16_t, WifiSpectrumBand > GetChannelWidthAndBand(const WifiTxVector &txVector, uint16_t staId) const override
Get the channel width and band to use (will be overloaded by child classes).
Definition: he-phy.cc:739
ns3::WifiNetDevice::GetHeConfiguration
Ptr< HeConfiguration > GetHeConfiguration(void) const
Definition: wifi-net-device.cc:480
ns3::WifiTxVector::IsUlMu
bool IsUlMu(void) const
Return true if this TX vector is used for an uplink multi-user transmission.
Definition: wifi-tx-vector.cc:382
ns3::HePpdu::PSD_NON_HE_TB
@ PSD_NON_HE_TB
non-HE TB PPDU transmissions
Definition: he-ppdu.h:160
anonymous_namespace{he-phy.cc}::ConstructorHe
Constructor class for HE modes.
Definition: he-phy.cc:1206
ns3::HtPhy::m_bssMembershipSelector
uint8_t m_bssMembershipSelector
the BSS membership selector
Definition: ht-phy.h:529
ns3::PhyEntity::GetMeasurementChannelWidth
virtual uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: phy-entity.cc:1007
ns3::HtPhy::m_maxMcsIndexPerSs
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Definition: ht-phy.h:527
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::HePhy::ConvertHeTbPpduDurationToLSigLength
static uint16_t ConvertHeTbPpduDurationToLSigLength(Time ppduDuration, WifiPhyBand band)
Definition: he-phy.cc:261
ns3::VhtPhy::GetVhtMcs3
static WifiMode GetVhtMcs3(void)
Return MCS 3 from VHT MCS values.
ns3::WifiCodeRate
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
Definition: wifi-phy-common.h:45
ns3::HePhy::m_endOfHeSigACallback
EndOfHeSigACallback m_endOfHeSigACallback
end of HE-SIG-A callback
Definition: he-phy.h:418
ns3::HeRu::RuSpec
RU Specification.
Definition: he-ru.h:68
ns3::PhyEntity::GetCurrentPreambleEvents
const std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > & GetCurrentPreambleEvents(void) const
Get the map of current preamble events (stored in WifiPhy).
Definition: phy-entity.cc:723
ns3::WifiTxVector::GetModulationClass
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
Definition: wifi-tx-vector.cc:128
ns3::WifiPhyRxfailureReason
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
Definition: wifi-phy-common.h:263
ns3::HePhy::DoEndReceivePayload
void DoEndReceivePayload(Ptr< const WifiPpdu > ppdu) override
Perform amendment-specific actions at the end of the reception of the payload.
Definition: he-phy.cc:674
ns3::PhyEntity::GetCurrentEvent
Ptr< const Event > GetCurrentEvent(void) const
Get the pointer to the current event (stored in WifiPhy).
Definition: phy-entity.cc:1001
ns3::HePhy::GetStaId
uint16_t GetStaId(const Ptr< const WifiPpdu > ppdu) const override
Return the STA ID that has been assigned to the station this PHY belongs to.
Definition: he-phy.cc:504
ns3::HtPhy::m_maxSupportedMcsIndexPerSs
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
Definition: ht-phy.h:528
ns3::FILTERED
@ FILTERED
Definition: wifi-phy-common.h:281
ns3::HE_TB_PPDU_TOO_LATE
@ HE_TB_PPDU_TOO_LATE
Definition: wifi-phy-common.h:280
ns3::HePhy::StartTx
void StartTx(Ptr< WifiPpdu > ppdu) override
This function is called by SpectrumWifiPhy to send the PPDU while performing amendment-specific actio...
Definition: he-phy.cc:918
ns3::HePhy::SetEndOfHeSigACallback
void SetEndOfHeSigACallback(EndOfHeSigACallback callback)
Set a callback for a end of HE-SIG-A.
Definition: he-phy.cc:565
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
max
#define max(a, b)
Definition: 80211b.c:43
ns3::WifiPhy::ConvertHeRuSubcarriers
virtual WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const
Definition: wifi-phy.cc:1939
ns3::WIFI_PREAMBLE_HE_ER_SU
@ WIFI_PREAMBLE_HE_ER_SU
Definition: wifi-phy-common.h:75
ns3::NanoSeconds
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1313
ns3::PhyEntity::PhyFieldRxStatus
Status of the reception of the PPDU field.
Definition: phy-entity.h:111
ns3::HePhy::GetPhyRateFromTxVector
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId=SU_STA_ID)
Return the PHY rate corresponding to the supplied TXVECTOR for the STA-ID.
Definition: he-phy.cc:1081
ns3::WifiPhy::NotifyRxDrop
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1703
ns3::HePhy::GetBssColor
uint8_t GetBssColor(void) const
Definition: he-phy.cc:488
ns3::VhtPhy::GetVhtMcs5
static WifiMode GetVhtMcs5(void)
Return MCS 5 from VHT MCS values.
ns3::HePhy::GetCurrentHeTbPpduUid
uint64_t GetCurrentHeTbPpduUid(void) const
Definition: he-phy.cc:819
ns3::HePhy::ObtainNextUid
uint64_t ObtainNextUid(const WifiTxVector &txVector) override
Obtain the next UID for the PPDU to transmit.
Definition: he-phy.cc:843
ns3::VhtPhy::GetVhtMcs0
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
ns3::HePhy::CalculateTxDuration
Time CalculateTxDuration(WifiConstPsduMap psduMap, const WifiTxVector &txVector, WifiPhyBand band) const override
Definition: he-phy.cc:941
ns3::HePhy::HePhy
HePhy(bool buildModeList=true)
Constructor for HE PHY.
Definition: he-phy.cc:70
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::HePhy::GetTxPowerSpectralDensity
Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const override
Definition: he-phy.cc:863
ns3::HtPhy::CalculateDataRate
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
ns3::WifiPhy::GetLastRxEndTime
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2160
ns3::HePhy::GetSigBDuration
Time GetSigBDuration(const WifiTxVector &txVector) const override
Definition: he-phy.cc:203
ns3::PhyEntity::DoAbortCurrentReception
virtual void DoAbortCurrentReception(WifiPhyRxfailureReason reason)
Perform amendment-specific actions before aborting the current reception.
Definition: phy-entity.cc:958
ns3::PhyEntity::GetChannelWidthAndBand
virtual std::pair< uint16_t, WifiSpectrumBand > GetChannelWidthAndBand(const WifiTxVector &txVector, uint16_t staId) const
Get the channel width and band to use (will be overloaded by child classes).
Definition: phy-entity.cc:716
ns3::PhyEntity::m_wifiPhy
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:783
ns3::PhyEntity::m_endOfMpduEvents
std::vector< EventId > m_endOfMpduEvents
the end of MPDU events (only used for A-MPDUs)
Definition: phy-entity.h:789
ns3::WifiPhy::GetPreviouslyRxPpduUid
uint64_t GetPreviouslyRxPpduUid(void) const
Definition: wifi-phy.cc:1900
ns3::HePhy::ConvertLSigLengthToHeTbPpduDuration
static Time ConvertLSigLengthToHeTbPpduDuration(uint16_t length, const WifiTxVector &txVector, WifiPhyBand band)
Definition: he-phy.cc:274
he-ppdu.h
Declaration of ns3::HePpdu class.
ns3::WifiTxVector::GetHeMuUserInfoMap
const HeMuUserInfoMap & GetHeMuUserInfoMap(void) const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
Definition: wifi-tx-vector.cc:421
ns3::HeRu::GetRuType
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:512
SU_STA_ID
#define SU_STA_ID
Definition: wifi-mode.h:32
ns3::HePhy::StartReceivePreamble
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration) override
Start receiving the PHY preamble of a PPDU (i.e.
Definition: he-phy.cc:335
ns3::WifiModeFactory::CreateWifiMcs
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
ns3::HePhy::GetRuBandForRx
WifiSpectrumBand GetRuBandForRx(const WifiTxVector &txVector, uint16_t staId) const
Get the band in the RX spectrum associated with the RU used by the PSDU transmitted to/by a given STA...
Definition: he-phy.cc:770
ns3::WifiPhy::GetPhyBand
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
ns3::WIFI_PREAMBLE_HE_MU
@ WIFI_PREAMBLE_HE_MU
Definition: wifi-phy-common.h:76
ns3::HePhy::DoStartReceivePayload
void DoStartReceivePayload(Ptr< Event > event) override
Start receiving the PSDU (i.e.
Definition: he-phy.cc:629
ns3::WifiPhy::GetOperatingChannel
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1137
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::HeRu::RuSpec::GetIndex
std::size_t GetIndex(void) const
Get the RU index.
Definition: he-ru.cc:174
ns3::Time::GetNanoSeconds
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:392
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
NS_ASSERT_MSG
#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
ns3::WifiTxVector::GetChannelWidth
uint16_t GetChannelWidth(void) const
Definition: wifi-tx-vector.cc:154
ns3::WifiTxVector::HeMuUserInfoMap
std::map< uint16_t, HeMuUserInfo > HeMuUserInfoMap
map of HE MU specific user info paramters indexed by STA-ID
Definition: wifi-tx-vector.h:74
ns3::WifiPpduField
WifiPpduField
The type of PPDU field (grouped for convenience)
Definition: wifi-phy-common.h:171
ns3::HePhy::NotifyEndOfHeSigA
void NotifyEndOfHeSigA(HeSigAParameters params)
Fire a EndOfHeSigA callback (if connected) once HE-SIG-A field has been received.
Definition: he-phy.cc:571
ns3::WifiTxVector::IsMu
bool IsMu(void) const
Return true if this TX vector is used for a multi-user transmission.
Definition: wifi-tx-vector.cc:370
ns3::HePpdu::PSD_HE_TB_NON_OFDMA_PORTION
@ PSD_HE_TB_NON_OFDMA_PORTION
preamble of HE TB PPDU, which should only be sent on minimum subset of 20 MHz channels containing RU
Definition: he-ppdu.h:161
ns3::PhyEntity::PhyFieldRxStatus::isSuccess
bool isSuccess
outcome (true if success) of the reception
Definition: phy-entity.h:113
ns3::MakeCallback
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
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::VhtPhy::GetVhtMcs2
static WifiMode GetVhtMcs2(void)
Return MCS 2 from VHT MCS values.
ns3::WifiPhy::GetDevice
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:783
NS_ABORT_IF
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
ns3::HePhy::GetSymbolDuration
Time GetSymbolDuration(const WifiTxVector &txVector) const override
Definition: he-phy.cc:309
ns3::WifiPreamble
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-phy-common.h:68
ns3::HePhy::GetPpduFormats
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: he-phy.cc:165
ns3::HePhy::DoAbortCurrentReception
void DoAbortCurrentReception(WifiPhyRxfailureReason reason) override
Perform amendment-specific actions before aborting the current reception.
Definition: he-phy.cc:387
ns3::WIFI_PPDU_TYPE_UL_MU
@ WIFI_PPDU_TYPE_UL_MU
Definition: wifi-phy-common.h:232
ns3::HePhy::GetConstellationSize
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied HE MCS index.
Definition: he-phy.cc:1060
ns3::HePhy::m_beginOfdmaPayloadRxEvents
std::map< uint16_t, EventId > m_beginOfdmaPayloadRxEvents
the beginning of the OFDMA payload reception events (indexed by STA-ID)
Definition: he-phy.h:416
ns3::WifiTxVector::GetGuardInterval
uint16_t GetGuardInterval(void) const
Definition: wifi-tx-vector.cc:160
ns3::HePhy::BuildPpdu
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: he-phy.cc:317
ns3::HePpdu::PSD_HE_TB_OFDMA_PORTION
@ PSD_HE_TB_OFDMA_PORTION
OFDMA portion of HE TB PPDU, which should only be sent on RU.
Definition: he-ppdu.h:162
ns3::WIFI_PHY_BAND_2_4GHZ
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
ns3::WifiTxVector::GetNss
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.
Definition: wifi-tx-vector.cc:172
ns3::HeRu::RuSpec::SetPhyIndex
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
Definition: he-ru.cc:188
ns3::HeSigAParameters::rssiW
double rssiW
RSSI in W.
Definition: he-phy.h:48
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::HePhy::GetDataRateFromTxVector
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId=SU_STA_ID)
Return the data rate corresponding to the supplied TXVECTOR for the STA-ID.
Definition: he-phy.cc:1095
ns3::PhyEntity::StartReceivePreamble
virtual void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: phy-entity.cc:362
ns3::HeRu::RU_26_TONE
@ RU_26_TONE
Definition: he-ru.h:43
ns3::HtPhy::CalculatePhyRate
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
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::MakeBoundCallback
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
ns3::HePhy::GetNumberBccEncoders
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: he-phy.cc:303
ns3::PhyEntity::NotifyInterferenceRxEndAndClear
void NotifyInterferenceRxEndAndClear(bool reset)
Notify WifiPhy's InterferenceHelper of the end of the reception, clear maps and end of MPDU event,...
Definition: phy-entity.cc:761
ns3::HePhy::InitializeModes
static void InitializeModes(void)
Initialize all HE modes.
Definition: he-phy.cc:970
HE_PHY
#define HE_PHY
This defines the BSS membership value for HE PHY.
Definition: he-phy.h:41
ns3::PhyEntity::CancelAllEvents
virtual void CancelAllEvents(void)
Cancel and clear all running events.
Definition: phy-entity.cc:911
ns3::HeRu::RuSpec::GetRuType
RuType GetRuType(void) const
Get the RU type.
Definition: he-ru.cc:167
ns3::WIFI_PPDU_TYPE_DL_MU
@ WIFI_PPDU_TYPE_DL_MU
Definition: wifi-phy-common.h:231
ns3::WifiPhy::GetChannelWidth
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1233
ns3::PhyEntity::GetAddressedPsduInPpdu
virtual Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Definition: phy-entity.cc:203
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802....
Definition: wifi-spectrum-value-helper.cc:329
ns3::HePhy::DoGetEvent
Ptr< Event > DoGetEvent(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW) override
Get the event corresponding to the incoming PPDU.
Definition: he-phy.cc:420
ns3::HePhy::~HePhy
virtual ~HePhy()
Destructor for HE PHY.
Definition: he-phy.cc:85
CASE
#define CASE(x)
ns3::WifiPhy::GetMaxSupportedRxSpatialStreams
uint8_t GetMaxSupportedRxSpatialStreams(void) const
Definition: wifi-phy.cc:1421
ns3::PhyEntity::ResetReceive
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the PPDU under reception after it has failed the PHY header.
Definition: phy-entity.cc:972
ns3::WifiPhyOperatingChannel::GetPrimaryChannelIndex
uint8_t GetPrimaryChannelIndex(uint16_t primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
Definition: wifi-phy-operating-channel.cc:151
ns3::HePhy::GetPhyRate
static uint64_t GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied HE MCS index, channel width, guard interval,...
Definition: he-phy.cc:1073
ns3::WIFI_PPDU_FIELD_DATA
@ WIFI_PPDU_FIELD_DATA
data field
Definition: wifi-phy-common.h:190
ns3::HeRu::FindOverlappingRu
static RuSpec FindOverlappingRu(uint16_t bw, RuSpec referenceRu, RuType searchedRuType)
Find the RU allocation of the given RU type overlapping the given reference RU allocation.
Definition: he-ru.cc:410
ns3::PhyEntity::DoStartReceivePayload
virtual void DoStartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Definition: phy-entity.cc:540
ns3::RxPowerWattPerChannelBand
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:75
ns3::WifiTxVector::GetLength
uint16_t GetLength(void) const
Get the LENGTH field of the L-SIG.
Definition: wifi-tx-vector.cc:328
ns3::VhtPhy
PHY entity for VHT (11ac)
Definition: vht-phy.h:49
ns3::HePhy::GetUsableSubcarriers
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
Definition: he-phy.cc:1120
ns3::VhtPhy::GetConstellationSize
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:405
ns3::HtPhy::GetCodeRatio
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
he-configuration.h
ns3::HePhy::GetNonHtReferenceRate
static uint64_t GetNonHtReferenceRate(uint8_t mcsValue)
Calculate the rate in bps of the non-HT Reference Rate corresponding to the supplied HE MCS index.
Definition: he-phy.cc:1143
ns3::VhtPhy::GetVhtMcs4
static WifiMode GetVhtMcs4(void)
Return MCS 4 from VHT MCS values.
ns3::WIFI_PPDU_FIELD_TRAINING
@ WIFI_PPDU_FIELD_TRAINING
STF + LTF fields (excluding those in preamble for HT-GF)
Definition: wifi-phy-common.h:187
ns3::WifiPhyBand
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
ns3::HePhy::GetCenterFrequencyForNonOfdmaPart
uint16_t GetCenterFrequencyForNonOfdmaPart(const WifiTxVector &txVector, uint16_t staId) const
Get the center frequency of the non-OFDMA part of the current TxVector for the given STA-ID.
Definition: he-phy.cc:896
ns3::HeRu::SubcarrierRange
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
ns3::WIFI_CODE_RATE_3_4
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
Definition: wifi-phy-common.h:60
ns3::HeSigAParameters
Parameters for received HE-SIG-A for OBSS_PD based SR.
Definition: he-phy.h:47
ns3::WifiTxVector::GetNumRusPerHeSigBContentChannel
std::pair< std::size_t, std::size_t > GetNumRusPerHeSigBContentChannel(void) const
Get the number of RUs per HE-SIG-B content channel.
Definition: wifi-tx-vector.cc:435
ns3::WifiMode::GetDataRate
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
ns3::PhyEntity::m_endRxPayloadEvents
std::vector< EventId > m_endRxPayloadEvents
the end of receive events (only one unless UL MU reception)
Definition: phy-entity.h:791
ns3::PhyEntity::GetTxMaskRejectionParams
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const
Definition: phy-entity.cc:1065
ns3::VhtPhy::GetVhtMcs1
static WifiMode GetVhtMcs1(void)
Return MCS 1 from VHT MCS values.
ns3::HePhy::GetDataRate
static uint64_t GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied HE MCS index, channel width, guard interval,...
Definition: he-phy.cc:1109
ns3::HePhy::GetMeasurementChannelWidth
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const override
Return the channel width used to measure the RSSI.
Definition: he-phy.cc:825
ns3::WIFI_PREAMBLE_HE_TB
@ WIFI_PREAMBLE_HE_TB
Definition: wifi-phy-common.h:77
ns3::HePhy::GetSigADuration
Time GetSigADuration(WifiPreamble preamble) const override
Definition: he-phy.cc:197
ns3::PhyEntity::m_globalPpduUid
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
Definition: phy-entity.h:801
ns3::WifiPhy::GetStaticPhyEntity
static const Ptr< const PhyEntity > GetStaticPhyEntity(WifiModulationClass modulation)
Get the implemented PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:870
ns3::HePhy::CreateHeMcs
static WifiMode CreateHeMcs(uint8_t index)
Create and return the HE MCS corresponding to the provided index.
Definition: he-phy.cc:1029
ns3::HePhy::GetWifiConstPsduMap
WifiConstPsduMap GetWifiConstPsduMap(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector) const override
Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
Definition: he-phy.cc:1179
ns3::WIFI_PPDU_FIELD_SIG_B
@ WIFI_PPDU_FIELD_SIG_B
SIG-B field.
Definition: wifi-phy-common.h:189
ns3::PhyEntity::UpdateInterferenceEvent
void UpdateInterferenceEvent(Ptr< Event > event, const RxPowerWattPerChannelBand &rxPower)
Update an event in WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:755
ns3::WIFI_PPDU_FIELD_NON_HT_HEADER
@ 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...
Definition: wifi-phy-common.h:185
ns3::WifiTxVector::IsDlMu
bool IsDlMu(void) const
Return true if this TX vector is used for a downlink multi-user transmission.
Definition: wifi-tx-vector.cc:376
ns3::HeRu::GetSubcarrierGroup
static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t phyIndex)
Get the subcarrier group of the RU having the given PHY index among all the RUs of the given type (nu...
Definition: he-ru.cc:313
ns3::VhtPhy::GetCodeRate
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:391
ns3::WifiTxVector::GetMode
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.
Definition: wifi-tx-vector.cc:112
ns3::PhyEntity::DROP
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:102
ns3::HePhy::GetSigBMode
WifiMode GetSigBMode(const WifiTxVector &txVector) const override
Definition: he-phy.cc:132
ns3::HePhy::GetHeMcs
static WifiMode GetHeMcs(uint8_t index)
Return the HE MCS corresponding to the provided index.
Definition: he-phy.cc:979
ns3::WifiNetDevice::GetMac
Ptr< WifiMac > GetMac(void) const
Definition: wifi-net-device.cc:201
ns3::HePhy::DoResetReceive
void DoResetReceive(Ptr< Event > event) override
Perform amendment-specific actions before resetting PHY at the end of the PPDU under reception after ...
Definition: he-phy.cc:405
ns3::VhtPhy::GetSigMode
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
ns3::WifiMode::GetMcsValue
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:137
NS_ABORT_MSG
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50