A Discrete-Event Network Simulator
API
spectrum-wifi-phy.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Ghada Badawy <gbadawy@gmail.com>
20  * S├ębastien Deronne <sebastien.deronne@gmail.com>
21  *
22  * Ported from yans-wifi-phy.cc by several contributors starting
23  * with Nicola Baldo and Dean Armstrong
24  */
25 
26 #include "ns3/log.h"
27 #include "ns3/double.h"
28 #include "ns3/boolean.h"
29 #include "ns3/wifi-net-device.h"
30 #include "ns3/node.h"
31 #include "ns3/simulator.h"
32 #include "spectrum-wifi-phy.h"
35 #include "wifi-utils.h"
36 #include "wifi-psdu.h"
37 
38 namespace ns3 {
39 
40 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhy");
41 
42 NS_OBJECT_ENSURE_REGISTERED (SpectrumWifiPhy);
43 
44 TypeId
46 {
47  static TypeId tid = TypeId ("ns3::SpectrumWifiPhy")
48  .SetParent<WifiPhy> ()
49  .SetGroupName ("Wifi")
50  .AddConstructor<SpectrumWifiPhy> ()
51  .AddAttribute ("DisableWifiReception",
52  "Prevent Wi-Fi frame sync from ever happening",
53  BooleanValue (false),
56  .AddAttribute ("TxMaskInnerBandMinimumRejection",
57  "Minimum rejection (dBr) for the inner band of the transmit spectrum mask",
58  DoubleValue (-20.0),
60  MakeDoubleChecker<double> ())
61  .AddAttribute ("TxMaskOuterBandMinimumRejection",
62  "Minimum rejection (dBr) for the outer band of the transmit spectrum mask",
63  DoubleValue (-28.0),
65  MakeDoubleChecker<double> ())
66  .AddAttribute ("TxMaskOuterBandMaximumRejection",
67  "Maximum rejection (dBr) for the outer band of the transmit spectrum mask",
68  DoubleValue (-40.0),
70  MakeDoubleChecker<double> ())
71  .AddTraceSource ("SignalArrival",
72  "Signal arrival",
74  "ns3::SpectrumWifiPhy::SignalArrivalCallback")
75  ;
76  return tid;
77 }
78 
80 {
81  NS_LOG_FUNCTION (this);
82 }
83 
85 {
86  NS_LOG_FUNCTION (this);
87 }
88 
89 void
91 {
92  NS_LOG_FUNCTION (this);
93  m_channel = 0;
95  m_antenna = 0;
97  m_ruBands.clear ();
99 }
100 
101 void
103 {
104  NS_LOG_FUNCTION (this);
106  // This connection is deferred until frequency and channel width are set
108  {
110  }
111  else
112  {
113  NS_FATAL_ERROR ("SpectrumWifiPhy misses channel and WifiSpectrumPhyInterface objects at initialization time");
114  }
115 }
116 
119 {
120  NS_LOG_FUNCTION (this);
121  if (m_rxSpectrumModel)
122  {
123  return m_rxSpectrumModel;
124  }
125  else
126  {
127  if (GetFrequency () == 0)
128  {
129  NS_LOG_DEBUG ("Frequency is not set; returning 0");
130  return 0;
131  }
132  else
133  {
134  uint16_t channelWidth = GetChannelWidth ();
135  NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << channelWidth << ")");
138  }
139  }
140  return m_rxSpectrumModel;
141 }
142 
143 void
145 {
146  NS_LOG_FUNCTION (this);
147  uint16_t channelWidth = GetChannelWidth ();
149  if (channelWidth < 20)
150  {
151  WifiSpectrumBand band = GetBand (channelWidth);
152  m_interference.AddBand (band);
153  }
154  else
155  {
156  for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
157  {
158  for (uint8_t i = 0; i < (channelWidth / bw); ++i)
159  {
160  m_interference.AddBand (GetBand (bw, i));
161  }
162  }
163  }
165  {
166  // For a given RU type, some RUs over a channel occupy the same tones as
167  // the corresponding RUs over a subchannel, while some others not. For instance,
168  // the first nine 26-tone RUs over an 80 MHz channel occupy the same tones as
169  // the first nine 26-tone RUs over the lowest 40 MHz subchannel. Therefore, we
170  // need to store all the bands in a set (which removes duplicates) and then
171  // pass the elements in the set to AddBand (to which we cannot pass duplicates)
172  if (m_ruBands[channelWidth].empty ())
173  {
174  for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
175  {
176  for (uint8_t i = 0; i < (channelWidth / bw); ++i)
177  {
178  for (unsigned int type = 0; type < 7; type++)
179  {
180  HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
181  std::size_t nRus = HeRu::GetNRus (bw, ruType);
182  for (std::size_t index = 1; index <= nRus; index++)
183  {
184  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, index);
185  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
186  WifiSpectrumBand band = ConvertHeRuSubcarriers (bw, GetGuardBandwidth (channelWidth),
187  range, i);
188  bool primary80 = (channelWidth < 160 || index <= nRus / 2);
189  m_ruBands[channelWidth].insert ({band, HeRu::RuSpec {primary80, ruType, index}});
190  }
191  }
192  }
193  }
194  }
195  for (const auto& bandRuPair : m_ruBands[channelWidth])
196  {
197  m_interference.AddBand (bandRuPair.first);
198  }
199  }
200 }
201 
204 {
205  return m_channel;
206 }
207 
208 void
210 {
211  m_channel = channel;
212 }
213 
214 void
216 {
217  NS_LOG_FUNCTION (this);
218  NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time");
219  uint16_t channelWidth = GetChannelWidth ();
220  NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << channelWidth << ")");
221  // Replace existing spectrum model with new one, and must call AddRx ()
222  // on the SpectrumChannel to provide this new spectrum model to it
226 }
227 
228 void
230 {
231  NS_LOG_FUNCTION (this << +nch);
233  if (IsInitialized ())
234  {
236  }
237 }
238 
239 void
241 {
242  NS_LOG_FUNCTION (this << freq);
243  WifiPhy::SetFrequency (freq);
244  if (IsInitialized ())
245  {
247  }
248 }
249 
250 void
251 SpectrumWifiPhy::SetChannelWidth (uint16_t channelwidth)
252 {
253  NS_LOG_FUNCTION (this << channelwidth);
254  WifiPhy::SetChannelWidth (channelwidth);
255  if (IsInitialized ())
256  {
258  }
259 }
260 
261 void
263 {
264  NS_LOG_FUNCTION (this << standard << band);
265  WifiPhy::ConfigureStandardAndBand (standard, band);
266  if (IsInitialized ())
267  {
269  }
270 }
271 
272 void
274 {
275  NS_LOG_FUNCTION (this << rxParams);
276  Time rxDuration = rxParams->duration;
277  Ptr<SpectrumValue> receivedSignalPsd = rxParams->psd;
278  NS_LOG_DEBUG ("Received signal with PSD " << *receivedSignalPsd << " and duration " << rxDuration.As (Time::NS));
279  uint32_t senderNodeId = 0;
280  if (rxParams->txPhy)
281  {
282  senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId ();
283  }
284  NS_LOG_DEBUG ("Received signal from " << senderNodeId << " with unfiltered power " << WToDbm (Integral (*receivedSignalPsd)) << " dBm");
285 
286  // Integrate over our receive bandwidth (i.e., all that the receive
287  // spectral mask representing our filtering allows) to find the
288  // total energy apparent to the "demodulator".
289  // This is done per 20 MHz channel band.
290  uint16_t channelWidth = GetChannelWidth ();
291  double totalRxPowerW = 0;
292  RxPowerWattPerChannelBand rxPowerW;
293 
294  if ((channelWidth == 5) || (channelWidth == 10))
295  {
296  WifiSpectrumBand filteredBand = GetBand (channelWidth);
297  Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFrequency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth), filteredBand);
298  SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd);
299  NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << Integral (filteredSignal));
300  double rxPowerPerBandW = Integral (filteredSignal) * DbToRatio (GetRxGain ());
301  totalRxPowerW += rxPowerPerBandW;
302  rxPowerW.insert ({filteredBand, rxPowerPerBandW});
303  NS_LOG_DEBUG ("Signal power received after antenna gain for " << channelWidth << " MHz channel: " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
304  }
305 
306  for (uint16_t bw = 160; bw > 20; bw = bw / 2) //20 MHz is handled apart since the totalRxPowerW is computed through it
307  {
308  for (uint8_t i = 0; i < (channelWidth / bw); i++)
309  {
310  NS_ASSERT (channelWidth >= bw);
311  WifiSpectrumBand filteredBand = GetBand (bw, i);
312  Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFrequency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth), filteredBand);
313  SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd);
314  NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for " << bw << " MHz channel band " << +i << ": " << Integral (filteredSignal));
315  double rxPowerPerBandW = Integral (filteredSignal) * DbToRatio (GetRxGain ());
316  rxPowerW.insert ({filteredBand, rxPowerPerBandW});
317  NS_LOG_DEBUG ("Signal power received after antenna gain for " << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
318  }
319  }
320 
321 
322  for (uint8_t i = 0; i < (channelWidth / 20); i++)
323  {
324  WifiSpectrumBand filteredBand = GetBand (20, i);
325  Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFrequency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth), filteredBand);
326  SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd);
327  NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for 20 MHz channel band " << +i << ": " << Integral (filteredSignal));
328  double rxPowerPerBandW = Integral (filteredSignal) * DbToRatio (GetRxGain ());
329  totalRxPowerW += rxPowerPerBandW;
330  rxPowerW.insert ({filteredBand, rxPowerPerBandW});
331  NS_LOG_DEBUG ("Signal power received after antenna gain for 20 MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
332  }
333 
335  {
336  NS_ASSERT (!m_ruBands[channelWidth].empty ());
337  for (const auto& bandRuPair : m_ruBands[channelWidth])
338  {
339  Ptr<SpectrumValue> filter = WifiSpectrumValueHelper::CreateRfFilter (GetFrequency (), channelWidth, GetBandBandwidth (), GetGuardBandwidth (channelWidth), bandRuPair.first);
340  SpectrumValue filteredSignal = (*filter) * (*receivedSignalPsd);
341  NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for RU with type " << bandRuPair.second.ruType << " and index " << bandRuPair.second.index << " -> (" << bandRuPair.first.first << "; " << bandRuPair.first.second << "): " << Integral (filteredSignal));
342  double rxPowerPerBandW = Integral (filteredSignal) * DbToRatio (GetRxGain ());
343  NS_LOG_DEBUG ("Signal power received after antenna gain for RU with type " << bandRuPair.second.ruType << " and index " << bandRuPair.second.index << " -> (" << bandRuPair.first.first << "; " << bandRuPair.first.second << "): " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
344  rxPowerW.insert ({bandRuPair.first, rxPowerPerBandW});
345  }
346  }
347 
348  NS_LOG_DEBUG ("Total signal power received after antenna gain: " << totalRxPowerW << " W (" << WToDbm (totalRxPowerW) << " dBm)");
349 
350  Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSignalParameters> (rxParams);
351 
352  // Log the signal arrival to the trace source
353  m_signalCb (wifiRxParams ? true : false, senderNodeId, WToDbm (totalRxPowerW), rxDuration);
354 
355  if (wifiRxParams == 0)
356  {
357  NS_LOG_INFO ("Received non Wi-Fi signal");
358  m_interference.AddForeignSignal (rxDuration, rxPowerW);
360  return;
361  }
362  if (wifiRxParams && m_disableWifiReception)
363  {
364  NS_LOG_INFO ("Received Wi-Fi signal but blocked from syncing");
365  m_interference.AddForeignSignal (rxDuration, rxPowerW);
367  return;
368  }
369  // Do no further processing if signal is too weak
370  // Current implementation assumes constant RX power over the PPDU duration
371  // Compare received TX power per MHz to normalized RX sensitivity
372  uint16_t txWidth = GetPhyEntity (wifiRxParams->ppdu->GetModulation ())->GetTransmissionChannelWidth (wifiRxParams->ppdu);
373  if (totalRxPowerW < DbmToW (GetRxSensitivity ()) * (txWidth / 20.0))
374  {
375  NS_LOG_INFO ("Received signal too weak to process: " << WToDbm (totalRxPowerW) << " dBm");
376  return;
377  }
378  // Unless we are receiving a TB PPDU, do not sync with this signal if the PPDU
379  // does not overlap with the receiver's primary20 channel
380  if (wifiRxParams->txPhy != 0)
381  {
382  Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (rxParams->txPhy->GetDevice ());
383  NS_ASSERT (dev != 0);
384  Ptr<WifiPhy> txPhy = dev->GetPhy ();
385  NS_ASSERT (txPhy != 0);
386  uint16_t txChannelWidth = wifiRxParams->ppdu->GetTxVector ().GetChannelWidth ();
387  uint16_t txCenterFreq = txPhy->GetOperatingChannel ().GetPrimaryChannelCenterFrequency (txChannelWidth);
388 
389  if (!GetPhyEntity (wifiRxParams->ppdu->GetModulation ())->CanReceivePpdu (wifiRxParams->ppdu, txCenterFreq))
390  {
391  NS_LOG_INFO ("Cannot receive the PPDU, consider it as interference");
392  m_interference.Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (),
393  rxDuration, rxPowerW);
394  SwitchMaybeToCcaBusy (GetMeasurementChannelWidth (wifiRxParams->ppdu));
395  return;
396  }
397  }
398 
399  NS_LOG_INFO ("Received Wi-Fi signal");
400  Ptr<WifiPpdu> ppdu = wifiRxParams->ppdu->Copy ();
401  StartReceivePreamble (ppdu, rxPowerW, rxDuration);
402 }
403 
406 {
407  return m_antenna;
408 }
409 
410 void
412 {
413  NS_LOG_FUNCTION (this << a);
414  m_antenna = a;
415 }
416 
417 void
419 {
420  NS_LOG_FUNCTION (this << device);
421  m_wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface> ();
422  m_wifiSpectrumPhyInterface->SetSpectrumWifiPhy (this);
423  m_wifiSpectrumPhyInterface->SetDevice (device);
424 }
425 
426 void
428 {
429  NS_LOG_FUNCTION (this << ppdu);
430  GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu);
431 }
432 
433 void
435 {
436  NS_LOG_FUNCTION (this << txParams);
437 
438  //Finish configuration
439  NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe forgot to call CreateWifiSpectrumPhyInterface?");
440  txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> ();
441  txParams->txAntenna = m_antenna;
442 
443  m_channel->StartTx (txParams);
444 }
445 
446 uint32_t
448 {
449  uint32_t bandBandwidth = 0;
450  switch (GetPhyStandard ())
451  {
457  // Use OFDM subcarrier width of 312.5 KHz as band granularity
458  bandBandwidth = 312500;
459  break;
461  if (GetChannelWidth () == 5)
462  {
463  // Use OFDM subcarrier width of 78.125 KHz as band granularity
464  bandBandwidth = 78125;
465  }
466  else
467  {
468  // Use OFDM subcarrier width of 156.25 KHz as band granularity
469  bandBandwidth = 156250;
470  }
471  break;
473  // Use OFDM subcarrier width of 78.125 KHz as band granularity
474  bandBandwidth = 78125;
475  break;
476  default:
477  NS_FATAL_ERROR ("Standard unknown: " << GetPhyStandard ());
478  break;
479  }
480  return bandBandwidth;
481 }
482 
483 uint16_t
484 SpectrumWifiPhy::GetGuardBandwidth (uint16_t currentChannelWidth) const
485 {
486  uint16_t guardBandwidth = 0;
487  if (currentChannelWidth == 22)
488  {
489  //handle case of DSSS transmission
490  guardBandwidth = 10;
491  }
492  else
493  {
494  //In order to properly model out of band transmissions for OFDM, the guard
495  //band has been configured so as to expand the modeled spectrum up to the
496  //outermost referenced point in "Transmit spectrum mask" sections' PSDs of
497  //each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
498  //to the currently considered channel bandwidth (which can be different from
499  //supported channel width).
500  guardBandwidth = currentChannelWidth;
501  }
502  return guardBandwidth;
503 }
504 
506 SpectrumWifiPhy::GetBand (uint16_t bandWidth, uint8_t bandIndex)
507 {
508  uint16_t channelWidth = GetChannelWidth ();
509  uint32_t bandBandwidth = GetBandBandwidth ();
510  size_t numBandsInChannel = static_cast<size_t> (channelWidth * 1e6 / bandBandwidth);
511  size_t numBandsInBand = static_cast<size_t> (bandWidth * 1e6 / bandBandwidth);
512  if (numBandsInBand % 2 == 0)
513  {
514  numBandsInChannel += 1; // symmetry around center frequency
515  }
516  size_t totalNumBands = GetRxSpectrumModel ()->GetNumBands ();
517  NS_ASSERT_MSG ((numBandsInChannel % 2 == 1) && (totalNumBands % 2 == 1), "Should have odd number of bands");
518  NS_ASSERT_MSG ((bandIndex * bandWidth) < channelWidth, "Band index is out of bound");
519  WifiSpectrumBand band;
520  band.first = ((totalNumBands - numBandsInChannel) / 2) + (bandIndex * numBandsInBand);
521  if (band.first >= totalNumBands / 2)
522  {
523  //step past DC
524  band.first += 1;
525  }
526  band.second = band.first + numBandsInBand - 1;
527  return band;
528 }
529 
531 SpectrumWifiPhy::ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
532  HeRu::SubcarrierRange range, uint8_t bandIndex) const
533 {
534  WifiSpectrumBand convertedSubcarriers;
535  uint32_t nGuardBands = static_cast<uint32_t> (((2 * guardBandwidth * 1e6) / GetBandBandwidth ()) + 0.5);
536  uint32_t centerFrequencyIndex = 0;
537  switch (bandWidth)
538  {
539  case 20:
540  centerFrequencyIndex = (nGuardBands / 2) + 6 + 122;
541  break;
542  case 40:
543  centerFrequencyIndex = (nGuardBands / 2) + 12 + 244;
544  break;
545  case 80:
546  centerFrequencyIndex = (nGuardBands / 2) + 12 + 500;
547  break;
548  case 160:
549  centerFrequencyIndex = (nGuardBands / 2) + 12 + 1012;
550  break;
551  default:
552  NS_FATAL_ERROR ("ChannelWidth " << bandWidth << " unsupported");
553  break;
554  }
555 
556  size_t numBandsInBand = static_cast<size_t> (bandWidth * 1e6 / GetBandBandwidth ());
557  centerFrequencyIndex += numBandsInBand * bandIndex;
558 
559  convertedSubcarriers.first = centerFrequencyIndex + range.first;
560  convertedSubcarriers.second = centerFrequencyIndex + range.second;
561  return convertedSubcarriers;
562 }
563 
564 std::tuple<double, double, double>
566 {
567  return std::make_tuple (m_txMaskInnerBandMinimumRejection,
570 }
571 
572 } //namespace ns3
ERP-OFDM PHY (Clause 19, Section 19.5)
size_t GetNumBands() const
WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the start band index and the stop band index for a given band.
std::map< uint16_t, RuBand > m_ruBands
For each channel width, store all the distinct spectrum bands associated with every RU in a channel o...
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
nanosecond
Definition: nstime.h:118
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance...
Definition: wifi-phy.cc:878
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:45
AttributeValue implementation for Boolean.
Definition: boolean.h:36
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:758
double Integral(const SpectrumValue &arg)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void RemoveBands(void)
Remove the frequency bands.
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
802.11 PHY layer model
Definition: wifi-phy.h:48
Ptr< const SpectrumModel > GetRxSpectrumModel()
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:41
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:85
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1069
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:596
void DoDispose(void) override
Destructor implementation.
#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
bool IsInitialized(void) const
Check if the object has been initialized.
Definition: object.cc:208
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
static TypeId GetTypeId(void)
Get the type ID.
bool m_disableWifiReception
forces this PHY to fail to sync on any signal
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
virtual void SetFrequency(uint16_t freq)
If the operating channel for this object has not been set yet, the given center frequency is saved an...
Definition: wifi-phy.cc:1143
void StartTx(Ptr< WifiPpdu > ppdu) override
void SetAntenna(const Ptr< AntennaModel > antenna)
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
channel
Definition: third.py:92
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:672
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:1233
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker...
Definition: wifi-phy.cc:2151
Ptr< Event > Add(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing=false)
Add the PPDU-related signal to interference helper.
void Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
make Callback use a separate empty type
Definition: empty.h:33
RU Specification.
Definition: he-ru.h:64
double m_txMaskOuterBandMaximumRejection
The maximum rejection (in dBr) for the outer band of the transmit spectrum mask.
double m_txMaskOuterBandMinimumRejection
The minimum rejection (in dBr) for the outer band of the transmit spectrum mask.
static std::size_t GetNRus(uint16_t bw, RuType ruType)
Get the number of distinct RUs of the given type (number of tones) available in a HE PPDU of the give...
Definition: he-ru.cc:153
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: wifi-phy.cc:2262
OFDM PHY (Clause 17 - amendment for 10 MHz and 5 MHz channels)
void DoInitialize(void) override
Initialize() implementation.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
802.11 PHY layer modelThis PHY implements a spectrum-aware enhancement of the 802.11 SpectrumWifiPhy model.
static Ptr< SpectrumValue > CreateRfFilter(uint32_t centerFrequency, uint16_t totalChannelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth, WifiSpectrumBand band)
Create a spectral density corresponding to the RF filter.
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
WifiPhyStandard GetPhyStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1131
Ptr< WifiPhy > GetPhy(void) const
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth)
Return a SpectrumModel instance corresponding to the center frequency and channel width...
OFDM PHY (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:1168
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1890
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
uint32_t GetBandBandwidth(void) const
virtual void SetChannelNumber(uint8_t id)
Set channel number.
Definition: wifi-phy.cc:1174
static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t index)
Get the subcarrier group of the RU having the given index among all the RUs of the given type (number...
Definition: he-ru.cc:247
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:47
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:35
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const override
Ptr< Channel > GetChannel(void) const override
Return the Channel this WifiPhy is connected to.
#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
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: double.h:42
void AddBand(WifiSpectrumBand band)
Add a frequency band.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:32
void UpdateInterferenceHelperBands(void)
This function is called to update the bands handled by the InterferenceHelper.
void SetFrequency(uint16_t freq) override
If the operating channel for this object has not been set yet, the given center frequency is saved an...
void AddForeignSignal(Time duration, RxPowerWattPerChannelBand rxPower)
Add a non-Wifi signal to interference helper.
Ptr< AntennaModel > GetRxAntenna(void) const
Get the antenna model used for reception.
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1172
virtual void SetChannelWidth(uint16_t channelWidth)
If the operating channel for this object has not been set yet, the given channel width is saved and w...
Definition: wifi-phy.cc:1205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Ptr< AntennaModel > m_antenna
antenna model
void SetChannelNumber(uint8_t id) override
Set channel number.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< WifiSpectrumPhyInterface > m_wifiSpectrumPhyInterface
Spectrum PHY interface.
void ResetSpectrumModel(void)
Perform run-time spectrum model change.
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1137
double m_txMaskInnerBandMinimumRejection
The minimum rejection (in dBr) for the inner band of the transmit spectrum mask.
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
Set of values corresponding to a given SpectrumModel.
void SetChannelWidth(uint16_t channelwidth) override
If the operating channel for this object has not been set yet, the given channel width is saved and w...
a unique identifier for an interface.
Definition: type-id.h:58
void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band) override
Configure the PHY-level parameters for different Wi-Fi standard.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:75
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...