9#include "ns3/constant-obss-pd-algorithm.h" 
   10#include "ns3/eht-configuration.h" 
   11#include "ns3/eht-phy.h" 
   12#include "ns3/eht-ppdu.h" 
   13#include "ns3/he-ppdu.h" 
   14#include "ns3/ht-ppdu.h" 
   15#include "ns3/interference-helper.h" 
   17#include "ns3/multi-model-spectrum-channel.h" 
   18#include "ns3/nist-error-rate-model.h" 
   19#include "ns3/non-communicating-net-device.h" 
   20#include "ns3/ofdm-ppdu.h" 
   21#include "ns3/pointer.h" 
   22#include "ns3/rng-seed-manager.h" 
   23#include "ns3/spectrum-wifi-helper.h" 
   24#include "ns3/spectrum-wifi-phy.h" 
   26#include "ns3/threshold-preamble-detection-model.h" 
   27#include "ns3/vht-configuration.h" 
   28#include "ns3/vht-ppdu.h" 
   29#include "ns3/waveform-generator.h" 
   30#include "ns3/wifi-mac-header.h" 
   31#include "ns3/wifi-net-device.h" 
   32#include "ns3/wifi-phy-listener.h" 
   33#include "ns3/wifi-psdu.h" 
   34#include "ns3/wifi-spectrum-value-helper.h" 
   35#include "ns3/wifi-standards.h" 
   36#include "ns3/wifi-utils.h" 
   87    void DoRun() 
override;
 
  146                            dBm_u expectedCcaThreshold);
 
 
  168    : 
TestCase(
"Wi-Fi PHY CCA thresholds test"),
 
  169      m_CcaEdThreshold{-62.0},
 
  170      m_CcaSensitivity{-82.0},
 
  171      m_secondaryCcaSensitivityThresholds{
dBm_u{-72}, 
dBm_u{-72}, 
dBm_u{-69}},
 
  172      m_obssPdLevel{-82.0},
 
  173      m_per20CcaSensitivity{-72.0}
 
 
  279                                             dBm_u expectedCcaThreshold)
 
  282    const auto actualThreshold = phy->GetCcaThreshold(ppdu, channelType);
 
  283    NS_LOG_INFO((ppdu == 
nullptr ? 
"any signal" : 
"a PPDU")
 
  284                << 
" in " << channelType << 
" channel: " << actualThreshold << 
"dBm");
 
  286                              expectedCcaThreshold,
 
  288                              "Actual CCA threshold for " 
  289                                  << (ppdu == 
nullptr ? 
"any signal" : 
"a PPDU") << 
" in " 
  290                                  << channelType << 
" channel " << actualThreshold
 
  291                                  << 
"dBm does not match expected threshold " 
  292                                  << expectedCcaThreshold << 
"dBm");
 
 
  828                            const std::vector<Time>& per20MhzDurations)
 override 
  830        NS_LOG_FUNCTION(
this << duration << channelType << per20MhzDurations.size());
 
 
 
  894    void DoRun() 
override;
 
  940                                      const std::vector<Time>& expectedPer20MhzDurations);
 
 1002                      const std::vector<TxSignalInfo>& generatedSignals,
 
 1003                      const std::vector<TxPpduInfo>& generatedPpdus,
 
 1004                      const std::vector<StateCheckPoint>& stateCheckpoints,
 
 1005                      const std::vector<CcaCheckPoint>& ccaCheckpoints);
 
 1031    std::shared_ptr<CcaTestPhyListener>
 
 1037    std::vector<std::vector<Time>>
 
 
 1043                                                           ? 
std::string(
"802.11ax")
 
 1044                                                           : 
std::string(
"802.11be"))),
 
 1045      m_standard{standard},
 
 1046      m_numSignalGenerators{2},
 
 1048      m_channelWidth{
MHz_u{20}}
 
 
 1059    NS_LOG_FUNCTION(
this << signalGenerator << txPower << frequency << bandwidth << duration);
 
 1063    bandInfo.
fl = bandInfo.
fc - 
MHzToHz(bandwidth / 2);
 
 1064    bandInfo.
