A Discrete-Event Network Simulator
API
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/log.h"
36#include "ns3/node.h"
37#include "ns3/simulator.h"
38#include "ns3/wifi-net-device.h"
39
40namespace ns3
41{
42
43NS_LOG_COMPONENT_DEFINE("SpectrumWifiPhy");
44
45NS_OBJECT_ENSURE_REGISTERED(SpectrumWifiPhy);
46
47TypeId
49{
50 static TypeId tid =
51 TypeId("ns3::SpectrumWifiPhy")
53 .SetGroupName("Wifi")
54 .AddConstructor<SpectrumWifiPhy>()
55 .AddAttribute("DisableWifiReception",
56 "Prevent Wi-Fi frame sync from ever happening",
57 BooleanValue(false),
60 .AddAttribute(
61 "TxMaskInnerBandMinimumRejection",
62 "Minimum rejection (dBr) for the inner band of the transmit spectrum mask",
63 DoubleValue(-20.0),
65 MakeDoubleChecker<double>())
66 .AddAttribute(
67 "TxMaskOuterBandMinimumRejection",
68 "Minimum rejection (dBr) for the outer band of the transmit spectrum mask",
69 DoubleValue(-28.0),
71 MakeDoubleChecker<double>())
72 .AddAttribute(
73 "TxMaskOuterBandMaximumRejection",
74 "Maximum rejection (dBr) for the outer band of the transmit spectrum mask",
75 DoubleValue(-40.0),
77 MakeDoubleChecker<double>())
78 .AddTraceSource("SignalArrival",
79 "Signal arrival",
81 "ns3::SpectrumWifiPhy::SignalArrivalCallback");
82 return tid;
83}
84
86{
87 NS_LOG_FUNCTION(this);
88}
89
91{
92 NS_LOG_FUNCTION(this);
93}
94
95void
97{
98 NS_LOG_FUNCTION(this);
99 m_channel = nullptr;
101 m_antenna = nullptr;
102 m_rxSpectrumModel = nullptr;
103 m_ruBands.clear();
105}
106
107void
109{
110 NS_LOG_FUNCTION(this);
112 // This connection is deferred until frequency and channel width are set
114 {
116 }
117 else
118 {
119 NS_FATAL_ERROR("SpectrumWifiPhy misses channel and WifiSpectrumPhyInterface objects at "
120 "initialization time");
121 }
122}
123
126{
127 NS_LOG_FUNCTION(this);
129 {
130 return m_rxSpectrumModel;
131 }
132 else
133 {
134 if (GetFrequency() == 0)
135 {
136 NS_LOG_DEBUG("Frequency is not set; returning 0");
137 return nullptr;
138 }
139 else
140 {
141 uint16_t channelWidth = GetChannelWidth();
142 NS_LOG_DEBUG("Creating spectrum model from frequency/width pair of ("
143 << GetFrequency() << ", " << channelWidth << ")");
146 channelWidth,
148 GetGuardBandwidth(channelWidth));
150 }
151 }
152 return m_rxSpectrumModel;
153}
154
155void
157{
158 NS_LOG_FUNCTION(this);
159 uint16_t channelWidth = GetChannelWidth();
160 m_interference->RemoveBands();
161 if (channelWidth < 20)
162 {
163 WifiSpectrumBand band = GetBand(channelWidth);
164 m_interference->AddBand(band);
165 }
166 else
167 {
168 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
169 {
170 for (uint32_t i = 0; i < (channelWidth / bw); ++i)
171 {
172 m_interference->AddBand(GetBand(bw, i));
173 }
174 }
175 }
177 {
178 // For a given RU type, some RUs over a channel occupy the same tones as
179 // the corresponding RUs over a subchannel, while some others not. For instance,
180 // the first nine 26-tone RUs over an 80 MHz channel occupy the same tones as
181 // the first nine 26-tone RUs over the lowest 40 MHz subchannel. Therefore, we
182 // need to store all the bands in a set (which removes duplicates) and then
183 // pass the elements in the set to AddBand (to which we cannot pass duplicates)
184 if (m_ruBands[channelWidth].empty())
185 {
186 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
187 {
188 for (uint32_t i = 0; i < (channelWidth / bw); ++i)
189 {
190 for (uint32_t type = 0; type < 7; type++)
191 {
192 HeRu::RuType ruType = static_cast<HeRu::RuType>(type);
193 std::size_t nRus = HeRu::GetNRus(bw, ruType);
194 for (std::size_t phyIndex = 1; phyIndex <= nRus; phyIndex++)
195 {
197 HeRu::GetSubcarrierGroup(bw, ruType, phyIndex);
199 std::make_pair(group.front().first, group.back().second);
200 WifiSpectrumBand band =
202 GetGuardBandwidth(channelWidth),
203 range,
204 i);
205 std::size_t index =
206 (bw == 160 && phyIndex > nRus / 2 ? phyIndex - nRus / 2 : phyIndex);
207 bool primary80IsLower80 =
209 bool primary80 = (bw < 160 || ruType == HeRu::RU_2x996_TONE ||
210 (primary80IsLower80 && phyIndex <= nRus / 2) ||
211 (!primary80IsLower80 && phyIndex > nRus / 2));
212 HeRu::RuSpec ru(ruType, index, primary80);
214 GetOperatingChannel().GetPrimaryChannelIndex(
215 20)) != phyIndex);
216 m_ruBands[channelWidth].insert({band, ru});
217 }
218 }
219 }
220 }
221 }
222 for (const auto& bandRuPair : m_ruBands[channelWidth])
223 {
224 m_interference->AddBand(bandRuPair.first);
225 }
226 }
227}
228
231{
232 return m_channel;
233}
234
235void
237{
239}
240
241void
243{
244 NS_LOG_FUNCTION(this);
245 NS_ASSERT_MSG(IsInitialized(), "Executing method before run-time");
246 uint16_t channelWidth = GetChannelWidth();
247 NS_LOG_DEBUG("Run-time change of spectrum model from frequency/width pair of ("
248 << GetFrequency() << ", " << channelWidth << ")");
249 // Replace existing spectrum model with new one, and must call AddRx ()
250 // on the SpectrumChannel to provide this new spectrum model to it
252 channelWidth,
254 GetGuardBandwidth(channelWidth));
257}
258
259void
261{
262 NS_LOG_FUNCTION(this);
264 if (IsInitialized())
265 {
267 }
268}
269
270bool
272{
273 return GetLatestPhyEntity()->CanStartRx(ppdu, txWidth);
274}
275
276void
278{
279 NS_LOG_FUNCTION(this << rxParams);
280 Time rxDuration = rxParams->duration;
281 Ptr<SpectrumValue> receivedSignalPsd = rxParams->psd;
282 NS_LOG_DEBUG("Received signal with PSD " << *receivedSignalPsd << " and duration "
283 << rxDuration.As(Time::NS));
284 uint32_t senderNodeId = 0;
285 if (rxParams->txPhy)
286 {
287 senderNodeId = rxParams->txPhy->GetDevice()->GetNode()->GetId();
288 }
289 NS_LOG_DEBUG("Received signal from " << senderNodeId << " with unfiltered power "
290 << WToDbm(Integral(*receivedSignalPsd)) << " dBm");
291
292 // Integrate over our receive bandwidth (i.e., all that the receive
293 // spectral mask representing our filtering allows) to find the
294 // total energy apparent to the "demodulator".
295 // This is done per 20 MHz channel band.
296 uint16_t channelWidth = GetChannelWidth();
297 double totalRxPowerW = 0;
299
300 if ((channelWidth == 5) || (channelWidth == 10))
301 {
302 WifiSpectrumBand filteredBand = GetBand(channelWidth);
303 double rxPowerPerBandW =
304 WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, filteredBand);
305 NS_LOG_DEBUG("Signal power received (watts) before antenna gain: " << rxPowerPerBandW);
306 rxPowerPerBandW *= DbToRatio(GetRxGain());
307 totalRxPowerW += rxPowerPerBandW;
308 rxPowerW.insert({filteredBand, rxPowerPerBandW});
309 NS_LOG_DEBUG("Signal power received after antenna gain for "
310 << channelWidth << " MHz channel: " << rxPowerPerBandW << " W ("
311 << WToDbm(rxPowerPerBandW) << " dBm)");
312 }
313
314 // 20 MHz is handled apart since the totalRxPowerW is computed through it
315 for (uint16_t bw = 160; bw > 20; bw = bw / 2)
316 {
317 for (uint32_t i = 0; i < (channelWidth / bw); i++)
318 {
319 NS_ASSERT(channelWidth >= bw);
320 WifiSpectrumBand filteredBand = GetBand(bw, i);
321 double rxPowerPerBandW =
322 WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, filteredBand);
323 NS_LOG_DEBUG("Signal power received (watts) before antenna gain for "
324 << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW);
325 rxPowerPerBandW *= DbToRatio(GetRxGain());
326 rxPowerW.insert({filteredBand, rxPowerPerBandW});
327 NS_LOG_DEBUG("Signal power received after antenna gain for "
328 << bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W ("
329 << WToDbm(rxPowerPerBandW) << " dBm)");
330 }
331 }
332
333 for (uint32_t i = 0; i < (channelWidth / 20); i++)
334 {
335 WifiSpectrumBand filteredBand = GetBand(20, i);
336 double rxPowerPerBandW =
337 WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, filteredBand);
338 NS_LOG_DEBUG("Signal power received (watts) before antenna gain for 20 MHz channel band "
339 << +i << ": " << rxPowerPerBandW);
340 rxPowerPerBandW *= DbToRatio(GetRxGain());
341 totalRxPowerW += rxPowerPerBandW;
342 rxPowerW.insert({filteredBand, rxPowerPerBandW});
343 NS_LOG_DEBUG("Signal power received after antenna gain for 20 MHz channel band "
344 << +i << ": " << rxPowerPerBandW << " W (" << WToDbm(rxPowerPerBandW)
345 << " dBm)");
346 }
347
349 {
350 NS_ASSERT(!m_ruBands[channelWidth].empty());
351 for (const auto& bandRuPair : m_ruBands[channelWidth])
352 {
353 double rxPowerPerBandW =
354 WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, bandRuPair.first);
355 NS_LOG_DEBUG("Signal power received (watts) before antenna gain for RU with type "
356 << bandRuPair.second.GetRuType() << " and index "
357 << bandRuPair.second.GetIndex() << " -> (" << bandRuPair.first.first
358 << "; " << bandRuPair.first.second << "): " << rxPowerPerBandW);
359 rxPowerPerBandW *= DbToRatio(GetRxGain());
360 NS_LOG_DEBUG("Signal power received after antenna gain for RU with type "
361 << bandRuPair.second.GetRuType() << " and index "
362 << bandRuPair.second.GetIndex() << " -> (" << bandRuPair.first.first
363 << "; " << bandRuPair.first.second << "): " << rxPowerPerBandW << " W ("
364 << WToDbm(rxPowerPerBandW) << " dBm)");
365 rxPowerW.insert({bandRuPair.first, rxPowerPerBandW});
366 }
367 }
368
369 NS_LOG_DEBUG("Total signal power received after antenna gain: "
370 << totalRxPowerW << " W (" << WToDbm(totalRxPowerW) << " dBm)");
371
373 DynamicCast<WifiSpectrumSignalParameters>(rxParams);
374
375 // Log the signal arrival to the trace source
376 m_signalCb(bool(wifiRxParams), senderNodeId, WToDbm(totalRxPowerW), rxDuration);
377
378 if (!wifiRxParams)
379 {
380 NS_LOG_INFO("Received non Wi-Fi signal");
381 m_interference->AddForeignSignal(rxDuration, rxPowerW);
382 SwitchMaybeToCcaBusy(nullptr);
383 return;
384 }
385 if (wifiRxParams && m_disableWifiReception)
386 {
387 NS_LOG_INFO("Received Wi-Fi signal but blocked from syncing");
388 m_interference->AddForeignSignal(rxDuration, rxPowerW);
389 SwitchMaybeToCcaBusy(nullptr);
390 return;
391 }
392 // Do no further processing if signal is too weak
393 // Current implementation assumes constant RX power over the PPDU duration
394 // Compare received TX power per MHz to normalized RX sensitivity
395 const auto txWidth = wifiRxParams->txWidth;
396 const auto& ppdu = GetRxPpduFromTxPpdu(wifiRxParams->ppdu);
397 const auto& txVector = ppdu->GetTxVector();
398 if (totalRxPowerW < DbmToW(GetRxSensitivity()) * (txWidth / 20.0))
399 {
400 NS_LOG_INFO("Received signal too weak to process: " << WToDbm(totalRxPowerW) << " dBm");
401 m_interference->Add(ppdu, txVector, rxDuration, rxPowerW);
402 SwitchMaybeToCcaBusy(nullptr);
403 return;
404 }
405
406 if (wifiRxParams->txPhy)
407 {
408 if (!CanStartRx(ppdu, txWidth))
409 {
410 NS_LOG_INFO("Cannot start reception of the PPDU, consider it as interference");
411 m_interference->Add(ppdu, txVector, rxDuration, rxPowerW);
413 return;
414 }
415 }
416
417 NS_LOG_INFO("Received Wi-Fi signal");
418 StartReceivePreamble(ppdu, rxPowerW, rxDuration);
419}
420
423{
424 return GetPhyEntityForPpdu(ppdu)->GetRxPpduFromTxPpdu(ppdu);
425}
426
429{
430 return m_antenna;
431}
432
433void
435{
436 NS_LOG_FUNCTION(this << a);
437 m_antenna = a;
438}
439
440void
442{
443 NS_LOG_FUNCTION(this << device);
444 m_wifiSpectrumPhyInterface = CreateObject<WifiSpectrumPhyInterface>();
445 m_wifiSpectrumPhyInterface->SetSpectrumWifiPhy(this);
446 m_wifiSpectrumPhyInterface->SetDevice(device);
447}
448
449void
451{
452 NS_LOG_FUNCTION(this << ppdu);
453 GetPhyEntity(ppdu->GetModulation())->StartTx(ppdu);
454}
455
456void
458{
459 NS_LOG_FUNCTION(this << txParams);
460
461 // Finish configuration
463 "SpectrumPhy() is not set; maybe forgot to call CreateWifiSpectrumPhyInterface?");
464 txParams->txPhy = m_wifiSpectrumPhyInterface->GetObject<SpectrumPhy>();
465 txParams->txAntenna = m_antenna;
466
467 m_channel->StartTx(txParams);
468}
469
472{
473 uint32_t bandBandwidth = 0;
474 switch (GetStandard())
475 {
481 // Use OFDM subcarrier width of 312.5 KHz as band granularity
482 bandBandwidth = 312500;
483 break;
485 if (GetChannelWidth() == 5)
486 {
487 // Use OFDM subcarrier width of 78.125 KHz as band granularity
488 bandBandwidth = 78125;
489 }
490 else
491 {
492 // Use OFDM subcarrier width of 156.25 KHz as band granularity
493 bandBandwidth = 156250;
494 }
495 break;
498 // Use OFDM subcarrier width of 78.125 KHz as band granularity
499 bandBandwidth = 78125;
500 break;
501 default:
502 NS_FATAL_ERROR("Standard unknown: " << GetStandard());
503 break;
504 }
505 return bandBandwidth;
506}
507
508uint16_t
509SpectrumWifiPhy::GetGuardBandwidth(uint16_t currentChannelWidth) const
510{
511 uint16_t guardBandwidth = 0;
512 if (currentChannelWidth == 22)
513 {
514 // handle case of DSSS transmission
515 guardBandwidth = 10;
516 }
517 else
518 {
519 // In order to properly model out of band transmissions for OFDM, the guard
520 // band has been configured so as to expand the modeled spectrum up to the
521 // outermost referenced point in "Transmit spectrum mask" sections' PSDs of
522 // each PHY specification of 802.11-2016 standard. It thus ultimately corresponds
523 // to the currently considered channel bandwidth (which can be different from
524 // supported channel width).
525 guardBandwidth = currentChannelWidth;
526 }
527 return guardBandwidth;
528}
529
531SpectrumWifiPhy::GetBand(uint16_t bandWidth, uint8_t bandIndex)
532{
533 uint16_t channelWidth = GetChannelWidth();
534 uint32_t bandBandwidth = GetBandBandwidth();
535 size_t numBandsInChannel = static_cast<size_t>(channelWidth * 1e6 / bandBandwidth);
536 size_t numBandsInBand = static_cast<size_t>(bandWidth * 1e6 / bandBandwidth);
537 if (numBandsInBand % 2 == 0)
538 {
539 numBandsInChannel += 1; // symmetry around center frequency
540 }
541 size_t totalNumBands = GetRxSpectrumModel()->GetNumBands();
542 NS_ASSERT_MSG((numBandsInChannel % 2 == 1) && (totalNumBands % 2 == 1),
543 "Should have odd number of bands");
544 NS_ASSERT_MSG((bandIndex * bandWidth) < channelWidth, "Band index is out of bound");
545 WifiSpectrumBand band;
546 band.first = ((totalNumBands - numBandsInChannel) / 2) + (bandIndex * numBandsInBand);
547 band.second = band.first + numBandsInBand - 1;
548 if (band.first >= totalNumBands / 2)
549 {
550 // step past DC
551 band.first += 1;
552 }
553 return band;
554}
555
558 uint16_t guardBandwidth,
560 uint8_t bandIndex) const
561{
562 WifiSpectrumBand convertedSubcarriers;
563 uint32_t nGuardBands =
564 static_cast<uint32_t>(((2 * guardBandwidth * 1e6) / GetBandBandwidth()) + 0.5);
565 uint32_t centerFrequencyIndex = 0;
566 switch (bandWidth)
567 {
568 case 20:
569 centerFrequencyIndex = (nGuardBands / 2) + 6 + 122;
570 break;
571 case 40:
572 centerFrequencyIndex = (nGuardBands / 2) + 12 + 244;
573 break;
574 case 80:
575 centerFrequencyIndex = (nGuardBands / 2) + 12 + 500;
576 break;
577 case 160:
578 centerFrequencyIndex = (nGuardBands / 2) + 12 + 1012;
579 break;
580 default:
581 NS_FATAL_ERROR("ChannelWidth " << bandWidth << " unsupported");
582 break;
583 }
584
585 size_t numBandsInBand = static_cast<size_t>(bandWidth * 1e6 / GetBandBandwidth());
586 centerFrequencyIndex += numBandsInBand * bandIndex;
587
588 convertedSubcarriers.first = centerFrequencyIndex + range.first;
589 convertedSubcarriers.second = centerFrequencyIndex + range.second;
590 return convertedSubcarriers;
591}
592
593std::tuple<double, double, double>
595{
596 return std::make_tuple(m_txMaskInnerBandMinimumRejection,
599}
600
601} // 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
RU Specification.
Definition: he-ru.h:66
std::size_t GetPhyIndex(uint16_t bw, uint8_t p20Index) const
Get the RU PHY index.
Definition: he-ru.cc:456
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:568
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:472
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:55
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:52
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
@ RU_2x996_TONE
Definition: he-ru.h:48
bool IsInitialized() const
Check if the object has been initialized.
Definition: object.cc:212
size_t GetNumBands() const
Abstract base class for Spectrum-aware PHY layers.
Definition: spectrum-phy.h:46
virtual Ptr< NetDevice > GetDevice() const =0
Get the associated NetDevice instance.
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 Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
void DoInitialize() override
Initialize() implementation.
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
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...
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.
void ResetSpectrumModel()
Perform run-time spectrum model change.
Ptr< Channel > GetChannel() const override
Return the Channel this WifiPhy is connected to.
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
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.
void DoDispose() override
Destructor implementation.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
uint32_t GetBandBandwidth() const
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.
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
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.
Ptr< Object > GetAntenna() const
Get the antenna model used for reception.
void UpdateInterferenceHelperBands()
This function is called to update the bands handled by the InterferenceHelper.
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
void StartTx(Ptr< const WifiPpdu > ppdu) override
void DoChannelSwitch() override
Actually switch channel based on the stored channel settings.
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
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:935
802.11 PHY layer model
Definition: wifi-phy.h:53
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1026
double GetRxSensitivity() const
Return the receive sensitivity threshold (dBm).
Definition: wifi-phy.cc:479
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1014
double GetRxGain() const
Return the reception gain (dB).
Definition: wifi-phy.cc:581
Ptr< PhyEntity > GetPhyEntity(WifiModulationClass modulation) const
Get the supported PHY entity corresponding to the modulation class.
Definition: wifi-phy.cc:704
void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: wifi-phy.cc:1817
void DoDispose() override
Destructor implementation.
Definition: wifi-phy.cc:392
virtual void DoChannelSwitch()
Actually switch channel based on the stored channel settings.
Definition: wifi-phy.cc:1152
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1206
void DoInitialize() override
Initialize() implementation.
Definition: wifi-phy.cc:367
WifiStandard GetStandard() const
Get the configured Wi-Fi standard.
Definition: wifi-phy.cc:1002
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:725
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:2058
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1008
Ptr< PhyEntity > GetLatestPhyEntity() const
Get the latest PHY entity supported by this PHY instance.
Definition: wifi-phy.cc:719
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...
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.
#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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#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_80211a
@ WIFI_STANDARD_80211p
@ WIFI_STANDARD_80211be
@ 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:46
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:40
std::map< WifiSpectrumBand, 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
channel
Definition: third.py:81
Time duration
The duration of the packet transmission.
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.