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...
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 |
TestCase & | operator= (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< YansWifiPhy > | m_rx {nullptr} |
The receive function for testing. | |
WifiPhyRxTraceHelper | m_rxTraceHelper |
The helper being tested for tracking PHY reception events. | |
Ptr< YansWifiPhy > | m_txA {nullptr} |
The transmit function for node A. | |
Ptr< YansWifiPhy > | m_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_t > | MacToNodeId |
Maps MAC addresses to node IDs. | |
Ptr< Node > | nodeRx |
The receiving node. | |
Ptr< FixedRssLossModel > | propLoss |
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... | |
Static Public Attributes inherited from ns3::TestCase | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::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. | |
TestCase * | GetParent () 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. | |
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 1689 of file wifi-phy-rx-trace-helper-test.cc.
TestWifiPhyRxTraceHelperYans::TestWifiPhyRxTraceHelperYans | ( | ) |
Constructs a TestWifiPhyRxTraceHelperYans instance for testing the trace helper with Yans.
Definition at line 1786 of file wifi-phy-rx-trace-helper-test.cc.
|
private |
Checks the statistics of PPDU and MPDU reception success and failure.
expectedPpduSuccess | The expected number of successful PPDU receptions. |
expectedPpduFailure | The expected number of failed PPDU receptions. |
expectedMpduSuccess | The expected number of successful MPDU receptions within PPDUs. |
expectedMpduFailure | The expected number of failed MPDU receptions within PPDUs. |
expectedOverlaps | The expected number of overlapping reception events. |
expectedNonOverlaps | The expected number of non-overlapping reception events. |
Definition at line 1975 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().
|
private |
Checks the statistics of PPDU and MPDU reception success and failure.
expectedRecordCount | The expected number of records. |
Definition at line 2035 of file wifi-phy-rx-trace-helper-test.cc.
References ns3::WifiPhyRxTraceHelper::GetPpduRecords(), m_rxTraceHelper, and NS_TEST_ASSERT_MSG_EQ.
Referenced by DoRun().
|
private |
Checks the statistics of PPDU and MPDU reception success and failure.
expectedStats | The expected counts for PPDU and MPDU reception. |
nodeId | The node ID for which to check the received stats. |
deviceId | The device ID for which to check the received stats. |
linkId | The link ID for which to check the received stats. |
Definition at line 2007 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().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 2044 of file wifi-phy-rx-trace-helper-test.cc.
References ns3::WifiPhy::AssignStreams(), CheckAllStats(), CheckRecords(), CheckStats(), correctReceiver, ns3::Simulator::Destroy(), ns3::Node::GetId(), 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_rx, m_rxTraceHelper, m_txA, m_txB, ns3::MicroSeconds(), nodeRx, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), SendPpduWithOneMpdu(), SendPpduWithTwoMpdus(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), ns3::WifiPhyRxTraceHelper::Start(), ns3::WifiPhyRxTraceHelper::Stop(), and wrongReceiver.
|
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 1792 of file wifi-phy-rx-trace-helper-test.cc.
References ns3::NodeContainer::Add(), ns3::Node::AddDevice(), ns3::Object::AggregateObject(), ns3::WifiPhy::ConfigureStandard(), ns3::CreateObject(), 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.
|
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 1881 of file wifi-phy-rx-trace-helper-test.cc.
References ns3::Object::Dispose(), m_rx, m_txA, and m_txB.
|
private |
Sends a PPDU containing one MPDU addressed to a specific receiver.
rxPowerDbm | The transmit power in dBm. |
add1 | The MAC address of the receiver. |
tx_phy | The transmitting PHY object. |
Definition at line 1936 of file wifi-phy-rx-trace-helper-test.cc.
References ns3::Create(), ns3::HePhy::GetHeMcs0(), m_uid, ns3::NanoSeconds(), propLoss, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::WifiMacHeader::SetType(), ns3::WIFI_MAC_QOSDATA, and ns3::WIFI_PREAMBLE_HE_SU.
Referenced by DoRun().
|
private |
Sends a PPDU containing two MPDUs addressed to specific receivers.
rxPowerDbm | The transmit power in dBm. |
add1 | The MAC address of the first receiver. |
add2 | The MAC address of the second receiver. |
tx_phy | The transmitting PHY object. |
Definition at line 1889 of file wifi-phy-rx-trace-helper-test.cc.
References ns3::Create(), ns3::HePhy::GetHeMcs0(), m_uid, ns3::NanoSeconds(), propLoss, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::WifiMacHeader::SetType(), ns3::WIFI_MAC_QOSDATA, and ns3::WIFI_PREAMBLE_HE_SU.
Referenced by DoRun().
|
private |
The MAC address representing the correct receiver, used for testing.
Definition at line 1761 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoRun().
|
private |
The receive function for testing.
Definition at line 1776 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoRun(), DoSetup(), and DoTeardown().
|
private |
The helper being tested for tracking PHY reception events.
Definition at line 1781 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by CheckAllStats(), CheckRecords(), CheckStats(), DoRun(), and DoSetup().
|
private |
The transmit function for node A.
Definition at line 1774 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoRun(), DoSetup(), and DoTeardown().
|
private |
The transmit function for node B.
Definition at line 1775 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoRun(), DoSetup(), and DoTeardown().
|
private |
The unique identifier used for the PPDU in the test.
Definition at line 1783 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by SendPpduWithOneMpdu(), and SendPpduWithTwoMpdus().
|
private |
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 1765 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoSetup().
The receiving node.
Definition at line 1773 of file wifi-phy-rx-trace-helper-test.cc.
|
private |
The propagation loss model used to configure RSSI.
Definition at line 1778 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoSetup(), SendPpduWithOneMpdu(), and SendPpduWithTwoMpdus().
|
private |
The MAC address representing an incorrect receiver, used for testing.
Definition at line 1758 of file wifi-phy-rx-trace-helper-test.cc.
Referenced by DoRun().