9#include "ns3/interference-helper.h"
11#include "ns3/multi-model-spectrum-channel.h"
12#include "ns3/nist-error-rate-model.h"
13#include "ns3/ofdm-phy.h"
14#include "ns3/ofdm-ppdu.h"
15#include "ns3/spectrum-phy.h"
16#include "ns3/spectrum-wifi-helper.h"
17#include "ns3/spectrum-wifi-phy.h"
19#include "ns3/wifi-mac-header.h"
20#include "ns3/wifi-net-device.h"
21#include "ns3/wifi-psdu.h"
22#include "ns3/wifi-spectrum-phy-interface.h"
23#include "ns3/wifi-spectrum-signal-parameters.h"
24#include "ns3/wifi-spectrum-value-helper.h"
25#include "ns3/wifi-utils.h"
82 std::vector<bool> statusPerMpdu);
124 m_ccabusyStateCount(0)
148 const auto txDuration =
149 m_phy->CalculateTxDuration(psdu->GetSize(), txVector,
m_phy->GetPhyBand());
159 txParams->psd = txPowerSpectrum;
160 txParams->txPhy =
nullptr;
161 txParams->duration = txDuration;
162 txParams->ppdu = ppdu;
169 auto txPowerSpectrum =
175 txParams->psd = txPowerSpectrum;
176 txParams->txPhy =
nullptr;
177 txParams->duration =
Seconds(0.5);
198 std::vector<bool> statusPerMpdu)
223 if (newState == WifiPhyState::IDLE)
227 else if (newState == WifiPhyState::RX)
231 else if (newState == WifiPhyState::CCA_BUSY)
245 m_phy->SetInterferenceHelper(interferenceHelper);
247 m_phy->SetErrorRateModel(error);
248 m_phy->SetDevice(dev);
249 m_phy->AddChannel(spectrumChannel);
254 m_phy->TraceConnectWithoutContext(
"PhyRxDrop",
256 m_phy->GetState()->TraceConnectWithoutContext(
260 node->AddDevice(dev);
283 void DoRun()
override;
294 const auto txPower =
DbmToW(-110);
307 "Reception should not have been triggered if packet is weaker than "
308 "RxSensitivity threshold");
311 "State should stay idle if reception involves a signal weaker than "
312 "RxSensitivity threshold");
329 void DoRun()
override;
344 const auto txPower =
DbmToW(-90);
357 "Reception of non-wifi packet should not be triggered");
360 "State should stay idle if reception involves a signal weaker than "
361 "RxSensitivity threshold");
378 void DoRun()
override;
393 const auto txPower =
DbmToW(-60);
406 "Packet reception should have been successful");
412 "State should have moved to CCA_BUSY, then to RX and finally back to IDLE");
431 void DoRun()
override;
446 const auto txPower =
DbmToW(-60);
459 "Reception of non-wifi packet should not be triggered");
462 "State should have moved to CCA-BUSY then back to IDLE");
Wifi Phy Threshold Strong Foreign Signal Test.
~WifiPhyThresholdsStrongForeignSignalTest() override
WifiPhyThresholdsStrongForeignSignalTest()
void DoRun() override
Implementation to actually run this TestCase.
Wifi Phy Threshold Strong Wifi Signal Test.
void DoRun() override
Implementation to actually run this TestCase.
~WifiPhyThresholdsStrongWifiSignalTest() override
WifiPhyThresholdsStrongWifiSignalTest()
Wifi Phy Threshold Test base class.
uint32_t m_rxDropped
count number of dropped packets
virtual void SendSignal(Watt_u txPower, bool wifiSignal)
Send signal function.
uint32_t m_ccabusyStateCount
count number of PHY state change to CCA_BUSY state
uint32_t m_idleStateCount
count number of PHY state change to IDLE state
uint32_t m_rxStateCount
count number of PHY state change to RX state
virtual Ptr< SpectrumSignalParameters > MakeForeignSignal(Watt_u txPower)
Make foreign signal function.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
virtual void PhyStateChanged(Time start, Time duration, WifiPhyState newState)
PHY state changed callback function.
uint32_t m_stateChanged
count number of PHY state change
uint32_t m_rxFailure
count number of unsuccessfuly received packets
virtual Ptr< SpectrumSignalParameters > MakeWifiSignal(Watt_u txPower, const WifiPhyOperatingChannel &channel)
Make wifi signal function.
virtual void RxFailure(Ptr< const WifiPsdu > psdu)
PHY receive failure callback function.
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
PHY dropped packet callback function.
Ptr< SpectrumWifiPhy > m_phy
PHY object.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
virtual void RxSuccess(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
PHY receive success callback function.
WifiPhyThresholdsTest(std::string test_name)
Constructor.
uint32_t m_rxSuccess
count number of successfully received packets
Wifi Phy Thresholds Test Suite.
WifiPhyThresholdsTestSuite()
Wifi Phy Threshold Weak Foreign Signal Test.
WifiPhyThresholdsWeakForeignSignalTest()
~WifiPhyThresholdsWeakForeignSignalTest() override
void DoRun() override
Implementation to actually run this TestCase.
Wifi Phy Threshold Weak Wifi Signal Test.
void DoRun() override
Implementation to actually run this TestCase.
WifiPhyThresholdsWeakWifiSignalTest()
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6 Mbps.
Smart pointer class similar to boost::intrusive_ptr.
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 void Run()
Run the simulation.
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.
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
Class that keeps track of all information about the current PHY operating channel.
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(MHz_u centerFrequency, MHz_u channelWidth, Watt_u txPower, MHz_u guardBandwidth, dBr_u minInnerBand=-20, dBr_u minOuterband=-28, dBr_u lowestPoint=-40, const std::vector< bool > &puncturedSubchannels={})
Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802....
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 ",...
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.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Watt_u DbmToW(dBm_u val)
Convert from dBm to Watts.
RxSignalInfo structure containing info on the received signal.
static const uint8_t CHANNEL_NUMBER
static const MHz_u FREQUENCY
static WifiPhyThresholdsTestSuite wifiPhyThresholdsTestSuite
the test suite
static const MHz_u CHANNEL_WIDTH