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
38namespace ns3 {
39
40NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhy");
41
42NS_OBJECT_ENSURE_REGISTERED (SpectrumWifiPhy);
43
44TypeId
46{
47 static TypeId tid = TypeId ("ns3::SpectrumWifiPhy")
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
89void
91{
92 NS_LOG_FUNCTION (this);
93 m_channel = 0;
95 m_antenna = 0;
97 m_ruBands.clear ();
99}
100
101void
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);
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
143void
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 {
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 phyIndex = 1; phyIndex <= nRus; phyIndex++)
183 {
184 HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, phyIndex);
185 HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
187 range, i);
188 std::size_t index = (bw == 160 && phyIndex > nRus / 2
189 ? phyIndex - nRus / 2 : phyIndex);
190 bool primary80IsLower80 = (GetOperatingChannel ().GetPrimaryChannelIndex (20)
191 < bw / 40);
192 bool primary80 = (bw < 160
193 || ruType == HeRu::RU_2x996_TONE
194 || (primary80IsLower80 && phyIndex <= nRus / 2)
195 || (!primary80IsLower80 && phyIndex > nRus / 2));
196 HeRu::RuSpec ru (ruType, index, primary80);
197 ru.SetPhyIndex (bw, GetOperatingChannel ().GetPrimaryChannelIndex (20));
198 NS_ABORT_IF (ru.GetPhyIndex () != phyIndex);
199 m_ruBands[channelWidth].insert ({band, ru});
200 }
201 }
202 }
203 }
204 }
205 for (const auto& bandRuPair : m_ruBands[channelWidth])
206 {
207 m_interference.AddBand (bandRuPair.first);
208 }
209 }
210}
211
214{
215 return m_channel;
216}
217
218void
220{
222}
223
224void
226{
227 NS_LOG_FUNCTION (this);
228 NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time");
229 uint16_t channelWidth = GetChannelWidth ();
230 NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << channelWidth << ")");
231 // Replace existing spectrum model with new one, and must call AddRx ()
232 // on the SpectrumChannel to provide this new spectrum model to it
236}
237
238void
240{
241 NS_LOG_FUNCTION (this);
243 if (IsInitialized ())
244 {
246 }
247}
248
249void
251{
252 NS_LOG_FUNCTION (this << rxParams);
253 Time rxDuration = rxParams->duration;
254 Ptr<SpectrumValue> receivedSignalPsd = rxParams->psd;
255 NS_LOG_DEBUG ("Received signal with PSD " << *receivedSignalPsd << " and duration " << rxDuration.As (Time::NS));
256 uint32_t senderNodeId = 0;
257 if (rxParams->txPhy)
258 {
259 senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId ();
260 }
261 NS_LOG_DEBUG ("Received signal from " << senderNodeId << " with unfiltered power " << WToDbm (Integral (*receivedSignalPsd)) << " dBm");
262
263 // Integrate over our receive bandwidth (i.e., all that the receive
264 // spectral mask representing our filtering allows) to find the
265 // total energy apparent to the "demodulator".
266 // This is done per 20 MHz channel band.
267 uint16_t channelWidth = GetChannelWidth ();
268 double totalRxPowerW = 0;
270
271 if ((channelWidth == 5) || (channelWidth == 10))
272 {
273 WifiSpectrumBand filteredBand = GetBand (channelWidth);
274 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, filteredBand);
275 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << rxPowerPerBandW);
276 rxPowerPerBandW *= DbToRatio (GetRxGain ());
277 totalRxPowerW += rxPowerPerBandW;
278 rxPowerW.insert ({filteredBand, rxPowerPerBandW});
279 NS_LOG_DEBUG ("Signal power received after antenna gain for " << channelWidth << " MHz channel: " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
280 }
281
282 for (uint16_t bw = 160; bw > 20; bw = bw / 2) //20 MHz is handled apart since the totalRxPowerW is computed through it
283 {
284 for (uint8_t i = 0; i < (channelWidth / bw); i++)
285 {
286 NS_ASSERT (channelWidth >= bw);
287 WifiSpectrumBand filteredBand = GetBand (bw, i);
288 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, filteredBand);
289 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for " << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW);
290 rxPowerPerBandW *= DbToRatio (GetRxGain ());
291 rxPowerW.insert ({filteredBand, rxPowerPerBandW});
292 NS_LOG_DEBUG ("Signal power received after antenna gain for " << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
293 }
294 }
295
296
297 for (uint8_t i = 0; i < (channelWidth / 20); i++)
298 {
299 WifiSpectrumBand filteredBand = GetBand (20, i);
300 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, filteredBand);
301 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for 20 MHz channel band " << +i << ": " << rxPowerPerBandW);
302 rxPowerPerBandW *= DbToRatio (GetRxGain ());
303 totalRxPowerW += rxPowerPerBandW;
304 rxPowerW.insert ({filteredBand, rxPowerPerBandW});
305 NS_LOG_DEBUG ("Signal power received after antenna gain for 20 MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
306 }
307
309 {
310 NS_ASSERT (!m_ruBands[channelWidth].empty ());
311 for (const auto& bandRuPair : m_ruBands[channelWidth])
312 {
313 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, bandRuPair.first);
314 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for RU with type " << bandRuPair.second.GetRuType () << " and index " << bandRuPair.second.GetIndex () << " -> (" << bandRuPair.first.first << "; " << bandRuPair.first.second << "): " << rxPowerPerBandW);
315 rxPowerPerBandW *= DbToRatio (GetRxGain ());
316 NS_LOG_DEBUG ("Signal power received after antenna gain for RU with type " << bandRuPair.second.GetRuType () << " and index " << bandRuPair.second.GetIndex () << " -> (" << bandRuPair.first.first << "; " << bandRuPair.first.second << "): " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
317 rxPowerW.insert ({bandRuPair.first, rxPowerPerBandW});
318 }
319 }
320
321 NS_LOG_DEBUG ("Total signal power received after antenna gain: " << totalRxPowerW << " W (" << WToDbm (totalRxPowerW) << " dBm)");
322
323 Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSignalParameters> (rxParams);
324
325 // Log the signal arrival to the trace source
326 m_signalCb (wifiRxParams, senderNodeId, WToDbm (totalRxPowerW), rxDuration);
327
328 if (wifiRxParams == 0)
329 {
330 NS_LOG_INFO ("Received non Wi-Fi signal");
331 m_interference.AddForeignSignal (rxDuration, rxPowerW);
333 return;
334 }
335 if (wifiRxParams && m_disableWifiReception)
336 {
337 NS_LOG_INFO ("Received Wi-Fi signal but blocked from syncing");
338 m_interference.AddForeignSignal (rxDuration, rxPowerW);
340 return;
341 }
342 // Do no further processing if signal is too weak
343 // Current implementation assumes constant RX power over the PPDU duration
344 // Compare received TX power per MHz to normalized RX sensitivity
345 uint16_t txWidth = wifiRxParams->ppdu->GetTransmissionChannelWidth ();
346 if (totalRxPowerW < DbmToW (GetRxSensitivity ()) * (txWidth / 20.0))
347 {
348 NS_LOG_INFO ("Received signal too weak to process: " << WToDbm (totalRxPowerW) << " dBm");
349 m_interference.Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (), rxDuration,
350 rxPowerW);
352 return;
353 }
354
355 // Unless we are receiving a TB PPDU, do not sync with this signal if the PPDU
356 // does not overlap with the receiver's primary20 channel
357 if (wifiRxParams->txPhy != 0)
358 {
359 // if the channel width is a multiple of 20 MHz, then we consider the primary20 channel
360 uint16_t width = (GetChannelWidth () % 20 == 0 ? 20 : GetChannelWidth ());
361 uint16_t p20MinFreq =
363 uint16_t p20MaxFreq =
365
366 if (!wifiRxParams->ppdu->CanBeReceived (wifiRxParams->txCenterFreq, p20MinFreq, p20MaxFreq))
367 {
368 NS_LOG_INFO ("Cannot receive the PPDU, consider it as interference");
369 m_interference.Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (),
370 rxDuration, rxPowerW);
372 return;
373 }
374 }
375
376 NS_LOG_INFO ("Received Wi-Fi signal");
377 Ptr<WifiPpdu> ppdu = wifiRxParams->ppdu->Copy ();
378 StartReceivePreamble (ppdu, rxPowerW, rxDuration);
379}
380
383{
384 return m_antenna;
385}
386
387void
389{
390 NS_LOG_FUNCTION (this << a);
391 m_antenna = a;
392}
393
394void
396{
397 NS_LOG_FUNCTION (this << device);
398 m_wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface> ();
399 m_wifiSpectrumPhyInterface->SetSpectrumWifiPhy (this);
400 m_wifiSpectrumPhyInterface->SetDevice (device);
401}
402
403void
405{
406 NS_LOG_FUNCTION (this << ppdu);
407 GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu);
408}
409
410void
412{
413 NS_LOG_FUNCTION (this << txParams);
414
415 //Finish configuration
416 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe forgot to call CreateWifiSpectrumPhyInterface?");
417 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> ();
418 txParams->txAntenna = m_antenna;
419
420 m_channel->StartTx (txParams);
421}
422
425{
426 uint32_t bandBandwidth = 0;
427 switch (GetStandard ())
428 {
434 // Use OFDM subcarrier width of 312.5 KHz as band granularity
435 bandBandwidth = 312500;
436 break;
438 if (GetChannelWidth () == 5)
439 {
440 // Use OFDM subcarrier width of 78.125 KHz as band granularity
441 bandBandwidth = 78125;
442 }
443 else
444 {
445 // Use OFDM subcarrier width of 156.25 KHz as band granularity
446 bandBandwidth = 156250;
447 }
448 break;
450 // Use OFDM subcarrier width of 78.125 KHz as band granularity
451 bandBandwidth = 78125;
452 break;
453 default:
454 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ());
455 break;
456 }
457 return bandBandwidth;
458}
459
460uint16_t
461SpectrumWifiPhy::GetGuardBandwidth (uint16_t currentChannelWidth) const
462{
463 uint16_t guardBandwidth = 0;
464 if (currentChannelWidth == 22)
465 {
466 //handle case of DSSS transmission
467 guardBandwidth = 10;
468 }
469 else
470 {
471 //In order to properly model out of band transmissions for OFDM, the guard
472 //band has been configured so as to expand the modeled spectrum up to the
473 //outermost referenced point in "Transmit spectrum mask" sections' PSDs of
474 //each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
475 //to the currently considered channel bandwidth (which can be different from
476 //supported channel width).
477 guardBandwidth = currentChannelWidth;
478 }
479 return guardBandwidth;
480}
481
483SpectrumWifiPhy::GetBand (uint16_t bandWidth, uint8_t bandIndex)
484{
485 uint16_t channelWidth = GetChannelWidth ();
486 uint32_t bandBandwidth = GetBandBandwidth ();
487 size_t numBandsInChannel = static_cast<size_t> (channelWidth * 1e6 / bandBandwidth);
488 size_t numBandsInBand = static_cast<size_t> (bandWidth * 1e6 / bandBandwidth);
489 if (numBandsInBand % 2 == 0)
490 {
491 numBandsInChannel += 1; // symmetry around center frequency
492 }
493 size_t totalNumBands = GetRxSpectrumModel ()->GetNumBands ();
494 NS_ASSERT_MSG ((numBandsInChannel % 2 == 1) && (totalNumBands % 2 == 1), "Should have odd number of bands");
495 NS_ASSERT_MSG ((bandIndex * bandWidth) < channelWidth, "Band index is out of bound");
496 WifiSpectrumBand band;
497 band.first = ((totalNumBands - numBandsInChannel) / 2) + (bandIndex * numBandsInBand);
498 if (band.first >= totalNumBands / 2)
499 {
500 //step past DC
501 band.first += 1;
502 }
503 band.second = band.first + numBandsInBand - 1;
504 return band;
505}
506
508SpectrumWifiPhy::ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
509 HeRu::SubcarrierRange range, uint8_t bandIndex) const
510{
511 WifiSpectrumBand convertedSubcarriers;
512 uint32_t nGuardBands = static_cast<uint32_t> (((2 * guardBandwidth * 1e6) / GetBandBandwidth ()) + 0.5);
513 uint32_t centerFrequencyIndex = 0;
514 switch (bandWidth)
515 {
516 case 20:
517 centerFrequencyIndex = (nGuardBands / 2) + 6 + 122;
518 break;
519 case 40:
520 centerFrequencyIndex = (nGuardBands / 2) + 12 + 244;
521 break;
522 case 80:
523 centerFrequencyIndex = (nGuardBands / 2) + 12 + 500;
524 break;
525 case 160:
526 centerFrequencyIndex = (nGuardBands / 2) + 12 + 1012;
527 break;
528 default:
529 NS_FATAL_ERROR ("ChannelWidth " << bandWidth << " unsupported");
530 break;
531 }
532
533 size_t numBandsInBand = static_cast<size_t> (bandWidth * 1e6 / GetBandBandwidth ());
534 centerFrequencyIndex += numBandsInBand * bandIndex;
535
536 convertedSubcarriers.first = centerFrequencyIndex + range.first;
537 convertedSubcarriers.second = centerFrequencyIndex + range.second;
538 return convertedSubcarriers;
539}
540
541std::tuple<double, double, double>
543{
544 return std::make_tuple (m_txMaskInnerBandMinimumRejection,
547}
548
549} //namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
RU Specification.
Definition: he-ru.h:68
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
Definition: he-ru.cc:188
std::size_t GetPhyIndex(void) const
Get the RU PHY index.
Definition: he-ru.cc:212
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
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:219
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:42
@ RU_2x996_TONE
Definition: he-ru.h:49
void AddForeignSignal(Time duration, RxPowerWattPerChannelBand &rxPower)
Add a non-Wifi signal to interference helper.
void RemoveBands(void)
Remove the frequency bands.
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 AddBand(WifiSpectrumBand band)
Add a frequency band.
bool IsInitialized(void) const
Check if the object has been initialized.
Definition: object.cc:208
virtual void DoInitialize(void)
Initialize() implementation.
Definition: object.cc:353
size_t GetNumBands() const
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:47
802.11 PHY layer model
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
void Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
uint32_t GetBandBandwidth(void) const
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
void StartTx(Ptr< WifiPpdu > ppdu) override
Ptr< AntennaModel > m_antenna
antenna model
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...
void DoChannelSwitch(void) override
Actually switch channel based on the stored channel settings.
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const override
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
void DoDispose(void) override
Destructor implementation.
Ptr< WifiSpectrumPhyInterface > m_wifiSpectrumPhyInterface
Spectrum PHY interface.
double m_txMaskInnerBandMinimumRejection
The minimum rejection (in dBr) for the inner band of the transmit spectrum mask.
double m_txMaskOuterBandMinimumRejection
The minimum rejection (in dBr) for the outer band of the transmit spectrum mask.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
static TypeId GetTypeId(void)
Get the type ID.
void SetAntenna(const Ptr< AntennaModel > antenna)
double m_txMaskOuterBandMaximumRejection
The maximum rejection (in dBr) for the outer band of the transmit spectrum mask.
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
Ptr< Object > GetAntenna(void) const
Get the antenna model used for reception.
bool m_disableWifiReception
forces this PHY to fail to sync on any signal
Ptr< const SpectrumModel > GetRxSpectrumModel()
WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the start band index and the stop band index for a given band.
void ResetSpectrumModel(void)
Perform run-time spectrum model change.
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void UpdateInterferenceHelperBands(void)
This function is called to update the bands handled by the InterferenceHelper.
Ptr< Channel > GetChannel(void) const override
Return the Channel this WifiPhy is connected to.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
void DoInitialize(void) override
Initialize() implementation.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
@ NS
nanosecond
Definition: nstime.h:117
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:432
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
802.11 PHY layer model
Definition: wifi-phy.h:49
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1604
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:883
WifiStandard GetStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:877
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:338
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: wifi-phy.cc:1963
InterferenceHelper m_interference
the class handling interference computations
Definition: wifi-phy.h:1134
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance.
Definition: wifi-phy.cc:627
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:1852
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:507
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:421
virtual void DoChannelSwitch(void)
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1004
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:901
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:889
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...
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
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.
static double GetBandPowerW(Ptr< SpectrumValue > psd, const WifiSpectrumBand &band)
Calculate the power of the specified band composed of uniformly-sized sub-bands.
make Callback use a separate empty type
Definition: empty.h:34
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:85
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:42
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
@ WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211p
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211g
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_80211ac
@ WIFI_STANDARD_80211b
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:43
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
double Integral(const SpectrumValue &arg)
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:37
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:75
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:31
channel
Definition: third.py:92