A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-wifi-phy-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 University of Washington
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
18#include "ns3/constant-position-mobility-model.h"
19#include "ns3/he-phy.h" //includes OFDM PHY
20#include "ns3/interference-helper.h"
21#include "ns3/log.h"
22#include "ns3/multi-model-spectrum-channel.h"
23#include "ns3/nist-error-rate-model.h"
24#include "ns3/ofdm-ppdu.h"
25#include "ns3/spectrum-wifi-helper.h"
26#include "ns3/spectrum-wifi-phy.h"
27#include "ns3/test.h"
28#include "ns3/wifi-mac-header.h"
29#include "ns3/wifi-net-device.h"
30#include "ns3/wifi-phy-listener.h"
31#include "ns3/wifi-psdu.h"
32#include "ns3/wifi-spectrum-signal-parameters.h"
33#include "ns3/wifi-spectrum-value-helper.h"
34#include "ns3/wifi-utils.h"
35
36using namespace ns3;
37
38NS_LOG_COMPONENT_DEFINE("SpectrumWifiPhyBasicTest");
39
40static const uint8_t CHANNEL_NUMBER = 36;
41static const uint32_t FREQUENCY = 5180; // MHz
42static const uint16_t CHANNEL_WIDTH = 20; // MHz
43static const uint16_t GUARD_WIDTH =
44 CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
45
47{
48 public:
51};
52
60{
61 public:
68 SpectrumWifiPhyBasicTest(std::string name);
70
71 protected:
72 void DoSetup() override;
73 void DoTeardown() override;
80 Ptr<SpectrumSignalParameters> MakeSignal(double txPowerWatts);
85 void SendSignal(double txPowerWatts);
94 RxSignalInfo rxSignalInfo,
95 WifiTxVector txVector,
96 std::vector<bool> statusPerMpdu);
103
104 private:
105 void DoRun() override;
106
107 uint64_t m_uid;
108};
109
111 : SpectrumWifiPhyBasicTest("SpectrumWifiPhy test case receives one packet")
112{
113}
114
116 : TestCase(name),
117 m_count(0),
118 m_uid(0)
119{
120}
121
122// Make a Wi-Fi signal to inject directly to the StartRx() method
125{
126 WifiTxVector txVector =
127 WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
128
129 Ptr<Packet> pkt = Create<Packet>(1000);
130 WifiMacHeader hdr;
131
133 hdr.SetQosTid(0);
134
135 Ptr<WifiPsdu> psdu = Create<WifiPsdu>(pkt, hdr);
136 Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
137
138 Ptr<WifiPpdu> ppdu = Create<OfdmPpdu>(psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, m_uid++);
139
140 Ptr<SpectrumValue> txPowerSpectrum =
143 txPowerWatts,
145 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters>();
146 txParams->psd = txPowerSpectrum;
147 txParams->txPhy = nullptr;
148 txParams->duration = txDuration;
149 txParams->ppdu = ppdu;
150 txParams->txWidth = CHANNEL_WIDTH;
151
152 return txParams;
153}
154
155// Make a Wi-Fi signal to inject directly to the StartRx() method
156void
158{
159 m_phy->StartRx(MakeSignal(txPowerWatts));
160}
161
162void
164 RxSignalInfo rxSignalInfo,
165 WifiTxVector txVector,
166 std::vector<bool> statusPerMpdu)
167{
168 NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
169 m_count++;
170}
171
172void
174{
175 NS_LOG_FUNCTION(this << *psdu);
176 m_count++;
177}
178
180{
181}
182
183// Create necessary objects, and inject signals. Test that the expected
184// number of packet receptions occur.
185void
187{
188 m_phy = CreateObject<SpectrumWifiPhy>();
191 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
192 m_phy->SetInterferenceHelper(interferenceHelper);
193 Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel>();
194 m_phy->SetErrorRateModel(error);
199}
200
201void
203{
204 m_phy->Dispose();
205 m_phy = nullptr;
206}
207
208// Test that the expected number of packet receptions occur.
209void
211{
212 double txPowerWatts = 0.010;
213 // Send packets spaced 1 second apart; all should be received
217 // Send packets spaced 1 microsecond second apart; none should be received (PHY header reception
218 // failure)
221 this,
222 txPowerWatts);
225 this,
226 txPowerWatts);
229
230 NS_TEST_ASSERT_MSG_EQ(m_count, 3, "Didn't receive right number of packets");
231}
232
240{
241 public:
247 : m_notifyRxStart(0),
251 {
252 }
253
255 {
256 }
257
258 void NotifyRxStart(Time duration) override
259 {
260 NS_LOG_FUNCTION(this << duration);
262 }
263
264 void NotifyRxEndOk() override
265 {
266 NS_LOG_FUNCTION(this);
268 }
269
270 void NotifyRxEndError() override
271 {
272 NS_LOG_FUNCTION(this);
274 }
275
276 void NotifyTxStart(Time duration, double txPowerDbm) override
277 {
278 NS_LOG_FUNCTION(this << duration << txPowerDbm);
279 }
280
282 WifiChannelListType channelType,
283 const std::vector<Time>& /*per20MhzDurations*/) override
284 {
285 NS_LOG_FUNCTION(this << duration << channelType);
287 }
288
289 void NotifySwitchingStart(Time duration) override
290 {
291 }
292
293 void NotifySleep() override
294 {
295 }
296
297 void NotifyOff() override
298 {
299 }
300
301 void NotifyWakeup() override
302 {
303 }
304
305 void NotifyOn() override
306 {
307 }
308
313};
314
322{
323 public:
326
327 private:
328 void DoSetup() override;
329 void DoRun() override;
331};
332
334 : SpectrumWifiPhyBasicTest("SpectrumWifiPhy test operation of WifiPhyListener")
335{
336}
337
339{
340}
341
342void
344{
348}
349
350void
352{
353 double txPowerWatts = 0.010;
356
357 NS_TEST_ASSERT_MSG_EQ(m_count, 1, "Didn't receive right number of packets");
360 2,
361 "Didn't receive NotifyCcaBusyStart (once preamble is detected + prolonged by L-SIG "
362 "reception, then switched to Rx by at the beginning of data)");
363 NS_TEST_ASSERT_MSG_EQ(m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
364 NS_TEST_ASSERT_MSG_EQ(m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
365
367 delete m_listener;
368}
369
377{
378 public:
385 SpectrumWifiPhyFilterTest(std::string name);
387
388 private:
389 void DoSetup() override;
390 void DoTeardown() override;
391 void DoRun() override;
392
396 void RunOne();
397
401 void SendPpdu();
402
409
412
415
416 std::set<WifiSpectrumBand> m_ruBands;
417};
418
420 : TestCase("SpectrumWifiPhy test RX filters"),
421 m_txChannelWidth(20),
422 m_rxChannelWidth(20)
423{
424}
425
427 : TestCase(name)
428{
429}
430
431void
433{
435 0,
437 800,
438 1,
439 1,
440 0,
442 false,
443 false);
444 Ptr<Packet> pkt = Create<Packet>(1000);
445 WifiMacHeader hdr;
447 hdr.SetQosTid(0);
448 hdr.SetAddr1(Mac48Address("00:00:00:00:00:01"));
449 hdr.SetSequenceNumber(1);
450 Ptr<WifiPsdu> psdu = Create<WifiPsdu>(pkt, hdr);
451 m_txPhy->Send(WifiConstPsduMap({std::make_pair(SU_STA_ID, psdu)}), txVector);
452}
453
455{
456 m_txPhy = nullptr;
457 m_rxPhy = nullptr;
458}
459
460void
462{
463 for (const auto& pair : rxPowersW)
464 {
465 NS_LOG_INFO("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW="
466 << pair.second << " (" << WToDbm(pair.second) << " dBm)");
467 }
468
469 size_t numBands = rxPowersW.size();
470 size_t expectedNumBands = std::max(1, (m_rxChannelWidth / 20));
471 expectedNumBands += (m_rxChannelWidth / 40);
472 expectedNumBands += (m_rxChannelWidth / 80);
473 expectedNumBands += (m_rxChannelWidth / 160);
474 expectedNumBands += m_ruBands.size();
475
476 NS_TEST_ASSERT_MSG_EQ(numBands,
477 expectedNumBands,
478 "Total number of bands handled by the receiver is incorrect");
479
480 uint16_t channelWidth = std::min(m_txChannelWidth, m_rxChannelWidth);
481 WifiSpectrumBand band = m_rxPhy->GetBand(channelWidth, 0);
482 auto it = rxPowersW.find(band);
483 NS_LOG_INFO("powerW total band: " << it->second << " (" << WToDbm(it->second) << " dBm)");
484 int totalRxPower = static_cast<int>(WToDbm(it->second) + 0.5);
485 int expectedTotalRxPower;
487 {
488 // PHY sends at 16 dBm, and since there is no loss, this should be the total power at the
489 // receiver.
490 expectedTotalRxPower = 16;
491 }
492 else
493 {
494 // Only a part of the transmitted power is received
495 expectedTotalRxPower =
496 16 - static_cast<int>(RatioToDb(m_txChannelWidth / m_rxChannelWidth));
497 }
498 NS_TEST_ASSERT_MSG_EQ(totalRxPower,
499 expectedTotalRxPower,
500 "Total received power is not correct");
501
502 if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
503 {
504 band = m_rxPhy->GetBand(20, 0); // primary 20 MHz
505 it = rxPowersW.find(band);
506 NS_LOG_INFO("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm(it->second)
507 << " dBm)");
508 int rxPowerPrimaryChannel20 = static_cast<int>(WToDbm(it->second) + 0.5);
509 int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int>(RatioToDb(channelWidth / 20));
510 NS_TEST_ASSERT_MSG_EQ(rxPowerPrimaryChannel20,
511 expectedRxPowerPrimaryChannel20,
512 "Received power in the primary 20 MHz band is not correct");
513 }
514}
515
516void
518{
519 // WifiHelper::EnableLogComponents ();
520 // LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
521
522 Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
523 Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel>();
524 lossModel->SetFrequency(5.180e9);
525 spectrumChannel->AddPropagationLossModel(lossModel);
527 CreateObject<ConstantSpeedPropagationDelayModel>();
528 spectrumChannel->SetPropagationDelayModel(delayModel);
529
530 Ptr<Node> txNode = CreateObject<Node>();
531 Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice>();
532 m_txPhy = CreateObject<ExtSpectrumWifiPhy>();
535 Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper>();
536 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
537 Ptr<ErrorRateModel> txErrorModel = CreateObject<NistErrorRateModel>();
538 m_txPhy->SetErrorRateModel(txErrorModel);
539 m_txPhy->SetDevice(txDev);
540 m_txPhy->SetChannel(spectrumChannel);
541 Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel>();
542 m_txPhy->SetMobility(apMobility);
543 txDev->SetPhy(m_txPhy);
544 txNode->AggregateObject(apMobility);
545 txNode->AddDevice(txDev);
546
547 Ptr<Node> rxNode = CreateObject<Node>();
548 Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice>();
549 m_rxPhy = CreateObject<ExtSpectrumWifiPhy>();
552 Ptr<InterferenceHelper> rxInterferenceHelper = CreateObject<InterferenceHelper>();
553 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
554 Ptr<ErrorRateModel> rxErrorModel = CreateObject<NistErrorRateModel>();
555 m_rxPhy->SetErrorRateModel(rxErrorModel);
556 m_rxPhy->SetChannel(spectrumChannel);
557 Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel>();
558 m_rxPhy->SetMobility(sta1Mobility);
559 rxDev->SetPhy(m_rxPhy);
560 rxNode->AggregateObject(sta1Mobility);
561 rxNode->AddDevice(rxDev);
564}
565
566void
568{
569 m_txPhy->Dispose();
570 m_txPhy = nullptr;
571 m_rxPhy->Dispose();
572 m_rxPhy = nullptr;
573}
574
575void
577{
578 uint16_t txFrequency;
579 switch (m_txChannelWidth)
580 {
581 case 20:
582 default:
583 txFrequency = 5180;
584 break;
585 case 40:
586 txFrequency = 5190;
587 break;
588 case 80:
589 txFrequency = 5210;
590 break;
591 case 160:
592 txFrequency = 5250;
593 break;
594 }
595 auto txChannelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
596 txFrequency,
602
603 uint16_t rxFrequency;
604 switch (m_rxChannelWidth)
605 {
606 case 20:
607 default:
608 rxFrequency = 5180;
609 break;
610 case 40:
611 rxFrequency = 5190;
612 break;
613 case 80:
614 rxFrequency = 5210;
615 break;
616 case 160:
617 rxFrequency = 5250;
618 break;
619 }
620 auto rxChannelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
621 rxFrequency,
627
628 m_ruBands.clear();
629 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
630 {
631 for (uint16_t i = 0; i < (m_rxChannelWidth / bw); ++i)
632 {
633 for (unsigned int type = 0; type < 7; type++)
634 {
635 HeRu::RuType ruType = static_cast<HeRu::RuType>(type);
636 for (std::size_t index = 1; index <= HeRu::GetNRus(bw, ruType); index++)
637 {
638 HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup(bw, ruType, index);
640 std::make_pair(group.front().first, group.back().second);
642 bw,
644 range,
645 i);
646 m_ruBands.insert(band);
647 }
648 }
649 }
650 }
651
653
655}
656
657void
659{
660 m_txChannelWidth = 20;
661 m_rxChannelWidth = 20;
662 RunOne();
663
664 m_txChannelWidth = 40;
665 m_rxChannelWidth = 40;
666 RunOne();
667
668 m_txChannelWidth = 80;
669 m_rxChannelWidth = 80;
670 RunOne();
671
672 m_txChannelWidth = 160;
673 m_rxChannelWidth = 160;
674 RunOne();
675
676 m_txChannelWidth = 20;
677 m_rxChannelWidth = 40;
678 RunOne();
679
680 m_txChannelWidth = 20;
681 m_rxChannelWidth = 80;
682 RunOne();
683
684 m_txChannelWidth = 40;
685 m_rxChannelWidth = 80;
686 RunOne();
687
688 m_txChannelWidth = 20;
689 m_rxChannelWidth = 160;
690 RunOne();
691
692 m_txChannelWidth = 40;
693 m_rxChannelWidth = 160;
694 RunOne();
695
696 m_txChannelWidth = 80;
697 m_rxChannelWidth = 160;
698 RunOne();
699
700 m_txChannelWidth = 40;
701 m_rxChannelWidth = 20;
702 RunOne();
703
704 m_txChannelWidth = 80;
705 m_rxChannelWidth = 20;
706 RunOne();
707
708 m_txChannelWidth = 80;
709 m_rxChannelWidth = 40;
710 RunOne();
711
712 m_txChannelWidth = 160;
713 m_rxChannelWidth = 20;
714 RunOne();
715
716 m_txChannelWidth = 160;
717 m_rxChannelWidth = 40;
718 RunOne();
719
720 m_txChannelWidth = 160;
721 m_rxChannelWidth = 80;
722 RunOne();
723
725}
726
734{
735 public:
737};
738
740 : TestSuite("wifi-spectrum-wifi-phy", UNIT)
741{
745}
746
Spectrum Wifi Phy Basic Test.
void SpectrumWifiPhyRxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Spectrum wifi receive success function.
Ptr< SpectrumSignalParameters > MakeSignal(double txPowerWatts)
Make signal function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
void SpectrumWifiPhyRxFailure(Ptr< const WifiPsdu > psdu)
Spectrum wifi receive failure function.
void SendSignal(double txPowerWatts)
Send signal function.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
uint64_t m_uid
the UID to use for the PPDU
Ptr< SpectrumWifiPhy > m_phy
Phy.
Spectrum Wifi Phy Filter Test.
void RxCallback(Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by the PHYs.
uint16_t m_txChannelWidth
TX channel width (MHz)
void DoRun() override
Implementation to actually run this TestCase.
void RunOne()
Run one function.
void SendPpdu()
Send PPDU function.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
std::set< WifiSpectrumBand > m_ruBands
spectrum bands associated to all the RUs
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Ptr< ExtSpectrumWifiPhy > m_rxPhy
RX PHY.
uint16_t m_rxChannelWidth
RX channel width (MHz)
Ptr< ExtSpectrumWifiPhy > m_txPhy
TX PHY.
Spectrum Wifi Phy Listener Test.
TestPhyListener * m_listener
listener
void DoRun() override
Implementation to actually run this TestCase.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Spectrum Wifi Phy Test Suite.
Test Phy Listener.
void NotifyWakeup() override
Notify listeners that we woke up.
TestPhyListener()
Create a test PhyListener.
void NotifyRxEndOk() override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
void NotifyOff() override
Notify listeners that we went to switch off.
void NotifySleep() override
Notify listeners that we went to sleep.
void NotifySwitchingStart(Time duration) override
uint32_t m_notifyMaybeCcaBusyStart
notify maybe CCA busy start
uint32_t m_notifyRxStart
notify receive start
void NotifyTxStart(Time duration, double txPowerDbm) override
void NotifyCcaBusyStart(Time duration, WifiChannelListType channelType, const std::vector< Time > &) override
void NotifyRxStart(Time duration) override
void NotifyOn() override
Notify listeners that we went to switch on.
uint32_t m_notifyRxEndOk
notify receive end OK
void NotifyRxEndError() override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
uint32_t m_notifyRxEndError
notify receive end error
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
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
an EUI-48 address
Definition: mac48-address.h:46
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:311
void Dispose()
Dispose of this Object.
Definition: object.cc:219
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6 Mbps.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:140
static void Run()
Run the simulation.
Definition: simulator.cc:176
802.11 PHY layer model
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
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 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...
encapsulates test code
Definition: test.h:1060
@ QUICK
Fast test.
Definition: test.h:1065
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Implements the IEEE 802.11 MAC header.
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:624
void Send(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector)
This function is a wrapper for the Send variant that accepts a WifiConstPsduMap as first argument.
Definition: wifi-phy.cc:1693
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:632
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:448
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:941
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1480
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
Definition: wifi-phy.cc:1062
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:996
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:600
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:612
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:454
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:442
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:870
receive notifications about PHY events.
static ConstIterator FindFirst(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first channel matching the specified parameters.
static Ptr< SpectrumValue > CreateOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM (802.11a/g).
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#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_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:144
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1360
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211ax
@ WIFI_PREAMBLE_LONG
@ WIFI_PREAMBLE_HE_SU
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:52
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:46
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:707
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
@ WIFI_MAC_QOSDATA
static const uint8_t CHANNEL_NUMBER
static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite
the test suite
static const uint16_t GUARD_WIDTH
static const uint16_t CHANNEL_WIDTH
static const uint32_t FREQUENCY
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:70
#define SU_STA_ID
Definition: wifi-mode.h:34