A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
TestWifiPhyRxTraceHelper Class Reference

Implements a test case to evaluate the reception process of WiFi Physical Layer (PHY) frames (PPDU) with multiple MAC Protocol Data Units (MPDUs). More...

+ Inheritance diagram for TestWifiPhyRxTraceHelper:
+ Collaboration diagram for TestWifiPhyRxTraceHelper:

Public Member Functions

 TestWifiPhyRxTraceHelper (std::string test_name)
 Constructs a TestWifiPhyRxTraceHelper instance with a given test name.
 
 ~TestWifiPhyRxTraceHelper () override=default
 Destructor.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void CheckAllStats (uint64_t expectedPpduSuccess, uint64_t expectedPpduFailure, uint64_t expectedMpduSuccess, uint64_t expectedMpduFailure, uint64_t expectedOverlaps, uint64_t expectedNonOverlaps)
 Checks the statistics of PPDU and MPDU reception success and failure.
 
void CheckRecords (uint64_t expectedRecordCount)
 Checks the statistics of PPDU and MPDU reception success and failure.
 
void CheckStats (WifiPhyTraceStatistics expectedStats, uint32_t nodeId, uint32_t deviceId, uint32_t linkId)
 Checks the statistics of PPDU and MPDU reception success and failure.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
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.
 
void SendPpduWithOneMpdu (double rxPowerDbm, Mac48Address add1, Ptr< ns3::SpectrumWifiPhy > tx_phy)
 Sends a PPDU containing one MPDU addressed to a specific receiver.
 
void SendPpduWithTwoMpdus (double rxPowerDbm, Mac48Address add1, Mac48Address add2, Ptr< ns3::SpectrumWifiPhy > tx_phy)
 Sends a PPDU containing two MPDUs addressed to specific receivers.
 

Private Attributes

Mac48Address correctReceiver
 The MAC address representing the correct receiver, used for testing.
 
Ptr< SpectrumWifiPhym_rx {nullptr}
 The receive function for testing.
 
WifiPhyRxTraceHelper m_rxTraceHelper
 The helper being tested for tracking PHY reception events.
 
Ptr< SpectrumWifiPhym_txA {nullptr}
 The transmit function for node A.
 
Ptr< SpectrumWifiPhym_txB {nullptr}
 The transmit function for node B.
 
std::map< ns3::Mac48Address, uint32_tMacToNodeId
 Maps MAC addresses to node IDs.
 
Ptr< NodenodeRx
 The receiving node.
 
Mac48Address wrongReceiver
 The MAC address representing an incorrect receiver, used for testing.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
using TestDuration = Duration
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto QUICK = Duration::QUICK
 
static constexpr auto TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

Implements a test case to evaluate the reception process of WiFi Physical Layer (PHY) frames (PPDU) with multiple MAC Protocol Data Units (MPDUs).

This class extends the TestCase class to simulate and analyze the reception of PPDUs containing either one or two MPDUs. It specifically tests the PHY layer's capability to handle multiple MPDUs addressed to specific receivers, measuring success and failure rates. The simulation setup includes configuring transmit and receive power levels, and the class provides functionality to check statistics related to PPDU and MPDU reception success and failure, as well as overlap handling.

Definition at line 77 of file wifi-phy-rx-trace-helper-test.cc.

Constructor & Destructor Documentation

◆ TestWifiPhyRxTraceHelper()

TestWifiPhyRxTraceHelper::TestWifiPhyRxTraceHelper ( std::string  test_name)

Constructs a TestWifiPhyRxTraceHelper instance with a given test name.

Parameters
test_nameThe name of the test case.

Definition at line 176 of file wifi-phy-rx-trace-helper-test.cc.

◆ ~TestWifiPhyRxTraceHelper()

TestWifiPhyRxTraceHelper::~TestWifiPhyRxTraceHelper ( )
overridedefault

Destructor.

Member Function Documentation

◆ CheckAllStats()

void TestWifiPhyRxTraceHelper::CheckAllStats ( uint64_t  expectedPpduSuccess,
uint64_t  expectedPpduFailure,
uint64_t  expectedMpduSuccess,
uint64_t  expectedMpduFailure,
uint64_t  expectedOverlaps,
uint64_t  expectedNonOverlaps 
)
private