fh = bandInfo.
fc + 
MHzToHz(bandwidth / 2);
 
 1066    bands.push_back(bandInfo);
 
 1072    signalGenerator->SetTxPowerSpectralDensity(signalPsd);
 
 1073    signalGenerator->SetPeriod(duration);
 
 1074    signalGenerator->Start();
 
 
 1082    signalGenerator->Stop();
 
 
 1098    const auto preamble =
 
 1107    m_txPhy->SetTxPowerStart(txPower);
 
 1108    m_txPhy->SetTxPowerEnd(txPower);
 
 1110    m_txPhy->Send(psdu, txVector);
 
 
 1126    m_rxPhy->GetAttribute(
"State", ptr);
 
 1128    currentState = state->GetState();
 
 1131                          "PHY State " << currentState << 
" does not match expected state " 
 
 1137    Time expectedEndTime,
 
 1139    const std::vector<Time>& expectedPer20MhzDurations)
 
 1144                                              << 
" does not match expected time " << expectedEndTime
 
 1147                          expectedChannelType,
 
 1149                                              << 
" does not match expected channel type " 
 1152                          expectedPer20MhzDurations.size(),
 
 1153                          "PHY CCA-BUSY per-20 MHz durations does not match expected vector" 
 1155    for (std::size_t i = 0; i < expectedPer20MhzDurations.size(); ++i)
 
 1158                              expectedPer20MhzDurations.at(i),
 
 1159                              "PHY CCA-BUSY per-20 MHz duration at index " 
 1160                                  << i << 
