A Discrete-Event Network Simulator
API
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:
49 using SpectrumWifiPhy::GetBand;
50 using SpectrumWifiPhy::SpectrumWifiPhy;
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 =
141 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(FREQUENCY,
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
151 return txParams;
152}
153
154// Make a Wi-Fi signal to inject directly to the StartRx() method
155void
157{
158 m_phy->StartRx(MakeSignal(txPowerWatts));
159}
160
161void
163 RxSignalInfo rxSignalInfo,
164 WifiTxVector txVector,
165 std::vector<bool> statusPerMpdu)
166{
167 NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
168 m_count++;
169}
170
171void
173{
174 NS_LOG_FUNCTION(this << *psdu);
175 m_count++;
176}
177
179{
180}
181
182// Create necessary objects, and inject signals. Test that the expected
183// number of packet receptions occur.
184void
186{
187 m_phy = CreateObject<SpectrumWifiPhy>();
190 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
191 m_phy->SetInterferenceHelper(interferenceHelper);
192 Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel>();
193 m_phy->SetErrorRateModel(error);
198}
199
200void
202{
203 m_phy->Dispose();
204 m_phy = nullptr;
205}
206
207// Test that the expected number of packet receptions occur.
208void
210{
211 double txPowerWatts = 0.010;
212 // Send packets spaced 1 second apart; all should be received
213 Simulator::Schedule(Seconds(1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
214 Simulator::Schedule(Seconds(2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
215 Simulator::Schedule(Seconds(3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
216 // Send packets spaced 1 microsecond second apart; none should be received (PHY header reception
217 // failure)
218 Simulator::Schedule(MicroSeconds(4000000),
220 this,
221 txPowerWatts);
222 Simulator::Schedule(MicroSeconds(4000001),
224 this,
225 txPowerWatts);
226 Simulator::Run();
227 Simulator::Destroy();
228
229 NS_TEST_ASSERT_MSG_EQ(m_count, 3, "Didn't receive right number of packets");
230}
231
239{
240 public:
246 : m_notifyRxStart(0),
250 {
251 }
252
254 {
255 }
256
257 void NotifyRxStart(Time duration) override
258 {
259 NS_LOG_FUNCTION(this << duration);
261 }
262
263 void NotifyRxEndOk() override
264 {
265 NS_LOG_FUNCTION(this);
267 }
268
269 void NotifyRxEndError() override
270 {
271 NS_LOG_FUNCTION(this);
273 }
274
275 void NotifyTxStart(Time duration, double txPowerDbm) override
276 {
277 NS_LOG_FUNCTION(this << duration << txPowerDbm);
278 }
279
281 WifiChannelListType channelType,
282 const std::vector<Time>& /*per20MhzDurations*/) override
283 {
284 NS_LOG_FUNCTION(this << duration << channelType);
286 }
287
288 void NotifySwitchingStart(Time duration) override
289 {
290 }
291
292 void NotifySleep() override
293 {
294 }
295
296 void NotifyOff() override
297 {
298 }
299
300 void NotifyWakeup() override
301 {
302 }
303
304 void NotifyOn() override
305 {
306 }
307
312};
313
321{
322 public:
325
326 private:
327 void DoSetup() override;
328 void DoRun() override;
330};
331
333 : SpectrumWifiPhyBasicTest("SpectrumWifiPhy test operation of WifiPhyListener")
334{
335}
336
338{
339}
340
341void
343{
347}
348
349void
351{
352 double txPowerWatts = 0.010;
353 Simulator::Schedule(Seconds(1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
354 Simulator::Run();
355
356 NS_TEST_ASSERT_MSG_EQ(m_count, 1, "Didn't receive right number of packets");
359 2,
360 "Didn't receive NotifyCcaBusyStart (once preamble is detected + prolonged by L-SIG "
361 "reception, then switched to Rx by at the beginning of data)");
362 NS_TEST_ASSERT_MSG_EQ(m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
363 NS_TEST_ASSERT_MSG_EQ(m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
364
365 Simulator::Destroy();
366 delete m_listener;
367}
368
376{
377 public:
384 SpectrumWifiPhyFilterTest(std::string name);
386
387 private:
388 void DoSetup() override;
389 void DoTeardown() override;
390 void DoRun() override;
391
395 void RunOne();
396
400 void SendPpdu();
401
408
411
414
415 std::set<WifiSpectrumBand> m_ruBands;
416};
417
419 : TestCase("SpectrumWifiPhy test RX filters"),
420 m_txChannelWidth(20),
421 m_rxChannelWidth(20)
422{
423}
424
426 : TestCase(name)
427{
428}
429
430void
432{
433 WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(),
434 0,
436 800,
437 1,
438 1,
439 0,
441 false,
442 false);
443 Ptr<Packet> pkt = Create<Packet>(1000);
444 WifiMacHeader hdr;
446 hdr.SetQosTid(0);
447 hdr.SetAddr1(Mac48Address("00:00:00:00:00:01"));
448 hdr.SetSequenceNumber(1);
449 Ptr<WifiPsdu> psdu = Create<WifiPsdu>(pkt, hdr);
450 m_txPhy->Send(WifiConstPsduMap({std::make_pair(SU_STA_ID, psdu)}), txVector);
451}
452
454{
455 m_txPhy = nullptr;
456 m_rxPhy = nullptr;
457}
458
459void
461{
462 for (const auto& pair : rxPowersW)
463 {
464 NS_LOG_INFO("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW="
465 << pair.second << " (" << WToDbm(pair.second) << " dBm)");
466 }
467
468 size_t numBands = rxPowersW.size();
469 size_t expectedNumBands = std::max(1, (m_rxChannelWidth / 20));
470 expectedNumBands += (m_rxChannelWidth / 40);
471 expectedNumBands += (m_rxChannelWidth / 80);
472 expectedNumBands += (m_rxChannelWidth / 160);
473 expectedNumBands += m_ruBands.size();
474
475 NS_TEST_ASSERT_MSG_EQ(numBands,
476 expectedNumBands,
477 "Total number of bands handled by the receiver is incorrect");
478
479 uint16_t channelWidth = std::min(m_txChannelWidth, m_rxChannelWidth);
480 WifiSpectrumBand band = m_rxPhy->GetBand(channelWidth, 0);
481 auto it = rxPowersW.find(band);
482 NS_LOG_INFO("powerW total band: " << it->second << " (" << WToDbm(it->second) << " dBm)");
483 int totalRxPower = static_cast<int>(WToDbm(it->second) + 0.5);
484 int expectedTotalRxPower;
486 {
487 // PHY sends at 16 dBm, and since there is no loss, this should be the total power at the
488 // receiver.
489 expectedTotalRxPower = 16;
490 }
491 else
492 {
493 // Only a part of the transmitted power is received
494 expectedTotalRxPower =
495 16 - static_cast<int>(RatioToDb(m_txChannelWidth / m_rxChannelWidth));
496 }
497 NS_TEST_ASSERT_MSG_EQ(totalRxPower,
498 expectedTotalRxPower,
499 "Total received power is not correct");
500
501 if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
502 {
503 band = m_rxPhy->GetBand(20, 0); // primary 20 MHz
504 it = rxPowersW.find(band);
505 NS_LOG_INFO("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm(it->second)
506 << " dBm)");
507 int rxPowerPrimaryChannel20 = static_cast<int>(WToDbm(it->second) + 0.5);
508 int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int>(RatioToDb(channelWidth / 20));
509 NS_TEST_ASSERT_MSG_EQ(rxPowerPrimaryChannel20,
510 expectedRxPowerPrimaryChannel20,
511 "Received power in the primary 20 MHz band is not correct");
512 }
513}
514
515void
517{
518 // WifiHelper::EnableLogComponents ();
519 // LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
520
521 Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
522 Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel>();
523 lossModel->SetFrequency(5.180e9);
524 spectrumChannel->AddPropagationLossModel(lossModel);
526 CreateObject<ConstantSpeedPropagationDelayModel>();
527 spectrumChannel->SetPropagationDelayModel(delayModel);
528
529 Ptr<Node> txNode = CreateObject<Node>();
530 Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice>();
531 m_txPhy = CreateObject<ExtSpectrumWifiPhy>();
534 Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper>();
535 m_txPhy->SetInterferenceHelper(txInterferenceHelper);
536 Ptr<ErrorRateModel> txErrorModel = CreateObject<NistErrorRateModel>();
537 m_txPhy->SetErrorRateModel(txErrorModel);
538 m_txPhy->SetDevice(txDev);
539 m_txPhy->SetChannel(spectrumChannel);
540 Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel>();
541 m_txPhy->SetMobility(apMobility);
542 txDev->SetPhy(m_txPhy);
543 txNode->AggregateObject(apMobility);
544 txNode->AddDevice(txDev);
545
546 Ptr<Node> rxNode = CreateObject<Node>();
547 Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice>();
548 m_rxPhy = CreateObject<ExtSpectrumWifiPhy>();
551 Ptr<InterferenceHelper> rxInterferenceHelper = CreateObject<InterferenceHelper>();
552 m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
553 Ptr<ErrorRateModel> rxErrorModel = CreateObject<NistErrorRateModel>();
554 m_rxPhy->SetErrorRateModel(rxErrorModel);
555 m_rxPhy->SetChannel(spectrumChannel);
556 Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel>();
557 m_rxPhy->SetMobility(sta1Mobility);
558 rxDev->SetPhy(m_rxPhy);
559 rxNode->AggregateObject(sta1Mobility);
560 rxNode->AddDevice(rxDev);
563}
564
565void
567{
568 m_txPhy->Dispose();
569 m_txPhy = nullptr;
570 m_rxPhy->Dispose();
571 m_rxPhy = nullptr;
572}
573
574void
576{
577 uint16_t txFrequency;
578 switch (m_txChannelWidth)
579 {
580 case 20:
581 default:
582 txFrequency = 5180;
583 break;
584 case 40:
585 txFrequency = 5190;
586 break;
587 case 80:
588 txFrequency = 5210;
589 break;
590 case 160:
591 txFrequency = 5250;
592 break;
593 }
594 auto txChannelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
595 txFrequency,
601
602 uint16_t rxFrequency;
603 switch (m_rxChannelWidth)
604 {
605 case 20:
606 default:
607 rxFrequency = 5180;
608 break;
609 case 40:
610 rxFrequency = 5190;
611 break;
612 case 80:
613 rxFrequency = 5210;
614 break;
615 case 160:
616 rxFrequency = 5250;
617 break;
618 }
619 auto rxChannelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
620 rxFrequency,
626
627 m_ruBands.clear();
628 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
629 {
630 for (uint16_t i = 0; i < (m_rxChannelWidth / bw); ++i)
631 {
632 for (unsigned int type = 0; type < 7; type++)
633 {
634 HeRu::RuType ruType = static_cast<HeRu::RuType>(type);
635 for (std::size_t index = 1; index <= HeRu::GetNRus(bw, ruType); index++)
636 {
637 HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup(bw, ruType, index);
639 std::make_pair(group.front().first, group.back().second);
641 bw,
643 range,
644 i);
645 m_ruBands.insert(band);
646 }
647 }
648 }
649 }
650
651 Simulator::Schedule(Seconds(1), &SpectrumWifiPhyFilterTest::SendPpdu, this);
652
653 Simulator::Run();
654}
655
656void
658{
659 m_txChannelWidth = 20;
660 m_rxChannelWidth = 20;
661 RunOne();
662
663 m_txChannelWidth = 40;
664 m_rxChannelWidth = 40;
665 RunOne();
666
667 m_txChannelWidth = 80;
668 m_rxChannelWidth = 80;
669 RunOne();
670
671 m_txChannelWidth = 160;
672 m_rxChannelWidth = 160;
673 RunOne();
674
675 m_txChannelWidth = 20;
676 m_rxChannelWidth = 40;
677 RunOne();
678
679 m_txChannelWidth = 20;
680 m_rxChannelWidth = 80;
681 RunOne();
682
683 m_txChannelWidth = 40;
684 m_rxChannelWidth = 80;
685 RunOne();
686
687 m_txChannelWidth = 20;
688 m_rxChannelWidth = 160;
689 RunOne();
690
691 m_txChannelWidth = 40;
692 m_rxChannelWidth = 160;
693 RunOne();
694
695 m_txChannelWidth = 80;
696 m_rxChannelWidth = 160;
697 RunOne();
698
699 m_txChannelWidth = 40;
700 m_rxChannelWidth = 20;
701 RunOne();
702
703 m_txChannelWidth = 80;
704 m_rxChannelWidth = 20;
705 RunOne();
706
707 m_txChannelWidth = 80;
708 m_rxChannelWidth = 40;
709 RunOne();
710
711 m_txChannelWidth = 160;
712 m_rxChannelWidth = 20;
713 RunOne();
714
715 m_txChannelWidth = 160;
716 m_rxChannelWidth = 40;
717 RunOne();
718
719 m_txChannelWidth = 160;
720 m_rxChannelWidth = 80;
721 RunOne();
722
723 Simulator::Destroy();
724}
725
733{
734 public:
736};
737
739 : TestSuite("wifi-spectrum-wifi-phy", UNIT)
740{
741 AddTestCase(new SpectrumWifiPhyBasicTest, TestCase::QUICK);
742 AddTestCase(new SpectrumWifiPhyListenerTest, TestCase::QUICK);
743 AddTestCase(new SpectrumWifiPhyFilterTest, TestCase::QUICK);
744}
745
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
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
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
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:138
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:369
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:259
void Dispose()
Dispose of this Object.
Definition: object.cc:219
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
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.
void SetPhy(const Ptr< WifiPhy > phy)
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:606
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:1635
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:614
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:423
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:895
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1422
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:1004
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:950
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:575
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:587
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:429
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:417
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:869
receive notifications about PHY events.
uint32_t GetSize() const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:263
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:1362
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
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:691
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