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 
36 using namespace ns3;
37 
38 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhyBasicTest");
39 
40 static const uint8_t CHANNEL_NUMBER = 36;
41 static const uint32_t FREQUENCY = 5180; // MHz
42 static const uint16_t CHANNEL_WIDTH = 20; // MHz
43 static const uint16_t GUARD_WIDTH = CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
44 
46 {
47 public:
50 };
51 
59 {
60 public:
67  SpectrumWifiPhyBasicTest (std::string name);
68  virtual ~SpectrumWifiPhyBasicTest ();
69 
70 protected:
71  void DoSetup (void) override;
72  void DoTeardown (void) override;
74 
79  Ptr<SpectrumSignalParameters> MakeSignal (double txPowerWatts);
84  void SendSignal (double txPowerWatts);
92  void SpectrumWifiPhyRxSuccess (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
93  WifiTxVector txVector, std::vector<bool> statusPerMpdu);
98  void SpectrumWifiPhyRxFailure (Ptr<WifiPsdu> psdu);
99  uint32_t m_count;
100 
101 private:
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
147 void
149 {
150  m_phy->StartRx (MakeSignal (txPowerWatts));
151 }
152 
153 void
155  WifiTxVector txVector, std::vector<bool> statusPerMpdu)
156 {
157  NS_LOG_FUNCTION (this << *psdu << rxSignalInfo << txVector);
158  m_count++;
159 }
160 
161 void
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.
174 void
176 {
177  m_phy = CreateObject<SpectrumWifiPhy> ();
179  Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
180  m_phy->SetErrorRateModel (error);
185 }
186 
187 void
189 {
190  m_phy->Dispose ();
191  m_phy = 0;
192 }
193 
194 // Test that the expected number of packet receptions occur.
195 void
197 {
198  double txPowerWatts = 0.010;
199  // Send packets spaced 1 second apart; all should be received
200  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
201  Simulator::Schedule (Seconds (2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
202  Simulator::Schedule (Seconds (3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
203  // Send packets spaced 1 microsecond second apart; none should be received (PHY header reception failure)
204  Simulator::Schedule (MicroSeconds (4000000), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
205  Simulator::Schedule (MicroSeconds (4000001), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
206  Simulator::Run ();
207  Simulator::Destroy ();
208 
209  NS_TEST_ASSERT_MSG_EQ (m_count, 3, "Didn't receive right number of packets");
210 }
211 
219 {
220 public:
226  : m_notifyRxStart (0),
227  m_notifyRxEndOk (0),
228  m_notifyRxEndError (0),
230  {
231  }
232  virtual ~TestPhyListener ()
233  {
234  }
235  void NotifyRxStart (Time duration) override
236  {
237  NS_LOG_FUNCTION (this << duration);
238  ++m_notifyRxStart;
239  }
240  void NotifyRxEndOk (void) override
241  {
242  NS_LOG_FUNCTION (this);
243  ++m_notifyRxEndOk;
244  }
245  void NotifyRxEndError (void) override
246  {
247  NS_LOG_FUNCTION (this);
249  }
250  void NotifyTxStart (Time duration, double txPowerDbm) override
251  {
252  NS_LOG_FUNCTION (this << duration << txPowerDbm);
253  }
254  void NotifyMaybeCcaBusyStart (Time duration) override
255  {
256  NS_LOG_FUNCTION (this);
258  }
259  void NotifySwitchingStart (Time duration) override
260  {
261  }
262  void NotifySleep (void) override
263  {
264  }
265  void NotifyOff (void) override
266  {
267  }
268  void NotifyWakeup (void) override
269  {
270  }
271  void NotifyOn (void) override
272  {
273  }
274  uint32_t m_notifyRxStart;
275  uint32_t m_notifyRxEndOk;
278 };
279 
287 {
288 public:
290  virtual ~SpectrumWifiPhyListenerTest ();
291 private:
292  void DoSetup (void) override;
293  void DoRun (void) override;
295 };
296 
298  : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test operation of WifiPhyListener")
299 {
300 }
301 
303 {
304 }
305 
306 void
308 {
312 }
313 
314 void
316 {
317  double txPowerWatts = 0.010;
318  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
319  Simulator::Run ();
320 
321  NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
322  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)");
323  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
324  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
325 
326  Simulator::Destroy ();
327  delete m_listener;
328 }
329 
337 {
338 public:
345  SpectrumWifiPhyFilterTest (std::string name);
346  virtual ~SpectrumWifiPhyFilterTest ();
347 
348 private:
349  void DoSetup (void) override;
350  void DoTeardown (void) override;
351  void DoRun (void) override;
352 
356  void RunOne ();
357 
361  void SendPpdu (void);
362 
369 
372 
373  uint16_t m_txChannelWidth;
374  uint16_t m_rxChannelWidth;
375 
376  std::set<WifiSpectrumBand> m_ruBands;
377 };
378 
380  : TestCase ("SpectrumWifiPhy test RX filters"),
381  m_txChannelWidth (20),
382  m_rxChannelWidth (20)
383 {
384 }
385 
387  : TestCase (name)
388 {
389 }
390 
391 void
393 {
394  WifiTxVector txVector = WifiTxVector (HePhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, m_txChannelWidth, false, false);
395  Ptr<Packet> pkt = Create<Packet> (1000);
396  WifiMacHeader hdr;
398  hdr.SetQosTid (0);
399  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:01"));
400  hdr.SetSequenceNumber (1);
401  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
402  m_txPhy->Send (WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)}), txVector);
403 }
404 
406 {
407  m_txPhy = 0;
408  m_rxPhy = 0;
409 }
410 
411 void
413 {
414  for (auto const& pair : rxPowersW)
415  {
416  NS_LOG_INFO ("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW=" << pair.second << " (" << WToDbm (pair.second) << " dBm)");
417  }
418 
419  size_t numBands = rxPowersW.size ();
420  size_t expectedNumBands = std::max (1, (m_rxChannelWidth / 20));
421  expectedNumBands += (m_rxChannelWidth / 40);
422  expectedNumBands += (m_rxChannelWidth / 80);
423  expectedNumBands += (m_rxChannelWidth / 160);
424  expectedNumBands += m_ruBands.size ();
425 
426  NS_TEST_ASSERT_MSG_EQ (numBands, expectedNumBands, "Total number of bands handled by the receiver is incorrect");
427 
428  uint16_t channelWidth = std::min (m_txChannelWidth, m_rxChannelWidth);
429  WifiSpectrumBand band = m_rxPhy->GetBand (channelWidth, 0);
430  auto it = rxPowersW.find (band);
431  NS_LOG_INFO ("powerW total band: " << it->second << " (" << WToDbm (it->second) << " dBm)");
432  int totalRxPower = static_cast<int> (WToDbm (it->second) + 0.5);
433  int expectedTotalRxPower;
435  {
436  //PHY sends at 16 dBm, and since there is no loss, this should be the total power at the receiver.
437  expectedTotalRxPower = 16;
438  }
439  else
440  {
441  //Only a part of the transmitted power is received
442  expectedTotalRxPower = 16 - static_cast<int> (RatioToDb (m_txChannelWidth / m_rxChannelWidth));
443  }
444  NS_TEST_ASSERT_MSG_EQ (totalRxPower, expectedTotalRxPower, "Total received power is not correct");
445 
446  if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
447  {
448  band = m_rxPhy->GetBand (20, 0); //primary 20 MHz
449  it = rxPowersW.find (band);
450  NS_LOG_INFO ("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm (it->second) << " dBm)");
451  int rxPowerPrimaryChannel20 = static_cast<int> (WToDbm (it->second) + 0.5);
452  int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int> (RatioToDb (channelWidth / 20));
453  NS_TEST_ASSERT_MSG_EQ (rxPowerPrimaryChannel20, expectedRxPowerPrimaryChannel20, "Received power in the primary 20 MHz band is not correct");
454  }
455 }
456 
457 void
459 {
460  //WifiHelper::EnableLogComponents ();
461  //LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
462 
463  Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();
464  Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
465  lossModel->SetFrequency (5.180e9);
466  spectrumChannel->AddPropagationLossModel (lossModel);
467  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
468  spectrumChannel->SetPropagationDelayModel (delayModel);
469 
470  Ptr<Node> txNode = CreateObject<Node> ();
471  Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
472  m_txPhy = CreateObject<ExtSpectrumWifiPhy> ();
475  Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
476  m_txPhy->SetErrorRateModel (error);
477  m_txPhy->SetDevice (txDev);
478  m_txPhy->SetChannel (spectrumChannel);
479  Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
480  m_txPhy->SetMobility (apMobility);
481  txDev->SetPhy (m_txPhy);
482  txNode->AggregateObject (apMobility);
483  txNode->AddDevice (txDev);
484 
485  Ptr<Node> rxNode = CreateObject<Node> ();
486  Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice> ();
487  m_rxPhy = CreateObject<ExtSpectrumWifiPhy> ();
490  m_rxPhy->SetErrorRateModel (error);
491  m_rxPhy->SetChannel (spectrumChannel);
492  Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
493  m_rxPhy->SetMobility (sta1Mobility);
494  rxDev->SetPhy (m_rxPhy);
495  rxNode->AggregateObject (sta1Mobility);
496  rxNode->AddDevice (rxDev);
498 }
499 
500 void
502 {
503  m_txPhy->Dispose ();
504  m_txPhy = 0;
505  m_rxPhy->Dispose ();
506  m_rxPhy = 0;
507 }
508 
509 void
511 {
512  uint16_t txFrequency;
513  switch (m_txChannelWidth)
514  {
515  case 20:
516  default:
517  txFrequency = 5180;
518  break;
519  case 40:
520  txFrequency = 5190;
521  break;
522  case 80:
523  txFrequency = 5210;
524  break;
525  case 160:
526  txFrequency = 5250;
527  break;
528  }
529  m_txPhy->SetFrequency (txFrequency);
530 
531  uint16_t rxFrequency;
532  switch (m_rxChannelWidth)
533  {
534  case 20:
535  default:
536  rxFrequency = 5180;
537  break;
538  case 40:
539  rxFrequency = 5190;
540  break;
541  case 80:
542  rxFrequency = 5210;
543  break;
544  case 160:
545  rxFrequency = 5250;
546  break;
547  }
548  m_rxPhy->SetFrequency (rxFrequency);
549 
550  m_ruBands.clear ();
551  for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
552  {
553  for (uint8_t i = 0; i < (m_rxChannelWidth / bw); ++i)
554  {
555  for (unsigned int type = 0; type < 7; type++)
556  {
557  HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
558  for (std::size_t index = 1; index <= HeRu::GetNRus (bw, ruType); index++)
559  {
560  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, index);
561  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
563  range, i);
564  m_ruBands.insert (band);
565  }
566  }
567  }
568  }
569 
570  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyFilterTest::SendPpdu, this);
571 
572  Simulator::Run ();
573 }
574 
575 void
577 {
578  m_txChannelWidth = 20;
579  m_rxChannelWidth = 20;
580  RunOne ();
581 
582  m_txChannelWidth = 40;
583  m_rxChannelWidth = 40;
584  RunOne ();
585 
586  m_txChannelWidth = 80;
587  m_rxChannelWidth = 80;
588  RunOne ();
589 
590  m_txChannelWidth = 160;
591  m_rxChannelWidth = 160;
592  RunOne ();
593 
594  m_txChannelWidth = 20;
595  m_rxChannelWidth = 40;
596  RunOne ();
597 
598  m_txChannelWidth = 20;
599  m_rxChannelWidth = 80;
600  RunOne ();
601 
602  m_txChannelWidth = 40;
603  m_rxChannelWidth = 80;
604  RunOne ();
605 
606  m_txChannelWidth = 20;
607  m_rxChannelWidth = 160;
608  RunOne ();
609 
610  m_txChannelWidth = 40;
611  m_rxChannelWidth = 160;
612  RunOne ();
613 
614  m_txChannelWidth = 80;
615  m_rxChannelWidth = 160;
616  RunOne ();
617 
618  m_txChannelWidth = 40;
619  m_rxChannelWidth = 20;
620  RunOne ();
621 
622  m_txChannelWidth = 80;
623  m_rxChannelWidth = 20;
624  RunOne ();
625 
626  m_txChannelWidth = 80;
627  m_rxChannelWidth = 40;
628  RunOne ();
629 
630  m_txChannelWidth = 160;
631  m_rxChannelWidth = 20;
632  RunOne ();
633 
634  m_txChannelWidth = 160;
635  m_rxChannelWidth = 40;
636  RunOne ();
637 
638  m_txChannelWidth = 160;
639  m_rxChannelWidth = 80;
640  RunOne ();
641 
642  Simulator::Destroy ();
643 }
644 
652 {
653 public:
655 };
656 
658  : TestSuite ("wifi-spectrum-wifi-phy", UNIT)
659 {
660  AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK);
661  AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK);
662  AddTestCase (new SpectrumWifiPhyFilterTest, TestCase::QUICK);
663 }
664 
ns3::SpectrumChannel::SetPropagationDelayModel
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
Definition: spectrum-channel.cc:139
SpectrumWifiPhyBasicTest
Spectrum Wifi Phy Basic Test.
Definition: spectrum-wifi-phy-test.cc:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::SpectrumSignalParameters::psd
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
Definition: spectrum-signal-parameters.h:94
TestPhyListener::TestPhyListener
TestPhyListener(void)
Create a test PhyListener.
Definition: spectrum-wifi-phy-test.cc:225
spectrumWifiPhyTestSuite
static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite
the test suite
Definition: spectrum-wifi-phy-test.cc:665
SpectrumWifiPhyTestSuite
Spectrum Wifi Phy Test Suite.
Definition: spectrum-wifi-phy-test.cc:652
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
ExtSpectrumWifiPhy
Definition: spectrum-wifi-phy-test.cc:46
ns3::Object::Dispose
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
SpectrumWifiPhyFilterTest::m_rxPhy
Ptr< ExtSpectrumWifiPhy > m_rxPhy
RX PHY.
Definition: spectrum-wifi-phy-test.cc:371
ns3::SpectrumChannel::AddPropagationLossModel
void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add the single-frequency propagation loss model to be used.
Definition: spectrum-channel.cc:117
SpectrumWifiPhyFilterTest::RunOne
void RunOne()
Run one function.
Definition: spectrum-wifi-phy-test.cc:510
ns3::WifiSpectrumBand
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
Definition: wifi-spectrum-value-helper.h:34
min
#define min(a, b)
Definition: 80211b.c:42
ns3::SpectrumWifiPhy::StartRx
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
Definition: spectrum-wifi-phy.cc:283
ns3::WifiPhy::SetDevice
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:777
ns3::SpectrumWifiPhy::SetChannelNumber
void SetChannelNumber(uint8_t id) override
Set channel number.
Definition: spectrum-wifi-phy.cc:239
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiPhy::CalculateTxDuration
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1610
GUARD_WIDTH
static const uint16_t GUARD_WIDTH
Definition: spectrum-wifi-phy-test.cc:43
ns3::WifiMacHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
Definition: wifi-mac-header.cc:312
ns3::SpectrumWifiPhy::GetBand
WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the start band index and the stop band index for a given band.
Definition: spectrum-wifi-phy.cc:523
ns3::HeRu::SubcarrierGroup
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
ns3::WifiPhyListener
receive notifications about PHY events.
Definition: wifi-phy-listener.h:33
SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess
void SpectrumWifiPhyRxSuccess(Ptr< WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Spectrum wifi receive success function.
Definition: spectrum-wifi-phy-test.cc:154
ns3::WIFI_PHY_BAND_5GHZ
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
TestPhyListener::m_notifyRxEndOk
uint32_t m_notifyRxEndOk
notify receive end OK
Definition: spectrum-wifi-phy-test.cc:275
SpectrumWifiPhyListenerTest
Spectrum Wifi Phy Listener Test.
Definition: spectrum-wifi-phy-test.cc:287
ns3::SpectrumWifiPhy::SetChannel
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
Definition: spectrum-wifi-phy.cc:219
SpectrumWifiPhyFilterTest::SendPpdu
void SendPpdu(void)
Send PPDU function.
Definition: spectrum-wifi-phy-test.cc:392
SpectrumWifiPhyBasicTest::m_uid
uint64_t m_uid
the UID to use for the PPDU
Definition: spectrum-wifi-phy-test.cc:104
SpectrumWifiPhyFilterTest::DoTeardown
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
Definition: spectrum-wifi-phy-test.cc:501
ns3::SpectrumSignalParameters::txPhy
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
Definition: spectrum-signal-parameters.h:107
ns3::WToDbm
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:43
SpectrumWifiPhyFilterTest
Spectrum Wifi Phy Filter Test.
Definition: spectrum-wifi-phy-test.cc:337
TestPhyListener::m_notifyMaybeCcaBusyStart
uint32_t m_notifyMaybeCcaBusyStart
notify maybe CCA busy start
Definition: spectrum-wifi-phy-test.cc:277
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::SpectrumWifiPhy::ConfigureStandardAndBand
void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band) override
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: spectrum-wifi-phy.cc:272
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::WifiPhy::SetReceiveOkCallback
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:635
ns3::WifiConstPsduMap
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:43
ns3::WIFI_PREAMBLE_HE_SU
@ WIFI_PREAMBLE_HE_SU
Definition: wifi-phy-common.h:74
SpectrumWifiPhyBasicTest::m_count
uint32_t m_count
count
Definition: spectrum-wifi-phy-test.cc:99
CHANNEL_NUMBER
static const uint8_t CHANNEL_NUMBER
Definition: spectrum-wifi-phy-test.cc:40
ns3::SpectrumWifiPhy
802.11 PHY layer model
Definition: spectrum-wifi-phy.h:55
ns3::TestCase
encapsulates test code
Definition: test.h:1154
TestPhyListener::NotifySwitchingStart
void NotifySwitchingStart(Time duration) override
Definition: spectrum-wifi-phy-test.cc:259
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition: wifi-mac-header.cc:108
SpectrumWifiPhyFilterTest::RxCallback
void RxCallback(Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by the PHYs.
Definition: spectrum-wifi-phy-test.cc:412
SpectrumWifiPhyListenerTest::DoSetup
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
Definition: spectrum-wifi-phy-test.cc:307
TestPhyListener
Test Phy Listener.
Definition: spectrum-wifi-phy-test.cc:219
SpectrumWifiPhyBasicTest::MakeSignal
Ptr< SpectrumSignalParameters > MakeSignal(double txPowerWatts)
Make signal function.
Definition: spectrum-wifi-phy-test.cc:121
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
SpectrumWifiPhyFilterTest::m_rxChannelWidth
uint16_t m_rxChannelWidth
RX channel width (MHz)
Definition: spectrum-wifi-phy-test.cc:374
TestPhyListener::m_notifyRxStart
uint32_t m_notifyRxStart
notify receive start
Definition: spectrum-wifi-phy-test.cc:274
ns3::WifiPhy::RegisterListener
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:647
ns3::Ptr< SpectrumWifiPhy >
SpectrumWifiPhyListenerTest::~SpectrumWifiPhyListenerTest
virtual ~SpectrumWifiPhyListenerTest()
Definition: spectrum-wifi-phy-test.cc:302
ns3::WIFI_PHY_STANDARD_80211ax
@ WIFI_PHY_STANDARD_80211ax
HE PHY (clause 26)
Definition: wifi-standards.h:49
ns3::SpectrumWifiPhy::CreateWifiSpectrumPhyInterface
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
Definition: spectrum-wifi-phy.cc:435
TestPhyListener::NotifyOff
void NotifyOff(void) override
Notify listeners that we went to switch off.
Definition: spectrum-wifi-phy-test.cc:265
SpectrumWifiPhyBasicTest::SendSignal
void SendSignal(double txPowerWatts)
Send signal function.
Definition: spectrum-wifi-phy-test.cc:148
SpectrumWifiPhyFilterTest::m_ruBands
std::set< WifiSpectrumBand > m_ruBands
spectrum bands associated to all the RUs
Definition: spectrum-wifi-phy-test.cc:376
max
#define max(a, b)
Definition: 80211b.c:43
SpectrumWifiPhyBasicTest::~SpectrumWifiPhyBasicTest
virtual ~SpectrumWifiPhyBasicTest()
Definition: spectrum-wifi-phy-test.cc:168
SpectrumWifiPhyFilterTest::m_txPhy
Ptr< ExtSpectrumWifiPhy > m_txPhy
TX PHY.
Definition: spectrum-wifi-phy-test.cc:370
ns3::WifiPhy::SetReceiveErrorCallback
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:641
SpectrumWifiPhyBasicTest::SpectrumWifiPhyBasicTest
SpectrumWifiPhyBasicTest()
Definition: spectrum-wifi-phy-test.cc:107
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
SpectrumWifiPhyTestSuite::SpectrumWifiPhyTestSuite
SpectrumWifiPhyTestSuite()
Definition: spectrum-wifi-phy-test.cc:657
TestPhyListener::NotifyWakeup
void NotifyWakeup(void) override
Notify listeners that we woke up.
Definition: spectrum-wifi-phy-test.cc:268
ns3::FriisPropagationLossModel::SetFrequency
void SetFrequency(double frequency)
Definition: propagation-loss-model.cc:197
ns3::HeRu::RuType
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:42
ns3::Object::AggregateObject
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
ns3::WifiPsdu::GetSize
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
TestPhyListener::NotifyTxStart
void NotifyTxStart(Time duration, double txPowerDbm) override
Definition: spectrum-wifi-phy-test.cc:250
SU_STA_ID
#define SU_STA_ID
Definition: wifi-mode.h:32
TestPhyListener::NotifySleep
void NotifySleep(void) override
Notify listeners that we went to sleep.
Definition: spectrum-wifi-phy-test.cc:262
ns3::WifiPhy::GetPhyBand
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1124
ns3::WifiSpectrumSignalParameters::ppdu
Ptr< WifiPpdu > ppdu
The PPDU being transmitted.
Definition: wifi-spectrum-signal-parameters.h:53
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
TestPhyListener::NotifyRxStart
void NotifyRxStart(Time duration) override
Definition: spectrum-wifi-phy-test.cc:235
ns3::SpectrumSignalParameters::duration
Time duration
The duration of the packet transmission.
Definition: spectrum-signal-parameters.h:102
ns3::Node::AddDevice
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
SpectrumWifiPhyFilterTest::m_txChannelWidth
uint16_t m_txChannelWidth
TX channel width (MHz)
Definition: spectrum-wifi-phy-test.cc:373
ns3::SpectrumWifiPhy::SpectrumWifiPhy
SpectrumWifiPhy()
Definition: spectrum-wifi-phy.cc:79
SpectrumWifiPhyFilterTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: spectrum-wifi-phy-test.cc:576
SpectrumWifiPhyBasicTest::m_phy
Ptr< SpectrumWifiPhy > m_phy
Phy.
Definition: spectrum-wifi-phy-test.cc:73
SpectrumWifiPhyListenerTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: spectrum-wifi-phy-test.cc:315
ns3::SpectrumWifiPhy::GetGuardBandwidth
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
Definition: spectrum-wifi-phy.cc:501
ns3::WifiPhy::SetMobility
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:789
ns3::MakeCallback
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:1642
ns3::RatioToDb
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:49
ns3::WIFI_PHY_STANDARD_80211n
@ WIFI_PHY_STANDARD_80211n
HT PHY (clause 20)
Definition: wifi-standards.h:45
ns3::WIFI_PREAMBLE_LONG
@ WIFI_PREAMBLE_LONG
Definition: wifi-phy-common.h:69
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
TestPhyListener::m_notifyRxEndError
uint32_t m_notifyRxEndError
notify receive end error
Definition: spectrum-wifi-phy-test.cc:276
NS_TEST_ASSERT_MSG_EQ
#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:166
SpectrumWifiPhyListenerTest::m_listener
TestPhyListener * m_listener
listener
Definition: spectrum-wifi-phy-test.cc:294
SpectrumWifiPhyBasicTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: spectrum-wifi-phy-test.cc:196
ns3::RxSignalInfo
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:67
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
TestPhyListener::~TestPhyListener
virtual ~TestPhyListener()
Definition: spectrum-wifi-phy-test.cc:232
ns3::WIFI_MAC_QOSDATA
@ WIFI_MAC_QOSDATA
Definition: wifi-mac-header.h:70
CHANNEL_WIDTH
static const uint16_t CHANNEL_WIDTH
Definition: spectrum-wifi-phy-test.cc:42
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
TestPhyListener::NotifyRxEndError
void NotifyRxEndError(void) override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
Definition: spectrum-wifi-phy-test.cc:245
SpectrumWifiPhyFilterTest::DoSetup
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
Definition: spectrum-wifi-phy-test.cc:458
SpectrumWifiPhyBasicTest::DoTeardown
void DoTeardown(void) override
Implementation to do any local setup required for this TestCase.
Definition: spectrum-wifi-phy-test.cc:188
SpectrumWifiPhyListenerTest::SpectrumWifiPhyListenerTest
SpectrumWifiPhyListenerTest()
Definition: spectrum-wifi-phy-test.cc:297
ns3::SpectrumWifiPhy::SetFrequency
void SetFrequency(uint16_t freq) override
If the operating channel for this object has not been set yet, the given center frequency is saved an...
Definition: spectrum-wifi-phy.cc:250
ns3::WifiMacHeader::SetType
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition: wifi-mac-header.cc:132
ns3::RxPowerWattPerChannelBand
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:75
ns3::SpectrumWifiPhy::ConvertHeRuSubcarriers
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
Definition: spectrum-wifi-phy.cc:548
SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxFailure
void SpectrumWifiPhyRxFailure(Ptr< WifiPsdu > psdu)
Spectrum wifi receive failure function.
Definition: spectrum-wifi-phy-test.cc:162
ns3::HeRu::SubcarrierRange
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
TestPhyListener::NotifyOn
void NotifyOn(void) override
Notify listeners that we went to switch on.
Definition: spectrum-wifi-phy-test.cc:271
ns3::ObjectBase::TraceConnectWithoutContext
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
ns3::WifiMacHeader::SetQosTid
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Definition: wifi-mac-header.cc:352
TestPhyListener::NotifyMaybeCcaBusyStart
void NotifyMaybeCcaBusyStart(Time duration) override
Definition: spectrum-wifi-phy-test.cc:254
ns3::WifiPhy::SetErrorRateModel
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:808
SpectrumWifiPhyFilterTest::SpectrumWifiPhyFilterTest
SpectrumWifiPhyFilterTest()
Definition: spectrum-wifi-phy-test.cc:379
ns3::WifiPhy::Send
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:1789
TestPhyListener::NotifyRxEndOk
void NotifyRxEndOk(void) override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
Definition: spectrum-wifi-phy-test.cc:240
ns3::WifiNetDevice::SetPhy
void SetPhy(const Ptr< WifiPhy > phy)
Definition: wifi-net-device.cc:187
SpectrumWifiPhyBasicTest::DoSetup
void DoSetup(void) override
Implementation to do any local setup required for this TestCase.
Definition: spectrum-wifi-phy-test.cc:175
FREQUENCY
static const uint32_t FREQUENCY
Definition: spectrum-wifi-phy-test.cc:41
SpectrumWifiPhyFilterTest::~SpectrumWifiPhyFilterTest
virtual ~SpectrumWifiPhyFilterTest()
Definition: spectrum-wifi-phy-test.cc:405