" does not match expected duration at " 
 
 1173                                       const std::vector<TxSignalInfo>& generatedSignals,
 
 1174                                       const std::vector<TxPpduInfo>& generatedPpdus,
 
 1175                                       const std::vector<StateCheckPoint>& stateCheckpoints,
 
 1176                                       const std::vector<CcaCheckPoint>& ccaCheckpoints)
 
 1178    for (
const auto& generatedPpdu : generatedPpdus)
 
 1183                            generatedPpdu.power,
 
 1184                            generatedPpdu.centerFreq,
 
 1185                            generatedPpdu.bandwidth);
 
 1188    std::size_t index = 0;
 
 1189    for (
const auto& generatedSignal : generatedSignals)
 
 1195                            generatedSignal.power,
 
 1196                            generatedSignal.centerFreq,
 
 1197                            generatedSignal.bandwidth,
 
 1198                            generatedSignal.duration);
 
 1201    for (
const auto& checkpoint : ccaCheckpoints)
 
 1207                            checkpoint.expectedChannelListType,
 
 1208                            checkpoint.expectedPer20MhzDurations);
 
 1211    for (
const auto& checkpoint : stateCheckpoints)
 
 1216                            checkpoint.expectedPhyState);
 
 
 1333    rxDev->SetVhtConfiguration(vhtConfiguration);
 
 1337        rxDev->SetEhtConfiguration(ehtConfiguration);
 
 1343    m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
 
 1345    m_rxPhy->SetErrorRateModel(rxErrorModel);
 
 1348    m_rxPhy->SetPreambleDetectionModel(preambleDetectionModel);
 
 1349    m_rxPhy->AddChannel(spectrumChannel);
 
 1353    rxNode->AddDevice(rxDev);
 
 1360    m_txPhy->SetInterferenceHelper(txInterferenceHelper);
 
 1362    m_txPhy->SetErrorRateModel(txErrorModel);
 
 1363    m_txPhy->AddChannel(spectrumChannel);
 
 1367    txNode->AddDevice(txDev);
 
 1375        signalGenerator->SetDevice(signalGeneratorDev);
 
 1376        signalGenerator->SetChannel(spectrumChannel);
 
 1377        signalGenerator->SetDutyCycle(1);
 
 1378        signalGeneratorNode->AddDevice(signalGeneratorDev);
 
 
 1388    int64_t streamNumber = 0;
 
 1389    m_rxPhy->AssignStreams(streamNumber);
 
 1390    m_txPhy->AssignStreams(streamNumber);
 
 1404    const auto& ppduDurations =
 
 1419                        "Reception of a signal that occupies P20 below ED threshold");
 
 1427             WifiPhyState::IDLE}, 
 
 1440                        "Reception of signal that occupies P20 above ED threshold");
 
 1452             WifiPhyState::CCA_BUSY}, 
 
 1469                        "Reception of two 20 MHz signals that occupies P20 below ED threshold with " 
 1470                        "sum above ED threshold");
 
 1481                      WifiPhyState::CCA_BUSY}, 
 
 1483                      WifiPhyState::CCA_BUSY}, 
 
 1501        "Reception of a 20 MHz PPDU that occupies P20 below CCA sensitivity threshold");
 
 1508                      WifiPhyState::IDLE}, 
 
 1523        "Reception of a 20 MHz PPDU that occupies P20 above CCA sensitivity threshold");
 
 1548        "Reception of a 40 MHz PPDU that occupies P20 below CCA sensitivity threshold");
 
 1555                      WifiPhyState::IDLE}, 
 
 1570        "Reception of a 40 MHz PPDU that occupies P40 above CCA sensitivity threshold");
 
 1580                 : WifiPhyState::CCA_BUSY}, 
 
 1598                            "Reception of a 20 MHz signal that occupies S20 below ED threshold");
 
 1606                 WifiPhyState::IDLE}, 
 
 1619                            "Reception of a 20 MHz signal that occupies S20 above ED threshold");
 
 1628                 WifiPhyState::IDLE}, 
 
 1645                            "Reception of a 40 MHz signal that occupies P40 above ED threshold");
 
 1654                 WifiPhyState::CCA_BUSY}, 
 
 1671                            "Reception of a signal that occupies S20 followed by the reception of " 
 1672                            "another signal that occupies P20");
 
 1683                 WifiPhyState::IDLE}, 
 
 1685                 WifiPhyState::CCA_BUSY}, 
 
 1689                 WifiPhyState::CCA_BUSY}, 
 
 1711                            "Reception of a signal that occupies P20 followed by the reception of " 
 1712                            "another signal that occupies S20");
 
 1724                 WifiPhyState::CCA_BUSY}, 
 
 1728                 WifiPhyState::CCA_BUSY}, 
 
 1751            "Reception of a 20 MHz PPDU that occupies S20 below CCA sensitivity threshold");
 
 1758                          WifiPhyState::IDLE}, 
 
 1772            "Reception of a 20 MHz PPDU that occupies S20 above CCA sensitivity threshold");
 
 1780                          WifiPhyState::IDLE}, 
 
 1785                       ppduDurations.at(
MHz_u{20}),
 
 1798                            "Reception of a 20 MHz signal that occupies S20 above ED threshold " 
 1800                            "MHz PPDU that occupies P40 below CCA sensitivity threshold");
 
 1837                            "Reception of a 20 MHz signal that occupies the first subchannel of " 
 1838                            "S40 below ED threshold");
 
 1849                          WifiPhyState::IDLE}, 
 
 1864                            "Reception of a 20 MHz signal that occupies the first subchannel of " 
 1865                            "S40 above ED threshold");
 
 1877                          WifiPhyState::IDLE}, 
 
 1894                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 1895                            "S40 below ED threshold");
 
 1906                          WifiPhyState::IDLE}, 
 
 1922                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 1923                            "S40 above ED threshold");
 
 1935                          WifiPhyState::IDLE}, 
 
 1952                            "Reception of a 40 MHz signal that occupies S40 below ED threshold");
 
 1960                 WifiPhyState::IDLE}, 
 
 1975                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 1976                            "S40 above ED threshold");
 
 1985                 WifiPhyState::IDLE}, 
 
 2002                            "Reception of a 80 MHz signal that occupies P80 above ED threshold");
 
 2011                 WifiPhyState::CCA_BUSY}, 
 
 2028                            "Reception of a 20 MHz signal that occupies S40 followed by the " 
 2029                            "reception of another 20 MHz signal that occupies P20");
 
 2044                 WifiPhyState::IDLE}, 
 
 2046                 WifiPhyState::CCA_BUSY}, 
 
 2050                 WifiPhyState::CCA_BUSY}, 
 
 2072                            "Reception of a signal that occupies S40 followed by the reception of " 
 2073                            "another signal that occupies S20");
 
 2088                 WifiPhyState::IDLE}, 
 
 2090                 WifiPhyState::IDLE}, 
 
 2092                 WifiPhyState::IDLE}, 
 
 2115            "Reception of a 40 MHz PPDU that occupies S40 below CCA sensitivity threshold");
 
 2122                          WifiPhyState::IDLE}, 
 
 2137            "Reception of a 40 MHz PPDU that occupies S40 above CCA sensitivity threshold");
 
 2140                    ppduDurations.at(
MHz_u{40}));
 
 2147                          WifiPhyState::IDLE}, 
 
 2152                       ppduDurations.at(
MHz_u{40}),
 
 2165                            "Reception of a 40 MHz signal that occupies S40 above ED threshold " 
 2167                            "MHz PPDU that occupies P80 below CCA sensitivity threshold");
 
 2204                            "Reception of a 80 MHz PPDU that occupies the 40 MHz band above CCA " 
 2205                            "sensitivity threshold");
 
 2213                 WifiPhyState::CCA_BUSY}, 
 
 2222              ppduDurations.at(
MHz_u{80}),
 
 2235                            "Reception of a 80 MHz PPDU that occupies the 40 MHz band above CCA " 
 2236                            "sensitivity threshold");
 
 2253                 WifiPhyState::CCA_BUSY}, 
 
 2262              ppduDurations.at(
MHz_u{80}),
 
 2275            "Reception of a 40 MHz PPDU that does not occupy the operational channel");
 
 2282                          WifiPhyState::IDLE}, 
 
 2298                            "Reception of a 20 MHz signal that occupies the first subchannel of " 
 2299                            "S80 below ED threshold");
 
 2310                          WifiPhyState::IDLE}, 
 
 2324                            "Reception of a 20 MHz signal that occupies the first subchannel of " 
 2325                            "S80 above ED threshold");
 
 2337                          WifiPhyState::IDLE}, 
 
 2354                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 2355                            "S80 below ED threshold");
 
 2366                          WifiPhyState::IDLE}, 
 
 2380                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 2381                            "S80 above ED threshold");
 
 2393                          WifiPhyState::IDLE}, 
 
 2410                            "Reception of a 20 MHz signal that occupies the third subchannel of " 
 2411                            "S80 below ED threshold");
 
 2422                          WifiPhyState::IDLE}, 
 
 2436                            "Reception of a 20 MHz signal that occupies the third subchannel of " 
 2437                            "S80 above ED threshold");
 
 2449                          WifiPhyState::IDLE}, 
 
 2466                            "Reception of a 20 MHz signal that occupies the fourth subchannel of " 
 2467                            "S80 below ED threshold");
 
 2478                          WifiPhyState::IDLE}, 
 
 2492                            "Reception of a 20 MHz signal that occupies the fourth subchannel of " 
 2493                            "S80 above ED threshold");
 
 2505                          WifiPhyState::IDLE}, 
 
 2523                            "Reception of a 40 MHz signal that occupies the first and second " 
 2524                            "subchannels of S80 below ED threshold");
 
 2535                          WifiPhyState::IDLE}, 
 
 2549                            "Reception of a 40 MHz signal that occupies the first and second " 
 2550                            "subchannels of S80 above ED threshold");
 
 2562                          WifiPhyState::IDLE}, 
 
 2580                            "Reception of a 40 MHz signal that occupies the third and fourth " 
 2581                            "subchannels of S80 below ED threshold");
 
 2592                          WifiPhyState::IDLE}, 
 
 2606                            "Reception of a 40 MHz signal that occupies the third and fourth " 
 2607                            "subchannels of S80 above ED threshold");
 
 2619                          WifiPhyState::IDLE}, 
 
 2636                            "Reception of a 80 MHz signal that occupies S80 below ED threshold");
 
 2644                 WifiPhyState::IDLE}, 
 
 2658                            "Reception of a 80 MHz signal that occupies S80 above ED threshold");
 
 2667                 WifiPhyState::IDLE}, 
 
 2685            "Reception of a 160 MHz signal that occupies the whole band below ED threshold");
 
 2693                 WifiPhyState::IDLE}, 
 
 2708            "Reception of a 160 MHz signal that occupies the whole band above ED threshold");
 
 2717                 WifiPhyState::CCA_BUSY}, 
 
 2734                            "Reception of a 20 MHz signal that occupies S80 followed by the " 
 2735                            "reception of another 20 MHz signal that occupies P20");
 
 2750                 WifiPhyState::IDLE}, 
 
 2752                 WifiPhyState::CCA_BUSY}, 
 
 2756                 WifiPhyState::CCA_BUSY}, 
 
 2778                            "Reception of a signal that occupies S80 followed by the reception of " 
 2779                            "another signal that occupies S40");
 
 2798                 WifiPhyState::IDLE}, 
 
 2800                 WifiPhyState::IDLE}, 
 
 2802                 WifiPhyState::IDLE}, 
 
 2824                            "Reception of a signal that occupies S80 followed by the reception of " 
 2825                            "another signal that occupies S20");
 
 2840                 WifiPhyState::IDLE}, 
 
 2842                 WifiPhyState::IDLE}, 
 
 2844                 WifiPhyState::IDLE}, 
 
 2867            "Reception of a 80 MHz PPDU that occupies S80 below CCA sensitivity threshold");
 
 2874                          WifiPhyState::IDLE}, 
 
 2888            "Reception of a 80 MHz PPDU that occupies S80 above CCA sensitivity threshold");
 
 2896                          WifiPhyState::IDLE}, 
 
 2901                       ppduDurations.at(
MHz_u{80}),
 
 2916                "Reception of a 20 MHz signal that generates a per20bitmap parameter " 
 2917                "change when previous CCA indication reports IDLE");
 
 2930                     WifiPhyState::IDLE}, 
 
 2947                                "Reception of a 20 MHz signal that generates a per20bitmap " 
 2948                                "parameter change when " 
 2949                                "previous CCA indication reports BUSY for the primary channel");
 
 2969                     WifiPhyState::CCA_BUSY}, 
 
 2995                            "Reception of a 20 MHz signal that occupies the first subchannel of " 
 2996                            "S160 below ED threshold");
 
 3007                          WifiPhyState::IDLE}, 
 
 3022                            "Reception of a 20 MHz signal that occupies the first subchannel of " 
 3023                            "S160 above ED threshold");
 
 3035                          WifiPhyState::IDLE}, 
 
 3052                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 3053                            "S160 below ED threshold");
 
 3064                          WifiPhyState::IDLE}, 
 
 3079                            "Reception of a 20 MHz signal that occupies the second subchannel of " 
 3080                            "S160 above ED threshold");
 
 3092                          WifiPhyState::IDLE}, 
 
 3109                            "Reception of a 20 MHz signal that occupies the third subchannel of " 
 3110                            "S160 below ED threshold");
 
 3121                          WifiPhyState::IDLE}, 
 
 3136                            "Reception of a 20 MHz signal that occupies the third subchannel of " 
 3137                            "S160 above ED threshold");
 
 3149                          WifiPhyState::IDLE}, 
 
 3166                            "Reception of a 20 MHz signal that occupies the fourth subchannel of " 
 3167                            "S160 below ED threshold");
 
 3178                          WifiPhyState::IDLE}, 
 
 3193                            "Reception of a 20 MHz signal that occupies the fourth subchannel of " 
 3194                            "S160 above ED threshold");
 
 3206                          WifiPhyState::IDLE}, 
 
 3224                            "Reception of a 40 MHz signal that occupies the fifth and sixth " 
 3225                            "subchannels of S160 below ED threshold");
 
 3236                          WifiPhyState::IDLE}, 
 
 3250                            "Reception of a 40 MHz signal that occupies the fifth and sixth " 
 3251                            "subchannels of S160 above ED threshold");
 
 3263                          WifiPhyState::IDLE}, 
 
 3281                            "Reception of a 40 MHz signal that occupies the seventh and eighth " 
 3282                            "subchannels of S160 below ED threshold");
 
 3293                          WifiPhyState::IDLE}, 
 
 3307                            "Reception of a 40 MHz signal that occupies the seventh and eighth " 
 3308                            "subchannels of S160 above ED threshold");
 
 3320                          WifiPhyState::IDLE}, 
 
 3338                            "Reception of a 80 MHz signal that occupies the first four " 
 3339                            "subchannels of S160 below ED threshold");
 
 3350                          WifiPhyState::IDLE}, 
 
 3364                            "Reception of a 80 MHz signal that occupies the first four " 
 3365                            "subchannels of S160 above ED threshold");
 
 3377                          WifiPhyState::IDLE}, 
 
 3395                            "Reception of a 80 MHz signal that occupies the last four " 
 3396                            "subchannels of S160 below ED threshold");
 
 3407                          WifiPhyState::IDLE}, 
 
 3421                            "Reception of a 80 MHz signal that occupies the last four " 
 3422                            "subchannels of S160 above ED threshold");
 
 3434                          WifiPhyState::IDLE}, 
 
 3453            "Reception of a 160 MHz signal that occupies the whole S160 below ED threshold");
 
 3461                 WifiPhyState::IDLE}, 
 
 3476            "Reception of a 160 MHz signal that occupies the whole S160 above ED threshold");
 
 3485                 WifiPhyState::IDLE}, 
 
 3503            "Reception of a 320 MHz signal that occupies the whole band below ED threshold");
 
 3511                 WifiPhyState::IDLE}, 
 
 3526            "Reception of a 320 MHz signal that occupies the whole band above ED threshold");
 
 3535                 WifiPhyState::CCA_BUSY}, 
 
 3552                            "Reception of a 20 MHz signal that occupies S160 followed by the " 
 3553                            "reception of another 20 MHz signal that occupies P20");
 
 3568                 WifiPhyState::IDLE}, 
 
 3570                 WifiPhyState::CCA_BUSY}, 
 
 3574                 WifiPhyState::CCA_BUSY}, 
 
 3596                            "Reception of a signal that occupies S160 followed by the reception of " 
 3597                            "another signal that occupies S80");
 
 3616                 WifiPhyState::IDLE}, 
 
 3618                 WifiPhyState::IDLE}, 
 
 3620                 WifiPhyState::IDLE}, 
 
 3642                            "Reception of a signal that occupies S160 followed by the reception of " 
 3643                            "another signal that occupies S40");
 
 3662                 WifiPhyState::IDLE}, 
 
 3664                 WifiPhyState::IDLE}, 
 
 3666                 WifiPhyState::IDLE}, 
 
 3688                            "Reception of a signal that occupies S160 followed by the reception of " 
 3689                            "another signal that occupies S20");
 
 3704                 WifiPhyState::IDLE}, 
 
 3706                 WifiPhyState::IDLE}, 
 
 3708                 WifiPhyState::IDLE}, 
 
 3731            "Reception of a 160 MHz PPDU that occupies S160 below CCA sensitivity threshold");
 
 3738                          WifiPhyState::IDLE}, 
 
 3753            "Reception of a 160 MHz PPDU that occupies S160 above CCA sensitivity threshold");
 
 3761                          WifiPhyState::IDLE}, 
 
 3766                       ppduDurations.at(160),
 
 
 3814        signalGenerator->Dispose();
 
 3815        signalGenerator = 
