A Discrete-Event Network Simulator
API
spectrum-wifi-phy-test.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2015 University of Washington
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include "ns3/test.h"
20#include "ns3/constant-position-mobility-model.h"
21#include "ns3/spectrum-wifi-helper.h"
22#include "ns3/wifi-spectrum-value-helper.h"
23#include "ns3/multi-model-spectrum-channel.h"
24#include "ns3/spectrum-wifi-phy.h"
25#include "ns3/nist-error-rate-model.h"
26#include "ns3/wifi-mac-header.h"
27#include "ns3/wifi-spectrum-signal-parameters.h"
28#include "ns3/wifi-phy-listener.h"
29#include "ns3/log.h"
30#include "ns3/wifi-net-device.h"
31#include "ns3/wifi-psdu.h"
32#include "ns3/ofdm-ppdu.h"
33#include "ns3/wifi-utils.h"
34#include "ns3/he-phy.h" //includes OFDM PHY
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 = CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
44
46{
47public:
48 using SpectrumWifiPhy::SpectrumWifiPhy;
49 using SpectrumWifiPhy::GetBand;
50};
51
59{
60public:
67 SpectrumWifiPhyBasicTest (std::string name);
69
70protected:
71 void DoSetup (void) override;
72 void DoTeardown (void) override;
79 Ptr<SpectrumSignalParameters> MakeSignal (double txPowerWatts);
84 void SendSignal (double txPowerWatts);
93 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
100
101private:
102 void DoRun (void) override;
103
104 uint64_t m_uid;
105};
106
108 : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test case receives one packet")
109{
110}
111
113 : TestCase (name),
114 m_count (0),
115 m_uid (0)
116{
117}
118
119// Make a Wi-Fi signal to inject directly to the StartRx() method
122{
123 WifiTxVector txVector = WifiTxVector (OfdmPhy::GetOfdmRate6Mbps (), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
124
125 Ptr<Packet> pkt = Create<Packet> (1000);
126 WifiMacHeader hdr;
127
129 hdr.SetQosTid (0);
130
131 Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
132 Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ());
133
134 Ptr<WifiPpdu> ppdu = Create<OfdmPpdu> (psdu, txVector, WIFI_PHY_BAND_5GHZ, m_uid++);
135
136 Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH);
137 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
138 txParams->psd = txPowerSpectrum;
139 txParams->txPhy = 0;
140 txParams->duration = txDuration;
141 txParams->ppdu = ppdu;
142
143 return txParams;
144}
145
146// Make a Wi-Fi signal to inject directly to the StartRx() method
147void
149{
150 m_phy->StartRx (MakeSignal (txPowerWatts));
151}
152
153void
155 WifiTxVector txVector, std::vector<bool> statusPerMpdu)
156{
157 NS_LOG_FUNCTION (this << *psdu << rxSignalInfo << txVector);
158 m_count++;
159}
160
161void
163{
164 NS_LOG_FUNCTION (this << *psdu);
165 m_count++;
166}
167
169{
170}
171
172// Create necessary objects, and inject signals. Test that the expected
173// number of packet receptions occur.
174void
176{
177 m_phy = CreateObject<SpectrumWifiPhy> ();
180 Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
181 m_phy->SetErrorRateModel (error);
184}
185
186void
188{
189 m_phy->Dispose ();
190 m_phy = 0;
191}
192
193// Test that the expected number of packet receptions occur.
194void
196{
197 double txPowerWatts = 0.010;
198 // Send packets spaced 1 second apart; all should be received
199 Simulator::Schedule (Seconds (1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
200 Simulator::Schedule (Seconds (2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
201 Simulator::Schedule (Seconds (3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
202 // Send packets spaced 1 microsecond second apart; none should be received (PHY header reception failure)
203 Simulator::Schedule (MicroSeconds (4000000), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
204 Simulator::Schedule (MicroSeconds (4000001), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
205 Simulator::Run ();
206 Simulator::Destroy ();
207
208 NS_TEST_ASSERT_MSG_EQ (m_count, 3, "Didn't receive right number of packets");
209}
210
218{
219public:
225 : m_notifyRxStart (0),
226 m_notifyRxEndOk (0),
229 {
230 }
232 {
233 }
234 void NotifyRxStart (Time duration) override
235 {
236 NS_LOG_FUNCTION (this << duration);
238 }
239 void NotifyRxEndOk (void) override
240 {
241 NS_LOG_FUNCTION (this);
243 }
244 void NotifyRxEndError (void) override
245 {
246 NS_LOG_FUNCTION (this);
248 }
249 void NotifyTxStart (Time duration, double txPowerDbm) override
250 {
251 NS_LOG_FUNCTION (this << duration << txPowerDbm);
252 }
253 void NotifyMaybeCcaBusyStart (Time duration) override
254 {
255 NS_LOG_FUNCTION (this);
257 }
258 void NotifySwitchingStart (Time duration) override
259 {
260 }
261 void NotifySleep (void) override
262 {
263 }
264 void NotifyOff (void) override
265 {
266 }
267 void NotifyWakeup (void) override
268 {
269 }
270 void NotifyOn (void) override
271 {
272 }
277};
278
286{
287public:
290private:
291 void DoSetup (void) override;
292 void DoRun (void) override;
294};
295
297 : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test operation of WifiPhyListener")
298{
299}
300
302{
303}
304
305void
307{
311}
312
313void
315{
316 double txPowerWatts = 0.010;
317 Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
318 Simulator::Run ();
319
320 NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
321 NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyMaybeCcaBusyStart, 2, "Didn't receive NotifyMaybeCcaBusyStart (once preamble is detected + prolonged by L-SIG reception, then switched to Rx by at the beginning of data)");
322 NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
323 NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
324
325 Simulator::Destroy ();
326 delete m_listener;
327}
328
336{
337public:
344 SpectrumWifiPhyFilterTest (std::string name);
346
347private:
348 void DoSetup (void) override;
349 void DoTeardown (void) override;
350 void DoRun (void) override;
351
355 void RunOne ();
356
360 void SendPpdu (void);
361
368
371
374
375 std::set<WifiSpectrumBand> m_ruBands;
376};
377
379 : TestCase ("SpectrumWifiPhy test RX filters"),
380 m_txChannelWidth (20),
381 m_rxChannelWidth (20)
382{
383}
384
386 : TestCase (name)
387{
388}
389
390void
392{
393 WifiTxVector txVector = WifiTxVector (HePhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, m_txChannelWidth, false, false);
394 Ptr<Packet> pkt = Create<Packet> (1000);
395 WifiMacHeader hdr;
397 hdr.SetQosTid (0);
398 hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:01"));
399 hdr.SetSequenceNumber (1);
400 Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
401 m_txPhy->Send (WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)}), txVector);
402}
403
405{
406 m_txPhy = 0;
407 m_rxPhy = 0;
408}
409
410void
412{
413 for (auto const& pair : rxPowersW)
414 {
415 NS_LOG_INFO ("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW=" << pair.second << " (" << WToDbm (pair.second) << " dBm)");
416 }
417
418 size_t numBands = rxPowersW.size ();
419 size_t expectedNumBands = std::max (1, (m_rxChannelWidth / 20));
420 expectedNumBands += (m_rxChannelWidth / 40);
421 expectedNumBands += (m_rxChannelWidth / 80);
422 expectedNumBands += (m_rxChannelWidth / 160);
423 expectedNumBands += m_ruBands.size ();
424
425 NS_TEST_ASSERT_MSG_EQ (numBands, expectedNumBands, "Total number of bands handled by the receiver is incorrect");
426
427 uint16_t channelWidth = std::min (m_txChannelWidth, m_rxChannelWidth);
428 WifiSpectrumBand band = m_rxPhy->GetBand (channelWidth, 0);
429 auto it = rxPowersW.find (band);
430 NS_LOG_INFO ("powerW total band: " << it->second << " (" << WToDbm (it->second) << " dBm)");
431 int totalRxPower = static_cast<int> (WToDbm (it->second) + 0.5);
432 int expectedTotalRxPower;
434 {
435 //PHY sends at 16 dBm, and since there is no loss, this should be the total power at the receiver.
436 expectedTotalRxPower = 16;
437 }
438 else
439 {
440 //Only a part of the transmitted power is received
441 expectedTotalRxPower = 16 - static_cast<int> (RatioToDb (m_txChannelWidth / m_rxChannelWidth));
442 }
443 NS_TEST_ASSERT_MSG_EQ (totalRxPower, expectedTotalRxPower, "Total received power is not correct");
444
445 if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
446 {
447 band = m_rxPhy->GetBand (20, 0); //primary 20 MHz
448 it = rxPowersW.find (band);
449 NS_LOG_INFO ("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm (it->second) << " dBm)");
450 int rxPowerPrimaryChannel20 = static_cast<int> (WToDbm (it->second) + 0.5);
451 int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int> (RatioToDb (channelWidth / 20));
452 NS_TEST_ASSERT_MSG_EQ (rxPowerPrimaryChannel20, expectedRxPowerPrimaryChannel20, "Received power in the primary 20 MHz band is not correct");
453 }
454}
455
456void
458{
459 //WifiHelper::EnableLogComponents ();
460 //LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
461
462 Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();
463 Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
464 lossModel->SetFrequency (5.180e9);
465 spectrumChannel->AddPropagationLossModel (lossModel);
466 Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
467 spectrumChannel->SetPropagationDelayModel (delayModel);
468
469 Ptr<Node> txNode = CreateObject<Node> ();
470 Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
471 m_txPhy = CreateObject<ExtSpectrumWifiPhy> ();
474 Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
475 m_txPhy->SetErrorRateModel (error);
476 m_txPhy->SetDevice (txDev);
477 m_txPhy->SetChannel (spectrumChannel);
478 Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
479 m_txPhy->SetMobility (apMobility);
480 txDev->SetPhy (m_txPhy);
481 txNode->AggregateObject (apMobility);
482 txNode->AddDevice (txDev);
483
484 Ptr<Node> rxNode = CreateObject<Node> ();
485 Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice> ();
486 m_rxPhy = CreateObject<ExtSpectrumWifiPhy> ();
489 m_rxPhy->SetErrorRateModel (error);
490 m_rxPhy->SetChannel (spectrumChannel);
491 Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
492 m_rxPhy->SetMobility (sta1Mobility);
493 rxDev->SetPhy (m_rxPhy);
494 rxNode->AggregateObject (sta1Mobility);
495 rxNode->AddDevice (rxDev);
497}
498
499void
501{
502 m_txPhy->Dispose ();
503 m_txPhy = 0;
504 m_rxPhy->Dispose ();
505 m_rxPhy = 0;
506}
507
508void
510{
511 uint16_t txFrequency;
512 switch (m_txChannelWidth)
513 {
514 case 20:
515 default:
516 txFrequency = 5180;
517 break;
518 case 40:
519 txFrequency = 5190;
520 break;
521 case 80:
522 txFrequency = 5210;
523 break;
524 case 160:
525 txFrequency = 5250;
526 break;
527 }
528 auto txChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, txFrequency, m_txChannelWidth,
532 (int)(WIFI_PHY_BAND_5GHZ), 0});
533
534 uint16_t rxFrequency;
535 switch (m_rxChannelWidth)
536 {
537 case 20:
538 default:
539 rxFrequency = 5180;
540 break;
541 case 40:
542 rxFrequency = 5190;
543 break;
544 case 80:
545 rxFrequency = 5210;
546 break;
547 case 160:
548 rxFrequency = 5250;
549 break;
550 }
551 auto rxChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, rxFrequency, m_rxChannelWidth,
555 (int)(WIFI_PHY_BAND_5GHZ), 0});
556
557 m_ruBands.clear ();
558 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
559 {
560 for (uint8_t i = 0; i < (m_rxChannelWidth / bw); ++i)
561 {
562 for (unsigned int type = 0; type < 7; type++)
563 {
564 HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
565 for (std::size_t index = 1; index <= HeRu::GetNRus (bw, ruType); index++)
566 {
567 HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, index);
568 HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
570 range, i);
571 m_ruBands.insert (band);
572 }
573 }
574 }
575 }
576
577 Simulator::Schedule (Seconds (1), &SpectrumWifiPhyFilterTest::SendPpdu, this);
578
579 Simulator::Run ();
580}
581
582void
584{
585 m_txChannelWidth = 20;
586 m_rxChannelWidth = 20;
587 RunOne ();
588
589 m_txChannelWidth = 40;
590 m_rxChannelWidth = 40;
591 RunOne ();
592
593 m_txChannelWidth = 80;
594 m_rxChannelWidth = 80;
595 RunOne ();
596
597 m_txChannelWidth = 160;
598 m_rxChannelWidth = 160;
599 RunOne ();
600
601 m_txChannelWidth = 20;
602 m_rxChannelWidth = 40;
603 RunOne ();
604
605 m_txChannelWidth = 20;
606 m_rxChannelWidth = 80;
607 RunOne ();
608
609 m_txChannelWidth = 40;
610 m_rxChannelWidth = 80;
611 RunOne ();
612
613 m_txChannelWidth = 20;
614 m_rxChannelWidth = 160;
615 RunOne ();
616
617 m_txChannelWidth = 40;
618 m_rxChannelWidth = 160;
619 RunOne ();
620
621 m_txChannelWidth = 80;
622 m_rxChannelWidth = 160;
623 RunOne ();
624
625 m_txChannelWidth = 40;
626 m_rxChannelWidth = 20;
627 RunOne ();
628
629 m_txChannelWidth = 80;
630 m_rxChannelWidth = 20;
631 RunOne ();
632
633 m_txChannelWidth = 80;
634 m_rxChannelWidth = 40;
635 RunOne ();
636
637 m_txChannelWidth = 160;
638 m_rxChannelWidth = 20;
639 RunOne ();
640
641 m_txChannelWidth = 160;
642 m_rxChannelWidth = 40;
643 RunOne ();
644
645 m_txChannelWidth = 160;
646 m_rxChannelWidth = 80;
647 RunOne ();
648
649 Simulator::Destroy ();
650}
651
659{
660public:
662};
663
665 : TestSuite ("wifi-spectrum-wifi-phy", UNIT)
666{
667 AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK);
668 AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK);
669 AddTestCase (new SpectrumWifiPhyFilterTest, TestCase::QUICK);
670}
671
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
Spectrum Wifi Phy Basic Test.
Ptr< SpectrumSignalParameters > MakeSignal(double txPowerWatts)
Make signal function.
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void SpectrumWifiPhyRxSuccess(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Spectrum wifi receive success function.
void DoRun(void) override
Implementation to actually run this TestCase.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void SendSignal(double txPowerWatts)
Send signal function.
void SpectrumWifiPhyRxFailure(Ptr< WifiPsdu > psdu)
Spectrum wifi receive failure function.
uint64_t m_uid
the UID to use for the PPDU
Ptr< SpectrumWifiPhy > m_phy
Phy.
Spectrum Wifi Phy Filter Test.
void SendPpdu(void)
Send PPDU function.
void DoRun(void) override
Implementation to actually run this TestCase.
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 DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
void RunOne()
Run one function.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
std::set< WifiSpectrumBand > m_ruBands
spectrum bands associated to all the RUs
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.
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
void DoRun(void) override
Implementation to actually run this TestCase.
TestPhyListener * m_listener
listener
Spectrum Wifi Phy Test Suite.
Test Phy Listener.
void NotifyRxEndError(void) override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
TestPhyListener(void)
Create a test PhyListener.
void NotifySleep(void) override
Notify listeners that we went to sleep.
void NotifyMaybeCcaBusyStart(Time duration) override
void NotifySwitchingStart(Time duration) override
uint32_t m_notifyMaybeCcaBusyStart
notify maybe CCA busy start
void NotifyOn(void) override
Notify listeners that we went to switch on.
uint32_t m_notifyRxStart
notify receive start
void NotifyTxStart(Time duration, double txPowerDbm) override
void NotifyRxStart(Time duration) override
void NotifyOff(void) override
Notify listeners that we went to switch off.
void NotifyWakeup(void) override
Notify listeners that we woke up.
uint32_t m_notifyRxEndOk
notify receive end OK
uint32_t m_notifyRxEndError
notify receive end error
void NotifyRxEndOk(void) override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:42
an EUI-48 address
Definition: mac48-address.h:44
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:364
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
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:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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)
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:1485
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:870
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:390
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:818
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1306
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:913
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:526
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:538
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:396
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:384
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:832
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:557
receive notifications about PHY events.
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
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:205
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_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:141
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1260
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
@ 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:49
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:43
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:75
@ WIFI_MAC_QOSDATA
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1648
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:67
#define SU_STA_ID
Definition: wifi-mode.h:32