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.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
110  {
111  //Training comes after SIG-B
112  return GetSigBMode (txVector);
113  }
114  else
115  {
116  //Training comes after SIG-A
117  return GetSigAMode ();
118  }
119  default:
120  return VhtPhy::GetSigMode (field, txVector);
121  }
122 }
123 
124 WifiMode
125 HePhy::GetSigAMode (void) const
126 {
127  return GetVhtMcs0 (); //same number of data tones as VHT for 20 MHz (i.e. 52)
128 }
129 
130 WifiMode
131 HePhy::GetSigBMode (const WifiTxVector& txVector) const
132 {
133  NS_ABORT_MSG_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_HE_MU, "HE-SIG-B only available for HE MU");
140  uint8_t smallestMcs = 5; //maximum MCS for HE-SIG-B
141  for (auto & info : txVector.GetHeMuUserInfoMap ())
142  {
143  smallestMcs = std::min (smallestMcs, info.second.mcs.GetMcsValue ());
144  }
145  switch (smallestMcs) //GetVhtMcs (mcs) is not static
146  {
147  case 0:
148  return GetVhtMcs0 ();
149  case 1:
150  return GetVhtMcs1 ();
151  case 2:
152  return GetVhtMcs2 ();
153  case 3:
154  return GetVhtMcs3 ();
155  case 4:
156  return GetVhtMcs4 ();
157  case 5:
158  default:
159  return GetVhtMcs5 ();
160  }
161 }
162 
165 {
166  return m_hePpduFormats;
167 }
168 
169 Time
170 HePhy::GetLSigDuration (WifiPreamble /* preamble */) const
171 {
172  return MicroSeconds (8); //L-SIG + RL-SIG
173 }
174 
175 Time
177  uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
178 {
179  Time ltfDuration = MicroSeconds (8); //TODO extract from TxVector when available
180  Time stfDuration = (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB) ? MicroSeconds (8) : MicroSeconds (4);
181  NS_ABORT_MSG_IF (nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for HE");
182  NS_ABORT_MSG_IF (nExtensionLtf > 0, "No extension LTFs expected for HE");
183  return stfDuration + ltfDuration * nDataLtf; //HE-STF + HE-LTFs
184 }
185 
186 Time
188 {
189  return (preamble == WIFI_PREAMBLE_HE_ER_SU) ? MicroSeconds (16) : MicroSeconds (8); //HE-SIG-A (first and second symbol)
190 }
191 
192 Time
193 HePhy::GetSigBDuration (const WifiTxVector& txVector) const
194 {
195  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU) //See section 27.3.10.8 of IEEE 802.11ax draft 4.0.
196  {
197  /*
198  * Compute the number of bits used by common field.
199  * Assume that compression bit in HE-SIG-A is not set (i.e. not
200  * full band MU-MIMO); the field is present.
201  */
202  uint16_t bw = txVector.GetChannelWidth ();
203  std::size_t commonFieldSize = 4 /* CRC */ + 6 /* tail */;
204  if (bw <= 40)
205  {
206  commonFieldSize += 8; //only one allocation subfield
207  }
208  else
209  {
210  commonFieldSize += 8 * (bw / 40) /* one allocation field per 40 MHz */ + 1 /* center RU */;
211  }
212 
213  /*
214  * Compute the number of bits used by user-specific field.
215  * MU-MIMO is not supported; only one station per RU.
216  * The user-specific field is composed of N user block fields
217  * spread over each corresponding HE-SIG-B content channel.
218  * Each user block field contains either two or one users' data
219  * (the latter being for odd number of stations per content channel).
220  * Padding will be handled further down in the code.
221  */
222  std::pair<std::size_t, std::size_t> numStaPerContentChannel = txVector.GetNumRusPerHeSigBContentChannel ();
223  std::size_t maxNumStaPerContentChannel = std::max (numStaPerContentChannel.first, numStaPerContentChannel.second);
224  std::size_t maxNumUserBlockFields = maxNumStaPerContentChannel / 2; //handle last user block with single user, if any, further down
225  std::size_t userSpecificFieldSize = maxNumUserBlockFields * (2 * 21 /* user fields (2 users) */ + 4 /* tail */ + 6 /* CRC */);
226  if (maxNumStaPerContentChannel % 2 != 0)
227  {
228  userSpecificFieldSize += 21 /* last user field */ + 4 /* CRC */ + 6 /* tail */;
229  }
230 
231  /*
232  * Compute duration of HE-SIG-B considering that padding
233  * is added up to the next OFDM symbol.
234  * Nss = 1 and GI = 800 ns for HE-SIG-B.
235  */
236  Time symbolDuration = MicroSeconds (4);
237  double numDataBitsPerSymbol = GetSigBMode (txVector).GetDataRate (20, 800, 1) * symbolDuration.GetNanoSeconds () / 1e9;
238  double numSymbols = ceil ((commonFieldSize + userSpecificFieldSize) / numDataBitsPerSymbol);
239 
240  return FemtoSeconds (static_cast<uint64_t> (numSymbols * symbolDuration.GetFemtoSeconds ()));
241  }
242  else
243  {
244  // no SIG-B
245  return MicroSeconds (0);
246  }
247 }
248 
249 uint16_t
251 {
252  uint8_t sigExtension = 0;
253  if (band == WIFI_PHY_BAND_2_4GHZ)
254  {
255  sigExtension = 6;
256  }
257  uint8_t m = 2; //HE TB PPDU so m is set to 2
258  uint16_t length = ((ceil ((static_cast<double> (ppduDuration.GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3 - m);
259  return length;
260 }
261 
262 Time
264 {
266  Time tSymbol = NanoSeconds (12800 + txVector.GetGuardInterval ());
267  Time preambleDuration = WifiPhy::GetStaticPhyEntity (WIFI_MOD_CLASS_HE)->CalculatePhyPreambleAndHeaderDuration (txVector); //this is quite convoluted but only way of keeping the method static
268  uint8_t sigExtension = 0;
269  if (band == WIFI_PHY_BAND_2_4GHZ)
270  {
271  sigExtension = 6;
272  }
273  uint8_t m = 2; //HE TB PPDU so m is set to 2
274  //Equation 27-11 of IEEE P802.11ax/D4.0
275  Time calculatedDuration = MicroSeconds (((ceil (static_cast<double> (length + 3 + m) / 3)) * 4) + 20 + sigExtension);
276  uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds () - (sigExtension * 1000)) / tSymbol.GetNanoSeconds ());
277  Time ppduDuration = preambleDuration + (nSymbols * tSymbol) + MicroSeconds (sigExtension);
278  return ppduDuration;
279 }
280 
281 Time
283 {
285  Time duration = GetDuration (WIFI_PPDU_FIELD_PREAMBLE, txVector)
287  + GetDuration (WIFI_PPDU_FIELD_SIG_A, txVector);
288  return duration;
289 }
290 
291 uint8_t
292 HePhy::GetNumberBccEncoders (const WifiTxVector& /* txVector */) const
293 {
294  return 1; //only 1 BCC encoder for HE since higher rates are obtained using LDPC
295 }
296 
297 Time
298 HePhy::GetSymbolDuration (const WifiTxVector& txVector) const
299 {
300  uint16_t gi = txVector.GetGuardInterval ();
301  NS_ASSERT (gi == 800 || gi == 1600 || gi == 3200);
302  return NanoSeconds (12800 + gi);
303 }
304 
306 HePhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
307 {
308  NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
309  HePpdu::TxPsdFlag flag = (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB) ?
312  return Create<HePpdu> (psdus, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
313  ObtainNextUid (txVector), flag);
314 }
315 
316 void
318  Time rxDuration)
319 {
320  NS_LOG_FUNCTION (this << ppdu << rxDuration);
321  const WifiTxVector& txVector = ppdu->GetTxVector ();
322  auto hePpdu = DynamicCast<HePpdu> (ppdu);
323  NS_ASSERT (hePpdu);
324  HePpdu::TxPsdFlag psdFlag = hePpdu->GetTxPsdFlag ();
325  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB
326  && psdFlag == HePpdu::PSD_HE_TB_OFDMA_PORTION)
327  {
328  if (m_currentHeTbPpduUid == ppdu->GetUid ()
329  && GetCurrentEvent () != 0)
330  {
331  //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)
332  bool ofdmaStarted = !m_beginOfdmaPayloadRxEvents.empty ();
333  NS_LOG_INFO ("Switch to OFDMA part (already started? " << (ofdmaStarted ? "Y" : "N") << ") " <<
334  "and schedule OFDMA payload reception in " << GetDuration (WIFI_PPDU_FIELD_TRAINING, txVector).As (Time::NS));
335  Ptr<Event> event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW, !ofdmaStarted);
336  uint16_t staId = GetStaId (ppdu);
339  &HePhy::StartReceiveOfdmaPayload, this, event);
340  }
341  else
342  {
343  //PHY receives the OFDMA payload while having dropped the preamble
344  NS_LOG_INFO ("Consider OFDMA part of the HE TB PPDU as interference since device dropped the preamble");
345  CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW);
346  //the OFDMA part of the HE TB PPDUs will be noise _after_ the completion of the current event
347  ErasePreambleEvent (ppdu, rxDuration);
348  }
349  }
350  else
351  {
352  PhyEntity::StartReceivePreamble (ppdu, rxPowersW, rxDuration);
353  }
354 }
355 
356 void
358 {
359  NS_LOG_FUNCTION (this);
360  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
361  {
362  beginOfdmaPayloadRxEvent.second.Cancel ();
363  }
366 }
367 
368 void
370 {
371  NS_LOG_FUNCTION (this << reason);
372  if (reason != OBSS_PD_CCA_RESET)
373  {
374  for (auto & endMpduEvent : m_endOfMpduEvents)
375  {
376  endMpduEvent.Cancel ();
377  }
378  m_endOfMpduEvents.clear ();
379  }
380  else
381  {
383  }
384 }
385 
386 void
388 {
389  NS_LOG_FUNCTION (this << *event);
390  if (event->GetPpdu ()->GetType () != WIFI_PPDU_TYPE_UL_MU)
391  {
392  NS_ASSERT (event->GetEndTime () == Simulator::Now ());
393  }
394  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
395  {
396  beginOfdmaPayloadRxEvent.second.Cancel ();
397  }
399 }
400 
403 {
404  Ptr<Event> event;
405  //We store all incoming preamble events, and a decision is made at the end of the preamble detection window.
406  //If a preamble is received after the preamble detection window, it is stored anyway because this is needed for HE TB PPDUs in
407  //order to properly update the received power in InterferenceHelper. The map is cleaned anyway at the end of the current reception.
408  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
409  {
410  auto uidPreamblePair = std::make_pair (ppdu->GetUid (), ppdu->GetPreamble ());
411  const WifiTxVector& txVector = ppdu->GetTxVector ();
412  Time rxDuration = CalculateNonOfdmaDurationForHeTb (txVector); //the OFDMA part of the transmission will be added later on
413  const auto & currentPreambleEvents = GetCurrentPreambleEvents ();
414  auto it = currentPreambleEvents.find (uidPreamblePair);
415  if (it != currentPreambleEvents.end ())
416  {
417  NS_LOG_DEBUG ("Received another HE TB PPDU for UID " << ppdu->GetUid () << " from STA-ID " << ppdu->GetStaId () << " and BSS color " << +txVector.GetBssColor ());
418  event = it->second;
419  if (Simulator::Now () - event->GetStartTime () > NanoSeconds (400))
420  {
421  //Section 27.3.14.3 from 802.11ax Draft 4.0: Pre-correction accuracy requirements.
422  //A STA that transmits an HE TB PPDU, non-HT PPDU, or non-HT duplicate PPDU in response to a triggering PPDU
423  //shall ensure that the transmission start time of the HE TB PPDU, non-HT PPDU, or non-HT duplicate PPDU is
424  //within ±0.4 µs + 16 µs from the end, at the STA’s antenna connector, of the last OFDM symbol of the triggering
425  //PPDU (if it contains no PE field) or of the PE field of the triggering PPDU (if the PE field is present).
426  //As a result, if an HE TB PPDU arrives later than 0.4 µs, it is added as an interference but PPDU is dropped.
427  event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW);
428  NS_LOG_DEBUG ("Drop packet because not received within the 400ns window");
430  }
431  else
432  {
433  //Update received power of the event associated to that UL MU transmission
434  UpdateInterferenceEvent (event, rxPowersW);
435  }
436  if ((GetCurrentEvent () != 0) && (GetCurrentEvent ()->GetPpdu ()->GetUid () != ppdu->GetUid ()))
437  {
438  NS_LOG_DEBUG ("Drop packet because already receiving another HE TB PPDU");
440  }
441  return nullptr;
442  }
443  else
444  {
445  NS_LOG_DEBUG ("Received a new HE TB PPDU for UID " << ppdu->GetUid () << " from STA-ID " << ppdu->GetStaId () << " and BSS color " << +txVector.GetBssColor ());
446  event = CreateInterferenceEvent (ppdu, txVector, rxDuration, rxPowersW);
447  AddPreambleEvent (event);
448  }
449  }
450  else
451  {
452  event = PhyEntity::DoGetEvent (ppdu, rxPowersW);
453  }
454  return event;
455 }
456 
459 {
460  if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU || ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
461  {
462  auto hePpdu = DynamicCast<const HePpdu> (ppdu);
463  NS_ASSERT (hePpdu);
464  return hePpdu->GetPsdu (GetBssColor (), GetStaId (ppdu));
465  }
466  return PhyEntity::GetAddressedPsduInPpdu (ppdu);
467 }
468 
469 uint8_t
470 HePhy::GetBssColor (void) const
471 {
472  uint8_t bssColor = 0;
473  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
474  if (device)
475  {
476  Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
477  if (heConfiguration)
478  {
479  bssColor = heConfiguration->GetBssColor ();
480  }
481  }
482  return bssColor;
483 }
484 
485 uint16_t
487 {
488  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
489  {
490  return ppdu->GetStaId ();
491  }
492  else if (ppdu->GetType () == WIFI_PPDU_TYPE_DL_MU)
493  {
494  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
495  if (device)
496  {
497  Ptr<StaWifiMac> mac = DynamicCast<StaWifiMac> (device->GetMac ());
498  if (mac && mac->IsAssociated ())
499  {
500  return mac->GetAssociationId ();
501  }
502  }
503  }
504  return PhyEntity::GetStaId (ppdu);
505 }
506 
509 {
510  NS_LOG_FUNCTION (this << *event << status);
511  //Notify end of SIG-A (in all cases)
512  HeSigAParameters params;
513  params.rssiW = GetRxPowerWForPpdu (event);
514  params.bssColor = event->GetTxVector ().GetBssColor ();
515  NotifyEndOfHeSigA (params); //if OBSS_PD CCA_RESET, set power restriction first and wait till field is processed before switching to IDLE
516 
517  if (status.isSuccess)
518  {
519  //Check if PPDU is filtered based on the BSS color
520  uint8_t myBssColor = GetBssColor ();
521  uint8_t rxBssColor = event->GetTxVector ().GetBssColor ();
522  if (myBssColor != 0 && rxBssColor != 0 && myBssColor != rxBssColor)
523  {
524  NS_LOG_DEBUG ("The BSS color of this PPDU (" << +rxBssColor << ") does not match the device's (" << +myBssColor << "). The PPDU is filtered.");
525  return PhyFieldRxStatus (false, FILTERED, DROP);
526  }
527 
528  Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
529  if (event->GetTxVector ().GetPreambleType () == WIFI_PREAMBLE_HE_TB)
530  {
531  m_currentHeTbPpduUid = ppdu->GetUid (); //to be able to correctly schedule start of OFDMA payload
532  }
533 
534  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
535  {
536  NS_ASSERT (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU);
537  NS_LOG_DEBUG ("No PSDU addressed to that PHY in the received MU PPDU. The PPDU is filtered.");
538  return PhyFieldRxStatus (false, FILTERED, DROP);
539  }
540  }
541  return status;
542 }
543 
544 void
546 {
547  m_endOfHeSigACallback = callback;
548 }
549 
550 void
552 {
554  {
555  m_endOfHeSigACallback (params);
556  }
557 }
558 
561 {
562  NS_LOG_FUNCTION (this << *event << status);
563  if (status.isSuccess)
564  {
565  //Check if PPDU is filtered only if the SIG-B content is supported (not explicitly stated but assumed based on behavior for SIG-A)
566  if (!GetAddressedPsduInPpdu (event->GetPpdu ()))
567  {
568  NS_LOG_DEBUG ("No PSDU addressed to that PHY in the received MU PPDU. The PPDU is filtered.");
569  return PhyFieldRxStatus (false, FILTERED, DROP);
570  }
571  }
572  return status;
573 }
574 
575 bool
577 {
578  const WifiTxVector& txVector = ppdu->GetTxVector ();
579  uint16_t staId = GetStaId (ppdu);
580  WifiMode txMode = txVector.GetMode (staId);
581  uint8_t nss = txVector.GetNssMax ();
582  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
583  {
584  for (auto info : txVector.GetHeMuUserInfoMap ())
585  {
586  if (info.first == staId)
587  {
588  nss = info.second.nss; //no need to look at other PSDUs
589  break;
590  }
591  }
592  }
593 
595  {
596  NS_LOG_DEBUG ("Packet reception could not be started because not enough RX antennas");
597  return false;
598  }
599  if (!IsModeSupported (txMode))
600  {
601  NS_LOG_DEBUG ("Drop packet because it was sent using an unsupported mode (" << txVector.GetMode () << ")");
602  return false;
603  }
604  return true;
605 }
606 
607 void
609 {
610  NS_LOG_FUNCTION (this << *event);
611  const WifiTxVector& txVector = event->GetTxVector ();
612  Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
613  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
614  {
615  Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
616  bool isAp = device != 0 && (DynamicCast<ApWifiMac> (device->GetMac ()) != 0);
617  if (!isAp)
618  {
619  NS_LOG_DEBUG ("Ignore HE TB PPDU payload received by STA but keep state in Rx");
620  m_endRxPayloadEvents.push_back (Simulator::Schedule (ppdu->GetTxDuration () - CalculatePhyPreambleAndHeaderDuration (txVector),
621  &PhyEntity::ResetReceive, this, event));
622  //Cancel all scheduled events for OFDMA payload reception
623  NS_ASSERT (!m_beginOfdmaPayloadRxEvents.empty () && m_beginOfdmaPayloadRxEvents.begin ()->second.IsRunning ());
624  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
625  {
626  beginOfdmaPayloadRxEvent.second.Cancel ();
627  }
629  }
630  else
631  {
632  NS_LOG_DEBUG ("Receiving PSDU in HE TB PPDU");
633  uint16_t staId = GetStaId (ppdu);
634  m_signalNoiseMap.insert ({std::make_pair (ppdu->GetUid (), staId), SignalNoiseDbm ()});
635  m_statusPerMpduMap.insert ({std::make_pair (ppdu->GetUid (), staId), std::vector<bool> ()});
636  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
637  {
638  //for HE TB PPDUs, ScheduleEndOfMpdus and EndReceive are scheduled by StartReceiveOfdmaPayload
639  NS_ASSERT (isAp);
641  for (auto & beginOfdmaPayloadRxEvent : m_beginOfdmaPayloadRxEvents)
642  {
643  NS_ASSERT (beginOfdmaPayloadRxEvent.second.IsRunning ());
644  }
645  }
646  }
647  }
648  else
649  {
651  }
652 }
653 
654 void
656 {
657  NS_LOG_FUNCTION (this << ppdu);
658  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
659  {
660  for (auto it = m_endRxPayloadEvents.begin (); it != m_endRxPayloadEvents.end (); )
661  {
662  if (it->IsExpired ())
663  {
664  it = m_endRxPayloadEvents.erase (it);
665  }
666  else
667  {
668  it++;
669  }
670  }
671  if (m_endRxPayloadEvents.empty ())
672  {
673  //We've got the last PPDU of the UL-OFDMA transmission
674  NotifyInterferenceRxEndAndClear (true); //reset WifiPhy
675  }
676  }
677  else
678  {
681  }
682 }
683 
684 void
686 {
687  Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
688  const RxPowerWattPerChannelBand& rxPowersW = event->GetRxPowerWPerBand ();
689  //The total RX power corresponds to the maximum over all the bands.
690  //Only perform this computation if the result needs to be logged.
691  auto it = rxPowersW.end ();
692  if (g_log.IsEnabled (ns3::LOG_FUNCTION))
693  {
694  it = std::max_element (rxPowersW.begin (), rxPowersW.end (),
695  [] (const std::pair<WifiSpectrumBand, double> &p1, const std::pair<WifiSpectrumBand, double> &p2) {
696  return p1.second < p2.second;
697  });
698 
699  }
700  NS_LOG_FUNCTION (this << *event << it->second);
701  NS_ASSERT (GetCurrentEvent () != 0);
702  auto itEvent = m_beginOfdmaPayloadRxEvents.find (GetStaId (ppdu));
708  NS_ASSERT (itEvent != m_beginOfdmaPayloadRxEvents.end () && itEvent->second.IsExpired ());
709  m_beginOfdmaPayloadRxEvents.erase (itEvent);
710 
711  Time payloadDuration = ppdu->GetTxDuration () - CalculatePhyPreambleAndHeaderDuration (ppdu->GetTxVector ());
713  ScheduleEndOfMpdus (event);
714  m_endRxPayloadEvents.push_back (Simulator::Schedule (payloadDuration, &PhyEntity::EndReceivePayload, this, event));
715  m_signalNoiseMap.insert ({std::make_pair (ppdu->GetUid (), ppdu->GetStaId ()), SignalNoiseDbm ()});
716  m_statusPerMpduMap.insert ({std::make_pair (ppdu->GetUid (), ppdu->GetStaId ()), std::vector<bool> ()});
717 }
718 
719 std::pair<uint16_t, WifiSpectrumBand>
720 HePhy::GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t staId) const
721 {
722  if (txVector.IsMu ())
723  {
724  return std::make_pair (HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ()),
725  GetRuBandForRx (txVector, staId));
726  }
727  else
728  {
729  return PhyEntity::GetChannelWidthAndBand (txVector, staId);
730  }
731 }
732 
734 HePhy::GetRuBandForTx (const WifiTxVector& txVector, uint16_t staId) const
735 {
736  NS_ASSERT (txVector.IsMu ());
737  WifiSpectrumBand band;
738  HeRu::RuSpec ru = txVector.GetRu (staId);
739  uint16_t channelWidth = txVector.GetChannelWidth ();
740  NS_ASSERT (channelWidth <= m_wifiPhy->GetChannelWidth ());
741  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (channelWidth, ru.GetRuType (), ru.GetPhyIndex ());
742  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
743  // for a TX spectrum, the guard bandwidth is a function of the transmission channel width
744  // and the spectrum width equals the transmission channel width (hence bandIndex equals 0)
745  band = m_wifiPhy->ConvertHeRuSubcarriers (channelWidth, GetGuardBandwidth (channelWidth),
746  range, 0);
747  return band;
748 }
749 
751 HePhy::GetRuBandForRx (const WifiTxVector& txVector, uint16_t staId) const
752 {
753  NS_ASSERT (txVector.IsMu ());
754  WifiSpectrumBand band;
755  HeRu::RuSpec ru = txVector.GetRu (staId);
756  uint16_t channelWidth = txVector.GetChannelWidth ();
757  NS_ASSERT (channelWidth <= m_wifiPhy->GetChannelWidth ());
758  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (channelWidth, ru.GetRuType (), ru.GetPhyIndex ());
759  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
760  // for an RX spectrum, the guard bandwidth is a function of the operating channel width
761  // and the spectrum width equals the operating channel width
763  range, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (channelWidth));
764  return band;
765 }
766 
768 HePhy::GetNonOfdmaBand (const WifiTxVector& txVector, uint16_t staId) const
769 {
771  uint16_t channelWidth = txVector.GetChannelWidth ();
772  NS_ASSERT (channelWidth <= m_wifiPhy->GetChannelWidth ());
773 
774  HeRu::RuSpec ru = txVector.GetRu (staId);
775  uint16_t nonOfdmaWidth = GetNonOfdmaWidth (ru);
776 
777  // Find the RU that encompasses the non-OFDMA part of the HE TB PPDU for the STA-ID
778  HeRu::RuSpec nonOfdmaRu = HeRu::FindOverlappingRu (channelWidth, ru, HeRu::GetRuType (nonOfdmaWidth));
779  nonOfdmaRu.SetPhyIndex (channelWidth, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (20));
780 
781  HeRu::SubcarrierGroup groupPreamble = HeRu::GetSubcarrierGroup (channelWidth, nonOfdmaRu.GetRuType (), nonOfdmaRu.GetPhyIndex ());
782  HeRu::SubcarrierRange range = std::make_pair (groupPreamble.front ().first, groupPreamble.back ().second);
783  return m_wifiPhy->ConvertHeRuSubcarriers (channelWidth, GetGuardBandwidth (m_wifiPhy->GetChannelWidth ()), range,
785 }
786 
787 uint16_t
789 {
790  if (ru.GetRuType () == HeRu::RU_26_TONE && ru.GetIndex () == 19)
791  {
792  // the center 26-tone RU in an 80 MHz channel is not fully covered by
793  // any 20 MHz channel, but only by an 80 MHz channel
794  return 80;
795  }
796  return std::max<uint16_t> (HeRu::GetBandwidth (ru.GetRuType ()), 20);
797 }
798 
799 uint64_t
801 {
802  return m_currentHeTbPpduUid;
803 }
804 
805 uint16_t
807 {
808  uint16_t channelWidth = PhyEntity::GetMeasurementChannelWidth (ppdu);
816  if (channelWidth >= 40 && ppdu->GetUid () != m_previouslyTxPpduUid)
817  {
818  channelWidth = 20;
819  }
820  return channelWidth;
821 }
822 
823 uint64_t
825 {
826  NS_LOG_FUNCTION (this << txVector);
827  uint64_t uid;
828  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
829  {
830  //Use UID of PPDU containing trigger frame to identify resulting HE TB PPDUs, since the latter should immediately follow the former
832  NS_ASSERT (uid != UINT64_MAX);
833  }
834  else
835  {
836  uid = m_globalPpduUid++;
837  }
838  m_previouslyTxPpduUid = uid; //to be able to identify solicited HE TB PPDUs
839  return uid;
840 }
841 
844 {
845  const WifiTxVector& txVector = ppdu->GetTxVector ();
846  uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
847  uint16_t channelWidth = txVector.GetChannelWidth ();
848  NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW);
849  auto hePpdu = DynamicCast<const HePpdu> (ppdu);
850  NS_ASSERT (hePpdu);
851  HePpdu::TxPsdFlag flag = hePpdu->GetTxPsdFlag ();
854  {
855  WifiSpectrumBand band = GetRuBandForTx (txVector, GetStaId (hePpdu));
856  v = WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity (centerFrequency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth), band);
857  }
858  else
859  {
861  {
862  //non-OFDMA portion is sent only on the 20 MHz channels covering the RU
863  uint16_t staId = GetStaId (hePpdu);
864  centerFrequency = GetCenterFrequencyForNonOfdmaPart (txVector, staId);
865  uint16_t ruWidth = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
866  channelWidth = ruWidth < 20 ? 20 : ruWidth;
867  }
868  const auto & txMaskRejectionParams = GetTxMaskRejectionParams ();
869  v = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (centerFrequency, channelWidth, txPowerW, GetGuardBandwidth (channelWidth),
870  std::get<0> (txMaskRejectionParams), std::get<1> (txMaskRejectionParams), std::get<2> (txMaskRejectionParams));
871  }
872  return v;
873 }
874 
875 uint16_t
876 HePhy::GetCenterFrequencyForNonOfdmaPart (const WifiTxVector& txVector, uint16_t staId) const
877 {
878  NS_LOG_FUNCTION (this << txVector << staId);
880  uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
881  uint16_t currentWidth = txVector.GetChannelWidth ();
882 
883  HeRu::RuSpec ru = txVector.GetRu (staId);
884  uint16_t nonOfdmaWidth = GetNonOfdmaWidth (ru);
885  if (nonOfdmaWidth != currentWidth)
886  {
887  //Obtain the index of the non-OFDMA portion
888  HeRu::RuSpec nonOfdmaRu = HeRu::FindOverlappingRu (currentWidth, ru, HeRu::GetRuType (nonOfdmaWidth));
889  nonOfdmaRu.SetPhyIndex (currentWidth, m_wifiPhy->GetOperatingChannel ().GetPrimaryChannelIndex (20));
890 
891  uint16_t startingFrequency = centerFrequency - (currentWidth / 2);
892  centerFrequency = startingFrequency + nonOfdmaWidth * (nonOfdmaRu.GetPhyIndex () - 1) + nonOfdmaWidth / 2;
893  }
894  return centerFrequency;
895 }
896 
897 void
899 {
900  NS_LOG_FUNCTION (this << ppdu);
901  if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
902  {
903  //non-OFDMA part
904  Time nonOfdmaDuration = CalculateNonOfdmaDurationForHeTb (ppdu->GetTxVector ());
905  Transmit (nonOfdmaDuration, ppdu, "non-OFDMA transmission");
906 
907  //OFDMA part
908  auto hePpdu = DynamicCast<HePpdu> (ppdu->Copy ()); //since flag will be modified
909  NS_ASSERT (hePpdu);
910  hePpdu->SetTxPsdFlag (HePpdu::PSD_HE_TB_OFDMA_PORTION);
911  Time ofdmaDuration = ppdu->GetTxDuration () - nonOfdmaDuration;
912  Simulator::Schedule (nonOfdmaDuration, &PhyEntity::Transmit, this, ofdmaDuration, hePpdu, "OFDMA transmission");
913  }
914  else
915  {
916  PhyEntity::StartTx (ppdu);
917  }
918 }
919 
920 Time
922 {
923  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
924  {
925  return ConvertLSigLengthToHeTbPpduDuration (txVector.GetLength (), txVector, band);
926  }
927 
928  Time maxDuration = Seconds (0);
929  for (auto & staIdPsdu : psduMap)
930  {
931  if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
932  {
933  WifiTxVector::HeMuUserInfoMap userInfoMap = txVector.GetHeMuUserInfoMap ();
934  NS_ABORT_MSG_IF (userInfoMap.find (staIdPsdu.first) == userInfoMap.end (), "STA-ID in psduMap (" << staIdPsdu.first << ") should be referenced in txVector");
935  }
936  Time current = WifiPhy::CalculateTxDuration (staIdPsdu.second->GetSize (), txVector, band,
937  staIdPsdu.first);
938  if (current > maxDuration)
939  {
940  maxDuration = current;
941  }
942  }
943  NS_ASSERT (maxDuration.IsStrictlyPositive ());
944  return maxDuration;
945 }
946 
947 void
949 {
950  for (uint8_t i = 0; i < 12; ++i)
951  {
952  GetHeMcs (i);
953  }
954 }
955 
956 WifiMode
957 HePhy::GetHeMcs (uint8_t index)
958 {
959 #define CASE(x) \
960 case x: \
961  return GetHeMcs ## x (); \
962 
963  switch (index)
964  {
965  CASE ( 0)
966  CASE ( 1)
967  CASE ( 2)
968  CASE ( 3)
969  CASE ( 4)
970  CASE ( 5)
971  CASE ( 6)
972  CASE ( 7)
973  CASE ( 8)
974  CASE ( 9)
975  CASE (10)
976  CASE (11)
977  default:
978  NS_ABORT_MSG ("Inexistent index (" << +index << ") requested for HE");
979  return WifiMode ();
980  }
981 #undef CASE
982 }
983 
984 #define GET_HE_MCS(x) \
985 WifiMode \
986 HePhy::GetHeMcs ## x (void) \
987 { \
988  static WifiMode mcs = CreateHeMcs (x); \
989  return mcs; \
990 }; \
991 
992 GET_HE_MCS (0)
993 GET_HE_MCS (1)
994 GET_HE_MCS (2)
995 GET_HE_MCS (3)
996 GET_HE_MCS (4)
997 GET_HE_MCS (5)
998 GET_HE_MCS (6)
999 GET_HE_MCS (7)
1000 GET_HE_MCS (8)
1001 GET_HE_MCS (9)
1002 GET_HE_MCS (10)
1003 GET_HE_MCS (11)
1004 #undef GET_HE_MCS
1005 
1006 WifiMode
1007 HePhy::CreateHeMcs (uint8_t index)
1008 {
1009  NS_ASSERT_MSG (index <= 11, "HeMcs index must be <= 11!");
1010  return WifiModeFactory::CreateWifiMcs ("HeMcs" + std::to_string (index),
1011  index,
1013  MakeBoundCallback (&GetCodeRate, index),
1015  MakeBoundCallback (&GetPhyRate, index),
1017  MakeBoundCallback (&GetDataRate, index),
1021 }
1022 
1024 HePhy::GetCodeRate (uint8_t mcsValue)
1025 {
1026  switch (mcsValue)
1027  {
1028  case 10:
1029  return WIFI_CODE_RATE_3_4;
1030  case 11:
1031  return WIFI_CODE_RATE_5_6;
1032  default:
1033  return VhtPhy::GetCodeRate (mcsValue);
1034  }
1035 }
1036 
1037 uint16_t
1039 {
1040  switch (mcsValue)
1041  {
1042  case 10:
1043  case 11:
1044  return 1024;
1045  default:
1046  return VhtPhy::GetConstellationSize (mcsValue);
1047  }
1048 }
1049 
1050 uint64_t
1051 HePhy::GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
1052 {
1053  WifiCodeRate codeRate = GetCodeRate (mcsValue);
1054  uint64_t dataRate = GetDataRate (mcsValue, channelWidth, guardInterval, nss);
1055  return HtPhy::CalculatePhyRate (codeRate, dataRate);
1056 }
1057 
1058 uint64_t
1059 HePhy::GetPhyRateFromTxVector (const WifiTxVector& txVector, uint16_t staId /* = SU_STA_ID */)
1060 {
1061  uint16_t bw = txVector.GetChannelWidth ();
1062  if (txVector.IsMu ())
1063  {
1064  bw = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
1065  }
1066  return HePhy::GetPhyRate (txVector.GetMode (staId).GetMcsValue (),
1067  bw,
1068  txVector.GetGuardInterval (),
1069  txVector.GetNss (staId));
1070 }
1071 
1072 uint64_t
1073 HePhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId /* = SU_STA_ID */)
1074 {
1075  uint16_t bw = txVector.GetChannelWidth ();
1076  if (txVector.IsMu ())
1077  {
1078  bw = HeRu::GetBandwidth (txVector.GetRu (staId).GetRuType ());
1079  }
1080  return HePhy::GetDataRate (txVector.GetMode (staId).GetMcsValue (),
1081  bw,
1082  txVector.GetGuardInterval (),
1083  txVector.GetNss (staId));
1084 }
1085 
1086 uint64_t
1087 HePhy::GetDataRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
1088 {
1089  NS_ASSERT (guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200);
1090  NS_ASSERT (nss <= 8);
1091  return HtPhy::CalculateDataRate (12.8, guardInterval,
1092  GetUsableSubcarriers (channelWidth),
1093  static_cast<uint16_t> (log2 (GetConstellationSize (mcsValue))),
1094  HtPhy::GetCodeRatio (GetCodeRate (mcsValue)), nss);
1095 }
1096 
1097 uint16_t
1098 HePhy::GetUsableSubcarriers (uint16_t channelWidth)
1099 {
1100  switch (channelWidth)
1101  {
1102  case 2: //26-tone RU
1103  return 24;
1104  case 4: //52-tone RU
1105  return 48;
1106  case 8: //106-tone RU
1107  return 102;
1108  case 20:
1109  default:
1110  return 234;
1111  case 40:
1112  return 468;
1113  case 80:
1114  return 980;
1115  case 160:
1116  return 1960;
1117  }
1118 }
1119 
1120 uint64_t
1122 {
1123  WifiCodeRate codeRate = GetCodeRate (mcsValue);
1124  uint16_t constellationSize = GetConstellationSize (mcsValue);
1125  return CalculateNonHtReferenceRate (codeRate, constellationSize);
1126 }
1127 
1128 uint64_t
1129 HePhy::CalculateNonHtReferenceRate (WifiCodeRate codeRate, uint16_t constellationSize)
1130 {
1131  uint64_t dataRate;
1132  switch (constellationSize)
1133  {
1134  case 1024:
1135  if (codeRate == WIFI_CODE_RATE_3_4 || codeRate == WIFI_CODE_RATE_5_6)
1136  {
1137  dataRate = 54000000;
1138  }
1139  else
1140  {
1141  NS_FATAL_ERROR ("Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
1142  }
1143  break;
1144  default:
1145  dataRate = VhtPhy::CalculateNonHtReferenceRate (codeRate, constellationSize);
1146  }
1147  return dataRate;
1148 }
1149 
1150 bool
1151 HePhy::IsModeAllowed (uint16_t /* channelWidth */, uint8_t /* nss */)
1152 {
1153  return true;
1154 }
1155 
1158 {
1159  uint16_t staId = SU_STA_ID;
1160 
1161  if (txVector.IsUlMu ())
1162  {
1163  NS_ASSERT (txVector.GetHeMuUserInfoMap ().size () == 1);
1164  staId = txVector.GetHeMuUserInfoMap ().begin ()->first;
1165  }
1166 
1167  return WifiConstPsduMap ({std::make_pair (staId, psdu)});
1168 }
1169 
1170 uint32_t
1172 {
1173  return 6500631;
1174 }
1175 
1176 } //namespace ns3
1177 
1178 namespace {
1179 
1183 static class ConstructorHe
1184 {
1185 public:
1187  {
1189  ns3::WifiPhy::AddStaticPhyEntity (ns3::WIFI_MOD_CLASS_HE, ns3::Create<ns3::HePhy> ());
1190  }
1192 
1193 }
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:315
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:508
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:458
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:788
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:768
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:125
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:183
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:576
ns3::HePhy::CalculateNonOfdmaDurationForHeTb
Time CalculateNonOfdmaDurationForHeTb(const WifiTxVector &txVector) const
Definition: he-phy.cc:282
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:387
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:685
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:56
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:176
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:127
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:1151
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:183
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:1171
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:560
ns3::OBSS_PD_CCA_RESET
@ OBSS_PD_CCA_RESET
Definition: wifi-phy-common.h:274
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:984
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:170
ns3::HePhy::CancelAllEvents
void CancelAllEvents(void) override
Cancel and clear all running events.
Definition: he-phy.cc:357
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:173
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:1024
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:69
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:734
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:1129
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:1186
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:262
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:720
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:381
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:1184
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:250
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:51
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::WifiPhyRxfailureReason
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
Definition: wifi-phy-common.h:258
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:655
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:486
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:276
ns3::HE_TB_PPDU_TOO_LATE
@ HE_TB_PPDU_TOO_LATE
Definition: wifi-phy-common.h:275
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:898
ns3::HePhy::SetEndOfHeSigACallback
void SetEndOfHeSigACallback(EndOfHeSigACallback callback)
Set a callback for a end of HE-SIG-A.
Definition: he-phy.cc:545
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:70
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:1059
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:470
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:800
ns3::HePhy::ObtainNextUid
uint64_t ObtainNextUid(const WifiTxVector &txVector) override
Obtain the next UID for the PPDU to transmit.
Definition: he-phy.cc:824
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:921
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:843
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:193
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:263
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:420
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:317
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:751
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:71
ns3::HePhy::DoStartReceivePayload
void DoStartReceivePayload(Ptr< Event > event) override
Start receiving the PSDU (i.e.
Definition: he-phy.cc:608
ns3::WifiTxVector::GetPreambleType
WifiPreamble GetPreambleType(void) const
Definition: wifi-tx-vector.cc:147
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:153
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:166
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:551
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:369
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:298
ns3::WifiPreamble
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-phy-common.h:63
ns3::HePhy::GetPpduFormats
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: he-phy.cc:164
ns3::HePhy::DoAbortCurrentReception
void DoAbortCurrentReception(WifiPhyRxfailureReason reason) override
Perform amendment-specific actions before aborting the current reception.
Definition: he-phy.cc:369
ns3::WIFI_PPDU_TYPE_UL_MU
@ WIFI_PPDU_TYPE_UL_MU
Definition: wifi-phy-common.h:227
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:1038
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:159
ns3::HePhy::BuildPpdu
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: he-phy.cc:306
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:171
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:1073
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:292
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:948
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:226
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:402
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:1051
ns3::WIFI_PPDU_FIELD_DATA
@ WIFI_PPDU_FIELD_DATA
data field
Definition: wifi-phy-common.h:185
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:327
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:1098
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:1121
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:182
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:876
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:55
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:434
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:1087
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:806
ns3::WIFI_PREAMBLE_HE_TB
@ WIFI_PREAMBLE_HE_TB
Definition: wifi-phy-common.h:72
ns3::HePhy::GetSigADuration
Time GetSigADuration(WifiPreamble preamble) const override
Definition: he-phy.cc:187
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:1007
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:1157
ns3::WIFI_PPDU_FIELD_SIG_B
@ WIFI_PPDU_FIELD_SIG_B
SIG-B field.
Definition: wifi-phy-common.h:184
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:180
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:111
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:131
ns3::HePhy::GetHeMcs
static WifiMode GetHeMcs(uint8_t index)
Return the HE MCS corresponding to the provided index.
Definition: he-phy.cc:957
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:387
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