23 #include "ns3/spectrum-wifi-helper.h" 24 #include "ns3/wifi-spectrum-value-helper.h" 25 #include "ns3/spectrum-wifi-phy.h" 26 #include "ns3/nist-error-rate-model.h" 27 #include "ns3/wifi-mac-header.h" 28 #include "ns3/wifi-mac-trailer.h" 29 #include "ns3/wifi-phy-tag.h" 30 #include "ns3/wifi-spectrum-signal-parameters.h" 31 #include "ns3/wifi-utils.h" 32 #include "ns3/wifi-phy-header.h" 72 virtual void SendSignal (
double txPowerWatts,
bool wifiSignal);
110 virtual void DoSetup (
void);
120 m_idleStateCount (0),
121 m_ccabusyStateCount (0)
142 hdr.SetDuration (txDuration);
155 txParams->
psd = txPowerSpectrum;
167 txParams->
psd = txPowerSpectrum;
229 m_phy = CreateObject<SpectrumWifiPhy> ();
255 virtual void DoRun (
void);
270 double txPowerWatts =
DbmToW (-110);
275 Simulator::Destroy ();
295 virtual void DoRun (
void);
310 double txPowerWatts =
DbmToW (-90);
315 Simulator::Destroy ();
335 virtual void DoRun (
void);
350 double txPowerWatts =
DbmToW (-60);
355 Simulator::Destroy ();
378 virtual void DoRun (
void);
393 double txPowerWatts =
DbmToW (-60);
398 Simulator::Destroy ();
417 :
TestSuite (
"wifi-phy-thresholds", UNIT)
WifiPhyThresholdsWeakForeignSignalTest()
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static const uint32_t FREQUENCY
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual void RxSuccess(Ptr< Packet > p, double snr, WifiTxVector txVector, std::vector< bool > statusPerMpdu)
PHY receive success callback function.
Ptr< WifiPhyStateHelper > GetState(void) const
Return the WifiPhyStateHelper of this PHY.
uint32_t m_ccabusyStateCount
count number of PHY state change to CCA_BUSY state
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level Phy interface to this Sp...
uint32_t m_rxDropped
count number of dropped packets
uint32_t m_rxSuccess
count number of successfully received packets
double DbmToW(double dBm)
Convert from dBm to Watts.
void SetReceiveErrorCallback(RxErrorCallback callback)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_rxStateCount
count number of PHY state change to RX state
static const uint8_t CHANNEL_NUMBER
virtual ~WifiPhyThresholdsStrongForeignSignalTest()
Wifi Phy Threshold Strong Foreign Signal Test.
Wifi Phy Threshold Weak Wifi Signal Test.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void RxFailure(Ptr< Packet > p)
PHY receive failure callback function.
virtual void PhyStateChanged(Time start, Time duration, WifiPhyState newState)
PHY state changed callback function.
virtual void SetChannelNumber(uint8_t id)
Set channel number.
virtual Ptr< SpectrumSignalParameters > MakeWifiSignal(double txPowerWatts)
Make wifi signal function.
Wifi Phy Threshold Strong Wifi Signal Test.
Wifi Phy Threshold Weak Foreign Signal Test.
void RxDropped(Ptr< const Packet > p, WifiPhyRxfailureReason reason)
PHY dropped packet callback function.
WifiPreamble GetPreambleType(void) const
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, uint16_t frequency)
HE PHY for the 5 GHz band (clause 26)
uint32_t m_stateChanged
count number of PHY state change
static WifiPhyThresholdsTestSuite wifiPhyThresholdsTestSuite
the test suite
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void ConfigureStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
uint32_t GetSerializedSize(void) const
#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.
virtual void DoSetup(void)
Implementation to do any local setup required for this TestCase.
WifiMode GetMode(void) const
The PHY layer has sense the medium busy through the CCA mechanism.
Ptr< SpectrumPhy > txPhy
The SpectrumPhy instance that is making the transmission.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
WifiPhyThresholdsTestSuite()
WifiModulationClass GetModulationClass() const
virtual void SetFrequency(uint16_t freq)
virtual ~WifiPhyThresholdsWeakWifiSignalTest()
WifiPhyThresholdsStrongWifiSignalTest()
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Sets the error rate model.
virtual void SendSignal(double txPowerWatts, bool wifiSignal)
Send signal function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
WifiPhyThresholdsWeakWifiSignalTest()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t CHANNEL_WIDTH
uint16_t GetFrequency(void) const
WifiPhyState
The state of the PHY layer.
void AddTrailer(const Trailer &trailer)
Add trailer to this packet.
Ptr< Packet > packet
The packet being transmitted with this signal.
virtual ~WifiPhyThresholdsStrongWifiSignalTest()
uint32_t m_rxFailure
count number of unsuccessfully received packets
void SetReceiveOkCallback(RxOkCallback callback)
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
virtual ~WifiPhyThresholdsWeakForeignSignalTest()
Ptr< SpectrumWifiPhy > m_phy
PHY object.
Time Seconds(double value)
Construct a Time in the indicated unit.
The PHY layer is receiving a packet.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t m_idleStateCount
count number of PHY state change to IDLE state
virtual Ptr< SpectrumSignalParameters > MakeForeignSignal(double txPowerWatts)
Make foreign signal function.
Tag for WifiTxVector and WifiPreamble information to be embedded in outgoing transmissions as a Packe...
Time duration
The duration of the packet transmission.
WifiPhyThresholdsStrongForeignSignalTest()
virtual ~WifiPhyThresholdsTest()
WifiPhyThresholdsTest(std::string test_name)
void AddHeader(const Header &header)
Add header to this packet.
Implements the IEEE 802.11 MAC trailer.
Wifi Phy Threshold Test base class.
Wifi Phy Thresholds Test Suite.