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/interference-helper.h"
26#include "ns3/nist-error-rate-model.h"
27#include "ns3/wifi-mac-header.h"
28#include "ns3/wifi-spectrum-signal-parameters.h"
29#include "ns3/wifi-phy-listener.h"
30#include "ns3/log.h"
31#include "ns3/wifi-net-device.h"
32#include "ns3/wifi-psdu.h"
33#include "ns3/ofdm-ppdu.h"
34#include "ns3/wifi-utils.h"
35#include "ns3/he-phy.h" //includes OFDM PHY
36
37using namespace ns3;
38
39NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhyBasicTest");
40
41static const uint8_t CHANNEL_NUMBER = 36;
42static const uint32_t FREQUENCY = 5180; // MHz
43static const uint16_t CHANNEL_WIDTH = 20; // MHz
44static const uint16_t GUARD_WIDTH = CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
45
47{
48public:
49 using SpectrumWifiPhy::SpectrumWifiPhy;
50 using SpectrumWifiPhy::GetBand;
51};
52
60{
61public:
68 SpectrumWifiPhyBasicTest (std::string name);
70
71protected:
72 void DoSetup (void) override;
73 void DoTeardown (void) override;
80 Ptr<SpectrumSignalParameters> MakeSignal (double txPowerWatts);
85 void SendSignal (double txPowerWatts);
94 WifiTxVector txVector, std::vector<bool> statusPerMpdu);
101
102private:
103 void DoRun (void) override;
104
105 uint64_t m_uid;
106};
107
109 : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test case receives one packet")
110{
111}
112
114 : TestCase (name),
115 m_count (0),
116 m_uid (0)
117{
118}
119
120// Make a Wi-Fi signal to inject directly to the StartRx() method
123{
124 WifiTxVector txVector = WifiTxVector (OfdmPhy::GetOfdmRate6Mbps (), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
125
126 Ptr<Packet> pkt = Create<Packet> (1000);
127 WifiMacHeader hdr;
128
130 hdr.SetQosTid (0);
131
132 Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
133 Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ());
134
135 Ptr<WifiPpdu> ppdu = Create<OfdmPpdu> (psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, m_uid++);
136
137 Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH);
138 Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
139 txParams->psd = txPowerSpectrum;
140 txParams->txPhy = 0;
141 txParams->duration = txDuration;
142 txParams->ppdu = ppdu;
143
144 return txParams;
145}
146
147// Make a Wi-Fi signal to inject directly to the StartRx() method
148void
150{
151 m_phy->StartRx (MakeSignal (txPowerWatts));
152}
153
154void
156 WifiTxVector txVector, std::vector<bool> statusPerMpdu)
157{
158 NS_LOG_FUNCTION (this << *psdu << rxSignalInfo << txVector);
159 m_count++;
160}
161
162void
164{
165 NS_LOG_FUNCTION (this << *psdu);
166 m_count++;
167}
168
170{
171}
172
173// Create necessary objects, and inject signals. Test that the expected
174// number of packet receptions occur.
175void
177{
178 m_phy = CreateObject<SpectrumWifiPhy> ();
181 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper> ();
182 m_phy->SetInterferenceHelper (interferenceHelper);
183 Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
184 m_phy->SetErrorRateModel (error);
187}
188
189void
191{
192 m_phy->Dispose ();
193 m_phy = 0;
194}
195
196// Test that the expected number of packet receptions occur.
197void
199{
200 double txPowerWatts = 0.010;
201 // Send packets spaced 1 second apart; all should be received
202 Simulator::Schedule (Seconds (1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
203 Simulator::Schedule (Seconds (2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
204 Simulator::Schedule (Seconds (3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
205 // Send packets spaced 1 microsecond second apart; none should be received (PHY header reception failure)
206 Simulator::Schedule (MicroSeconds (4000000), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
207 Simulator::Schedule (MicroSeconds (4000001), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
209 Simulator::Destroy ();
210
211 NS_TEST_ASSERT_MSG_EQ (m_count, 3, "Didn't receive right number of packets");
212}
213
221{
222public:
228 : m_notifyRxStart (0),
229 m_notifyRxEndOk (0),
232 {
233 }
235 {
236 }
237 void NotifyRxStart (Time duration) override
238 {
239 NS_LOG_FUNCTION (this << duration);
241 }
242 void NotifyRxEndOk (void) override
243 {
244 NS_LOG_FUNCTION (this);
246 }
247 void NotifyRxEndError (void) override
248 {
249 NS_LOG_FUNCTION (this);
251 }
252 void NotifyTxStart (Time duration, double txPowerDbm) override
253 {
254 NS_LOG_FUNCTION (this << duration << txPowerDbm);
255 }
256 void NotifyCcaBusyStart (Time duration, WifiChannelListType channelType,
257 const std::vector<Time>& /*per20MhzDurations*/) override
258 {
259 NS_LOG_FUNCTION (this << duration << channelType);
261 }
262 void NotifySwitchingStart (Time duration) override
263 {
264 }
265 void NotifySleep (void) override
266 {
267 }
268 void NotifyOff (void) override
269 {
270 }
271 void NotifyWakeup (void) override
272 {
273 }
274 void NotifyOn (void) override
275 {
276 }
281};
282
290{
291public:
294private:
295 void DoSetup (void) override;
296 void DoRun (void) override;
298};
299
301 : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test operation of WifiPhyListener")
302{
303}
304
306{
307}
308
309void
311{
315}
316
317void
319{
320 double txPowerWatts = 0.010;
321 Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
323
324 NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
325 NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyMaybeCcaBusyStart, 2, "Didn't receive NotifyCcaBusyStart (once preamble is detected + prolonged by L-SIG reception, then switched to Rx by at the beginning of data)");
326 NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
327 NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
328
329 Simulator::Destroy ();
330 delete m_listener;
331}
332
340{
341public:
348 SpectrumWifiPhyFilterTest (std::string name);
350
351private:
352 void DoSetup (void) override;
353 void DoTeardown (void) override;
354 void DoRun (void) override;
355
359 void RunOne ();
360
364 void SendPpdu (void);
365
372
375
378
379 std::set<WifiSpectrumBand> m_ruBands;
380};
381
383 : TestCase ("SpectrumWifiPhy test RX filters"),
384 m_txChannelWidth (20),
385 m_rxChannelWidth (20)
386{
387}
388
390 : TestCase (name)
391{
392}
393
394void
396{
397 WifiTxVector txVector = WifiTxVector (HePhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, m_txChannelWidth, false, false);
398 Ptr<Packet> pkt = Create<Packet> (1000);
399 WifiMacHeader hdr;
401 hdr.SetQosTid (0);
402 hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:01"));
403 hdr.SetSequenceNumber (1);
404 Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
405 m_txPhy->Send (WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)}), txVector);
406}
407
409{
410 m_txPhy = 0;
411 m_rxPhy = 0;
412}
413
414void
416{
417 for (auto const& pair : rxPowersW)
418 {
419 NS_LOG_INFO ("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW=" << pair.second << " (" << WToDbm (pair.second) << " dBm)");
420 }
421
422 size_t numBands = rxPowersW.size ();
423 size_t expectedNumBands = std::max (1, (m_rxChannelWidth / 20));
424 expectedNumBands += (m_rxChannelWidth / 40);
425 expectedNumBands += (m_rxChannelWidth / 80);
426 expectedNumBands += (m_rxChannelWidth / 160);
427 expectedNumBands += m_ruBands.size ();
428
429 NS_TEST_ASSERT_MSG_EQ (numBands, expectedNumBands, "Total number of bands handled by the receiver is incorrect");
430
431 uint16_t channelWidth = std::min (m_txChannelWidth, m_rxChannelWidth);
432 WifiSpectrumBand band = m_rxPhy->GetBand (channelWidth, 0);
433 auto it = rxPowersW.find (band);
434 NS_LOG_INFO ("powerW total band: " << it->second << " (" << WToDbm (it->second) << " dBm)");
435 int totalRxPower = static_cast<int> (WToDbm (it->second) + 0.5);
436 int expectedTotalRxPower;
438 {
439 //PHY sends at 16 dBm, and since there is no loss, this should be the total power at the receiver.
440 expectedTotalRxPower = 16;
441 }
442 else
443 {
444 //Only a part of the transmitted power is received
445 expectedTotalRxPower = 16 - static_cast<int> (RatioToDb (m_txChannelWidth / m_rxChannelWidth));
446 }
447 NS_TEST_ASSERT_MSG_EQ (totalRxPower, expectedTotalRxPower, "Total received power is not correct");
448
449 if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
450 {
451 band = m_rxPhy->GetBand (20, 0); //primary 20 MHz
452 it = rxPowersW.find (band);
453 NS_LOG_INFO ("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm (it->second) << " dBm)");
454 int rxPowerPrimaryChannel20 = static_cast<int> (WToDbm (it->second) + 0.5);
455 int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int> (RatioToDb (channelWidth / 20));
456 NS_TEST_ASSERT_MSG_EQ (rxPowerPrimaryChannel20, expectedRxPowerPrimaryChannel20, "Received power in the primary 20 MHz band is not correct");
457 }
458}
459
460void
462{
463 //WifiHelper::EnableLogComponents ();
464 //LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
465
466 Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();
467 Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
468 lossModel->SetFrequency (5.180e9);
469 spectrumChannel->AddPropagationLossModel (lossModel);
470 Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
471 spectrumChannel->SetPropagationDelayModel (delayModel);
472
473 Ptr<Node> txNode = CreateObject<Node> ();
474 Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
475 m_txPhy = CreateObject<ExtSpectrumWifiPhy> ();
478 Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper> ();
479 m_txPhy->SetInterferenceHelper (txInterferenceHelper);
480 Ptr<ErrorRateModel> txErrorModel = CreateObject<NistErrorRateModel> ();
481 m_txPhy->SetErrorRateModel (txErrorModel);
482 m_txPhy->SetDevice (txDev);
483 m_txPhy->SetChannel (spectrumChannel);
484 Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
485 m_txPhy->SetMobility (apMobility);
486 txDev->SetPhy (m_txPhy);
487 txNode->AggregateObject (apMobility);
488 txNode->AddDevice (txDev);
489
490 Ptr<Node> rxNode = CreateObject<Node> ();
491 Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice> ();
492 m_rxPhy = CreateObject<ExtSpectrumWifiPhy> ();
495 Ptr<InterferenceHelper> rxInterferenceHelper = CreateObject<InterferenceHelper> ();
496 m_rxPhy->SetInterferenceHelper (rxInterferenceHelper);
497 Ptr<ErrorRateModel> rxErrorModel = CreateObject<NistErrorRateModel> ();
498 m_rxPhy->SetErrorRateModel (rxErrorModel);
499 m_rxPhy->SetChannel (spectrumChannel);
500 Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
501 m_rxPhy->SetMobility (sta1Mobility);
502 rxDev->SetPhy (m_rxPhy);
503 rxNode->AggregateObject (sta1Mobility);
504 rxNode->AddDevice (rxDev);
506}
507
508void
510{
511 m_txPhy->Dispose ();
512 m_txPhy = 0;
513 m_rxPhy->Dispose ();
514 m_rxPhy = 0;
515}
516
517void
519{
520 uint16_t txFrequency;
521 switch (m_txChannelWidth)
522 {
523 case 20:
524 default:
525 txFrequency = 5180;
526 break;
527 case 40:
528 txFrequency = 5190;
529 break;
530 case 80:
531 txFrequency = 5210;
532 break;
533 case 160:
534 txFrequency = 5250;
535 break;
536 }
537 auto txChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, txFrequency, m_txChannelWidth,
541 (int)(WIFI_PHY_BAND_5GHZ), 0});
542
543 uint16_t rxFrequency;
544 switch (m_rxChannelWidth)
545 {
546 case 20:
547 default:
548 rxFrequency = 5180;
549 break;
550 case 40:
551 rxFrequency = 5190;
552 break;
553 case 80:
554 rxFrequency = 5210;
555 break;
556 case 160:
557 rxFrequency = 5250;
558 break;
559 }
560 auto rxChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, rxFrequency, m_rxChannelWidth,
564 (int)(WIFI_PHY_BAND_5GHZ), 0});
565
566 m_ruBands.clear ();
567 for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
568 {
569 for (uint8_t i = 0; i < (m_rxChannelWidth / bw); ++i)
570 {
571 for (unsigned int type = 0; type < 7; type++)
572 {
573 HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
574 for (std::size_t index = 1; index <= HeRu::GetNRus (bw, ruType); index++)
575 {
576 HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, index);
577 HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
579 range, i);
580 m_ruBands.insert (band);
581 }
582 }
583 }
584 }
585
586 Simulator::Schedule (Seconds (1), &SpectrumWifiPhyFilterTest::SendPpdu, this);
587
589}
590
591void
593{
594 m_txChannelWidth = 20;
595 m_rxChannelWidth = 20;
596 RunOne ();
597
598 m_txChannelWidth = 40;
599 m_rxChannelWidth = 40;
600 RunOne ();
601
602 m_txChannelWidth = 80;
603 m_rxChannelWidth = 80;
604 RunOne ();
605
606 m_txChannelWidth = 160;
607 m_rxChannelWidth = 160;
608 RunOne ();
609
610 m_txChannelWidth = 20;
611 m_rxChannelWidth = 40;
612 RunOne ();
613
614 m_txChannelWidth = 20;
615 m_rxChannelWidth = 80;
616 RunOne ();
617
618 m_txChannelWidth = 40;
619 m_rxChannelWidth = 80;
620 RunOne ();
621
622 m_txChannelWidth = 20;
623 m_rxChannelWidth = 160;
624 RunOne ();
625
626 m_txChannelWidth = 40;
627 m_rxChannelWidth = 160;
628 RunOne ();
629
630 m_txChannelWidth = 80;
631 m_rxChannelWidth = 160;
632 RunOne ();
633
634 m_txChannelWidth = 40;
635 m_rxChannelWidth = 20;
636 RunOne ();
637
638 m_txChannelWidth = 80;
639 m_rxChannelWidth = 20;
640 RunOne ();
641
642 m_txChannelWidth = 80;
643 m_rxChannelWidth = 40;
644 RunOne ();
645
646 m_txChannelWidth = 160;
647 m_rxChannelWidth = 20;
648 RunOne ();
649
650 m_txChannelWidth = 160;
651 m_rxChannelWidth = 40;
652 RunOne ();
653
654 m_txChannelWidth = 160;
655 m_rxChannelWidth = 80;
656 RunOne ();
657
658 Simulator::Destroy ();
659}
660
668{
669public:
671};
672
674 : TestSuite ("wifi-spectrum-wifi-phy", UNIT)
675{
676 AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK);
677 AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK);
678 AddTestCase (new SpectrumWifiPhyFilterTest, TestCase::QUICK);
679}
680
#define min(a, b)
Definition: 80211b.c:42
#define max(a, b)
Definition: 80211b.c:43
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
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 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 NotifyCcaBusyStart(Time duration, WifiChannelListType channelType, const std::vector< Time > &) 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:104
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:594
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:1547
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:602
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:932
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:411
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:877
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1368
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:975
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:563
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:575
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:417
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:405
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:838
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:1261
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
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: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:77
@ 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:69
#define SU_STA_ID
Definition: wifi-mode.h:32