20 #include "ns3/fatal-error.h"
23 #include "ns3/wifi-phy-band.h"
24 #include "ns3/wifi-spectrum-value-helper.h"
25 #include "ns3/wifi-standards.h"
70 uint16_t channelWidth,
73 std::size_t precision,
74 const std::vector<bool>& puncturedSubchannels = std::vector<bool>{});
78 void DoSetup()
override;
79 void DoRun()
override;
107 const std::string& name,
110 uint16_t channelWidth,
113 std::size_t precision,
114 const std::vector<bool>& puncturedSubchannels)
115 :
TestCase(std::string(
"SpectrumValue ") + name),
116 m_standard{standard},
118 m_channelWidth{channelWidth},
119 m_puncturedSubchannels{puncturedSubchannels},
121 m_expectedPsd{maskRefs},
122 m_tolerance{tolerance},
123 m_precision{precision}
125 NS_LOG_FUNCTION(
this << name << standard << band << channelWidth << tolerance << precision
126 << puncturedSubchannels.size());
136 double outerBandMaximumRejection = 0.0;
142 outerBandMaximumRejection = -40;
150 outerBandMaximumRejection = -40;
154 double refTxPowerW = 1;
162 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(freq,
168 outerBandMaximumRejection);
175 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(freq,
181 outerBandMaximumRejection);
188 WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(freq,
194 outerBandMaximumRejection);
200 WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity(freq,
206 outerBandMaximumRejection);
214 WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity(freq,
220 outerBandMaximumRejection);
229 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(freq,
235 outerBandMaximumRejection,
264 vect.push_back(
start);
270 for (uint32_t i =
start.first; i <=
stop.first; i++)
272 double val =
start.second + slope * (i -
start.first);
273 double multiplier = std::round(std::pow(10.0,
static_cast<double>(
m_precision)));
274 val = std::floor(val * multiplier + 0.5) / multiplier;
275 vect.emplace_back(i, val);
287 double currentPowerDbr = 0.0;
288 double maxPowerW = (*m_actualSpectrum)[0];
293 maxPowerW =
std::max(maxPowerW, *vit);
297 for (
const auto& [subcarrier, expectedValue] :
m_expectedPsd)
299 currentPowerDbr = 10.0 * std::log10((*
m_actualSpectrum)[subcarrier] / maxPowerW);
300 NS_LOG_LOGIC(
"For " << subcarrier <<
", expected: " << expectedValue
301 <<
" vs obtained: " << currentPowerDbr);
305 "Spectrum value mismatch for subcarrier " << subcarrier);
340 std::make_pair(0, -40.0),
341 std::make_pair(31, -28.375),
342 std::make_pair(32, -28.000),
343 std::make_pair(60, -20.276),
344 std::make_pair(61, -20.0),
345 std::make_pair(63, -20.0),
346 std::make_pair(64, -20.0),
347 std::make_pair(69, -3.333),
348 std::make_pair(123, -3.333),
349 std::make_pair(128, -20.0),
350 std::make_pair(129, -20.0),
351 std::make_pair(131, -20.0),
352 std::make_pair(132, -20.276),
353 std::make_pair(160, -28.000),
354 std::make_pair(161, -28.375),
355 std::make_pair(192, -40.0),
371 std::make_pair(0, -40.0),
372 std::make_pair(31, -28.375),
373 std::make_pair(32, -28.000),
374 std::make_pair(60, -20.276),
375 std::make_pair(61, -20.0),
376 std::make_pair(63, -20.0),
377 std::make_pair(64, -20.0),
378 std::make_pair(69, -3.333),
379 std::make_pair(123, -3.333),
380 std::make_pair(128, -20.0),
381 std::make_pair(129, -20.0),
382 std::make_pair(131, -20.0),
383 std::make_pair(132, -20.276),
384 std::make_pair(160, -28.000),
385 std::make_pair(161, -28.375),
386 std::make_pair(192, -40.0),
402 std::make_pair(0, -40.0),
403 std::make_pair(31, -28.375),
404 std::make_pair(32, -28.000),
405 std::make_pair(60, -20.276),
406 std::make_pair(61, -20.0),
407 std::make_pair(63, -20.0),
408 std::make_pair(64, -20.0),
409 std::make_pair(69, -3.333),
410 std::make_pair(123, -3.333),
411 std::make_pair(128, -20.0),
412 std::make_pair(129, -20.0),
413 std::make_pair(131, -20.0),
414 std::make_pair(132, -20.276),
415 std::make_pair(160, -28.000),
416 std::make_pair(161, -28.375),
417 std::make_pair(192, -40.0),
446 std::make_pair(0, -45.000),
447 std::make_pair(31, -28.531),
448 std::make_pair(32, -28.000),
449 std::make_pair(60, -20.276),
450 std::make_pair(61, -20.0),
451 std::make_pair(61, -20.0),
452 std::make_pair(62, -20.0),
453 std::make_pair(67, -3.333),
454 std::make_pair(125, -3.333),
455 std::make_pair(130, -20.0),
456 std::make_pair(131, -20.0),
457 std::make_pair(131, -20.0),
458 std::make_pair(132, -20.276),
459 std::make_pair(160, -28.000),
460 std::make_pair(161, -28.531),
461 std::make_pair(192, -45.000),
477 std::make_pair(0, -40.0),
478 std::make_pair(31, -28.375),
479 std::make_pair(32, -28.000),
480 std::make_pair(60, -20.276),
481 std::make_pair(61, -20.0),
482 std::make_pair(61, -20.0),
483 std::make_pair(62, -20.0),
484 std::make_pair(67, -3.333),
485 std::make_pair(125, -3.333),
486 std::make_pair(130, -20.0),
487 std::make_pair(131, -20.0),
488 std::make_pair(131, -20.0),
489 std::make_pair(132, -20.276),
490 std::make_pair(160, -28.000),
491 std::make_pair(161, -28.375),
492 std::make_pair(192, -40.0),
508 std::make_pair(0, -45.000),
509 std::make_pair(63, -28.266),
510 std::make_pair(64, -28.000),
511 std::make_pair(124, -20.131),
512 std::make_pair(125, -20.0),
513 std::make_pair(125, -20.0),
514 std::make_pair(126, -20.0),
515 std::make_pair(131, -3.333),
516 std::make_pair(253, -3.333),
517 std::make_pair(258, -20.0),
518 std::make_pair(259, -20.0),
519 std::make_pair(259, -20.0),
520 std::make_pair(260, -20.131),
521 std::make_pair(320, -28.000),
522 std::make_pair(321, -28.266),
523 std::make_pair(384, -45.000),
539 std::make_pair(0, -40.0),
540 std::make_pair(63, -28.188),
541 std::make_pair(64, -28.000),
542 std::make_pair(124, -20.131),
543 std::make_pair(125, -20.0),
544 std::make_pair(125, -20.0),
545 std::make_pair(126, -20.0),
546 std::make_pair(131, -3.333),
547 std::make_pair(253, -3.333),
548 std::make_pair(258, -20.0),
549 std::make_pair(259, -20.0),
550 std::make_pair(259, -20.0),
551 std::make_pair(260, -20.131),
552 std::make_pair(320, -28.000),
553 std::make_pair(321, -28.188),
554 std::make_pair(384, -40.0),
570 std::make_pair(0, -40.0),
571 std::make_pair(31, -28.375),
572 std::make_pair(32, -28.000),
573 std::make_pair(60, -20.276),
574 std::make_pair(61, -20.0),
575 std::make_pair(61, -20.0),
576 std::make_pair(62, -20.0),
577 std::make_pair(67, -3.333),
578 std::make_pair(125, -3.333),
579 std::make_pair(130, -20.0),
580 std::make_pair(131, -20.0),
581 std::make_pair(131, -20.0),
582 std::make_pair(132, -20.276),
583 std::make_pair(160, -28.000),
584 std::make_pair(161, -28.375),
585 std::make_pair(192, -40.0),
601 std::make_pair(0, -40.0),
602 std::make_pair(63, -28.188),
603 std::make_pair(64, -28.000),
604 std::make_pair(124, -20.131),
605 std::make_pair(125, -20.0),
606 std::make_pair(125, -20.0),
607 std::make_pair(126, -20.0),
608 std::make_pair(131, -3.333),
609 std::make_pair(253, -3.333),
610 std::make_pair(258, -20.0),
611 std::make_pair(259, -20.0),
612 std::make_pair(259, -20.0),
613 std::make_pair(260, -20.131),
614 std::make_pair(320, -28.000),
615 std::make_pair(321, -28.188),
616 std::make_pair(384, -40.0),
632 std::make_pair(0, -40.0),
633 std::make_pair(127, -28.094),
634 std::make_pair(128, -28.000),
635 std::make_pair(252, -20.064),
636 std::make_pair(253, -20.0),
637 std::make_pair(253, -20.0),
638 std::make_pair(254, -20.0),
639 std::make_pair(259, -3.333),
640 std::make_pair(509, -3.333),
641 std::make_pair(514, -20.0),
642 std::make_pair(515, -20.0),
643 std::make_pair(515, -20.0),
644 std::make_pair(516, -20.064),
645 std::make_pair(640, -28.000),
646 std::make_pair(641, -28.094),
647 std::make_pair(768, -40.0),
663 std::make_pair(0, -40.0),
664 std::make_pair(255, -28.047),
665 std::make_pair(256, -28.000),
666 std::make_pair(508, -20.032),
667 std::make_pair(509, -20.0),
668 std::make_pair(509, -20.0),
669 std::make_pair(510, -20.0),
670 std::make_pair(515, -3.333),
671 std::make_pair(1021, -3.333),
672 std::make_pair(1026, -20.0),
673 std::make_pair(1027, -20.0),
674 std::make_pair(1027, -20.0),
675 std::make_pair(1028, -20.032),
676 std::make_pair(1280, -28.000),
677 std::make_pair(1281, -28.047),
678 std::make_pair(1536, -40.0),
694 std::make_pair(0, -45.000),
695 std::make_pair(127, -28.133),
696 std::make_pair(128, -28.000),
697 std::make_pair(252, -20.064),
698 std::make_pair(253, -20.0),
699 std::make_pair(255, -20.0),
700 std::make_pair(256, -20.0),
701 std::make_pair(261, -3.333),
702 std::make_pair(262, 0.0),
703 std::make_pair(382, 0.0),
704 std::make_pair(383, -20.0),
705 std::make_pair(385, -20.0),
706 std::make_pair(386, 0.0),
707 std::make_pair(506, 0.0),
708 std::make_pair(507, -3.333),
709 std::make_pair(512, -20.0),
710 std::make_pair(513, -20.0),
711 std::make_pair(515, -20.0),
712 std::make_pair(516, -20.064),
713 std::make_pair(640, -28.000),
714 std::make_pair(641, -28.133),
715 std::make_pair(768, -45.000),
731 std::make_pair(0, -40.0),
732 std::make_pair(127, -28.094),
733 std::make_pair(128, -28.000),
734 std::make_pair(252, -20.064),
735 std::make_pair(253, -20.0),
736 std::make_pair(255, -20.0),
737 std::make_pair(256, -20.0),
738 std::make_pair(261, -3.333),
739 std::make_pair(262, 0.0),
740 std::make_pair(382, 0.0),
741 std::make_pair(383, -20.0),
742 std::make_pair(385, -20.0),
743 std::make_pair(386, 0.0),
744 std::make_pair(506, 0.0),
745 std::make_pair(507, -3.333),
746 std::make_pair(512, -20.0),
747 std::make_pair(513, -20.0),
748 std::make_pair(515, -20.0),
749 std::make_pair(516, -20.064),
750 std::make_pair(640, -28.000),
751 std::make_pair(641, -28.094),
752 std::make_pair(768, -40.0),
768 std::make_pair(0, -45.000),
769 std::make_pair(255, -28.066),
770 std::make_pair(256, -28.000),
771 std::make_pair(505, -20.032),
772 std::make_pair(506, -20.0),
773 std::make_pair(510, -20.0),
774 std::make_pair(511, -20.0),
775 std::make_pair(523, -1.538),
776 std::make_pair(524, 0.0),
777 std::make_pair(765, 0.0),
778 std::make_pair(766, -20.0),
779 std::make_pair(770, -20.0),
780 std::make_pair(771, 0.0),
781 std::make_pair(1012, 0.0),
782 std::make_pair(1013, -1.538),
783 std::make_pair(1025, -20.0),
784 std::make_pair(1026, -20.0),
785 std::make_pair(1030, -20.0),
786 std::make_pair(1031, -20.032),
787 std::make_pair(1280, -28.000),
788 std::make_pair(1281, -28.066),
789 std::make_pair(1536, -45.000),
805 std::make_pair(0, -40.0),
806 std::make_pair(255, -28.047),
807 std::make_pair(256, -28.000),
808 std::make_pair(505, -20.032),
809 std::make_pair(506, -20.0),
810 std::make_pair(510, -20.0),
811 std::make_pair(511, -20.0),
812 std::make_pair(523, -1.538),
813 std::make_pair(524, 0.0),
814 std::make_pair(765, 0.0),
815 std::make_pair(766, -20.0),
816 std::make_pair(770, -20.0),
817 std::make_pair(771, 0.0),
818 std::make_pair(1012, 0.0),
819 std::make_pair(1013, -1.538),
820 std::make_pair(1025, -20.0),
821 std::make_pair(1026, -20.0),
822 std::make_pair(1030, -20.0),
823 std::make_pair(1031, -20.032),
824 std::make_pair(1280, -28.000),
825 std::make_pair(1281, -28.047),
826 std::make_pair(1536, -40.0),
842 std::make_pair(0, -45.000),
843 std::make_pair(511, -28.033),
844 std::make_pair(512, -28.000),
845 std::make_pair(1017, -20.016),
846 std::make_pair(1018, -20.0),
847 std::make_pair(1022, -20.0),
848 std::make_pair(1023, -20.0),
849 std::make_pair(1035, -1.538),
850 std::make_pair(1036, 0.0),
851 std::make_pair(1533, 0.0),
852 std::make_pair(1534, -20.0),
853 std::make_pair(1538, -20.0),
854 std::make_pair(1539, 0.0),
855 std::make_pair(2036, 0.0),
856 std::make_pair(2037, -1.538),
857 std::make_pair(2049, -20.0),
858 std::make_pair(2050, -20.0),
859 std::make_pair(2054, -20.0),
860 std::make_pair(2055, -20.016),
861 std::make_pair(2560, -28.000),
862 std::make_pair(2561, -28.033),
863 std::make_pair(3072, -45.000),
879 std::make_pair(0, -40.0),
880 std::make_pair(511, -28.023),
881 std::make_pair(512, -28.000),
882 std::make_pair(1017, -20.016),
883 std::make_pair(1018, -20.0),
884 std::make_pair(1022, -20.0),
885 std::make_pair(1023, -20.0),
886 std::make_pair(1035, -1.538),
887 std::make_pair(1036, 0.0),
888 std::make_pair(1533, 0.0),
889 std::make_pair(1534, -20.0),
890 std::make_pair(1538, -20.0),
891 std::make_pair(1539, 0.0),
892 std::make_pair(2036, 0.0),
893 std::make_pair(2037, -1.538),
894 std::make_pair(2049, -20.0),
895 std::make_pair(2050, -20.0),
896 std::make_pair(2054, -20.0),
897 std::make_pair(2055, -20.016),
898 std::make_pair(2560, -28.000),
899 std::make_pair(2561, -28.023),
900 std::make_pair(3072, -40.0),
919 std::make_pair(0, -40.0),
920 std::make_pair(1023, -28.012),
921 std::make_pair(1024, -28.000),
922 std::make_pair(2041, -20.008),
923 std::make_pair(2042, -20.0),
924 std::make_pair(2046, -20.0),
925 std::make_pair(2047, -20.0),
926 std::make_pair(2059, -1.538),
927 std::make_pair(2060, 0.0),
928 std::make_pair(2557, 0.0),
929 std::make_pair(2558, -20.0),
930 std::make_pair(2562, -20.0),
931 std::make_pair(2563, 0.0),
932 std::make_pair(3060, 0.0),
933 std::make_pair(3061, -20.0),
934 std::make_pair(3083, -20.0),
935 std::make_pair(3084, 0.0),
936 std::make_pair(3581, 0.0),
937 std::make_pair(3582, -20.0),
938 std::make_pair(3586, -20.0),
939 std::make_pair(3587, 0.0),
940 std::make_pair(4084, 0.0),
941 std::make_pair(4085, -1.538),
942 std::make_pair(4097, -20.0),
943 std::make_pair(4098, -20.0),
944 std::make_pair(4102, -20.0),
945 std::make_pair(4103, -20.008),
946 std::make_pair(5120, -28.000),
947 std::make_pair(5121, -28.012),
948 std::make_pair(6144, -40.0),
962 NS_LOG_FUNCTION(
"Check slopes for 11ax 80MHz @ 5GHz with first 20 MHz subchannel punctured");
964 std::make_pair(0, -40.0),
965 std::make_pair(511, -28.023),
966 std::make_pair(512, -28.000),
967 std::make_pair(1017, -20.016),
968 std::make_pair(1018, -20.0),
969 std::make_pair(1022, -20.0),
970 std::make_pair(1023, -20.0),
971 std::make_pair(1272, -20.0),
972 std::make_pair(1273, -20.0),
973 std::make_pair(1279, 0.0),
974 std::make_pair(1280, 0.0),
975 std::make_pair(1533, 0.0),
976 std::make_pair(1534, -20.0),
977 std::make_pair(1538, -20.0),
978 std::make_pair(1539, 0.0),
979 std::make_pair(2036, 0.0),
980 std::make_pair(2037, -1.538),
981 std::make_pair(2049, -20.0),
982 std::make_pair(2050, -20.0),
983 std::make_pair(2054, -20.0),
984 std::make_pair(2055, -20.016),
985 std::make_pair(2560, -28.000),
986 std::make_pair(2561, -28.023),
987 std::make_pair(3072, -40.0),
997 {
true,
false,
false,
false}),
1002 NS_LOG_FUNCTION(
"Check slopes for 11ax 80MHz @ 5GHz with second 20 MHz subchannel punctured");
1004 std::make_pair(0, -40.0),
1005 std::make_pair(511, -28.023),
1006 std::make_pair(512, -28.000),
1007 std::make_pair(1017, -20.016),
1008 std::make_pair(1018, -20.0),
1009 std::make_pair(1022, -20.0),
1010 std::make_pair(1023, -20.0),
1011 std::make_pair(1035, -1.538),
1012 std::make_pair(1036, 0.0),
1013 std::make_pair(1279, 0.0),
1014 std::make_pair(1280, 0.0),
1015 std::make_pair(1286, -20.0),
1016 std::make_pair(1287, -20.0),
1017 std::make_pair(1528, -20.0),
1018 std::make_pair(1529, -20.0),
1019 std::make_pair(1533, -6.667),
1020 std::make_pair(1534, -20.0),
1021 std::make_pair(1538, -20.0),
1022 std::make_pair(1539, 0.0),
1023 std::make_pair(2036, 0.0),
1024 std::make_pair(2037, -1.538),
1025 std::make_pair(2049, -20.0),
1026 std::make_pair(2050, -20.0),
1027 std::make_pair(2054, -20.0),
1028 std::make_pair(2055, -20.016),
1029 std::make_pair(2560, -28.000),
1030 std::make_pair(2561, -28.023),
1031 std::make_pair(3072, -40.0),
1041 {
false,
true,
false,
false}),
1046 NS_LOG_FUNCTION(
"Check slopes for 11ax 80MHz @ 5GHz with third 20 MHz subchannel punctured");
1048 std::make_pair(0, -40.0),
1049 std::make_pair(511, -28.023),
1050 std::make_pair(512, -28.000),
1051 std::make_pair(1017, -20.016),
1052 std::make_pair(1018, -20.0),
1053 std::make_pair(1022, -20.0),
1054 std::make_pair(1023, -20.0),
1055 std::make_pair(1035, -1.538),
1056 std::make_pair(1036, 0.0),
1057 std::make_pair(1533, 0.0),
1058 std::make_pair(1534, -20.0),
1059 std::make_pair(1535, -20.0),
1060 std::make_pair(1539, -10.0),
1061 std::make_pair(1542, -20.0),
1062 std::make_pair(1543, -20.0),
1063 std::make_pair(1784, -20.0),
1064 std::make_pair(1785, -20.0),
1065 std::make_pair(1791, 0.0),
1066 std::make_pair(1792, 0.0),
1067 std::make_pair(2036, 0.0),
1068 std::make_pair(2037, -1.538),
1069 std::make_pair(2049, -20.0),
1070 std::make_pair(2050, -20.0),
1071 std::make_pair(2054, -20.0),
1072 std::make_pair(2055, -20.016),
1073 std::make_pair(2560, -28.000),
1074 std::make_pair(2561, -28.023),
1075 std::make_pair(3072, -40.0),
1085 {
false,
false,
true,
false}),
1090 NS_LOG_FUNCTION(
"Check slopes for 11ax 80MHz @ 5GHz with last 20 MHz subchannel punctured");
1092 std::make_pair(0, -40.0),
1093 std::make_pair(511, -28.023),
1094 std::make_pair(512, -28.000),
1095 std::make_pair(1017, -20.016),
1096 std::make_pair(1018, -20.0),
1097 std::make_pair(1022, -20.0),
1098 std::make_pair(1023, -20.0),
1099 std::make_pair(1035, -1.538),
1100 std::make_pair(1036, 0.0),
1101 std::make_pair(1533, 0.0),
1102 std::make_pair(1534, -20.0),
1103 std::make_pair(1538, -20.0),
1104 std::make_pair(1539, 0.0),
1105 std::make_pair(1791, 0.0),
1106 std::make_pair(1792, 0.0),
1107 std::make_pair(1798, -20.0),
1108 std::make_pair(1799, -20.0),
1109 std::make_pair(2049, -20.0),
1110 std::make_pair(2050, -20.0),
1111 std::make_pair(2054, -20.0),
1112 std::make_pair(2055, -20.016),
1113 std::make_pair(2560, -28.000),
1114 std::make_pair(2561, -28.023),
1115 std::make_pair(3072, -40.0),
1125 {
false,
false,
false,
true}),
1131 "Check slopes for 11ax 160MHz @ 5GHz with two first 20 MHz subchannels punctured");
1133 std::make_pair(0, -40.0),
1134 std::make_pair(1023, -28.012),
1135 std::make_pair(1024, -28.000),
1136 std::make_pair(2041, -20.008),
1137 std::make_pair(2042, -20.0),
1138 std::make_pair(2046, -20.0),
1139 std::make_pair(2047, -20.0),
1140 std::make_pair(2552, -20.0),
1141 std::make_pair(2553, -20.0),
1142 std::make_pair(2557, -6.66667),
1143 std::make_pair(2558, -20.0),
1144 std::make_pair(2562, -20.0),
1145 std::make_pair(2563, 0.0),
1146 std::make_pair(3060, 0.0),
1147 std::make_pair(3061, -20.0),
1148 std::make_pair(3083, -20.0),
1149 std::make_pair(3084, 0.0),
1150 std::make_pair(3581, 0.0),
1151 std::make_pair(3582, -20.0),
1152 std::make_pair(3586, -20.0),
1153 std::make_pair(3587, 0.0),
1154 std::make_pair(4084, 0.0),
1155 std::make_pair(4085, -1.538),
1156 std::make_pair(4097, -20.0),
1157 std::make_pair(4098, -20.0),
1158 std::make_pair(4102, -20.0),
1159 std::make_pair(4103, -20.008),
1160 std::make_pair(5120, -28.000),
1161 std::make_pair(5121, -28.012),
1162 std::make_pair(6144, -40.0),
1173 {
true,
true,
false,
false,
false,
false,
false,
false}),
1179 "Check slopes for 11ax 160MHz @ 5GHz with third and fourth 20 MHz subchannels punctured");
1181 std::make_pair(0, -40.0),
1182 std::make_pair(1023, -28.012),
1183 std::make_pair(1024, -28.000),
1184 std::make_pair(2041, -20.008),
1185 std::make_pair(2042, -20.0),
1186 std::make_pair(2046, -20.0),
1187 std::make_pair(2047, -20.0),
1188 std::make_pair(2059, -1.538),
1189 std::make_pair(2060, 0.0),
1190 std::make_pair(2557, 0.0),
1191 std::make_pair(2558, -20.0),
1192 std::make_pair(2562, -20.0),
1193 std::make_pair(2563, -10.0),
1194 std::make_pair(2566, -20.0),
1195 std::make_pair(2567, -20.0),
1196 std::make_pair(3060, -20.0),
1197 std::make_pair(3061, -20.0),
1198 std::make_pair(3083, -20.0),
1199 std::make_pair(3084, 0.0),
1200 std::make_pair(3581, 0.0),
1201 std::make_pair(3582, -20.0),
1202 std::make_pair(3586, -20.0),
1203 std::make_pair(3587, 0.0),
1204 std::make_pair(4084, 0.0),
1205 std::make_pair(4085, -1.538),
1206 std::make_pair(4097, -20.0),
1207 std::make_pair(4098, -20.0),
1208 std::make_pair(4102, -20.0),
1209 std::make_pair(4103, -20.008),
1210 std::make_pair(5120, -28.000),
1211 std::make_pair(5121, -28.012),
1212 std::make_pair(6144, -40.0),
1223 {
false,
false,
true,
true,
false,
false,
false,
false}),
1229 "Check slopes for 11ax 160MHz @ 5GHz with fifth and sixth 20 MHz subchannels punctured");
1231 std::make_pair(0, -40.0),
1232 std::make_pair(1023, -28.012),
1233 std::make_pair(1024, -28.000),
1234 std::make_pair(2041, -20.008),
1235 std::make_pair(2042, -20.0),
1236 std::make_pair(2046, -20.0),
1237 std::make_pair(2047, -20.0),
1238 std::make_pair(2059, -1.538),
1239 std::make_pair(2060, 0.0),
1240 std::make_pair(2557, 0.0),
1241 std::make_pair(2558, -20.0),
1242 std::make_pair(2562, -20.0),
1243 std::make_pair(2563, 0.0),
1244 std::make_pair(3060, 0.0),
1245 std::make_pair(3061, -20.0),
1246 std::make_pair(3083, -20.0),
1247 std::make_pair(3084, -20.0),
1248 std::make_pair(3576, -20.0),
1249 std::make_pair(3577, -20.0),
1250 std::make_pair(3581, -6.667),
1251 std::make_pair(3582, -20.0),
1252 std::make_pair(3586, -20.0),
1253 std::make_pair(3587, 0.0),
1254 std::make_pair(4084, 0.0),
1255 std::make_pair(4085, -1.538),
1256 std::make_pair(4097, -20.0),
1257 std::make_pair(4098, -20.0),
1258 std::make_pair(4102, -20.0),
1259 std::make_pair(4103, -20.008),
1260 std::make_pair(5120, -28.000),
1261 std::make_pair(5121, -28.012),
1262 std::make_pair(6144, -40.0),
1273 {
false,
false,
false,
false,
true,
true,
false,
false}),
1279 "Check slopes for 11ax 160MHz @ 5GHz with two last 20 MHz subchannels punctured");
1281 std::make_pair(0, -40.0),
1282 std::make_pair(1023, -28.012),
1283 std::make_pair(1024, -28.000),
1284 std::make_pair(2041, -20.008),
1285 std::make_pair(2042, -20.0),
1286 std::make_pair(2046, -20.0),
1287 std::make_pair(2047, -20.0),
1288 std::make_pair(2059, -1.538),
1289 std::make_pair(2060, 0.0),
1290 std::make_pair(2557, 0.0),
1291 std::make_pair(2558, -20.0),
1292 std::make_pair(2562, -20.0),
1293 std::make_pair(2563, 0.0),
1294 std::make_pair(3060, 0.0),
1295 std::make_pair(3061, -20.0),
1296 std::make_pair(3083, -20.0),
1297 std::make_pair(3084, 0.0),
1298 std::make_pair(3581, 0.0),
1299 std::make_pair(3582, -20.0),
1300 std::make_pair(3586, -20.0),
1301 std::make_pair(3587, -10.0),
1302 std::make_pair(3590, -20.0),
1303 std::make_pair(3591, -20.0),
1304 std::make_pair(4097, -20.0),
1305 std::make_pair(4098, -20.0),
1306 std::make_pair(4102, -20.0),
1307 std::make_pair(4103, -20.008),
1308 std::make_pair(5120, -28.000),
1309 std::make_pair(5121, -28.012),
1310 std::make_pair(6144, -40.0),
1321 {
false,
false,
false,
false,
false,
false,
true,
true}),
Test checks if Wifi spectrum values for OFDM are generated properly.
std::vector< IndexPowerPair > IndexPowerVect
typedef for a vector of pairs of sub-band index and relative power value (dBr)
~WifiOfdmMaskSlopesTestCase() override=default
double m_tolerance
tolerance (in dB)
std::vector< bool > m_puncturedSubchannels
bitmap indicating whether a 20 MHz subchannel is punctured or not (only used for 802....
void DoSetup() override
Implementation to do any local setup required for this TestCase.
std::pair< uint32_t, double > IndexPowerPair
typedef for a pair of sub-band index and relative power value (dBr)
uint16_t m_channelWidth
the channel width in MHz to use for the test
WifiOfdmMaskSlopesTestCase(const std::string &name, WifiStandard standard, WifiPhyBand band, uint16_t channelWidth, const IndexPowerVect &maskRefs, double tolerance, std::size_t precision, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
Constructor.
WifiPhyBand m_band
the wifi PHY band to use for the test
Ptr< SpectrumValue > m_actualSpectrum
actual spectrum value
void InterpolateAndAppendValues(IndexPowerVect &vect, IndexPowerPair start, IndexPowerPair stop) const
Interpolate PSD values for indexes between provided start and stop and append to provided vector.
void DoRun() override
Implementation to actually run this TestCase.
IndexPowerVect m_expectedPsd
expected power values
std::size_t m_precision
precision for double calculations (in decimals)
WifiStandard m_standard
the wifi standard to use for the test
Test suite for checking the consistency of different OFDM-based transmit masks.
WifiTransmitMaskTestSuite()
Values::const_iterator ConstValuesBegin() const
Values::const_iterator ConstValuesEnd() const
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#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.
bool TestDoubleIsEqual(const double x1, const double x2, const double epsilon)
Compare two double precision floating point numbers and declare them equal if they are within some ep...
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyBand
Identifies the PHY band.
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WifiTransmitMaskTestSuite g_WifiTransmitMaskTestSuite