A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-operating-channel-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7 */
8
9#include "ns3/he-phy.h"
10#include "ns3/he-ppdu.h"
11#include "ns3/interference-helper.h"
12#include "ns3/log.h"
13#include "ns3/multi-model-spectrum-channel.h"
14#include "ns3/nist-error-rate-model.h"
15#include "ns3/node.h"
16#include "ns3/spectrum-wifi-phy.h"
17#include "ns3/string.h"
18#include "ns3/test.h"
19#include "ns3/wifi-net-device.h"
20#include "ns3/wifi-phy-operating-channel.h"
21#include "ns3/wifi-psdu.h"
22#include "ns3/wifi-utils.h"
23
24using namespace ns3;
25
26NS_LOG_COMPONENT_DEFINE("WifiOperatingChannelTest");
27
28/**
29 * @ingroup wifi-test
30 * @ingroup tests
31 *
32 * @brief Test the WifiPhyOperatingChannel::Set() method.
33 */
35{
36 public:
37 /**
38 * Constructor
39 */
41 ~SetWifiOperatingChannelTest() override = default;
42
43 private:
44 void DoRun() override;
45
46 /**
47 * Run one function.
48 * @param runInfo the string that indicates info about the test case to run
49 * @param segments the info about each frequency segment to set for the operating channel
50 * @param standard the 802.11 standard to consider for the test
51 * @param band the PHY band to consider for the test
52 * @param expectExceptionThrown flag to indicate whether an exception is expected to be thrown
53 * @param expectedWidth the expected width type of the operating channel
54 * @param expectedSegments the info about the expected frequency segments of the operating
55 * channel
56 */
57 void RunOne(const std::string& runInfo,
58 const std::vector<FrequencyChannelInfo>& segments,
59 WifiStandard standard,
60 WifiPhyBand band,
61 bool expectExceptionThrown,
62 WifiChannelWidthType expectedWidth = WifiChannelWidthType::UNKNOWN,
63 const std::vector<FrequencyChannelInfo>& expectedSegments = {});
64
65 WifiPhyOperatingChannel m_channel; //!< operating channel
66};
67
69 : TestCase("Check configuration of the operating channel")
70{
71}
72
73void
74SetWifiOperatingChannelTest::RunOne(const std::string& runInfo,
75 const std::vector<FrequencyChannelInfo>& segments,
76 WifiStandard standard,
77 WifiPhyBand band,
78 bool expectExceptionThrown,
79 WifiChannelWidthType expectedWidth,
80 const std::vector<FrequencyChannelInfo>& expectedSegments)
81{
82 NS_LOG_FUNCTION(this << runInfo);
83
84 bool exceptionThrown = false;
85 try
86 {
87 m_channel.Set(segments, standard);
88 }
89 catch (const std::runtime_error&)
90 {
91 exceptionThrown = true;
92 }
93 NS_TEST_ASSERT_MSG_EQ(exceptionThrown,
94 expectExceptionThrown,
95 "Exception thrown mismatch for run: " << runInfo);
96 if (!exceptionThrown)
97 {
100 expectedWidth,
101 "Operating channel has an incorrect channel width type for run: " << runInfo);
103 expectedSegments.size(),
104 "Incorrect number of frequency segments for run: " << runInfo);
105 for (std::size_t i = 0; i < m_channel.GetNSegments(); ++i)
106 {
107 const auto& frequencyChannelInfo = expectedSegments.at(i);
109 frequencyChannelInfo.number,
110 "Operating channel has an incorrect channel number at segment "
111 << i << " for run: " << runInfo);
113 frequencyChannelInfo.frequency,
114 "Operating channel has an incorrect center frequency at segment "
115 << i << " for run: " << runInfo);
117 frequencyChannelInfo.width,
118 "Operating channel has an incorrect channel width at segment "
119 << i << " for run: " << runInfo);
121 frequencyChannelInfo.band,
122 "Operating channel has an incorrect band for run: " << runInfo);
123 }
124 }
125}
126
127void
129{
130 RunOne("dummy channel with all inputs unset",
131 {{}},
134 true);
135
136 RunOne("default 20 MHz OFDM channel operating on channel 36",
137 {{36, 0, 20, WIFI_PHY_BAND_5GHZ}},
140 false,
141 WifiChannelWidthType::CW_20MHZ,
142 {{36, 5180, 20, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
143
144 RunOne("default 40 MHz OFDM channel operating on channel 38",
145 {{38, 0, 40, WIFI_PHY_BAND_5GHZ}},
148 false,
149 WifiChannelWidthType::CW_40MHZ,
150 {{38, 5190, 40, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
151
152 RunOne("default 80 MHz OFDM channel operating on channel 42",
153 {{42, 0, 80, WIFI_PHY_BAND_5GHZ}},
156 false,
157 WifiChannelWidthType::CW_80MHZ,
158 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
159
160 RunOne("default 160 MHz (contiguous) OFDM channel operating on channel 50",
161 {{50, 0, 160, WIFI_PHY_BAND_5GHZ}},
164 false,
165 WifiChannelWidthType::CW_160MHZ,
166 {{50, 5250, 160, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
167
168 RunOne("valid 80+80 MHz (non-contiguous) OFDM channel operating on channels 42 and 106",
169 {{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {106, 0, 80, WIFI_PHY_BAND_5GHZ}},
172 false,
173 WifiChannelWidthType::CW_80_PLUS_80MHZ,
174 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM},
175 {106, 5530, 80, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
176
177 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel higher channel not being 80 MHz",
178 {{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {102, 0, 80, WIFI_PHY_BAND_5GHZ}},
181 true);
182
183 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel lower channel not being 80 MHz",
184 {{36, 0, 20, WIFI_PHY_BAND_5GHZ}, {106, 0, 80, WIFI_PHY_BAND_5GHZ}},
187 true);
188
189 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with both segments configured on the "
190 "same channel",
191 {{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {42, 0, 80, WIFI_PHY_BAND_5GHZ}},
194 true);
195
196 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with segments configured to be "
197 "contiguous (lower before higher)",
198 {{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {58, 0, 80, WIFI_PHY_BAND_5GHZ}},
201 true);
202
203 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with segments configured to be "
204 "contiguous (higher before lower)",
205 {{58, 0, 80, WIFI_PHY_BAND_5GHZ}, {42, 0, 80, WIFI_PHY_BAND_5GHZ}},
208 true);
209
210 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with each segments configured on a "
211 "different band",
212 {{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {215, 0, 80, WIFI_PHY_BAND_6GHZ}},
215 true);
216}
217
218/**
219 * @ingroup wifi-test
220 * @ingroup tests
221 *
222 * @brief Test the conversion from PHY ChannelSettings attribute to WifiPhyOperatingChannel.
223 */
225{
226 public:
227 /**
228 * Constructor
229 */
232
233 private:
234 void DoSetup() override;
235 void DoTeardown() override;
236 void DoRun() override;
237
238 /**
239 * Run one function.
240 * @param channelSettings the string to set the ChannelSettings attribute
241 * @param expectedWidthType the expected width type of the operating channel
242 * @param expectedSegments the info about each expected segment of the operating channel
243 * @param expectedP20Index the expected index of the P20
244 */
245 void RunOne(const std::string& channelSettings,
246 WifiChannelWidthType expectedWidthType,
247 const std::vector<FrequencyChannelInfo>& expectedSegments,
248 uint8_t expectedP20Index);
249
251};
252
254 : TestCase("Check conversion from attribute to the operating channel")
255{
256}
257
258void
260{
261 auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
262 auto node = CreateObject<Node>();
263 auto dev = CreateObject<WifiNetDevice>();
265 auto interferenceHelper = CreateObject<InterferenceHelper>();
266 m_phy->SetInterferenceHelper(interferenceHelper);
268 m_phy->SetErrorRateModel(error);
269 m_phy->SetDevice(dev);
270 m_phy->AddChannel(spectrumChannel);
271 m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
272 dev->SetPhy(m_phy);
273 node->AddDevice(dev);
274}
275
276void
278{
279 m_phy->Dispose();
280 m_phy = nullptr;
281}
282
283void
285 const std::string& channelSettings,
286 WifiChannelWidthType expectedWidthType,
287 const std::vector<FrequencyChannelInfo>& expectedSegments,
288 uint8_t expectedP20Index)
289{
290 NS_LOG_FUNCTION(this << channelSettings);
291
292 bool exceptionThrown = false;
293 try
294 {
295 m_phy->SetAttribute("ChannelSettings", StringValue(channelSettings));
296 }
297 catch (const std::runtime_error&)
298 {
299 exceptionThrown = true;
300 }
301 NS_TEST_ASSERT_MSG_EQ(exceptionThrown,
302 expectedSegments.empty(),
303 "Exception thrown mismatch for channel settings " << channelSettings);
304
305 if (exceptionThrown)
306 {
307 return;
308 }
309
311 m_phy->GetOperatingChannel().GetWidthType(),
312 expectedWidthType,
313 "Operating channel has an incorrect channel width type for channel settings "
314 << channelSettings);
315
316 const auto numSegments = m_phy->GetOperatingChannel().GetNSegments();
318 numSegments,
319 expectedSegments.size(),
320 "Operating channel has an incorrect number of segments for channel settings "
321 << channelSettings);
322
323 for (std::size_t i = 0; i < numSegments; ++i)
324 {
325 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetNumber(i),
326 expectedSegments.at(i).number,
327 "Operating channel has an incorrect channel number at segment "
328 << i << " for channel settings " << channelSettings);
329 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetFrequency(i),
330 expectedSegments.at(i).frequency,
331 "Operating channel has an incorrect center frequency at segment "
332 << i << " for channel settings " << channelSettings);
333 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetWidth(i),
334 expectedSegments.at(i).width,
335 "Operating channel has an incorrect channel width at segment "
336 << i << " for channel settings " << channelSettings);
337 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetPhyBand(),
338 expectedSegments.at(i).band,
339 "Operating channel has an incorrect band for channel settings "
340 << channelSettings);
341 }
342
343 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetPrimaryChannelIndex(20),
344 expectedP20Index,
345 "Operating channel has an incorrect P20 index for channel settings "
346 << channelSettings);
347}
348
349void
351{
352 // Test invalid combination
353 RunOne("{36, 40, BAND_UNSPECIFIED, 0}", WifiChannelWidthType::UNKNOWN, {}, 0);
354
355 // Test default with a single frequency segment
356 RunOne("{0, 0, BAND_UNSPECIFIED, 0}",
357 WifiChannelWidthType::CW_80MHZ,
358 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}},
359 0);
360
361 // Test default with two frequency segments unspecified
362 RunOne("{0, 0, BAND_UNSPECIFIED, 0};{0, 0, BAND_UNSPECIFIED, 0}",
363 WifiChannelWidthType::CW_80_PLUS_80MHZ,
364 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}, {106, 5530, 80, WIFI_PHY_BAND_5GHZ}},
365 0);
366
367 // Test default with two frequency segments and first is specified (but equals default)
368 RunOne("{42, 0, BAND_UNSPECIFIED, 0};{0, 0, BAND_UNSPECIFIED, 0}",
369 WifiChannelWidthType::CW_80_PLUS_80MHZ,
370 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}, {106, 5530, 80, WIFI_PHY_BAND_5GHZ}},
371 0);
372
373 // Test default with second segment specified to be at the first available 80 MHz segment
374 RunOne("{0, 0, BAND_UNSPECIFIED, 0};{42, 0, BAND_UNSPECIFIED, 0}",
375 WifiChannelWidthType::UNKNOWN,
376 {},
377 0);
378
379 // Test default with two frequency segments and first is specified (and differs from default)
380 RunOne("{106, 0, BAND_UNSPECIFIED, 0};{0, 0, BAND_UNSPECIFIED, 0}",
381 WifiChannelWidthType::CW_80_PLUS_80MHZ,
382 {{106, 5530, 80, WIFI_PHY_BAND_5GHZ}, {138, 5690, 80, WIFI_PHY_BAND_5GHZ}},
383 0);
384
385 // Test unique channel 36 (20 MHz)
386 RunOne("{36, 0, BAND_UNSPECIFIED, 0}",
387 WifiChannelWidthType::CW_20MHZ,
388 {{36, 5180, 20, WIFI_PHY_BAND_5GHZ}},
389 0);
390
391 // Test unique channel 38 (40 MHz)
392 RunOne("{38, 0, BAND_UNSPECIFIED, 0}",
393 WifiChannelWidthType::CW_40MHZ,
394 {{38, 5190, 40, WIFI_PHY_BAND_5GHZ}},
395 0);
396
397 // Test unique channel 42 (80 MHz)
398 RunOne("{42, 0, BAND_UNSPECIFIED, 0}",
399 WifiChannelWidthType::CW_80MHZ,
400 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}},
401 0);
402
403 // Test unique channel 50 (160 MHz)
404 RunOne("{50, 0, BAND_UNSPECIFIED, 0}",
405 WifiChannelWidthType::CW_160MHZ,
406 {{50, 5250, 160, WIFI_PHY_BAND_5GHZ}},
407 0);
408
409 // Test 80+80 MHz
410 RunOne("{42, 0, BAND_UNSPECIFIED, 0};{106, 0, BAND_UNSPECIFIED, 0}",
411 WifiChannelWidthType::CW_80_PLUS_80MHZ,
412 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}, {106, 5530, 80, WIFI_PHY_BAND_5GHZ}},
413 0);
414
415 // Test P20 for 80+80 MHz: second value shall be ignored
416 RunOne("{42, 0, BAND_UNSPECIFIED, 1};{106, 0, BAND_UNSPECIFIED, 2}",
417 WifiChannelWidthType::CW_80_PLUS_80MHZ,
418 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}, {106, 5530, 80, WIFI_PHY_BAND_5GHZ}},
419 1);
420
421 // Test default 20 MHz channel
422 RunOne("{0, 20, BAND_UNSPECIFIED, 0}",
423 WifiChannelWidthType::CW_20MHZ,
424 {{36, 5180, 20, WIFI_PHY_BAND_5GHZ}},
425 0);
426
427 // Test default 40 MHz channel
428 RunOne("{0, 40, BAND_UNSPECIFIED, 0}",
429 WifiChannelWidthType::CW_40MHZ,
430 {{38, 5190, 40, WIFI_PHY_BAND_5GHZ}},
431 0);
432
433 // Test default 80 MHz channel
434 RunOne("{0, 80, BAND_UNSPECIFIED, 0}",
435 WifiChannelWidthType::CW_80MHZ,
436 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}},
437 0);
438
439 // Test default 160 MHz channel
440 RunOne("{0, 160, BAND_UNSPECIFIED, 0}",
441 WifiChannelWidthType::CW_160MHZ,
442 {{50, 5250, 160, WIFI_PHY_BAND_5GHZ}},
443 0);
444
445 // Test default 80+80 MHz channel
446 RunOne("{0, 80, BAND_UNSPECIFIED, 0};{0, 80, BAND_UNSPECIFIED, 0}",
447 WifiChannelWidthType::CW_80_PLUS_80MHZ,
448 {{42, 5210, 80, WIFI_PHY_BAND_5GHZ}, {106, 5530, 80, WIFI_PHY_BAND_5GHZ}},
449 0);
450}
451
452/**
453 * @ingroup wifi-test
454 * @ingroup tests
455 *
456 * @brief Test the operating channel functions for 80+80MHz.
457 */
459{
460 public:
461 /**
462 * Constructor
463 */
465 ~WifiPhyChannel80Plus80Test() override = default;
466
467 private:
468 void DoRun() override;
469
470 /**
471 * Create a dummy PSDU whose payload is 1000 bytes
472 * @return a dummy PSDU whose payload is 1000 bytes
473 */
475
476 /**
477 * Create a HE PPDU
478 * @param bandwidth the bandwidth used for the transmission the PPDU
479 * @param channel the operating channel of the PHY used for the transmission
480 * @return a HE PPDU
481 */
483
484 WifiPhyOperatingChannel m_channel; //!< operating channel
485};
486
488 : TestCase("Check operating channel functions for 80+80MHz")
489{
490}
491
494{
495 Ptr<Packet> pkt = Create<Packet>(1000);
496 WifiMacHeader hdr;
498 hdr.SetQosTid(0);
499 return Create<WifiPsdu>(pkt, hdr);
500}
501
504 const WifiPhyOperatingChannel& channel)
505{
507 0,
509 NanoSeconds(800),
510 1,
511 1,
512 0,
513 bandwidth,
514 false);
516 return Create<HePpdu>(psdu, txVector, channel, MicroSeconds(100), 0);
517}
518
519void
521{
522 // P20 is in first segment and segments are provided in increasing frequency order
523 {
524 m_channel.Set({{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {106, 0, 80, WIFI_PHY_BAND_5GHZ}},
527
528 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(160);
529 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
530 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(80);
531 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 0, "Primary 80 MHz channel shall have index 0");
532 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(40);
533 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 1, "Primary 40 MHz channel shall have index 1");
534 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(20);
535 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 3, "Primary 20 MHz channel shall have index 3");
536
537 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(80);
538 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
539 1,
540 "Secondary 80 MHz channel shall have index 1");
541 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(40);
542 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
543 0,
544 "Secondary 40 MHz channel shall have index 0");
545 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(20);
546 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
547 2,
548 "Secondary 20 MHz channel shall have index 2");
549
550 const auto primary80MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(80);
551 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
552 5210,
553 "Primary 80 MHz channel center frequency shall be 5210 MHz");
554 const auto primary40MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(40);
555 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
556 5230,
557 "Primary 40 MHz channel center frequency shall be 5230 MHz");
558 const auto primary20MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(20);
559 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
560 5240,
561 "Primary 20 MHz channel center frequency shall be 5240 MHz");
562
563 const auto secondary80MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(80);
564 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
565 5530,
566 "Secondary 80 MHz channel center frequency shall be 5530 MHz");
567 const auto secondary40MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(40);
568 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
569 5190,
570 "Secondary 40 MHz channel center frequency shall be 5190 MHz");
571 const auto secondary20MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(20);
572 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
573 5220,
574 "Secondary 20 MHz channel center frequency shall be 5220 MHz");
575
576 const auto primary80MhzChannelNumber =
578 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
579 42,
580 "Primary 80 MHz channel number shall be 42");
581 const auto primary40MhzChannelNumber =
583 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
584 46,
585 "Primary 40 MHz channel number shall be 46");
586 const auto primary20MhzChannelNumber =
588 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
589 48,
590 "Primary 20 MHz channel number shall be 48");
591
592 auto ppdu160MHz = CreateDummyHePpdu(160, m_channel);
593 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
594 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
595 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
596 5210,
597 "Center frequency of first segment shall be 5210 MHz");
598 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
599 5530,
600 "Center frequency of second segment shall be 5530 MHz");
601 auto ppdu80MHz = CreateDummyHePpdu(80, m_channel);
602 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
603 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
604 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
605 5210,
606 "Center frequency for 80 MHz shall be 5210 MHz");
607 auto ppdu40MHz = CreateDummyHePpdu(40, m_channel);
608 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
609 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
610 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
611 5230,
612 "Center frequency for 40 MHz shall be 5230 MHz");
613 auto ppdu20MHz = CreateDummyHePpdu(20, m_channel);
614 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
615 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
616 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
617 5240,
618 "Center frequency for 20 MHz shall be 5240 MHz");
619 }
620
621 // P20 is in second segment and segments are provided in increasing frequency order
622 {
623 m_channel.Set({{42, 0, 80, WIFI_PHY_BAND_5GHZ}, {106, 0, 80, WIFI_PHY_BAND_5GHZ}},
626
627 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(160);
628 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
629 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(80);
630 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 1, "Primary 80 MHz channel shall have index 1");
631 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(40);
632 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 2, "Primary 40 MHz channel shall have index 2");
633 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(20);
634 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 4, "Primary 20 MHz channel shall have index 4");
635
636 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(80);
637 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
638 0,
639 "Secondary 80 MHz channel shall have index 0");
640 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(40);
641 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
642 3,
643 "Secondary 40 MHz channel shall have index 3");
644 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(20);
645 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
646 5,
647 "Secondary 20 MHz channel shall have index 5");
648
649 const auto primary80MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(80);
650 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
651 5530,
652 "Primary 80 MHz channel center frequency shall be 5530 MHz");
653 const auto primary40MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(40);
654 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
655 5510,
656 "Primary 40 MHz channel center frequency shall be 5510 MHz");
657 const auto primary20MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(20);
658 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
659 5500,
660 "Primary 20 MHz channel center frequency shall be 5500 MHz");
661
662 const auto secondary80MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(80);
663 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
664 5210,
665 "Secondary 80 MHz channel center frequency shall be 5210 MHz");
666 const auto secondary40MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(40);
667 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
668 5550,
669 "Secondary 40 MHz channel center frequency shall be 5550 MHz");
670 const auto secondary20MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(20);
671 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
672 5520,
673 "Secondary 20 MHz channel center frequency shall be 5520 MHz");
674
675 const auto primary80MhzChannelNumber =
677 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
678 106,
679 "Primary 80 MHz channel number shall be 106");
680 const auto primary40MhzChannelNumber =
682 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
683 102,
684 "Primary 40 MHz channel number shall be 102");
685 const auto primary20MhzChannelNumber =
687 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
688 100,
689 "Primary 20 MHz channel number shall be 100");
690
691 auto ppdu160MHz = CreateDummyHePpdu(160, m_channel);
692 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
693 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
694 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
695 5530,
696 "Center frequency of first segment shall be 5530 MHz");
697 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
698 5210,
699 "Center frequency of second segment shall be 5210 MHz");
700 auto ppdu80MHz = CreateDummyHePpdu(80, m_channel);
701 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
702 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
703 NS_ASSERT(txCenterFreqs80MHz.front() == 5530);
704 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
705 5530,
706 "Center frequency for 80 MHz shall be 5530 MHz");
707 auto ppdu40MHz = CreateDummyHePpdu(40, m_channel);
708 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
709 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
710 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
711 5510,
712 "Center frequency for 40 MHz shall be 5510 MHz");
713 auto ppdu20MHz = CreateDummyHePpdu(20, m_channel);
714 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
715 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
716 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
717 5500,
718 "Center frequency for 20 MHz shall be 5500 MHz");
719 }
720
721 // P20 is in first segment and segments are provided in decreasing frequency order
722 {
723 m_channel.Set({{106, 0, 80, WIFI_PHY_BAND_5GHZ}, {42, 0, 80, WIFI_PHY_BAND_5GHZ}},
726
727 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(160);
728 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
729 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(80);
730 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 0, "Primary 80 MHz channel shall have index 0");
731 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(40);
732 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 1, "Primary 40 MHz channel shall have index 1");
733 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(20);
734 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 3, "Primary 20 MHz channel shall have index 3");
735
736 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(80);
737 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
738 1,
739 "Secondary 80 MHz channel shall have index 1");
740 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(40);
741 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
742 0,
743 "Secondary 40 MHz channel shall have index 0");
744 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(20);
745 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
746 2,
747 "Secondary 20 MHz channel shall have index 2");
748
749 const auto primary80MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(80);
750 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
751 5210,
752 "Primary 80 MHz channel center frequency shall be 5210 MHz");
753 const auto primary40MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(40);
754 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
755 5230,
756 "Primary 40 MHz channel center frequency shall be 5230 MHz");
757 const auto primary20MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(20);
758 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
759 5240,
760 "Primary 20 MHz channel center frequency shall be 5240 MHz");
761
762 const auto secondary80MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(80);
763 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
764 5530,
765 "Secondary 80 MHz channel center frequency shall be 5530 MHz");
766 const auto secondary40MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(40);
767 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
768 5190,
769 "Secondary 40 MHz channel center frequency shall be 5190 MHz");
770 const auto secondary20MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(20);
771 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
772 5220,
773 "Secondary 20 MHz channel center frequency shall be 5220 MHz");
774
775 const auto primary80MhzChannelNumber =
777 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
778 42,
779 "Primary 80 MHz channel number shall be 42");
780 const auto primary40MhzChannelNumber =
782 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
783 46,
784 "Primary 40 MHz channel number shall be 46");
785 const auto primary20MhzChannelNumber =
787 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
788 48,
789 "Primary 20 MHz channel number shall be 48");
790
791 auto ppdu160MHz = CreateDummyHePpdu(160, m_channel);
792 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
793 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
794 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
795 5210,
796 "Center frequency of first segment shall be 5210 MHz");
797 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
798 5530,
799 "Center frequency of second segment shall be 5530 MHz");
800 auto ppdu80MHz = CreateDummyHePpdu(80, m_channel);
801 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
802 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
803 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
804 5210,
805 "Center frequency for 80 MHz shall be 5210 MHz");
806 auto ppdu40MHz = CreateDummyHePpdu(40, m_channel);
807 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
808 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
809 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
810 5230,
811 "Center frequency for 40 MHz shall be 5230 MHz");
812 auto ppdu20MHz = CreateDummyHePpdu(20, m_channel);
813 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
814 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
815 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
816 5240,
817 "Center frequency for 20 MHz shall be 5240 MHz");
818 }
819
820 // P20 is in second segment and segments are provided in decreasing frequency order
821 {
822 m_channel.Set({{106, 0, 80, WIFI_PHY_BAND_5GHZ}, {42, 0, 80, WIFI_PHY_BAND_5GHZ}},
825
826 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(160);
827 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
828 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(80);
829 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 1, "Primary 80 MHz channel shall have index 1");
830 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(40);
831 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 2, "Primary 40 MHz channel shall have index 2");
832 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(20);
833 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 4, "Primary 20 MHz channel shall have index 4");
834
835 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(80);
836 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
837 0,
838 "Secondary 80 MHz channel shall have index 0");
839 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(40);
840 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
841 3,
842 "Secondary 40 MHz channel shall have index 3");
843 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(20);
844 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
845 5,
846 "Secondary 20 MHz channel shall have index 5");
847
848 const auto primary80MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(80);
849 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
850 5530,
851 "Primary 80 MHz channel center frequency shall be 5530 MHz");
852 const auto primary40MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(40);
853 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
854 5510,
855 "Primary 40 MHz channel center frequency shall be 5510 MHz");
856 const auto primary20MhzCenterFrequency = m_channel.GetPrimaryChannelCenterFrequency(20);
857 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
858 5500,
859 "Primary 20 MHz channel center frequency shall be 5500 MHz");
860
861 const auto secondary80MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(80);
862 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
863 5210,
864 "Secondary 80 MHz channel center frequency shall be 5210 MHz");
865 const auto secondary40MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(40);
866 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
867 5550,
868 "Secondary 40 MHz channel center frequency shall be 5550 MHz");
869 const auto secondary20MhzCenterFrequency = m_channel.GetSecondaryChannelCenterFrequency(20);
870 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
871 5520,
872 "Secondary 20 MHz channel center frequency shall be 5520 MHz");
873
874 const auto primary80MhzChannelNumber =
876 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
877 106,
878 "Primary 80 MHz channel number shall be 106");
879 const auto primary40MhzChannelNumber =
881 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
882 102,
883 "Primary 40 MHz channel number shall be 102");
884 const auto primary20MhzChannelNumber =
886 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
887 100,
888 "Primary 20 MHz channel number shall be 100");
889
890 auto ppdu160MHz = CreateDummyHePpdu(160, m_channel);
891 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
892 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
893 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
894 5530,
895 "Center frequency of first segment shall be 5530 MHz");
896 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
897 5210,
898 "Center frequency of second segment shall be 5210 MHz");
899 auto ppdu80MHz = CreateDummyHePpdu(80, m_channel);
900 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
901 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
902 NS_ASSERT(txCenterFreqs80MHz.front() == 5530);
903 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
904 5530,
905 "Center frequency for 80 MHz shall be 5530 MHz");
906 auto ppdu40MHz = CreateDummyHePpdu(40, m_channel);
907 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
908 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
909 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
910 5510,
911 "Center frequency for 40 MHz shall be 5510 MHz");
912 auto ppdu20MHz = CreateDummyHePpdu(20, m_channel);
913 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
914 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
915 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
916 5500,
917 "Center frequency for 20 MHz shall be 5500 MHz");
918 }
919
921}
922
923/**
924 * @ingroup wifi-test
925 * @ingroup tests
926 *
927 * @brief wifi operating channel test suite
928 */
930{
931 public:
933};
934
936 : TestSuite("wifi-operating-channel", Type::UNIT)
937{
938 AddTestCase(new SetWifiOperatingChannelTest(), TestCase::Duration::QUICK);
939 AddTestCase(new PhyChannelSettingsToOperatingChannelTest(), TestCase::Duration::QUICK);
940 AddTestCase(new WifiPhyChannel80Plus80Test(), TestCase::Duration::QUICK);
941}
942
Test the conversion from PHY ChannelSettings attribute to WifiPhyOperatingChannel.
~PhyChannelSettingsToOperatingChannelTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void RunOne(const std::string &channelSettings, WifiChannelWidthType expectedWidthType, const std::vector< FrequencyChannelInfo > &expectedSegments, uint8_t expectedP20Index)
Run one function.
Test the WifiPhyOperatingChannel::Set() method.
WifiPhyOperatingChannel m_channel
operating channel
~SetWifiOperatingChannelTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
void RunOne(const std::string &runInfo, const std::vector< FrequencyChannelInfo > &segments, WifiStandard standard, WifiPhyBand band, bool expectExceptionThrown, WifiChannelWidthType expectedWidth=WifiChannelWidthType::UNKNOWN, const std::vector< FrequencyChannelInfo > &expectedSegments={})
Run one function.
wifi operating channel test suite
Test the operating channel functions for 80+80MHz.
Ptr< HePpdu > CreateDummyHePpdu(MHz_u bandwidth, const WifiPhyOperatingChannel &channel)
Create a HE PPDU.
Ptr< WifiPsdu > CreateDummyPsdu()
Create a dummy PSDU whose payload is 1000 bytes.
WifiPhyOperatingChannel m_channel
operating channel
~WifiPhyChannel80Plus80Test() override=default
void DoRun() override
Implementation to actually run this TestCase.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
Hold variables of type string.
Definition string.h:45
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
Implements the IEEE 802.11 MAC header.
virtual 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.
Class that keeps track of all information about the current PHY operating channel.
uint8_t GetNumber(std::size_t segment=0) const
Return the channel number for a given frequency segment.
WifiChannelWidthType GetWidthType() const
Return the width type of the operating channel.
MHz_u GetSecondaryChannelCenterFrequency(MHz_u secondaryChannelWidth) const
Get the center frequency of the secondary channel of the given width.
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
uint8_t GetSecondaryChannelIndex(MHz_u secondaryChannelWidth) const
If the operating channel width is made of a multiple of 20 MHz, return the index of the secondary cha...
std::size_t GetNSegments() const
Get the number of frequency segments in the operating channel.
void Set(const std::vector< FrequencyChannelInfo > &segments, WifiStandard standard)
Set the channel according to the specified parameters if a unique frequency channel matches the speci...
MHz_u GetWidth(std::size_t segment=0) const
Return the channel width for a given frequency segment.
uint8_t GetPrimaryChannelIndex(MHz_u primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
MHz_u GetPrimaryChannelCenterFrequency(MHz_u primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
MHz_u GetFrequency(std::size_t segment=0) const
Return the center frequency for a given frequency segment.
WifiPhyBand GetPhyBand() const
Return the PHY band of the operating channel.
uint8_t GetPrimaryChannelNumber(MHz_u primaryChannelWidth, WifiStandard standard) const
Get channel number of the primary channel.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#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:134
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1368
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1380
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyBand
Identifies the PHY band.
WifiChannelWidthType
Enumeration of the possible channel widths.
Definition wifi-types.h:22
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_PREAMBLE_HE_SU
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ WIFI_MAC_QOSDATA
static WifiOperatingChannelTestSuite g_wifiOperatingChannelTestSuite
the test suite