nullptr;
 
 
PHY listener for CCA tests.
void NotifyOn() override
Notify listeners that we went to switch on.
WifiChannelListType m_lastCcaBusyChannelType
Channel type indication for the last CCA-BUSY notification.
void NotifyTxStart(Time duration, dBm_u txPower) override
void NotifyCcaBusyStart(Time duration, WifiChannelListType channelType, const std::vector< Time > &per20MhzDurations) override
void NotifySleep() override
Notify listeners that we went to sleep.
void NotifyRxEndOk() override
We have received the last bit of a packet for which NotifyRxStart was invoked first and,...
CcaTestPhyListener()=default
void NotifyOff() override
Notify listeners that we went to switch off.
std::size_t m_notifications
Number of CCA notifications.
void NotifyRxStart(Time duration) override
Time m_endCcaBusy
End of the CCA-BUSY duration.
void Reset()
Reset function.
void NotifyWakeup() override
Notify listeners that we woke up.
std::vector< Time > m_lastPer20MhzCcaBusyDurations
End of the CCA-BUSY durations per 20 MHz.
void NotifySwitchingStart(Time duration) override
void NotifyRxEndError(const WifiTxVector &txVector) override
Wifi Phy Threshold Test base class.
MHz_u m_channelWidth
Operating channel width.
std::size_t m_numSignalGenerators
The number of non-wifi signals generators needed for the test.
WifiStandard m_standard
The standard to use for the test.
void SendSuPpdu(dBm_u txPower, MHz_u frequency, MHz_u bandwidth)
Send a HE or EHT SU PPDU.
void CheckPhyState(WifiPhyState expectedState)
Check the PHY state.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void CheckLastCcaBusyNotification(Time expectedEndTime, WifiChannelListType expectedChannelType, const std::vector< Time > &expectedPer20MhzDurations)
Check the last CCA-BUSY notification.
MHz_u m_frequency
Operating frequency.
void StartSignal(Ptr< WaveformGenerator > signalGenerator, dBm_u txPower, MHz_u frequency, MHz_u bandwidth, Time duration)
Start to generate a signal.
void RunOne()
Run one function.
std::vector< std::vector< Time > > m_expectedPer20MhzCcaBusyDurations
expected Per 20Mhz CCA durations per check
void DoCheckPhyState(WifiPhyState expectedState)
Check the PHY state.
void ResetExpectedPer20MhzCcaBusyDurations()
Reset the expected Per 20 MHz CCA durations.
std::shared_ptr< CcaTestPhyListener > m_rxPhyStateListener
Listener for PHY state transitions.
std::vector< Ptr< WaveformGenerator > > m_signalGenerators
Generators of non-wifi signals.
void ScheduleTest(Time delay, const std::vector< TxSignalInfo > &generatedSignals, const std::vector< TxPpduInfo > &generatedPpdus, const std::vector< StateCheckPoint > &stateCheckpoints, const std::vector< CcaCheckPoint > &ccaCheckpoints)
Schedule test to perform.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
WifiPhyCcaIndicationTest(WifiStandard standard)
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
void LogScenario(const std::string &log) const
Log scenario description.
void Reset()
Reset function.
Ptr< SpectrumWifiPhy > m_rxPhy
PHY object of the receiver.
Ptr< SpectrumWifiPhy > m_txPhy
PHY object of the transmitter.
void StopSignal(Ptr< WaveformGenerator > signalGenerator)
Stop to generate a signal.
Wi-Fi PHY CCA Test Suite.
void VerifyCcaThreshold(const Ptr< PhyEntity > phy, const Ptr< const WifiPpdu > ppdu, WifiChannelListType channelType, dBm_u expectedCcaThreshold)
Function to verify the CCA threshold that is being reported by a given PHY entity upon reception of a...
Ptr< WifiNetDevice > m_device
The WifiNetDevice.
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.
Ptr< SpectrumWifiPhy > m_phy
The spectrum PHY.
Ptr< ObssPdAlgorithm > m_obssPdAlgorithm
The OBSS-PD algorithm.
dBm_u m_obssPdLevel
The current OBSS-PD level.
Ptr< EhtConfiguration > m_ehtConfiguration
The EHT configuration.
Ptr< WifiPsdu > CreateDummyPsdu()
Create a dummy PSDU whose payload is 1000 bytes.
VhtConfiguration::SecondaryCcaSensitivityThresholds m_secondaryCcaSensitivityThresholds
The current CCA sensitivity thresholds for signals that do not occupy the primary 20 MHz channel.
void RunOne()
Run tests for given CCA attributes.
Ptr< VhtConfiguration > m_vhtConfiguration
The VHT configuration.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< EhtPpdu > CreateDummyEhtPpdu(MHz_u bandwidth, const WifiPhyOperatingChannel &channel)
Create a EHT PPDU.
dBm_u m_per20CcaSensitivity
The current CCA sensitivity threshold for Per 20MHz check.
Ptr< VhtPpdu > CreateDummyVhtPpdu(MHz_u bandwidth, const WifiPhyOperatingChannel &channel)
Create a VHT PPDU.
Ptr< HtPpdu > CreateDummyHtPpdu(MHz_u bandwidth, const WifiPhyOperatingChannel &channel)
Create a HT PPDU.
Ptr< OfdmPpdu > CreateDummyNonHtPpdu(const WifiPhyOperatingChannel &channel)
Create a non-HT PPDU.
dBm_u m_CcaEdThreshold
The current CCA-ED threshold for a 20 MHz subchannel.
WifiPhyCcaThresholdsTest()
dBm_u m_CcaSensitivity
The current CCA sensitivity threshold for signals that occupy the primary 20 MHz channel.
Ptr< HePpdu > CreateDummyHePpdu(MHz_u bandwidth, const WifiPhyOperatingChannel &channel)
Create a HE PPDU.
static WifiMode GetEhtMcs0()
Return MCS 0 from EHT MCS values.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
@ PSD_NON_HE_PORTION
Non-HE portion of an HE PPDU.
static WifiMode GetHtMcs0()
Return MCS 0 from HT MCS values.
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6 Mbps.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
std::tuple< dBm_u, dBm_u, dBm_u > SecondaryCcaSensitivityThresholds
Tuple identifying CCA sensitivity thresholds for secondary channels.
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
receive notifications about PHY events.
Class that keeps track of all information about the current PHY operating channel.
static ConstIterator FindFirst(uint8_t number, MHz_u frequency, MHz_u width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first frequency segment matching the specified parameters.
This objects implements the PHY state machine of the Wifi device.
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.
#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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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.
#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 ...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_MOD_CLASS_OFDM
OFDM (Clause 17)
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
@ WIFI_CHANLIST_SECONDARY40
@ WIFI_CHANLIST_SECONDARY
@ WIFI_CHANLIST_SECONDARY160
@ WIFI_CHANLIST_SECONDARY80
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
std::vector< BandInfo > Bands
Container of BandInfo.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Watt_u DbmToW(dBm_u val)
Convert from dBm to Watts.
Hz_u MHzToHz(MHz_u val)
Convert from MHz to Hz.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
structure that holds information to perform CCA check
Time expectedCcaEndTime
expected CCA_BUSY end time
Time timePoint
time at which the check will performed
std::vector< Time > expectedPer20MhzDurations
expected per-20 MHz CCA duration
WifiChannelListType expectedChannelListType
expected channel list type
structure that holds information to perform PHY state check
WifiPhyState expectedPhyState
expected PHY state
Time timePoint
time at which the check will performed
structure that holds information to generate PPDUs
dBm_u power
transmit power to use
Time startTime
time at which transmission will be started
MHz_u centerFreq
center frequency to use
MHz_u bandwidth
bandwidth to use
structure that holds information to generate signals
MHz_u centerFreq
center frequency to use
Time startTime
time at which transmission will be started
MHz_u bandwidth
bandwidth to use
Time duration
the duration of the transmission
dBm_u power
transmit power to use
The building block of a SpectrumModel.
double fc
center frequency
double fl
lower limit of subband
double fh
upper limit of subband
const Time aCcaTimeWithDelta
constexpr MHz_u P320_CENTER_FREQUENCY
constexpr MHz_u S80_CENTER_FREQUENCY
static WifiPhyCcaTestSuite WifiPhyCcaTestSuite
the test suite
constexpr MHz_u S20_CENTER_FREQUENCY
constexpr MHz_u P20_CENTER_FREQUENCY
constexpr MHz_u S160_CENTER_FREQUENCY
const Time phyHeaderDuration
constexpr MHz_u S40_CENTER_FREQUENCY
const std::map< MHz_u, Time > ehtPpduDurations
constexpr MHz_u P160_CENTER_FREQUENCY
constexpr MHz_u P80_CENTER_FREQUENCY
constexpr MHz_u P40_CENTER_FREQUENCY
const std::map< MHz_u, Time > hePpduDurations