6#include "ns3/ampdu-tag.h"
7#include "ns3/ap-wifi-mac.h"
8#include "ns3/boolean.h"
10#include "ns3/constant-position-mobility-model.h"
11#include "ns3/double.h"
12#include "ns3/eht-configuration.h"
13#include "ns3/he-phy.h"
14#include "ns3/he-ppdu.h"
15#include "ns3/interference-helper.h"
17#include "ns3/mobility-helper.h"
18#include "ns3/mpdu-aggregator.h"
19#include "ns3/multi-model-spectrum-channel.h"
20#include "ns3/nist-error-rate-model.h"
21#include "ns3/ofdm-ppdu.h"
22#include "ns3/packet-socket-address.h"
23#include "ns3/packet-socket-client.h"
24#include "ns3/packet-socket-helper.h"
25#include "ns3/packet-socket-server.h"
26#include "ns3/pointer.h"
27#include "ns3/propagation-loss-model.h"
28#include "ns3/rng-seed-manager.h"
29#include "ns3/simple-frame-capture-model.h"
30#include "ns3/single-model-spectrum-channel.h"
31#include "ns3/spectrum-wifi-helper.h"
32#include "ns3/spectrum-wifi-phy.h"
34#include "ns3/threshold-preamble-detection-model.h"
35#include "ns3/wifi-bandwidth-filter.h"
36#include "ns3/wifi-mac-header.h"
37#include "ns3/wifi-mpdu.h"
38#include "ns3/wifi-net-device.h"
39#include "ns3/wifi-phy-rx-trace-helper.h"
40#include "ns3/wifi-psdu.h"
41#include "ns3/wifi-spectrum-phy-interface.h"
42#include "ns3/wifi-spectrum-signal-parameters.h"
43#include "ns3/wifi-spectrum-value-helper.h"
44#include "ns3/wifi-utils.h"
45#include "ns3/yans-wifi-channel.h"
46#include "ns3/yans-wifi-phy.h"
82 void DoRun()
override;
269 std::vector<Ptr<WifiMpdu>>
mpduList;
287 tx_phy->Send(psdu, txVector);
309 std::vector<Ptr<WifiMpdu>>
mpduList;
319 tx_phy->Send(psdu, txVector);
334 "Didn't receive right number of successful PPDUs");
337 "Didn't receive right number of unsuccessful PPDUs");
340 "Didn't receive right number of successful MPDUs");
343 "Didn't receive right number of unsuccessful MPDUs");
346 "Didn't receive right number of overlapping PPDUs");
349 "Didn't receive right number of nonoverlapping PPDUs");
363 "Didn't receive right number of successful PPDUs");
366 "Didn't receive right number of unsuccessful PPDUs");
369 "Didn't receive right number of successful MPDUs");
372 "Didn't receive right number of unsuccessful MPDUs");
375 "Didn't receive right number of overlapping PPDUs");
378 "Didn't receive right number of nonoverlapping PPDUs");
387 "Didn't produce the right number of Records");
865 void DoRun()
override;
967 :
TestCase(
"Test for correct MLO operation")
1076 std::vector<Ptr<WifiPhy>>
phys0;
1080 std::vector<Ptr<WifiPhy>>
phys1;
1084 std::vector<Ptr<WifiPhy>>
physRx;
1095 nodeRx->AddDevice(
devRx);
1141 std::vector<Ptr<WifiMpdu>>
mpduList;
1159 tx_phy->Send(psdu, txVector);
1182 std::vector<Ptr<WifiMpdu>>
mpduList;
1192 tx_phy->Send(psdu, txVector);
1211 "Didn't receive right number of successful PPDUs");
1214 "Didn't receive right number of unsuccessful PPDUs");
1217 "Didn't receive right number of successful MPDUs");
1220 "Didn't receive right number of unsuccessful MPDUs");
1223 "Didn't receive right number of overlapping PPDUs");
1226 "Didn't receive right number of nonoverlapping PPDUs");
1245 "Didn't receive right number of successful PPDUs");
1248 "Didn't receive right number of unsuccessful PPDUs");
1251 "Didn't receive right number of successful MPDUs");
1254 "Didn't receive right number of unsuccessful MPDUs");
1257 "Didn't receive right number of overlapping PPDUs");
1260 "Didn't receive right number of nonoverlapping PPDUs");
1273 "Didn't receive right number of successful PPDUs");
1276 "Didn't receive right number of unsuccessful PPDUs");
1279 "Didn't receive right number of successful MPDUs");
1282 "Didn't receive right number of unsuccessful MPDUs");
1285 "Didn't receive right number of overlapping PPDUs");
1288 "Didn't receive right number of nonoverlapping PPDUs");
1303 "Didn't receive right number of successful PPDUs");
1306 "Didn't receive right number of unsuccessful PPDUs");
1309 "Didn't receive right number of successful MPDUs");
1312 "Didn't receive right number of unsuccessful MPDUs");
1315 "Didn't receive right number of overlapping PPDUs");
1318 "Didn't receive right number of nonoverlapping PPDUs");
1329 "Didn't produce the right number of Records");
1696 void DoRun()
override;
1783 :
TestCase(
"Test for correct operation when using Yans")
1852 mobilityA->SetPosition(Vector(0.0, 0.0, 0.0));
1856 mobilityB->SetPosition(Vector(0.0, 0.0, 0.0));
1860 mobilityRx->SetPosition(Vector(0.0, 0.0, 0.0));
1902 std::vector<Ptr<WifiMpdu>>
mpduList;
1922 tx_phy->GetOperatingChannel(),
1923 YansWifiPhy::CalculateTxDuration(psdu->GetSize(), txVector,
tx_phy->GetPhyBand()),
1948 std::vector<Ptr<WifiMpdu>>
mpduList;
1961 tx_phy->GetOperatingChannel(),
1962 YansWifiPhy::CalculateTxDuration(psdu->GetSize(), txVector,
tx_phy->GetPhyBand()),
1982 "Didn't receive right number of successful PPDUs");
1985 "Didn't receive right number of unsuccessful PPDUs");
1988 "Didn't receive right number of successful MPDUs");
1991 "Didn't receive right number of unsuccessful MPDUs");
1994 "Didn't receive right number of overlapping PPDUs");
1997 "Didn't receive right number of nonoverlapping PPDUs");
2012 "Didn't receive right number of successful PPDUs");
2015 "Didn't receive right number of unsuccessful PPDUs");
2018 "Didn't receive right number of successful MPDUs");
2021 "Didn't receive right number of unsuccessful MPDUs");
2024 "Didn't receive right number of overlapping PPDUs");
2027 "Didn't receive right number of nonoverlapping PPDUs");
2036 "Didn't produce the right number of Records");
Implements a test case to evaluate the reception process of WiFi Physical Layer (PHY) frames (PPDU) w...
TestWifiPhyRxTraceHelper(std::string test_name)
Constructs a TestWifiPhyRxTraceHelper instance with a given test name.
void DoRun() override
Implementation to actually run this TestCase.
void SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address add1, Mac48Address add2, Ptr< ns3::SpectrumWifiPhy > tx_phy)
Sends a PPDU containing two MPDUs addressed to specific receivers.
Mac48Address wrongReceiver
The MAC address representing an incorrect receiver, used for testing.
void SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address add1, Ptr< ns3::SpectrumWifiPhy > tx_phy)
Sends a PPDU containing one MPDU addressed to a specific receiver.
WifiPhyRxTraceHelper m_rxTraceHelper
The helper being tested for tracking PHY reception events.
void CheckRecords(uint64_t expectedRecordCount)
Checks the statistics of PPDU and MPDU reception success and failure.
Mac48Address correctReceiver
The MAC address representing the correct receiver, used for testing.
Ptr< SpectrumWifiPhy > m_txB
The transmit function for node B.
std::map< ns3::Mac48Address, uint32_t > MacToNodeId
Maps MAC addresses to node IDs.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< Node > nodeRx
The receiving node.
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.
~TestWifiPhyRxTraceHelper() override=default
Destructor.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_txA
The transmit function for node A.
void CheckStats(WifiPhyTraceStatistics expectedStats, uint32_t nodeId, uint32_t deviceId, uint32_t linkId)
Checks the statistics of PPDU and MPDU reception success and failure.
Ptr< SpectrumWifiPhy > m_rx
The receive function for testing.
Implements a test case to evaluate the reception process of WiFi Physical Layer (PHY) frames (PPDU) c...
Ptr< SpectrumWifiPhy > m_tx1A
The transmit function for node 1, link A.
void CheckRecords(uint64_t expectedRecordCount)
Checks the statistics of PPDU and MPDU reception success and failure.
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 in MLO scenarios.
WifiPhyRxTraceHelper m_rxTraceHelper
The helper being tested for tracking PHY reception events in MLO scenarios.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
TestWifiPhyRxTraceHelperMloStr()
Constructs a TestWifiPhyRxTraceHelperMloStr instance for MLO reception testing.
void SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address add1, Mac48Address add2, Ptr< ns3::SpectrumWifiPhy > tx_phy)
Sends a PPDU containing two MPDUs addressed to specific receivers, simulating an MLO scenario.
Ptr< SpectrumWifiPhy > m_rxA
The receive function for node 2, link A.
void DoRun() override
Implementation to actually run this TestCase.
void CheckStats(WifiPhyTraceStatistics expectedStats, uint32_t nodeId)
Checks the statistics of PPDU and MPDU reception success and failure.
Ptr< SpectrumWifiPhy > m_rxB
The receive function for node 2, link B.
Mac48Address correctReceiver
The MAC address representing the correct receiver, used for testing in MLO.
Ptr< SpectrumWifiPhy > m_tx1B
The transmit function for node 1, link B.
NodeContainer wifiNodes
All wifi nodes.
std::map< ns3::Mac48Address, uint32_t > MacToNodeId
Maps MAC addresses to node IDs for MLO test configuration.
void SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address add1, Ptr< ns3::SpectrumWifiPhy > tx_phy)
Sends a PPDU containing one MPDU addressed to a specific receiver, within an MLO setup.
Mac48Address wrongReceiver
The MAC address representing an incorrect receiver, used for testing in MLO.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< SpectrumWifiPhy > m_tx0A
The transmit function for node 0, link A.
Ptr< SpectrumWifiPhy > m_tx0B
The transmit function for node 0, link B.
Implements a test case to evaluate the reception process of WiFi Physical Layer (PHY) frames (PPDU) w...
Ptr< YansWifiPhy > m_rx
The receive function for testing.
WifiPhyRxTraceHelper m_rxTraceHelper
The helper being tested for tracking PHY reception events.
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.
Ptr< YansWifiPhy > m_txA
The transmit function for node A.
uint64_t m_uid
The unique identifier used for the PPDU in the test.
TestWifiPhyRxTraceHelperYans()
Constructs a TestWifiPhyRxTraceHelperYans instance for testing the trace helper with Yans.
void CheckRecords(uint64_t expectedRecordCount)
Checks the statistics of PPDU and MPDU reception success and failure.
Mac48Address wrongReceiver
The MAC address representing an incorrect receiver, used for testing.
std::map< ns3::Mac48Address, uint32_t > MacToNodeId
Maps MAC addresses to node IDs.
Mac48Address correctReceiver
The MAC address representing the correct receiver, used for testing.
void SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address add1, Ptr< ns3::YansWifiPhy > tx_phy)
Sends a PPDU containing one MPDU addressed to a specific receiver.
Ptr< Node > nodeRx
The receiving node.
void SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address add1, Mac48Address add2, Ptr< ns3::YansWifiPhy > tx_phy)
Sends a PPDU containing two MPDUs addressed to specific receivers.
Ptr< YansWifiPhy > m_txB
The transmit function for node B.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
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 DoTeardown() override
Implementation to do any local setup required for this TestCase.
Ptr< FixedRssLossModel > propLoss
The propagation loss model used to configure RSSI.
wifi PHY reception Test Suite
WifiPhyRxTraceHelperTestSuite()
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
keep track of a set of node pointers.
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
void Dispose()
Dispose of this Object.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
void SetTxPowerEnd(dBm_u end)
Sets the maximum available transmission power level.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
void SetTxPowerStart(dBm_u start)
Sets the minimum available transmission power level.
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
std::tuple< uint8_t, MHz_u, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying a segment of an operating channel.
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
void SetOperatingChannel(const WifiPhyOperatingChannel &channel)
If the standard for this object has not been set yet, store the channel settings corresponding to the...
void SetPreambleDetectionModel(const Ptr< PreambleDetectionModel > preambleDetectionModel)
Sets the preamble detection model.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Assists in tracing and analyzing Wi-Fi Physical Layer (PHY) receptions.
const std::vector< WifiPpduRxRecord > & GetPpduRecords() const
Accesses a vector of saved and completed PPDU reception records.
void Reset()
Resets the current statistics, clearing all counts and PPDU records.
void Stop(Time stopTime)
Stops the collection of statistics at a specified time.
WifiPhyTraceStatistics GetStatistics() const
Retrieves current statistics of successful and failed data PPDUs and MPDUs receptions,...
void Enable(NodeContainer nodes)
Enables trace collection for all nodes and WifiNetDevices in the specified NodeContainer.
void Start(Time startTime)
Starts the collection of statistics from a specified start time.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetChannel(const Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
void SetInterferenceHelper(const Ptr< InterferenceHelper > helper) override
Sets the interference helper.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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 MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
Keeps track of PHY layer trace statistics.
uint64_t m_failedMpdus
Number of failed unicast data MPDU receptions.
uint64_t m_failedPpdus
Number of failed PPDU receptions (with unicast data).
uint64_t m_receivedPpdus
Number of successfully received PPDUs (with unicast data).
uint64_t m_receivedMpdus
Number of successfully received unicast data MPDUs.
uint64_t m_overlappingPpdus
Number of PPDUs that overlapped in time with at least one other PPDU.
uint64_t m_nonOverlappingPpdus
Number of PPDUs that did not overlap in time with any other PPDU.
static WifiPhyRxTraceHelperTestSuite wifiPhyRxTestSuite
the test suite