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 
37 using namespace ns3;
38 
39 NS_LOG_COMPONENT_DEFINE ("SpectrumWifiPhyBasicTest");
40 
41 static const uint8_t CHANNEL_NUMBER = 36;
42 static const uint32_t FREQUENCY = 5180; // MHz
43 static const uint16_t CHANNEL_WIDTH = 20; // MHz
44 static const uint16_t GUARD_WIDTH = CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
45 
47 {
48 public:
51 };
52 
60 {
61 public:
68  SpectrumWifiPhyBasicTest (std::string name);
69  virtual ~SpectrumWifiPhyBasicTest ();
70 
71 protected:
72  void DoSetup (void) override;
73  void DoTeardown (void) override;
80  Ptr<SpectrumSignalParameters> MakeSignal (double txPowerWatts);
85  void SendSignal (double txPowerWatts);
93  void SpectrumWifiPhyRxSuccess (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
94  WifiTxVector txVector, std::vector<bool> statusPerMpdu);
99  void SpectrumWifiPhyRxFailure (Ptr<WifiPsdu> psdu);
100  uint32_t m_count;
101 
102 private:
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, 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
148 void
150 {
151  m_phy->StartRx (MakeSignal (txPowerWatts));
152 }
153 
154 void
156  WifiTxVector txVector, std::vector<bool> statusPerMpdu)
157 {
158  NS_LOG_FUNCTION (this << *psdu << rxSignalInfo << txVector);
159  m_count++;
160 }
161 
162 void
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.
175 void
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 
189 void
191 {
192  m_phy->Dispose ();
193  m_phy = 0;
194 }
195 
196 // Test that the expected number of packet receptions occur.
197 void
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);
208  Simulator::Run ();
209  Simulator::Destroy ();
210 
211  NS_TEST_ASSERT_MSG_EQ (m_count, 3, "Didn't receive right number of packets");
212 }
213 
221 {
222 public:
228  : m_notifyRxStart (0),
229  m_notifyRxEndOk (0),
230  m_notifyRxEndError (0),
232  {
233  }
234  virtual ~TestPhyListener ()
235  {
236  }
237  void NotifyRxStart (Time duration) override
238  {
239  NS_LOG_FUNCTION (this << duration);
240  ++m_notifyRxStart;
241  }
242  void NotifyRxEndOk (void) override
243  {
244  NS_LOG_FUNCTION (this);
245  ++m_notifyRxEndOk;
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 NotifyMaybeCcaBusyStart (Time duration) override
257  {
258  NS_LOG_FUNCTION (this);
260  }
261  void NotifySwitchingStart (Time duration) override
262  {
263  }
264  void NotifySleep (void) override
265  {
266  }
267  void NotifyOff (void) override
268  {
269  }
270  void NotifyWakeup (void) override
271  {
272  }
273  void NotifyOn (void) override
274  {
275  }
276  uint32_t m_notifyRxStart;
277  uint32_t m_notifyRxEndOk;
280 };
281 
289 {
290 public:
292  virtual ~SpectrumWifiPhyListenerTest ();
293 private:
294  void DoSetup (void) override;
295  void DoRun (void) override;
297 };
298 
300  : SpectrumWifiPhyBasicTest ("SpectrumWifiPhy test operation of WifiPhyListener")
301 {
302 }
303 
305 {
306 }
307 
308 void
310 {
314 }
315 
316 void
318 {
319  double txPowerWatts = 0.010;
320  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
321  Simulator::Run ();
322 
323  NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
324  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)");
325  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
326  NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
327 
328  Simulator::Destroy ();
329  delete m_listener;
330 }
331 
339 {
340 public:
347  SpectrumWifiPhyFilterTest (std::string name);
348  virtual ~SpectrumWifiPhyFilterTest ();
349 
350 private:
351  void DoSetup (void) override;
352  void DoTeardown (void) override;
353  void DoRun (void) override;
354 
358  void RunOne ();
359 
363  void SendPpdu (void);
364 
371 
374 
375  uint16_t m_txChannelWidth;
376  uint16_t m_rxChannelWidth;
377 
378  std::set<WifiSpectrumBand> m_ruBands;
379 };
380 
382  : TestCase ("SpectrumWifiPhy test RX filters"),
383  m_txChannelWidth (20),
384  m_rxChannelWidth (20)
385 {
386 }
387 
389  : TestCase (name)
390 {
391 }
392 
393 void
395 {
396  WifiTxVector txVector = WifiTxVector (HePhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, m_txChannelWidth, false, false);
397  Ptr<Packet> pkt = Create<Packet> (1000);
398  WifiMacHeader hdr;
400  hdr.SetQosTid (0);
401  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:01"));
402  hdr.SetSequenceNumber (1);
403  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (pkt, hdr);
404  m_txPhy->Send (WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)}), txVector);
405 }
406 
408 {
409  m_txPhy = 0;
410  m_rxPhy = 0;
411 }
412 
413 void
415 {
416  for (auto const& pair : rxPowersW)
417  {
418  NS_LOG_INFO ("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW=" << pair.second << " (" << WToDbm (pair.second) << " dBm)");
419  }
420 
421  size_t numBands = rxPowersW.size ();
422  size_t expectedNumBands = std::max (1, (m_rxChannelWidth / 20));
423  expectedNumBands += (m_rxChannelWidth / 40);
424  expectedNumBands += (m_rxChannelWidth / 80);
425  expectedNumBands += (m_rxChannelWidth / 160);
426  expectedNumBands += m_ruBands.size ();
427 
428  NS_TEST_ASSERT_MSG_EQ (numBands, expectedNumBands, "Total number of bands handled by the receiver is incorrect");
429 
430  uint16_t channelWidth = std::min (m_txChannelWidth, m_rxChannelWidth);
431  WifiSpectrumBand band = m_rxPhy->GetBand (channelWidth, 0);
432  auto it = rxPowersW.find (band);
433  NS_LOG_INFO ("powerW total band: " << it->second << " (" << WToDbm (it->second) << " dBm)");
434  int totalRxPower = static_cast<int> (WToDbm (it->second) + 0.5);
435  int expectedTotalRxPower;
437  {
438  //PHY sends at 16 dBm, and since there is no loss, this should be the total power at the receiver.
439  expectedTotalRxPower = 16;
440  }
441  else
442  {
443  //Only a part of the transmitted power is received
444  expectedTotalRxPower = 16 - static_cast<int> (RatioToDb (m_txChannelWidth / m_rxChannelWidth));
445  }
446  NS_TEST_ASSERT_MSG_EQ (totalRxPower, expectedTotalRxPower, "Total received power is not correct");
447 
448  if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
449  {
450  band = m_rxPhy->GetBand (20, 0); //primary 20 MHz
451  it = rxPowersW.find (band);
452  NS_LOG_INFO ("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm (it->second) << " dBm)");
453  int rxPowerPrimaryChannel20 = static_cast<int> (WToDbm (it->second) + 0.5);
454  int expectedRxPowerPrimaryChannel20 = 16 - static_cast<int> (RatioToDb (channelWidth / 20));
455  NS_TEST_ASSERT_MSG_EQ (rxPowerPrimaryChannel20, expectedRxPowerPrimaryChannel20, "Received power in the primary 20 MHz band is not correct");
456  }
457 }
458 
459 void
461 {
462  //WifiHelper::EnableLogComponents ();
463  //LogComponentEnable ("SpectrumWifiPhyBasicTest", LOG_LEVEL_ALL);
464 
465  Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel> ();
466  Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel> ();
467  lossModel->SetFrequency (5.180e9);
468  spectrumChannel->AddPropagationLossModel (lossModel);
469  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
470  spectrumChannel->SetPropagationDelayModel (delayModel);
471 
472  Ptr<Node> txNode = CreateObject<Node> ();
473  Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
474  m_txPhy = CreateObject<ExtSpectrumWifiPhy> ();
477  Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper> ();
478  m_txPhy->SetInterferenceHelper (txInterferenceHelper);
479  Ptr<ErrorRateModel> txErrorModel = CreateObject<NistErrorRateModel> ();
480  m_txPhy->SetErrorRateModel (txErrorModel);
481  m_txPhy->SetDevice (txDev);
482  m_txPhy->SetChannel (spectrumChannel);
483  Ptr<ConstantPositionMobilityModel> apMobility = CreateObject<ConstantPositionMobilityModel> ();
484  m_txPhy->SetMobility (apMobility);
485  txDev->SetPhy (m_txPhy);
486  txNode->AggregateObject (apMobility);
487  txNode->AddDevice (txDev);
488 
489  Ptr<Node> rxNode = CreateObject<Node> ();
490  Ptr<WifiNetDevice> rxDev = CreateObject<WifiNetDevice> ();
491  m_rxPhy = CreateObject<ExtSpectrumWifiPhy> ();
494  Ptr<InterferenceHelper> rxInterferenceHelper = CreateObject<InterferenceHelper> ();
495  m_rxPhy->SetInterferenceHelper (rxInterferenceHelper);
496  Ptr<ErrorRateModel> rxErrorModel = CreateObject<NistErrorRateModel> ();
497  m_rxPhy->SetErrorRateModel (rxErrorModel);
498  m_rxPhy->SetChannel (spectrumChannel);
499  Ptr<ConstantPositionMobilityModel> sta1Mobility = CreateObject<ConstantPositionMobilityModel> ();
500  m_rxPhy->SetMobility (sta1Mobility);
501  rxDev->SetPhy (m_rxPhy);
502  rxNode->AggregateObject (sta1Mobility);
503  rxNode->AddDevice (rxDev);
505 }
506 
507 void
509 {
510  m_txPhy->Dispose ();
511  m_txPhy = 0;
512  m_rxPhy->Dispose ();
513  m_rxPhy = 0;
514 }
515 
516 void
518 {
519  uint16_t txFrequency;
520  switch (m_txChannelWidth)
521  {
522  case 20:
523  default:
524  txFrequency = 5180;
525  break;
526  case 40:
527  txFrequency = 5190;
528  break;
529  case 80:
530  txFrequency = 5210;
531  break;
532  case 160:
533  txFrequency = 5250;
534  break;
535  }
536  auto txChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, txFrequency, m_txChannelWidth,
540  (int)(WIFI_PHY_BAND_5GHZ), 0});
541 
542  uint16_t rxFrequency;
543  switch (m_rxChannelWidth)
544  {
545  case 20:
546  default:
547  rxFrequency = 5180;
548  break;
549  case 40:
550  rxFrequency = 5190;
551  break;
552  case 80:
553  rxFrequency = 5210;
554  break;
555  case 160:
556  rxFrequency = 5250;
557  break;
558  }
559  auto rxChannelNum = std::get<0> (*WifiPhyOperatingChannel::FindFirst (0, rxFrequency, m_rxChannelWidth,
563  (int)(WIFI_PHY_BAND_5GHZ), 0});
564 
565  m_ruBands.clear ();
566  for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
567  {
568  for (uint8_t i = 0; i < (m_rxChannelWidth / bw); ++i)
569  {
570  for (unsigned int type = 0; type < 7; type++)
571  {
572  HeRu::RuType ruType = static_cast <HeRu::RuType> (type);
573  for (std::size_t index = 1; index <= HeRu::GetNRus (bw, ruType); index++)
574  {
575  HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup (bw, ruType, index);
576  HeRu::SubcarrierRange range = std::make_pair (group.front ().first, group.back ().second);
578  range, i);
579  m_ruBands.insert (band);
580  }
581  }
582  }
583  }
584 
585  Simulator::Schedule (Seconds (1), &SpectrumWifiPhyFilterTest::SendPpdu, this);
586 
587  Simulator::Run ();
588 }
589 
590 void
592 {
593  m_txChannelWidth = 20;
594  m_rxChannelWidth = 20;
595  RunOne ();
596 
597  m_txChannelWidth = 40;
598  m_rxChannelWidth = 40;
599  RunOne ();
600 
601  m_txChannelWidth = 80;
602  m_rxChannelWidth = 80;
603  RunOne ();
604 
605  m_txChannelWidth = 160;
606  m_rxChannelWidth = 160;
607  RunOne ();
608 
609  m_txChannelWidth = 20;
610  m_rxChannelWidth = 40;
611  RunOne ();
612 
613  m_txChannelWidth = 20;
614  m_rxChannelWidth = 80;
615  RunOne ();
616 
617  m_txChannelWidth = 40;
618  m_rxChannelWidth = 80;
619  RunOne ();
620 
621  m_txChannelWidth = 20;
622  m_rxChannelWidth = 160;
623  RunOne ();
624 
625  m_txChannelWidth = 40;
626  m_rxChannelWidth = 160;
627  RunOne ();
628 
629  m_txChannelWidth = 80;
630  m_rxChannelWidth = 160;
631  RunOne ();
632 
633  m_txChannelWidth = 40;
634  m_rxChannelWidth = 20;
635  RunOne ();
636 
637  m_txChannelWidth = 80;
638  m_rxChannelWidth = 20;
639  RunOne ();
640 
641  m_txChannelWidth = 80;
642  m_rxChannelWidth = 40;
643  RunOne ();
644 
645  m_txChannelWidth = 160;
646  m_rxChannelWidth = 20;
647  RunOne ();
648 
649  m_txChannelWidth = 160;
650  m_rxChannelWidth = 40;
651  RunOne ();
652 
653  m_txChannelWidth = 160;
654  m_rxChannelWidth = 80;
655  RunOne ();
656 
657  Simulator::Destroy ();
658 }
659 
667 {
668 public:
670 };
671 
673  : TestSuite ("wifi-spectrum-wifi-phy", UNIT)
674 {
675  AddTestCase (new SpectrumWifiPhyBasicTest, TestCase::QUICK);
676  AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK);
677  AddTestCase (new SpectrumWifiPhyFilterTest, TestCase::QUICK);
678 }
679 
#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)
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
Definition: wifi-phy.cc:566
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:1506
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:574
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:887
void SetReceiveErrorCallback(RxErrorCallback callback)
Definition: wifi-phy.cc:396
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:835
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1327
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:930
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:535
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:547
void RegisterListener(WifiPhyListener *listener)
Definition: wifi-phy.cc:402
void SetReceiveOkCallback(RxOkCallback callback)
Definition: wifi-phy.cc:390
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:833
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