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 "interference-helper.h"
36#include "wifi-utils.h"
37#include "wifi-psdu.h"
38
39namespace ns3 {
40
41NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhy");
42
43NS_OBJECT_ENSURE_REGISTERED (SpectrumWifiPhy);
44
45TypeId
47{
48 static TypeId tid = TypeId ("ns3::SpectrumWifiPhy")
50 .SetGroupName ("Wifi")
51 .AddConstructor<SpectrumWifiPhy> ()
52 .AddAttribute ("DisableWifiReception",
53 "Prevent Wi-Fi frame sync from ever happening",
54 BooleanValue (false),
57 .AddAttribute ("TxMaskInnerBandMinimumRejection",
58 "Minimum rejection (dBr) for the inner band of the transmit spectrum mask",
59 DoubleValue (-20.0),
61 MakeDoubleChecker<double> ())
62 .AddAttribute ("TxMaskOuterBandMinimumRejection",
63 "Minimum rejection (dBr) for the outer band of the transmit spectrum mask",
64 DoubleValue (-28.0),
66 MakeDoubleChecker<double> ())
67 .AddAttribute ("TxMaskOuterBandMaximumRejection",
68 "Maximum rejection (dBr) for the outer band of the transmit spectrum mask",
69 DoubleValue (-40.0),
71 MakeDoubleChecker<double> ())
72 .AddTraceSource ("SignalArrival",
73 "Signal arrival",
75 "ns3::SpectrumWifiPhy::SignalArrivalCallback")
76 ;
77 return tid;
78}
79
81{
82 NS_LOG_FUNCTION (this);
83}
84
86{
87 NS_LOG_FUNCTION (this);
88}
89
90void
92{
93 NS_LOG_FUNCTION (this);
94 m_channel = 0;
96 m_antenna = 0;
98 m_ruBands.clear ();
100}
101
102void
104{
105 NS_LOG_FUNCTION (this);
107 // This connection is deferred until frequency and channel width are set
109 {
111 }
112 else
113 {
114 NS_FATAL_ERROR ("SpectrumWifiPhy misses channel and WifiSpectrumPhyInterface objects at initialization time");
115 }
116}
117
120{
121 NS_LOG_FUNCTION (this);
123 {
124 return m_rxSpectrumModel;
125 }
126 else
127 {
128 if (GetFrequency () == 0)
129 {
130 NS_LOG_DEBUG ("Frequency is not set; returning 0");
131 return 0;
132 }
133 else
134 {
135 uint16_t channelWidth = GetChannelWidth ();
136 NS_LOG_DEBUG ("Creating spectrum model from frequency/width pair of (" << GetFrequency () << ", " << channelWidth << ")");
139 }
140 }
141 return m_rxSpectrumModel;
142}
143
144void
146{
147 NS_LOG_FUNCTION (this);
148 uint16_t channelWidth = GetChannelWidth ();
149 m_interference->RemoveBands ();
150 if (channelWidth < 20)
151 {
152 WifiSpectrumBand band = GetBand (channelWidth);
153 m_interference->AddBand (band);
154 }
155 else
156 {
157 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
158 {
159 for (uint8_t i = 0; i < (channelWidth / bw); ++i)
160 {
161 m_interference->AddBand (GetBand (bw, i));
162 }
163 }
164 }
166 {
167 // For a given RU type, some RUs over a channel occupy the same tones as
168 // the corresponding RUs over a subchannel, while some others not. For instance,
169 // the first nine 26-tone RUs over an 80 MHz channel occupy the same tones as
170 // the first nine 26-tone RUs over the lowest 40 MHz subchannel. Therefore, we
171 // need to store all the bands in a set (which removes duplicates) and then
172 // pass the elements in the set to AddBand (to which we cannot pass duplicates)
173 if (m_ruBands[channelWidth].empty ())
174 {
175 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
176 {
177 for (uint8_t i = 0; i < (channelWidth / bw); ++i)
178 {
179 for (unsigned int type = 0; type < 7; type++)
180 {
181 HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
182 std::size_t nRus = HeRu::GetNRus (bw, ruType);
183 for (std::size_t phyIndex = 1; phyIndex <= nRus; phyIndex++)
184 {
185 HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, phyIndex);
186 HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
188 range, i);
189 std::size_t index = (bw == 160 && phyIndex > nRus / 2
190 ? phyIndex - nRus / 2 : phyIndex);
191 bool primary80IsLower80 = (GetOperatingChannel ().GetPrimaryChannelIndex (20)
192 < bw / 40);
193 bool primary80 = (bw < 160
194 || ruType == HeRu::RU_2x996_TONE
195 || (primary80IsLower80 && phyIndex <= nRus / 2)
196 || (!primary80IsLower80 && phyIndex > nRus / 2));
197 HeRu::RuSpec ru (ruType, index, primary80);
198 ru.SetPhyIndex (bw, GetOperatingChannel ().GetPrimaryChannelIndex (20));
199 NS_ABORT_IF (ru.GetPhyIndex () != phyIndex);
200 m_ruBands[channelWidth].insert ({band, ru});
201 }
202 }
203 }
204 }
205 }
206 for (const auto& bandRuPair : m_ruBands[channelWidth])
207 {
208 m_interference->AddBand (bandRuPair.first);
209 }
210 }
211}
212
215{
216 return m_channel;
217}
218
219void
221{
223}
224
225void
227{
228 NS_LOG_FUNCTION (this);
229 NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time");
230 uint16_t channelWidth = GetChannelWidth ();
231 NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << channelWidth << ")");
232 // Replace existing spectrum model with new one, and must call AddRx ()
233 // on the SpectrumChannel to provide this new spectrum model to it
237}
238
239void
241{
242 NS_LOG_FUNCTION (this);
244 if (IsInitialized ())
245 {
247 }
248}
249
250void
252{
253 NS_LOG_FUNCTION (this << rxParams);
254 Time rxDuration = rxParams->duration;
255 Ptr<SpectrumValue> receivedSignalPsd = rxParams->psd;
256 NS_LOG_DEBUG ("Received signal with PSD " << *receivedSignalPsd << " and duration " << rxDuration.As (Time::NS));
257 uint32_t senderNodeId = 0;
258 if (rxParams->txPhy)
259 {
260 senderNodeId = rxParams->txPhy->GetDevice ()->GetNode ()->GetId ();
261 }
262 NS_LOG_DEBUG ("Received signal from " << senderNodeId << " with unfiltered power " << WToDbm (Integral (*receivedSignalPsd)) << " dBm");
263
264 // Integrate over our receive bandwidth (i.e., all that the receive
265 // spectral mask representing our filtering allows) to find the
266 // total energy apparent to the "demodulator".
267 // This is done per 20 MHz channel band.
268 uint16_t channelWidth = GetChannelWidth ();
269 double totalRxPowerW = 0;
271
272 if ((channelWidth == 5) || (channelWidth == 10))
273 {
274 WifiSpectrumBand filteredBand = GetBand (channelWidth);
275 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, filteredBand);
276 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain: " << rxPowerPerBandW);
277 rxPowerPerBandW *= DbToRatio (GetRxGain ());
278 totalRxPowerW += rxPowerPerBandW;
279 rxPowerW.insert ({filteredBand, rxPowerPerBandW});
280 NS_LOG_DEBUG ("Signal power received after antenna gain for " << channelWidth << " MHz channel: " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
281 }
282
283 for (uint16_t bw = 160; bw > 20; bw = bw / 2) //20 MHz is handled apart since the totalRxPowerW is computed through it
284 {
285 for (uint8_t i = 0; i < (channelWidth / bw); i++)
286 {
287 NS_ASSERT (channelWidth >= bw);
288 WifiSpectrumBand filteredBand = GetBand (bw, i);
289 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, filteredBand);
290 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for " << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW);
291 rxPowerPerBandW *= DbToRatio (GetRxGain ());
292 rxPowerW.insert ({filteredBand, rxPowerPerBandW});
293 NS_LOG_DEBUG ("Signal power received after antenna gain for " << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
294 }
295 }
296
297
298 for (uint8_t i = 0; i < (channelWidth / 20); i++)
299 {
300 WifiSpectrumBand filteredBand = GetBand (20, i);
301 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, filteredBand);
302 NS_LOG_DEBUG ("Signal power received (watts) before antenna gain for 20 MHz channel band " << +i << ": " << rxPowerPerBandW);
303 rxPowerPerBandW *= DbToRatio (GetRxGain ());
304 totalRxPowerW += rxPowerPerBandW;
305 rxPowerW.insert ({filteredBand, rxPowerPerBandW});
306 NS_LOG_DEBUG ("Signal power received after antenna gain for 20 MHz channel band " << +i << ": " << rxPowerPerBandW << " W (" << WToDbm (rxPowerPerBandW) << " dBm)");
307 }
308
310 {
311 NS_ASSERT (!m_ruBands[channelWidth].empty ());
312 for (const auto& bandRuPair : m_ruBands[channelWidth])
313 {
314 double rxPowerPerBandW = WifiSpectrumValueHelper::GetBandPowerW (receivedSignalPsd, bandRuPair.first);
315 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);
316 rxPowerPerBandW *= DbToRatio (GetRxGain ());
317 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)");
318 rxPowerW.insert ({bandRuPair.first, rxPowerPerBandW});
319 }
320 }
321
322 NS_LOG_DEBUG ("Total signal power received after antenna gain: " << totalRxPowerW << " W (" << WToDbm (totalRxPowerW) << " dBm)");
323
324 Ptr<WifiSpectrumSignalParameters> wifiRxParams = DynamicCast<WifiSpectrumSignalParameters> (rxParams);
325
326 // Log the signal arrival to the trace source
327 m_signalCb (wifiRxParams, senderNodeId, WToDbm (totalRxPowerW), rxDuration);
328
329 if (wifiRxParams == 0)
330 {
331 NS_LOG_INFO ("Received non Wi-Fi signal");
332 m_interference->AddForeignSignal (rxDuration, rxPowerW);
334 return;
335 }
336 if (wifiRxParams && m_disableWifiReception)
337 {
338 NS_LOG_INFO ("Received Wi-Fi signal but blocked from syncing");
339 m_interference->AddForeignSignal (rxDuration, rxPowerW);
341 return;
342 }
343 // Do no further processing if signal is too weak
344 // Current implementation assumes constant RX power over the PPDU duration
345 // Compare received TX power per MHz to normalized RX sensitivity
346 uint16_t txWidth = wifiRxParams->ppdu->GetTransmissionChannelWidth ();
347 if (totalRxPowerW < DbmToW (GetRxSensitivity ()) * (txWidth / 20.0))
348 {
349 NS_LOG_INFO ("Received signal too weak to process: " << WToDbm (totalRxPowerW) << " dBm");
350 m_interference->Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (), rxDuration,
351 rxPowerW);
353 return;
354 }
355
356 // Unless we are receiving a TB PPDU, do not sync with this signal if the PPDU
357 // does not overlap with the receiver's primary20 channel
358 if (wifiRxParams->txPhy != 0)
359 {
360 // if the channel width is a multiple of 20 MHz, then we consider the primary20 channel
361 uint16_t width = (GetChannelWidth () % 20 == 0 ? 20 : GetChannelWidth ());
362 uint16_t p20MinFreq =
364 uint16_t p20MaxFreq =
366
367 if (!wifiRxParams->ppdu->CanBeReceived (wifiRxParams->txCenterFreq, p20MinFreq, p20MaxFreq))
368 {
369 NS_LOG_INFO ("Cannot receive the PPDU, consider it as interference");
370 m_interference->Add (wifiRxParams->ppdu, wifiRxParams->ppdu->GetTxVector (),
371 rxDuration, rxPowerW);
373 return;
374 }
375 }
376
377 NS_LOG_INFO ("Received Wi-Fi signal");
378 Ptr<WifiPpdu> ppdu = wifiRxParams->ppdu->Copy ();
379 StartReceivePreamble (ppdu, rxPowerW, rxDuration);
380}
381
384{
385 return m_antenna;
386}
387
388void
390{
391 NS_LOG_FUNCTION (this << a);
392 m_antenna = a;
393}
394
395void
397{
398 NS_LOG_FUNCTION (this << device);
399 m_wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface> ();
400 m_wifiSpectrumPhyInterface->SetSpectrumWifiPhy (this);
401 m_wifiSpectrumPhyInterface->SetDevice (device);
402}
403
404void
406{
407 NS_LOG_FUNCTION (this << ppdu);
408 GetPhyEntity (ppdu->GetModulation ())->StartTx (ppdu);
409}
410
411void
413{
414 NS_LOG_FUNCTION (this << txParams);
415
416 //Finish configuration
417 NS_ASSERT_MSG (m_wifiSpectrumPhyInterface, "SpectrumPhy() is not set; maybe forgot to call CreateWifiSpectrumPhyInterface?");
418 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy> ();
419 txParams->txAntenna = m_antenna;
420
421 m_channel->StartTx (txParams);
422}
423
426{
427 uint32_t bandBandwidth = 0;
428 switch (GetStandard ())
429 {
435 // Use OFDM subcarrier width of 312.5 KHz as band granularity
436 bandBandwidth = 312500;
437 break;
439 if (GetChannelWidth () == 5)
440 {
441 // Use OFDM subcarrier width of 78.125 KHz as band granularity
442 bandBandwidth = 78125;
443 }
444 else
445 {
446 // Use OFDM subcarrier width of 156.25 KHz as band granularity
447 bandBandwidth = 156250;
448 }
449 break;
451 // Use OFDM subcarrier width of 78.125 KHz as band granularity
452 bandBandwidth = 78125;
453 break;
454 default:
455 NS_FATAL_ERROR ("Standard unknown: " << GetStandard ());
456 break;
457 }
458 return bandBandwidth;
459}
460
461uint16_t
462SpectrumWifiPhy::GetGuardBandwidth (uint16_t currentChannelWidth) const
463{
464 uint16_t guardBandwidth = 0;
465 if (currentChannelWidth == 22)
466 {
467 //handle case of DSSS transmission
468 guardBandwidth = 10;
469 }
470 else
471 {
472 //In order to properly model out of band transmissions for OFDM, the guard
473 //band has been configured so as to expand the modeled spectrum up to the
474 //outermost referenced point in "Transmit spectrum mask" sections' PSDs of
475 //each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
476 //to the currently considered channel bandwidth (which can be different from
477 //supported channel width).
478 guardBandwidth = currentChannelWidth;
479 }
480 return guardBandwidth;
481}
482
484SpectrumWifiPhy::GetBand (uint16_t bandWidth, uint8_t bandIndex)
485{
486 uint16_t channelWidth = GetChannelWidth ();
487 uint32_t bandBandwidth = GetBandBandwidth ();
488 size_t numBandsInChannel = static_cast<size_t> (channelWidth * 1e6 / bandBandwidth);
489 size_t numBandsInBand = static_cast<size_t> (bandWidth * 1e6 / bandBandwidth);
490 if (numBandsInBand % 2 == 0)
491 {
492 numBandsInChannel += 1; // symmetry around center frequency
493 }
494 size_t totalNumBands = GetRxSpectrumModel ()->GetNumBands ();
495 NS_ASSERT_MSG ((numBandsInChannel % 2 == 1) && (totalNumBands % 2 == 1), "Should have odd number of bands");
496 NS_ASSERT_MSG ((bandIndex * bandWidth) < channelWidth, "Band index is out of bound");
497 WifiSpectrumBand band;
498 band.first = ((totalNumBands - numBandsInChannel) / 2) + (bandIndex * numBandsInBand);
499 if (band.first >= totalNumBands / 2)
500 {
501 //step past DC
502 band.first += 1;
503 }
504 band.second = band.first + numBandsInBand - 1;
505 return band;
506}
507
509SpectrumWifiPhy::ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
510 HeRu::SubcarrierRange range, uint8_t bandIndex) const
511{
512 WifiSpectrumBand convertedSubcarriers;
513 uint32_t nGuardBands = static_cast<uint32_t> (((2 * guardBandwidth * 1e6) / GetBandBandwidth ()) + 0.5);
514 uint32_t centerFrequencyIndex = 0;
515 switch (bandWidth)
516 {
517 case 20:
518 centerFrequencyIndex = (nGuardBands / 2) + 6 + 122;
519 break;
520 case 40:
521 centerFrequencyIndex = (nGuardBands / 2) + 12 + 244;
522 break;
523 case 80:
524 centerFrequencyIndex = (nGuardBands / 2) + 12 + 500;
525 break;
526 case 160:
527 centerFrequencyIndex = (nGuardBands / 2) + 12 + 1012;
528 break;
529 default:
530 NS_FATAL_ERROR ("ChannelWidth " << bandWidth << " unsupported");
531 break;
532 }
533
534 size_t numBandsInBand = static_cast<size_t> (bandWidth * 1e6 / GetBandBandwidth ());
535 centerFrequencyIndex += numBandsInBand * bandIndex;
536
537 convertedSubcarriers.first = centerFrequencyIndex + range.first;
538 convertedSubcarriers.second = centerFrequencyIndex + range.second;
539 return convertedSubcarriers;
540}
541
542std::tuple<double, double, double>
544{
545 return std::make_tuple (m_txMaskInnerBandMinimumRejection,
548}
549
550} //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
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:418
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:50
void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1624
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:900
WifiStandard GetStandard(void) const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:894
virtual void DoDispose(void)
Destructor implementation.
Definition: wifi-phy.cc:339
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
Definition: wifi-phy.cc:1980
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class, for the WifiPhy instance.
Definition: wifi-phy.cc:644
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:1869
double GetRxGain(void) const
Return the reception gain (dB).
Definition: wifi-phy.cc:516
double GetRxSensitivity(void) const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:427
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1142
virtual void DoChannelSwitch(void)
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1021
uint16_t GetChannelWidth(void) const
Definition: wifi-phy.cc:918
uint16_t GetFrequency(void) const
Definition: wifi-phy.cc:906
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