Checks the statistics of PPDU and MPDU reception success and failure.

Parameters
expectedPpduSuccessThe expected number of successful PPDU receptions.
expectedPpduFailureThe expected number of failed PPDU receptions.
expectedMpduSuccessThe expected number of successful MPDU receptions within PPDUs.
expectedMpduFailureThe expected number of failed MPDU receptions within PPDUs.
expectedOverlapsThe expected number of overlapping reception events.
expectedNonOverlapsThe expected number of non-overlapping reception events.

Definition at line 322 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::WifiPhyRxTraceHelper::GetStatistics(), ns3::WifiPhyTraceStatistics::m_failedMpdus, ns3::WifiPhyTraceStatistics::m_failedPpdus, ns3::WifiPhyTraceStatistics::m_nonOverlappingPpdus, ns3::WifiPhyTraceStatistics::m_overlappingPpdus, ns3::WifiPhyTraceStatistics::m_receivedMpdus, ns3::WifiPhyTraceStatistics::m_receivedPpdus, m_rxTraceHelper, NS_TEST_ASSERT_MSG_EQ, and ns3::WifiPhyRxTraceHelper::Reset().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckRecords()

void TestWifiPhyRxTraceHelper::CheckRecords ( uint64_t  expectedRecordCount)
private

Checks the statistics of PPDU and MPDU reception success and failure.

Parameters
expectedRecordCountThe expected number of records.

Definition at line 381 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::WifiPhyRxTraceHelper::GetPpduRecords(), m_rxTraceHelper, and NS_TEST_ASSERT_MSG_EQ.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckStats()

void TestWifiPhyRxTraceHelper::CheckStats ( WifiPhyTraceStatistics  expectedStats,
uint32_t  nodeId,
uint32_t  deviceId,
uint32_t  linkId 
)
private

Checks the statistics of PPDU and MPDU reception success and failure.

Parameters
expectedStatsThe expected counts for PPDU and MPDU reception.
nodeIdThe node ID for which to check the received stats.
deviceIdThe device ID for which to check the received stats.
linkIdThe link ID for which to check the received stats.

Definition at line 353 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::WifiPhyRxTraceHelper::GetStatistics(), ns3::WifiPhyTraceStatistics::m_failedMpdus, ns3::WifiPhyTraceStatistics::m_failedPpdus, ns3::WifiPhyTraceStatistics::m_nonOverlappingPpdus, ns3::WifiPhyTraceStatistics::m_overlappingPpdus, ns3::WifiPhyTraceStatistics::m_receivedMpdus, ns3::WifiPhyTraceStatistics::m_receivedPpdus, m_rxTraceHelper, and NS_TEST_ASSERT_MSG_EQ.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRun()

◆ DoSetup()

void TestWifiPhyRxTraceHelper::DoSetup ( )
overrideprivatevirtual

Implementation to do any local setup required for this TestCase.

Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.

Reimplemented from ns3::TestCase.

Definition at line 182 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::NodeContainer::Add(), ns3::SpectrumWifiPhy::AddChannel(), ns3::Node::AddDevice(), ns3::WifiPhy::ConfigureStandard(), ns3::WifiPhyRxTraceHelper::Enable(), m_rx, m_rxTraceHelper, m_txA, m_txB, MacToNodeId, nodeRx, nodes, ns3::SpectrumWifiPhy::SetDevice(), ns3::WifiPhy::SetErrorRateModel(), ns3::WifiPhy::SetInterferenceHelper(), ns3::WifiPhy::SetOperatingChannel(), ns3::WifiPhy::SetPreambleDetectionModel(), ns3::WifiPhy::SetTxPowerEnd(), ns3::WifiPhy::SetTxPowerStart(), ns3::WIFI_PHY_BAND_5GHZ, and ns3::WIFI_STANDARD_80211ax.

+ Here is the call graph for this function:

◆ DoTeardown()

void TestWifiPhyRxTraceHelper::DoTeardown ( )
overrideprivatevirtual

