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/wifi-ppdu.h"
33 #include "ns3/wifi-utils.h"
34 
35 using namespace ns3;
36 
37 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhyBasicTest");
38 
39 static const uint8_t CHANNEL_NUMBER = 36;
40 static const uint32_t FREQUENCY = 5180; // MHz
41 static const uint16_t CHANNEL_WIDTH = 20; // MHz
42 static const uint16_t GUARD_WIDTH = CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
43 
45 {
46 public:
49 };
50 
58 {
59 public:
66  SpectrumWifiPhyBasicTest (std::string name);
67  virtual ~SpectrumWifiPhyBasicTest ();
68 
69 protected:
70  virtual void DoSetup (void);
72 
77  Ptr<SpectrumSignalParameters> MakeSignal (double txPowerWatts);
82  void SendSignal (double txPowerWatts);
90  void SpectrumWifiPhyRxSuccess (Ptr<WifiPsdu> psdu, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu);
95  void SpectrumWifiPhyRxFailure (Ptr<WifiPsdu> psdu);
96  uint32_t m_count;
97 
98 private:
99  virtual void DoRun (void);
100 };
101 
103  : TestCase ("SpectrumWifiPhy test case receives one packet"),
104  m_count (0)
105 {
106 }
107 
109  : TestCase (name),
110  m_count (0)
111 {
112 }
113 
114 // Make a Wi-Fi signal to inject directly to the StartRx() method
117 {
118  WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
119 
120  Ptr<Packet> pkt = Create<Packet> (1000);
121  WifiMacHeader hdr;
122 
124  hdr.SetQosTid (0);
125 
126  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
127  Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetPhyBand ());
128 
129  Ptr<WifiPpdu> ppdu = Create<WifiPpdu> (psdu, txVector, txDuration, WIFI_PHY_BAND_5GHZ);
130 
131  Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH);
132  Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
133  txParams->psd = txPowerSpectrum;
134  txParams->txPhy = 0;
135  txParams->duration = txDuration;
136  txParams->ppdu = ppdu;
137 
138  return txParams;
139 }
140 
141 // Make a Wi-Fi signal to inject directly to the StartRx() method
142 void
144 {
145  m_phy->StartRx (MakeSignal (txPowerWatts));
146 }
147 
148 void
149 SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess (Ptr<WifiPsdu> psdu, double snr, WifiTxVector txVector, std::vector<bool> statusPerMpdu)
150 {
151  NS_LOG_FUNCTION (this << *psdu << snr << txVector);
152  m_count++;
153 }
154 
155 void
157 {
158  NS_LOG_FUNCTION (this << *psdu);
159  m_count++;
160 }
161 
163 {
164 }
165 
166 // Create necessary objects, and inject signals. Test that the expected
167 // number of packet receptions occur.
168 void
170 {
171  m_phy = CreateObject<SpectrumWifiPhy> ();
173  Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
174  m_phy->SetErrorRateModel (error);
179 }
180 
181 // Test that the expected number of packet receptions occur.
182 void
184 {
185  double txPowerWatts = 0.010;
186  // Send packets spaced 1 second apart; all should be received
187  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
188  Simulator::Schedule (Seconds (2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
189  Simulator::Schedule (Seconds (3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
190  // Send packets spaced 1 microsecond second apart; none should be received (PHY header reception failure)
191  Simulator::Schedule (MicroSeconds (4000000), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
192  Simulator::Schedule (MicroSeconds (4000001), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
193  Simulator::Run ();
194  Simulator::Destroy ();
195 
196  NS_TEST_ASSERT_MSG_EQ (m_count, 3, "Didn't receive right number of packets");
197 }
198 
206 {
207 public:
213  : m_notifyRxStart (0),
214  m_notifyRxEndOk (0),
215  m_notifyRxEndError (0),
217  {
218  }
219  virtual ~TestPhyListener ()
220  {
221  }
222  virtual void NotifyRxStart (Time duration)
223  {
224  NS_LOG_FUNCTION (this << duration);
225  ++m_notifyRxStart;
226  }
227  virtual void NotifyRxEndOk (void)
228  {
229  NS_LOG_FUNCTION (this);
230  ++m_notifyRxEndOk;
231  }
232  virtual void NotifyRxEndError (void)
233  {
234  NS_LOG_FUNCTION (this);
236  }
237  virtual void NotifyTxStart (Time duration, double txPowerDbm)
238  {
239  NS_LOG_FUNCTION (this << duration << txPowerDbm);
240  }
241  virtual void NotifyMaybeCcaBusyStart (Time duration)
242  {
243  NS_LOG_FUNCTION (this);
245  }
246  virtual void NotifySwitchingStart (Time duration)
247  {
248  }
249  virtual void NotifySleep (void)
250  {
251  }
252  virtual void NotifyOff (void)
253  {
254  }
255  virtual void NotifyWakeup (void)
256  {
257  }
258  virtual void NotifyOn (void)
259  {
260  }
261  uint32_t m_notifyRxStart;
262  uint32_t m_notifyRxEndOk;
265 private:
266 };
267 
275 {
276 public:
278  virtual ~SpectrumWifiPhyListenerTest ();
279 private:
280  virtual void DoSetup (void);
281  virtual void DoRun (void);
283 };
284 
286  : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test operation of WifiPhyListener")
287 {
288 }
289 
291 {
292 }
293 
294 void
296 {
300 }
301 
302 void
304 {
305  double txPowerWatts = 0.010;
306  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
307  Simulator::Run ();
308 
309  NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
310  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyMaybeCcaBusyStart, 2, "Didn't receive NotifyMaybeCcaBusyStart (preamble deteted + L-SIG received)");
311  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
312  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
313 
314  Simulator::Destroy ();
315  delete m_listener;
316 }
317 
325 {
326 public:
333  SpectrumWifiPhyFilterTest (std::string name);
334  virtual ~SpectrumWifiPhyFilterTest ();
335 
336 private:
337  virtual void DoSetup (void);
338  virtual void DoRun (void);
339 
343  void RunOne ();
344 
348  void SendPpdu (void);
349 
357 
360 
361  uint16_t m_txChannelWidth;
362  uint16_t m_rxChannelWidth;
363 };
364 
366  : TestCase ("SpectrumWifiPhy test RX filters"),
367  m_txChannelWidth (20),
368  m_rxChannelWidth (20)
369 {
370 }
371 
373  : TestCase (name)
374 {
375 }
376 
377 void
379 {
380  WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, m_txChannelWidth, false, false);
381  Ptr<Packet> pkt = Create<Packet> (1000);
382  WifiMacHeader hdr;
384  hdr.SetQosTid (0);
385  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:01"));
386  hdr.SetSequenceNumber (1);
387  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
388  m_txPhy->Send (WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)}), txVector);
389 }
390 
392 {
393  m_txPhy = 0;
394  m_rxPhy = 0;
395 }
396 
397 void
399 {
400  for (auto const& pair : rxPowersW)
401  {
402  NS_LOG_INFO ("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW=" << pair.second << " (" << WToDbm (pair.second) << " dBm)");
403  }
404 
405  size_t numBands = rxPowersW.size ();
406  size_t expectedNumBands = std::max (1, (m_rxChannelWidth / 20));
407  expectedNumBands += (m_rxChannelWidth / 40);
408  expectedNumBands += (m_rxChannelWidth / 80);
409  expectedNumBands += (m_rxChannelWidth / 160);
410  if (m_rxChannelWidth == 20)
411  {
412  expectedNumBands += 9; /* RU_26_TONE */
413  expectedNumBands += 4; /* RU_52_TONE */
414  expectedNumBands += 2; /* RU_106_TONE */
415  expectedNumBands += 1; /* RU_242_TONE */
416  }
417  else if (m_rxChannelWidth == 40)
418  {
419  expectedNumBands += 18; /* RU_26_TONE */
420  expectedNumBands += 8; /* RU_52_TONE */
421  expectedNumBands += 4; /* RU_106_TONE */
422  expectedNumBands += 2; /* RU_242_TONE */
423  expectedNumBands += 1; /* RU_484_TONE */
424  }
425  else if (m_rxChannelWidth >= 80)
426  {
427  expectedNumBands += 37 * (m_rxChannelWidth / 80); /* RU_26_TONE */
428  expectedNumBands += 16 * (m_rxChannelWidth / 80); /* RU_52_TONE */
429  expectedNumBands += 8 * (m_rxChannelWidth / 80); /* RU_106_TONE */
430  expectedNumBands += 4 * (m_rxChannelWidth / 80); /* RU_242_TONE */
431  expectedNumBands += 2 * (m_rxChannelWidth / 80); /* RU_484_TONE */
432  expectedNumBands += 1 * (m_rxChannelWidth / 80); /* RU_996_TONE */
433  if (m_rxChannelWidth == 160)
434  {
435  ++expectedNumBands; /* RU_2x996_TONE */
436  }
437  }
438  NS_TEST_ASSERT_MSG_EQ (numBands, expectedNumBands, "Total number of bands handled by the receiver is incorrect");
439 
440  uint16_t channelWidth = std::min (m_txChannelWidth, m_rxChannelWidth);
441  WifiSpectrumBand band = m_rxPhy->GetBand (channelWidth, 0);
442  auto it = rxPowersW.find (band);
443  NS_LOG_INFO ("powerW total band: " << it->second << " (" << WToDbm (it->second) << " dBm)");
444  int totalRxPower = static_cast<int> (WToDbm (it->second) + 0.5);
445  int expectedTotalRxPower;
447  {
448  //PHY sends at 16 dBm, and since there is no loss, this should be the total power at the receiver.
449  expectedTotalRxPower = 16;
450  }
451  else
452  {
453  //Only a part of the transmitted power is received
454  expectedTotalRxPower = 16 - static_cast<int> (RatioToDb (m_txChannelWidth / m_rxChannelWidth));
455  }
456  NS_TEST_ASSERT_MSG_EQ (totalRxPower, expectedTotalRxPower, "Total received power is not correct");
457 
458  if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
459  {
460  band = m_rxPhy->GetBand (20, 0); //primary 20 MHz
461  it = rxPowersW.find (band);
462  NS_LOG_INFO ("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm (it->second) << " dBm)");
463  int rxPowerPrimaryChannel20 = static_cast<int> (WToDbm (it->second) + 0.5);
464  int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int> (RatioToDb (channelWidth / 20));
465  NS_TEST_ASSERT_MSG_EQ (rxPowerPrimaryChannel20, expectedRxPowerPrimaryChannel20, "Received power in the primary 20 MHz band is not correct");
466  }
467 }
468 
469 void
471 {
472  //WifiHelper::EnableLogComponents ();
473  //LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
474 
475  Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();
476  Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
477  lossModel->SetFrequency (5.180e9);
478  spectrumChannel->AddPropagationLossModel (lossModel);
479  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
480  spectrumChannel->SetPropagationDelayModel (delayModel);
481 
482  Ptr<Node> txNode = CreateObject<Node> ();
483  Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
484  m_txPhy = CreateObject<ExtSpectrumWifiPhy> ();
487  Ptr<ErrorRateModel> error = CreateObject<NistErrorRateModel> ();
488  m_txPhy->SetErrorRateModel (error);
489  m_txPhy->SetDevice (txDev);
490  m_txPhy->SetChannel (spectrumChannel);
491  Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
492  m_txPhy->SetMobility (apMobility);
493  txDev->SetPhy (m_txPhy);
494  txNode->AggregateObject (apMobility);
495  txNode->AddDevice (txDev);
496 
497  Ptr<Node> rxNode = CreateObject<Node> ();
498  Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice> ();
499  m_rxPhy = CreateObject<ExtSpectrumWifiPhy> ();
502  m_rxPhy->SetErrorRateModel (error);
503  m_rxPhy->SetChannel (spectrumChannel);
504  Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
505  m_rxPhy->SetMobility (sta1Mobility);
506  rxDev->SetPhy (m_rxPhy);
507  rxNode->AggregateObject (sta1Mobility);
508  rxNode->AddDevice (rxDev);
510 }
511 
512 void
514 {
516  uint16_t txFrequency;
517  switch (m_txChannelWidth)
518  {
519  case 20:
520  default:
521  txFrequency = 5180;
522  break;
523  case 40:
524  txFrequency = 5190;
525  break;
526  case 80:
527  txFrequency = 5210;
528  break;
529  case 160:
530  txFrequency = 5250;
531  break;
532  }
533  m_txPhy->SetFrequency (txFrequency);
534 
536  uint16_t rxFrequency;
537  switch (m_rxChannelWidth)
538  {
539  case 20:
540  default:
541  rxFrequency = 5180;
542  break;
543  case 40:
544  rxFrequency = 5190;
545  break;
546  case 80:
547  rxFrequency = 5210;
548  break;
549  case 160:
550  rxFrequency = 5250;
551  break;
552  }
553  m_rxPhy->SetFrequency (rxFrequency);
554 
555  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyFilterTest::SendPpdu, this);
556 
557  Simulator::Run ();
558 }
559 
560 void
562 {
563  m_txChannelWidth = 20;
564  m_rxChannelWidth = 20;
565  RunOne ();
566 
567  m_txChannelWidth = 40;
568  m_rxChannelWidth = 40;
569  RunOne ();
570 
571  m_txChannelWidth = 80;
572  m_rxChannelWidth = 80;
573  RunOne ();
574 
575  m_txChannelWidth = 160;
576  m_rxChannelWidth = 160;
577  RunOne ();
578 
579  m_txChannelWidth = 20;
580  m_rxChannelWidth = 40;
581  RunOne ();
582 
583  m_txChannelWidth = 20;
584  m_rxChannelWidth = 80;
585  RunOne ();
586 
587  m_txChannelWidth = 40;
588  m_rxChannelWidth = 80;
589  RunOne ();
590 
591  m_txChannelWidth = 20;
592  m_rxChannelWidth = 160;
593  RunOne ();
594 
595  m_txChannelWidth = 40;
596  m_rxChannelWidth = 160;
597  RunOne ();
598 
599  m_txChannelWidth = 80;
600  m_rxChannelWidth = 160;
601  RunOne ();
602 
603  m_txChannelWidth = 40;
604  m_rxChannelWidth = 20;
605  RunOne ();
606 
607  m_txChannelWidth = 80;
608  m_rxChannelWidth = 20;
609  RunOne ();
610 
611  m_txChannelWidth = 80;
612  m_rxChannelWidth = 40;
613  RunOne ();
614 
615  m_txChannelWidth = 160;
616  m_rxChannelWidth = 20;
617  RunOne ();
618 
619  m_txChannelWidth = 160;
620  m_rxChannelWidth = 40;
621  RunOne ();
622 
623  m_txChannelWidth = 160;
624  m_rxChannelWidth = 80;
625  RunOne ();
626 
627  Simulator::Destroy ();
628 }
629 
637 {
638 public:
640 };
641 
643  : TestSuite ("wifi-spectrum-wifi-phy", UNIT)
644 {
645  AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK);
646  AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK);
647  AddTestCase (new SpectrumWifiPhyFilterTest, TestCase::QUICK);
648 }
649 
static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite
the test suite
uint32_t m_notifyMaybeCcaBusyStart
notify maybe CCA busy start
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void RxCallback(Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by the PHYs.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Ptr< ExtSpectrumWifiPhy > m_rxPhy
RX PHY.
Ptr< WifiPpdu > ppdu
The PPDU being transmitted.
#define min(a, b)
Definition: 80211b.c:42
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Definition: wifi-ppdu.h:33
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1426
virtual void DoRun(void)
Implementation to actually run this TestCase.
A suite of tests to run.
Definition: test.h:1343
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
virtual void NotifySleep(void)
Notify listeners that we went to sleep.
uint32_t m_notifyRxEndError
notify receive end error
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:589
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
static const uint32_t FREQUENCY
Test Phy Listener.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:765
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
uint16_t m_rxChannelWidth
RX channel width (MHz)
The 5 GHz band.
Definition: wifi-phy-band.h:35
static const uint16_t CHANNEL_WIDTH
encapsulates test code
Definition: test.h:1153
void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Add the single-frequency propagation loss model to be used.
virtual void NotifyMaybeCcaBusyStart(Time duration)
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void SetChannelNumber(uint8_t id)
Set channel number.
void SpectrumWifiPhyRxSuccess(Ptr< WifiPsdu > psdu, double snr, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
Spectrum wifi receive success function.
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:753
Spectrum Wifi Phy Basic Test.
uint32_t m_notifyRxEndOk
notify receive end OK
WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0)
Get the start band index and the stop band index for a given band.
void SendSignal(double txPowerWatts)
Send signal function.
virtual void NotifyWakeup(void)
Notify listeners that we woke up.
#define max(a, b)
Definition: 80211b.c:43
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
receive notifications about PHY events.
Ptr< SpectrumSignalParameters > MakeSignal(double txPowerWatts)
Make signal function.
virtual void NotifySwitchingStart(Time duration)
#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
virtual void NotifyRxStart(Time duration)
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
802.11 PHY layer modelThis PHY implements a spectrum-aware enhancement of the 802.11 SpectrumWifiPhy model.
TestPhyListener * m_listener
listener
virtual void NotifyRxEndError(void)
We have received the last bit of a packet for which NotifyRxStart was invoked first and...
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void NotifyRxEndOk(void)
We have received the last bit of a packet for which NotifyRxStart was invoked first and...
virtual void SetFrequency(uint16_t freq)
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
Definition: wifi-phy.cc:784
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
Every class exported by the ns3 library is enclosed in the ns3 namespace.
an EUI-48 address
Definition: mac48-address.h:43
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
void RunOne()
Run one function.
Ptr< SpectrumWifiPhy > m_phy
Phy.
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:47
virtual void SetChannelWidth(uint16_t channelwidth)
Ptr< ExtSpectrumWifiPhy > m_txPhy
TX PHY.
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:53
Spectrum Wifi Phy Filter Test.
virtual void NotifyOn(void)
Notify listeners that we went to switch on.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Spectrum Wifi Phy Test Suite.
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:583
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:595
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
virtual void NotifyOff(void)
Notify listeners that we went to switch off.
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
Set the propagation delay model to be used.
uint16_t m_txChannelWidth
TX channel width (MHz)
void SendPpdu(void)
Send PPDU function.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
TestPhyListener(void)
Create a test PhyListener.
void Send(Ptr< const WifiPsdu > psdu, WifiTxVector txVector)
Definition: wifi-phy.cc:2707
Time duration
The duration of the packet transmission.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
Spectrum Wifi Phy Listener Test.
static Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:2546
void SpectrumWifiPhyRxFailure(Ptr< WifiPsdu > psdu)
Spectrum wifi receive failure function
static const uint16_t GUARD_WIDTH
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
virtual void NotifyTxStart(Time duration, double txPowerDbm)
uint32_t m_notifyRxStart
notify receive start
#define SU_STA_ID
Definition: wifi-mode.h:30
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
static const uint8_t CHANNEL_NUMBER
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Implements the IEEE 802.11 MAC header.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...