20 #include "ns3/interference-helper.h"
22 #include "ns3/multi-model-spectrum-channel.h"
23 #include "ns3/nist-error-rate-model.h"
24 #include "ns3/ofdm-phy.h"
25 #include "ns3/ofdm-ppdu.h"
26 #include "ns3/spectrum-phy.h"
27 #include "ns3/spectrum-wifi-helper.h"
28 #include "ns3/spectrum-wifi-phy.h"
30 #include "ns3/wifi-mac-header.h"
31 #include "ns3/wifi-net-device.h"
32 #include "ns3/wifi-psdu.h"
33 #include "ns3/wifi-spectrum-phy-interface.h"
34 #include "ns3/wifi-spectrum-signal-parameters.h"
35 #include "ns3/wifi-spectrum-value-helper.h"
36 #include "ns3/wifi-utils.h"
86 virtual void SendSignal(
double txPowerWatts,
bool wifiSignal);
97 std::vector<bool> statusPerMpdu);
127 void DoSetup()
override;
128 void DoTeardown()
override;
139 m_ccabusyStateCount(0)
172 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
178 txParams->psd = txPowerSpectrum;
179 txParams->txPhy =
nullptr;
180 txParams->duration = txDuration;
181 txParams->ppdu = ppdu;
189 WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
FREQUENCY,
194 txParams->
psd = txPowerSpectrum;
195 txParams->
txPhy =
nullptr;
217 std::vector<bool> statusPerMpdu)
262 m_phy = CreateObject<SpectrumWifiPhy>();
303 void DoRun()
override;
318 double txPowerWatts =
DbmToW(-110);
320 Simulator::Schedule(
Seconds(1),
327 Simulator::Destroy();
331 "Reception should not have been triggered if packet is weaker than "
332 "RxSensitivity threshold");
335 "State should stay idle if reception involves a signal weaker than "
336 "RxSensitivity threshold");
353 void DoRun()
override;
368 double txPowerWatts =
DbmToW(-90);
370 Simulator::Schedule(
Seconds(1),
377 Simulator::Destroy();
381 "Reception of non-wifi packet should not be triggered");
384 "State should stay idle if reception involves a signal weaker than "
385 "RxSensitivity threshold");
402 void DoRun()
override;
417 double txPowerWatts =
DbmToW(-60);
419 Simulator::Schedule(
Seconds(1),
426 Simulator::Destroy();
430 "Packet reception should have been successful");
436 "State should have moved to CCA_BUSY, then to RX and finally back to IDLE");
455 void DoRun()
override;
470 double txPowerWatts =
DbmToW(-60);
472 Simulator::Schedule(
Seconds(1),
479 Simulator::Destroy();
483 "Reception of non-wifi packet should not be triggered");
486 "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
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
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.
virtual Ptr< SpectrumSignalParameters > MakeWifiSignal(double txPowerWatts, const WifiPhyOperatingChannel &channel)
Make wifi signal function.
~WifiPhyThresholdsTest() override
Destructor.
uint32_t m_stateChanged
count number of PHY state change
uint32_t m_rxFailure
count number of unsuccessfuly received packets
virtual void RxFailure(Ptr< const WifiPsdu > psdu)
PHY receive failure callback function.
virtual Ptr< SpectrumSignalParameters > MakeForeignSignal(double txPowerWatts)
Make foreign signal 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.
virtual void SendSignal(double txPowerWatts, bool wifiSignal)
Send signal 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()
~WifiPhyThresholdsWeakWifiSignalTest() override
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void Dispose()
Dispose of this Object.
void SetDevice(const Ptr< WifiNetDevice > device) override
Sets the device this PHY is associated with.
void StartRx(Ptr< SpectrumSignalParameters > rxParams, Ptr< const WifiSpectrumPhyInterface > interface)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Attach a SpectrumChannel to use for a given frequency range.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
void SetPhy(const Ptr< WifiPhy > phy)
virtual void SetInterferenceHelper(const Ptr< InterferenceHelper > helper)
Sets the interference helper.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
void SetReceiveErrorCallback(RxErrorCallback callback)
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Ptr< WifiPhyStateHelper > GetState() const
Return the WifiPhyStateHelper of this PHY.
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
void SetReceiveOkCallback(RxOkCallback callback)
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Class that keeps track of all information about the current PHY operating channel.
uint32_t GetSize() const
Return the size of the PSDU in bytes.
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_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
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.
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...
double DbmToW(double dBm)
Convert from dBm to Watts.
RxSignalInfo structure containing info on the received signal.
Time duration
The duration of the packet transmission.
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
WifiPhyState
The state of the PHY layer.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ RX
The PHY layer is receiving a packet.
@ IDLE
The PHY layer is IDLE.
static const uint8_t CHANNEL_NUMBER
static WifiPhyThresholdsTestSuite wifiPhyThresholdsTestSuite
the test suite
static const uint16_t CHANNEL_WIDTH
static const uint32_t FREQUENCY