A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
TestWifiPhyRxTraceHelperYans 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) when using YansWifiPhy. More...

+ Inheritance diagram for TestWifiPhyRxTraceHelperYans:
+ Collaboration diagram for TestWifiPhyRxTraceHelperYans:

Public Member Functions

 TestWifiPhyRxTraceHelperYans ()
 Constructs a TestWifiPhyRxTraceHelperYans instance for testing the trace helper with Yans.
 
- 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::YansWifiPhy > tx_phy)
 Sends a PPDU containing one MPDU addressed to a specific receiver.
 
void SendPpduWithTwoMpdus (double rxPowerDbm, Mac48Address add1, Mac48Address add2, Ptr< ns3::YansWifiPhy > 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< YansWifiPhym_rx {nullptr}
 The receive function for testing.
 
WifiPhyRxTraceHelper m_rxTraceHelper
 The helper being tested for tracking PHY reception events.
 
Ptr< YansWifiPhym_txA {nullptr}
 The transmit function for node A.
 
Ptr< YansWifiPhym_txB {nullptr}
 The transmit function for node B.
 
uint64_t m_uid {0}
 The unique identifier used for the PPDU in the test.
 
std::map< ns3::Mac48Address, uint32_tMacToNodeId
 Maps MAC addresses to node IDs.
 
Ptr< NodenodeRx
 The receiving node.
 
Ptr< FixedRssLossModelpropLoss
 The propagation loss model used to configure RSSI.
 
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) when using YansWifiPhy.

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 1679 of file wifi-phy-rx-trace-helper-test.cc.

Constructor & Destructor Documentation

◆ TestWifiPhyRxTraceHelperYans()

TestWifiPhyRxTraceHelperYans::TestWifiPhyRxTraceHelperYans ( )

Constructs a TestWifiPhyRxTraceHelperYans instance for testing the trace helper with Yans.

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

Member Function Documentation

◆ CheckAllStats()

void TestWifiPhyRxTraceHelperYans::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 1951 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::WifiPhyRxTraceHelper::GetStatistics(), 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 TestWifiPhyRxTraceHelperYans::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 2011 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 TestWifiPhyRxTraceHelperYans::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 1983 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 TestWifiPhyRxTraceHelperYans::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 1782 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::NodeContainer::Add(), ns3::Node::AddDevice(), ns3::Object::AggregateObject(), ns3::WifiPhy::ConfigureStandard(), ns3::WifiPhyRxTraceHelper::Enable(), m_rx, m_rxTraceHelper, m_txA, m_txB, MacToNodeId, nodeRx, nodes, propLoss, ns3::YansWifiPhy::SetChannel(), ns3::WifiPhy::SetDevice(), ns3::WifiPhy::SetErrorRateModel(), ns3::YansWifiPhy::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 TestWifiPhyRxTraceHelperYans::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 1871 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 TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu ( double  rxPowerDbm,
Mac48Address  add1,
Ptr< ns3::YansWifiPhy 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 1919 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::HePhy::GetHeMcs0(), m_uid, propLoss, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::FixedRssLossModel::SetRss(), 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 TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus ( double  rxPowerDbm,
Mac48Address  add1,
Mac48Address  add2,
Ptr< ns3::YansWifiPhy 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 1879 of file wifi-phy-rx-trace-helper-test.cc.

References ns3::HePhy::GetHeMcs0(), m_uid, propLoss, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::FixedRssLossModel::SetRss(), 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 TestWifiPhyRxTraceHelperYans::correctReceiver
private
Initial value:
=
Mac48Address("00:00:00:00:00:03")

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

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

Referenced by DoRun().

◆ m_rx

Ptr<YansWifiPhy> TestWifiPhyRxTraceHelperYans::m_rx {nullptr}
private

The receive function for testing.

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

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

◆ m_rxTraceHelper

WifiPhyRxTraceHelper TestWifiPhyRxTraceHelperYans::m_rxTraceHelper
private

The helper being tested for tracking PHY reception events.

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

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

◆ m_txA

Ptr<YansWifiPhy> TestWifiPhyRxTraceHelperYans::m_txA {nullptr}
private

The transmit function for node A.

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

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

◆ m_txB

Ptr<YansWifiPhy> TestWifiPhyRxTraceHelperYans::m_txB {nullptr}
private

The transmit function for node B.

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

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

◆ m_uid

uint64_t TestWifiPhyRxTraceHelperYans::m_uid {0}
private

The unique identifier used for the PPDU in the test.

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

Referenced by SendPpduWithOneMpdu(), and SendPpduWithTwoMpdus().

◆ MacToNodeId

std::map<ns3::Mac48Address, uint32_t> TestWifiPhyRxTraceHelperYans::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 1755 of file wifi-phy-rx-trace-helper-test.cc.

Referenced by DoSetup().

◆ nodeRx

Ptr<Node> TestWifiPhyRxTraceHelperYans::nodeRx
private

The receiving node.

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

Referenced by DoRun(), and DoSetup().

◆ propLoss

Ptr<FixedRssLossModel> TestWifiPhyRxTraceHelperYans::propLoss
private

The propagation loss model used to configure RSSI.

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

Referenced by DoSetup(), SendPpduWithOneMpdu(), and SendPpduWithTwoMpdus().

◆ wrongReceiver

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

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

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

Referenced by DoRun().


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