Implementation to do any local setup required for this TestCase.

Subclasses should override this method to perform any costly per-test teardown

Reimplemented from ns3::TestCase.

Definition at line 255 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::Object::Dispose(), m_rx, m_txA, and m_txB.

+ Here is the call graph for this function:

◆ SendPpduWithOneMpdu()

void TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu ( double  rxPowerDbm,
Mac48Address  add1,
Ptr< ns3::SpectrumWifiPhy tx_phy 
)
private

Sends a PPDU containing one MPDU addressed to a specific receiver.

Parameters
rxPowerDbmThe transmit power in dBm.
add1The MAC address of the receiver.
tx_phyThe transmitting PHY object.

Definition at line 297 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::HePhy::GetHeMcs0(), ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::WifiMacHeader::SetType(), ns3::WIFI_MAC_QOSDATA, and ns3::WIFI_PREAMBLE_HE_SU.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPpduWithTwoMpdus()

void TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus ( double  rxPowerDbm,
Mac48Address  add1,
Mac48Address  add2,
Ptr< ns3::SpectrumWifiPhy tx_phy 
)
private

Sends a PPDU containing two MPDUs addressed to specific receivers.

Parameters
rxPowerDbmThe transmit power in dBm.
add1The MAC address of the first receiver.
add2The MAC address of the second receiver.
tx_phyThe transmitting PHY object.

Definition at line 263 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::HePhy::GetHeMcs0(), ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::WifiMacHeader::SetType(), ns3::WIFI_MAC_QOSDATA, and ns3::WIFI_PREAMBLE_HE_SU.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ correctReceiver

Mac48Address TestWifiPhyRxTraceHelper::correctReceiver
private
Initial value:
=
Mac48Address("00:00:00:00:00:03")

The MAC address representing the correct receiver, used for testing.

Definition at line 155 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoRun().

◆ m_rx

Ptr<SpectrumWifiPhy> TestWifiPhyRxTraceHelper::m_rx {nullptr}
private

The receive function for testing.

Definition at line 170 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoRun(), DoSetup(), and DoTeardown().

◆ m_rxTraceHelper

WifiPhyRxTraceHelper TestWifiPhyRxTraceHelper::m_rxTraceHelper
private

The helper being tested for tracking PHY reception events.

Definition at line 173 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by CheckAllStats(), CheckRecords(), CheckStats(), DoRun(), and DoSetup().

◆ m_txA

Ptr<SpectrumWifiPhy> TestWifiPhyRxTraceHelper::m_txA {nullptr}
private

The transmit function for node A.

Definition at line 168 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoRun(), DoSetup(), and DoTeardown().

◆ m_txB

Ptr<SpectrumWifiPhy> TestWifiPhyRxTraceHelper::m_txB {nullptr}
private

The transmit function for node B.

Definition at line 169 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoRun(), DoSetup(), and DoTeardown().

◆ MacToNodeId

std::map<ns3::Mac48Address, uint32_t> TestWifiPhyRxTraceHelper::MacToNodeId
private
Initial value:
= {
{Mac48Address("00:00:00:00:00:04"), 0},
{Mac48Address("00:00:00:00:00:05"), 1},
Mac48Address wrongReceiver
The MAC address representing an incorrect receiver, used for testing.
Mac48Address correctReceiver
The MAC address representing the correct receiver, used for testing.
an EUI-48 address
Definition: mac48-address.h:46

Maps MAC addresses to node IDs.

This is done since there is no MAC layer configured and therefore the helper cannot obtain the MAC addresses automatically.

Definition at line 159 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoSetup().

◆ nodeRx

Ptr<Node> TestWifiPhyRxTraceHelper::nodeRx
private

The receiving node.

Definition at line 167 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoRun(), and DoSetup().

◆ wrongReceiver

Mac48Address TestWifiPhyRxTraceHelper::wrongReceiver
private
Initial value:
=
Mac48Address("00:00:00:00:00:01")

The MAC address representing an incorrect receiver, used for testing.

Definition at line 152 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoRun().


The documentation for this class was generated from the following file: