A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-wifi-phy.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Ghada Badawy <gbadawy@gmail.com>
19 * Sébastien Deronne <sebastien.deronne@gmail.com>
20 *
21 * Ported from yans-wifi-phy.cc by several contributors starting
22 * with Nicola Baldo and Dean Armstrong
23 */
24
25#include "spectrum-wifi-phy.h"
26
27#include "interference-helper.h"
28#include "wifi-psdu.h"
31#include "wifi-utils.h"
32
33#include "ns3/boolean.h"
34#include "ns3/double.h"
35#include "ns3/he-phy.h"
36#include "ns3/log.h"
37#include "ns3/node.h"
38#include "ns3/simulator.h"
39#include "ns3/spectrum-channel.h"
40#include "ns3/wifi-net-device.h"
41
42#include <algorithm>
43
44namespace ns3
45{
46
47NS_LOG_COMPONENT_DEFINE("SpectrumWifiPhy");
48
49NS_OBJECT_ENSURE_REGISTERED(SpectrumWifiPhy);
50
51TypeId
53{
54 static TypeId tid =
55 TypeId("ns3::SpectrumWifiPhy")
57 .SetGroupName("Wifi")
58 .AddConstructor<SpectrumWifiPhy>()
59 .AddAttribute("DisableWifiReception",
60 "Prevent Wi-Fi frame sync from ever happening",
61 BooleanValue(false),
64 .AddAttribute(
65 "TrackSignalsFromInactiveInterfaces",
66 "Enable or disable tracking signals coming from inactive spectrum PHY interfaces",
67 BooleanValue(false),
70 .AddAttribute(
71 "TxMaskInnerBandMinimumRejection",
72 "Minimum rejection (dBr) for the inner band of the transmit spectrum mask",
73 DoubleValue(-20.0),
75 MakeDoubleChecker<double>())
76 .AddAttribute(
77 "TxMaskOuterBandMinimumRejection",
78 "Minimum rejection (dBr) for the outer band of the transmit spectrum mask",
79 DoubleValue(-28.0),
81 MakeDoubleChecker<double>())
82 .AddAttribute(
83 "TxMaskOuterBandMaximumRejection",
84 "Maximum rejection (dBr) for the outer band of the transmit spectrum mask",
85 DoubleValue(-40.0),
87 MakeDoubleChecker<double>())
88 .AddTraceSource("SignalArrival",
89 "Signal arrival",
91 "ns3::SpectrumWifiPhy::SignalArrivalCallback");
92 return tid;
93}
94
96 : m_spectrumPhyInterfaces{},
97 m_currentSpectrumPhyInterface{nullptr}
98{
99 NS_LOG_FUNCTION(this);
100}
101
103{
104 NS_LOG_FUNCTION(this);
105}
106
107void
109{
110 NS_LOG_FUNCTION(this);
113 m_antenna = nullptr;
115}
116
117void
119{
120 NS_LOG_FUNCTION(this);
122}
123
124void
126{
127 NS_LOG_FUNCTION(this);
129 uint16_t channelWidth = GetChannelWidth();
131 if (channelWidth < 20)
132 {
133 bands.push_back(GetBand(channelWidth));
134 }
135 else
136 {
137 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
138 {
139 for (uint32_t i = 0; i < (channelWidth / bw); ++i)
140 {
141 bands.push_back(GetBand(bw, i));
142 }
143 }
144 }
147 {
148 auto&& ruBands = HePhy::GetRuBands(this, channelWidth, GetGuardBandwidth(channelWidth));
149 for (const auto& bandRuPair : ruBands)
150 {
151 allBands.push_back(bandRuPair.first);
152 }
153 m_currentSpectrumPhyInterface->SetRuBands(std::move(ruBands));
154 }
155
156 m_currentSpectrumPhyInterface->SetBands(std::move(bands));
157
158 if (m_interference->HasBands())
159 {
160 m_interference->UpdateBands(allBands, GetCurrentFrequencyRange());
161 }
162 else
163 {
164 for (const auto& band : allBands)
165 {
166 m_interference->AddBand(band);
167 }
168 }
169}
170
173{
175 return m_currentSpectrumPhyInterface->GetChannel();
176}
177
178void
180{
181 NS_LOG_FUNCTION(this << channel << freqRange);
182
183 const auto foundOverlappingChannel =
184 std::any_of(m_spectrumPhyInterfaces.cbegin(),
186 [freqRange, channel](const auto& item) {
187 const auto spectrumRange = item.first;
188 const auto noOverlap =
189 ((freqRange.minFrequency >= spectrumRange.maxFrequency) ||
190 (freqRange.maxFrequency <= spectrumRange.minFrequency));
191 return (!noOverlap);
192 });
193 NS_ABORT_MSG_IF(foundOverlappingChannel,
194 "Added a wifi spectrum channel that overlaps with another existing wifi "
195 "spectrum channel");
196
197 auto wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface>(freqRange);
198 wifiSpectrumPhyInterface->SetSpectrumWifiPhy(this);
199 wifiSpectrumPhyInterface->SetChannel(channel);
200 if (GetDevice())
201 {
202 wifiSpectrumPhyInterface->SetDevice(GetDevice());
203 }
204 m_spectrumPhyInterfaces.emplace(freqRange, wifiSpectrumPhyInterface);
205}
206
207void
209{
210 NS_LOG_FUNCTION(this);
211
212 // We have to reset the spectrum model because we changed RF channel. Consequently,
213 // we also have to add the spectrum interface to the spectrum channel again because
214 // MultiModelSpectrumChannel keeps spectrum interfaces in a map indexed by the RX
215 // spectrum model UID (which has changed after channel switching).
216 // Both SingleModelSpectrumChannel and MultiModelSpectrumChannel ensure not to keep
217 // duplicated spectrum interfaces (the latter removes the spectrum interface and adds
218 // it again in the entry associated with the new RX spectrum model UID)
219
220 const auto channelWidth = GetChannelWidth();
221 const auto centerFrequency = GetFrequency();
222 if (m_currentSpectrumPhyInterface->GetCenterFrequency() == centerFrequency)
223 {
224 // Center frequency has not changed for that interface, hence we do not need to
225 // reset the spectrum model nor update any band stored in the interference helper
227 {
228 // If we are not tracking signals from inactive interface,
229 // this means the spectrum interface has been disconnected
230 // from the spectrum channel and has to be connected back
232 }
233 return;
234 }
235
236 // Replace existing spectrum model with new one
237 m_currentSpectrumPhyInterface->SetRxSpectrumModel(centerFrequency,
238 channelWidth,
240 GetGuardBandwidth(channelWidth));
241
243
245}
246
247void
249{
250 NS_LOG_FUNCTION(this);
251 const auto frequencyBefore = GetOperatingChannel().IsSet() ? GetFrequency() : 0;
252 const auto widthBefore = GetOperatingChannel().IsSet() ? GetChannelWidth() : 0;
254 const auto frequencyAfter = GetFrequency();
255 const auto widthAfter = GetChannelWidth();
256 if ((frequencyBefore == frequencyAfter) && (widthBefore == widthAfter))
257 {
258 NS_LOG_DEBUG("Same RF channel as before, do nothing");
259 if (IsInitialized())
260 {
261 SwitchMaybeToCcaBusy(nullptr);
262 }
263 return;
264 }
265
266 auto newSpectrumPhyInterface = GetInterfaceCoveringChannelBand(frequencyAfter, widthAfter);
267 const auto interfaceChanged = (newSpectrumPhyInterface != m_currentSpectrumPhyInterface);
268
269 NS_ABORT_MSG_IF(!newSpectrumPhyInterface,
270 "No spectrum channel covers frequency range ["
271 << frequencyAfter - (widthAfter / 2) << " MHz - "
272 << frequencyAfter + (widthAfter / 2) << " MHz]");
273
274 if (interfaceChanged)
275 {
276 NS_LOG_DEBUG("Switch to existing RF interface with frequency/width pair of ("
277 << frequencyAfter << ", " << widthAfter << ")");
279 {
281 }
282 }
283
284 m_currentSpectrumPhyInterface = newSpectrumPhyInterface;
286
287 if (IsInitialized())
288 {
289 SwitchMaybeToCcaBusy(nullptr);
290 }
291}
292
293bool
295{
296 return GetLatestPhyEntity()->CanStartRx(ppdu, txWidth);
297}
298
299void
302{
303 NS_LOG_FUNCTION(this << rxParams << interface);
304 Time rxDuration = rxParams->duration;
305 Ptr<SpectrumValue> receivedSignalPsd = rxParams->psd;
306 NS_LOG_DEBUG("Received signal with PSD " << *receivedSignalPsd << " and duration "
307 << rxDuration.As(Time::NS));
308 uint32_t senderNodeId = 0;
309 if (rxParams->txPhy)
310 {
311 senderNodeId = rxParams->txPhy->GetDevice()->GetNode()->GetId();
312 }
313 NS_LOG_DEBUG("Received signal from " << senderNodeId << " with unfiltered power "
314 << WToDbm(Integral(*receivedSignalPsd)) << " dBm");
315
316 // Integrate over our receive bandwidth (i.e., all that the receive
317 // spectral mask representing our filtering allows) to find the
318 // total energy apparent to the "demodulator".
319 // This is done per 20 MHz channel band.
320 const auto channelWidth = interface ? interface->GetChannelWidth() : GetChannelWidth();
321 const auto& bands =
322 interface ? interface->GetBands() : m_currentSpectrumPhyInterface->GetBands();
323 double totalRxPowerW = 0;
325
326 std::size_t index = 0;
327 uint16_t prevBw = 0;
328 for (const auto& band : bands)
329 {
330 uint16_t bw = (band.frequencies.second - band.frequencies.first) / 1e6;
331 NS_ASSERT(bw <= channelWidth);
332 index = ((bw != prevBw) ? 0 : (index + 1));
333 double rxPowerPerBandW =
334 WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, band.indices);
335 NS_LOG_DEBUG("Signal power received (watts) before antenna gain for "
336 << bw << " MHz channel band " << index << ": " << band);
337 rxPowerPerBandW *= DbToRatio(GetRxGain());
338 rxPowerW.insert({band, rxPowerPerBandW});
339 NS_LOG_DEBUG("Signal power received after antenna gain for "
340 << bw << " MHz channel band " << index << ": " << rxPowerPerBandW << " W ("
341 << WToDbm(rxPowerPerBandW) << " dBm)");
342 if (bw <= 20)
343 {
344 totalRxPowerW += rxPowerPerBandW;
345 }
346 prevBw = bw;
347 }
348
350 {
351 const auto& ruBands =
352 interface ? interface->GetRuBands() : m_currentSpectrumPhyInterface->GetRuBands();
353 NS_ASSERT(!ruBands.empty());
354 for (const auto& [band, ru] : ruBands)
355 {
356 double rxPowerPerBandW =
357 WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, band.indices);
358 NS_LOG_DEBUG("Signal power received (watts) before antenna gain for RU with type "
359 << ru.GetRuType() << " and index " << ru.GetIndex() << " -> ("
360 << band.indices.first << "; " << band.indices.second
361 << "): " << rxPowerPerBandW);
362 rxPowerPerBandW *= DbToRatio(GetRxGain());
363 NS_LOG_DEBUG("Signal power received after antenna gain for RU with type "
364 << ru.GetRuType() << " and index " << ru.GetIndex() << " -> ("
365 << band.indices.first << "; " << band.indices.second << "): "
366 << rxPowerPerBandW << " W (" << WToDbm(rxPowerPerBandW) << " dBm)");
367 rxPowerW.insert({band, rxPowerPerBandW});
368 }
369 }
370
371 NS_LOG_DEBUG("Total signal power received after antenna gain: "
372 << totalRxPowerW << " W (" << WToDbm(totalRxPowerW) << " dBm)");
373
375 DynamicCast<WifiSpectrumSignalParameters>(rxParams);
376
377 // Log the signal arrival to the trace source
378 m_signalCb(bool(wifiRxParams), senderNodeId, WToDbm(totalRxPowerW), rxDuration);
379
380 if (!wifiRxParams)
381 {
382 NS_LOG_INFO("Received non Wi-Fi signal");
383 m_interference->AddForeignSignal(rxDuration, rxPowerW);
384 SwitchMaybeToCcaBusy(nullptr);
385 return;
386 }
387
388 if (wifiRxParams && m_disableWifiReception)
389 {
390 NS_LOG_INFO("Received Wi-Fi signal but blocked from syncing");
391 m_interference->AddForeignSignal(rxDuration, rxPowerW);
392 SwitchMaybeToCcaBusy(nullptr);
393 return;
394 }
395
396 if (m_trackSignalsInactiveInterfaces && interface &&
397 (interface != m_currentSpectrumPhyInterface))
398 {
399 NS_LOG_INFO("Received Wi-Fi signal from a non-active PHY interface");
400 m_interference->AddForeignSignal(rxDuration, rxPowerW);
401 SwitchMaybeToCcaBusy(nullptr);
402 return;
403 }
404
405 // Do no further processing if signal is too weak
406 // Current implementation assumes constant RX power over the PPDU duration
407 // Compare received TX power per MHz to normalized RX sensitivity
408 const auto txWidth = wifiRxParams->txWidth;
409 const auto& ppdu = GetRxPpduFromTxPpdu(wifiRxParams->ppdu);
410 const auto& txVector = ppdu->GetTxVector();
411 if (totalRxPowerW < DbmToW(GetRxSensitivity()) * (txWidth / 20.0))
412 {
413 NS_LOG_INFO("Received signal too weak to process: " << WToDbm(totalRxPowerW) << " dBm");
414 m_interference->Add(ppdu, txVector, rxDuration, rxPowerW);
415 SwitchMaybeToCcaBusy(nullptr);
416 return;
417 }
418
419 if (wifiRxParams->txPhy)
420 {
421 if (!CanStartRx(ppdu, txWidth))
422 {
423 NS_LOG_INFO("Cannot start reception of the PPDU, consider it as interference");
424 m_interference->Add(ppdu, txVector, rxDuration, rxPowerW);
426 return;
427 }
428 }
429
430 NS_LOG_INFO("Received Wi-Fi signal");
431 StartReceivePreamble(ppdu, rxPowerW, rxDuration);
432}
433
436{
437 return GetPhyEntityForPpdu(ppdu)->GetRxPpduFromTxPpdu(ppdu);
438}
439
442{
443 return m_antenna;
444}
445
446void
448{
449 NS_LOG_FUNCTION(this << a);
450 m_antenna = a;
451}
452
453void
455{
456 NS_LOG_FUNCTION(this << device);
457 WifiPhy::SetDevice(device);
458 for (auto& spectrumPhyInterface : m_spectrumPhyInterfaces)
459 {
460 spectrumPhyInterface.second->SetDevice(device);
461 }
462}
463
464void
466{
467 NS_LOG_FUNCTION(this << ppdu);
468 GetPhyEntity(ppdu->GetModulation())->StartTx(ppdu);
469}
470
471void
473{
474 NS_LOG_FUNCTION(this << txParams);
476 m_currentSpectrumPhyInterface->StartTx(txParams);
477}
478
479uint16_t
480SpectrumWifiPhy::GetGuardBandwidth(uint16_t currentChannelWidth) const
481{
482 uint16_t guardBandwidth = 0;
483 if (currentChannelWidth == 22)
484 {
485 // handle case of DSSS transmission
486 guardBandwidth = 10;
487 }
488 else
489 {
490 // In order to properly model out of band transmissions for OFDM, the guard
491 // band has been configured so as to expand the modeled spectrum up to the
492 // outermost referenced point in "Transmit spectrum mask" sections' PSDs of
493 // each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
494 // to the currently considered channel bandwidth (which can be different from
495 // supported channel width).
496 guardBandwidth = currentChannelWidth;
497 }
498 return guardBandwidth;
499}
500
502SpectrumWifiPhy::GetBand(uint16_t bandWidth, uint8_t bandIndex /* = 0 */)
503{
504 auto channelWidth = GetChannelWidth();
505 auto subcarrierSpacing = GetSubcarrierSpacing();
506 auto numBandsInChannel = static_cast<size_t>(channelWidth * 1e6 / subcarrierSpacing);
507 auto numBandsInBand = static_cast<size_t>(bandWidth * 1e6 / subcarrierSpacing);
508 if (numBandsInBand % 2 == 0)
509 {
510 numBandsInChannel += 1; // symmetry around center frequency
511 }
513 auto rxSpectrumModel = m_currentSpectrumPhyInterface->GetRxSpectrumModel();
514 size_t totalNumBands = rxSpectrumModel->GetNumBands();
515 NS_ASSERT_MSG((numBandsInChannel % 2 == 1) && (totalNumBands % 2 == 1),
516 "Should have odd number of bands");
517 NS_ASSERT_MSG((bandIndex * bandWidth) < channelWidth, "Band index is out of bound");
518 NS_ASSERT(totalNumBands >= numBandsInChannel);
519 auto startIndex = ((totalNumBands - numBandsInChannel) / 2) + (bandIndex * numBandsInBand);
520 auto stopIndex = startIndex + numBandsInBand - 1;
521 auto frequencies = ConvertIndicesToFrequencies({startIndex, stopIndex});
522 auto freqRange = m_currentSpectrumPhyInterface->GetFrequencyRange();
523 NS_ASSERT(frequencies.first >= (freqRange.minFrequency * 1e6));
524 NS_ASSERT(frequencies.second <= (freqRange.maxFrequency * 1e6));
525 NS_ASSERT((frequencies.second - frequencies.first) == (bandWidth * 1e6));
526 if (startIndex >= totalNumBands / 2)
527 {
528 // step past DC
529 startIndex += 1;
530 }
531 return {{startIndex, stopIndex}, frequencies};
532}
533
536{
538 auto rxSpectrumModel = m_currentSpectrumPhyInterface->GetRxSpectrumModel();
539 auto startGuardBand = rxSpectrumModel->Begin();
540 auto startChannel = std::next(startGuardBand, indices.first);
541 auto endChannel = std::next(startGuardBand, indices.second + 1);
542 auto lowFreq = static_cast<uint64_t>(startChannel->fc);
543 auto highFreq = static_cast<uint64_t>(endChannel->fc);
544 return {lowFreq, highFreq};
545}
546
547std::tuple<double, double, double>
549{
550 return std::make_tuple(m_txMaskInnerBandMinimumRejection,
553}
554
557{
559 return m_currentSpectrumPhyInterface->GetFrequencyRange();
560}
561
563SpectrumWifiPhy::GetInterfaceCoveringChannelBand(uint16_t frequency, uint16_t width) const
564{
565 const auto lowFreq = frequency - (width / 2);
566 const auto highFreq = frequency + (width / 2);
567 const auto it = std::find_if(m_spectrumPhyInterfaces.cbegin(),
569 [lowFreq, highFreq](const auto& item) {
570 return ((lowFreq >= item.first.minFrequency) &&
571 (highFreq <= item.first.maxFrequency));
572 });
573 if (it == std::end(m_spectrumPhyInterfaces))
574 {
575 return nullptr;
576 }
577 return it->second;
578}
579
582{
584}
585
586} // 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:42
static RuBands GetRuBands(Ptr< const WifiPhy > phy, uint16_t channelWidth, uint16_t guardBandwidth)
Static function to compute the RU bands that belong to a given channel width.
Definition: he-phy.cc:1883
bool IsInitialized() const
Check if the object has been initialized.
Definition: object.cc:212
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
802.11 PHY layer model
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
std::tuple< double, double, double > GetTxMaskRejectionParams() const override
bool CanStartRx(Ptr< const WifiPpdu > ppdu, uint16_t txChannelWidth) const
Determine whether the PHY shall issue a PHY-RXSTART.indication primitive in response to a given PPDU.
void SetDevice(const Ptr< WifiNetDevice > device) override
Sets the device this PHY is associated with.
void Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
void StartRx(Ptr< SpectrumSignalParameters > rxParams, Ptr< const WifiSpectrumPhyInterface > interface)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void DoInitialize() override
Initialize() implementation.
std::map< FrequencyRange, Ptr< WifiSpectrumPhyInterface > > m_spectrumPhyInterfaces
Spectrum PHY interfaces.
Ptr< AntennaModel > m_antenna
antenna model
FrequencyRange GetCurrentFrequencyRange() const override
Get the frequency range of the current RF interface.
Ptr< const WifiPpdu > GetRxPpduFromTxPpdu(Ptr< const WifiPpdu > ppdu)
Determine the WifiPpdu to be used by the RX PHY based on the WifiPpdu sent by the TX PHY.
Ptr< WifiSpectrumPhyInterface > GetInterfaceCoveringChannelBand(uint16_t frequency, uint16_t width) const
Get the spectrum PHY interface that covers a band portion of the RF channel.
Ptr< AntennaModel > GetAntenna() const
Get the antenna model used for reception.
Ptr< Channel > GetChannel() const override
Return the Channel this WifiPhy is connected to.
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Attach a SpectrumChannel to use for a given frequency range.
Ptr< WifiSpectrumPhyInterface > m_currentSpectrumPhyInterface
The current Spectrum PHY interface (held for performance reasons)
Ptr< WifiSpectrumPhyInterface > GetCurrentInterface() const
Get the currently active spectrum PHY interface.
double m_txMaskInnerBandMinimumRejection
The minimum rejection (in dBr) for the inner band of the transmit spectrum mask.
bool m_trackSignalsInactiveInterfaces
flag whether signals coming from inactive spectrum PHY interfaces are tracked
double m_txMaskOuterBandMinimumRejection
The minimum rejection (in dBr) for the outer band of the transmit spectrum mask.
void DoDispose() override
Destructor implementation.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
void ResetSpectrumModelIfNeeded()
Perform run-time spectrum model change if the one used by the current Spectrum PHY interface has chan...
static TypeId GetTypeId()
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.
WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the info of a given band.
bool m_disableWifiReception
forces this PHY to fail to sync on any signal
void UpdateInterferenceHelperBands()
This function is called to update the bands handled by the InterferenceHelper.
void StartTx(Ptr< const WifiPpdu > ppdu) override
void DoChannelSwitch() override
Actually switch channel based on the stored channel settings.
WifiSpectrumBandFrequencies ConvertIndicesToFrequencies(const WifiSpectrumBandIndices &indices) const override
This is a helper function to convert start and stop indices to start and stop frequencies.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:417
@ NS
nanosecond
Definition: nstime.h:119
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
802.11 PHY layer model
Definition: wifi-phy.h:53
uint32_t GetSubcarrierSpacing() const
Definition: wifi-phy.cc:2204
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1035
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:488
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1023
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:713
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:609
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1833
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-phy.cc:615
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:401
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1169
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1231
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:376
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1011
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:734
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: wifi-phy.cc:2063
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1017
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:728
bool IsSet() const
Return true if a valid channel has been set, false otherwise.
std::vector< WifiSpectrumBandInfo > WifiSpectrumBands
vector of spectrum bands handled by this interface
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#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:86
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#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:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
@ WIFI_STANDARD_80211ax
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:46
std::pair< uint64_t, uint64_t > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies in Hz to represent a band
double Integral(const SpectrumValue &arg)
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:40
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
std::map< WifiSpectrumBandInfo, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:34
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
WifiSpectrumBandInfo structure containing info about a spectrum band.