# 802.11ax Downlink OFDMA Multinode System-Level Simulation

This example shows how to model a WLAN multinode downlink (DL) orthogonal frequency-division multiple access (OFDMA) network consisting of an IEEE® 802.11ax™ [ 1 ] access point (AP) and four stations (STAs).

Using this example, you can:

• Model DL OFDMA communication from AP to STAs and switch between two DL frame exchange sequences.

• Compare orthogonal frequency-division multiplexing (OFDM) and OFDMA throughputs.

View performance metrics such as throughput, packet latency, packet loss, and other network-related metrics for the DL OFDMA communication by using the `statistics.mat` file.

### OFDM and OFDMA

The IEEE 802.11ax standard introduces significant enhancements over the existing 802.11ac standard [ 2 ]. One of the key improvements is OFDMA, which is an extension of OFDM digital modulation technology into a multiuser environment. The fundamental objective of OFDMA is to efficiently use the available frequency space. OFDMA partitions the channel bandwidth into multiple mutually exclusive subbands, called resource units (RUs). By partitioning the channel bandwidth, multiple users can access the channel simultaneously. As a result, 802.11ax supports concurrent transmissions of packets to multiple users.

For example, a conventional 20 MHz channel can be partitioned into a maximum of nine subchannels. An 802.11ax AP can simultaneously transmit packets to nine 802.11ax STAs by using OFDMA. The simultaneous transmission of frames reduces excessive contention overhead at the medium access control (MAC) layer and minimizes the physical (PHY) preamble overhead. In OFDMA, the AP controls the allocation of RUs.

The 802.11ax standard specifies two types of OFDMA:

• DL OFDMA - The AP transmits packets to multiple STAs simultaneously using a different RU for each STA.

• Uplink (UL) OFDMA - Multiple STAs transmit packets to an AP simultaneously, with each STA using a different RU.

In this figure, the 802.11n/ac/ax AP transmits DL frames to four OFDM STAs independently over time. The AP uses the entire channel bandwidth to communicate with a single OFDM STA. Similarly, an OFDM STA uses the entire channel bandwidth to communicate with an 802.11n/ac/ax AP in an UL OFDM transmission.

This figure shows an OFDMA transmission. The 802.11ax AP partitions the channel bandwidth into RUs for four OFDMA STAs on a continuous basis for simultaneous DL transmissions.

### WLAN System-Level Simulation Scenario

Assume that the AP and the STAs are preassociated which means that the AP and the STAs are connected before the start of the simulation. This figure shows a WLAN system-level scenario that models a DL communication between an AP and four STAs.

In the preceding figure:

1. AP transmits DL data to all the STAs simultaneously.

2. STAs respond with a UL acknowledgment frame upon receiving the DL data frames from the AP.

### Configure Simulation Parameters

Specify the simulation time in milliseconds by using the `simulationTime` variable. To visualize a live state transition plot for all of the nodes, set the `showLiveStateTransitionPlot` variable to `true`. To visualize the table containing network statistics at the end of simulation, set the `displayStatistics` variable to `true`.

```simulationTime = 100; showLiveStateTransitionPlot = true; displayStatistics = true;```

Set the seed for the random number generator to `1`. The seed value controls the pattern of random number generation. The random number generated by the seed value impacts the backoff counter selection at the MAC layer and path loss modeling at the PHY. For high fidelity results, change the seed value and average the results over multiple simulations.

`rng(1,'combRecursive');`

To access all of the helper files in this example, add the `mlWLANSystemSimulation` folder to the MATLAB path

`addpath(genpath(fullfile(pwd,'mlWLANSystemSimulation')));`

#### Nodes

Configure the WLAN nodes by using these parameters.

• `numNodes` - Specify the desired number of nodes in the network.

• `nodePositions` - Specify the position of nodes in an $\mathit{x}$-, $\mathit{y}$-, and $\mathit{z}$- Cartesian coordinate system.

• `nodeConfig` - Specify the MAC and PHY configuration of each node.

Specify the number of nodes in the network.

`numNodes = 5;`

Specify the positions of the WLAN nodes as a numNodes-by-3 matrix. Units are in meters. Each row of the vector specifies the Cartesian coordinates of a node, starting from the first node.

`nodePositions = [0 0 0; 0 30 0; 30 0 0; 0 -30 0; -30 0 0];`

Specify the configuration for each WLAN node as a `numNodes`-by-1 vector. The configuration for a node is a `wlanNodeConfig` structure. The `wlanNodeConfig.mat` file specifies the MAC, PHY, and channel configuration structure of a node. Configure the nodes by initializing the default node configuration and then configuring the parameters at the PHY and MAC of each node. For more information about the configuration parameters in the MAC, PHY, and channel, see WLAN Node Composition and Configuration.

The example implements these configuration parameters for an AP node.

• `MaxDLStations` - Maximum number of STAs that can be scheduled for a DL multiuser (MU) transmission.

• `DLOFDMAFrameSequence` - Type of frame exchange sequence to use in DL OFDMA MU transmissions.

If you want to use DL MU frames with trigger response scheduling (TRS) control and a UL block ack (BA) sequence, set `DLOFDMAFrameSequence` to 1. In this frame exchange sequence, all the STAs that the AP schedules send an immediate response. The TRS Control subfield of the DL frame carries the scheduling information.

If you want to use DL MU frames with MU block ack request (BAR) trigger and a UL BA sequence, set `DLOFDMAFrameSequence` to 2. In this frame exchange sequence, the AP solicits acknowledgment frames from multiple scheduled STAs by using an MU-BAR Trigger frame.

Load the default node configuration file and set default node configuration parameters for all of the nodes.

```load('wlanNodeConfig.mat'); nodeConfig = repmat(wlanNodeConfig,1,numNodes);```

Configure the AP.

```nodeConfig(1).NodeName = "AP"; nodeConfig(1).NodePosition = nodePositions(1,:); nodeConfig(1).TxFormat = "HE_MU"; nodeConfig(1).BandAndChannel = {[5 36]}; nodeConfig(1).Bandwidth = 20; % In MHz nodeConfig(1).TxPower = 5; % In dBm nodeConfig(1).TxMCS = 8; nodeConfig(1).DisableRTS = true; % Flag to enable or disable MU-RTS/CTS exchange nodeConfig(1).DisableAck = false; % Flag to enable or disable UL acknowledgements nodeConfig(1).MaxSubframes = 5; nodeConfig(1).MaxDLStations = 4; % Set maximum number of DL STAs nodeConfig(1).DLOFDMAFrameSequence = 1; % Set DL frame exchange sequence```

Configure STA1.

```nodeConfig(2).NodeName = "STA1"; nodeConfig(2).NodePosition = nodePositions(2,:); nodeConfig(2).BandAndChannel = {[5 36]}; nodeConfig(2).Bandwidth = 20; % In MHz```

Configure STA2.

```nodeConfig(3).NodeName = "STA2"; nodeConfig(3).NodePosition = nodePositions(3,:); nodeConfig(3).BandAndChannel = {[5 36]}; nodeConfig(3).Bandwidth = 20; % In MHz```

Configure STA3.

```nodeConfig(4).NodeName = "STA3"; nodeConfig(4).NodePosition = nodePositions(4,:); nodeConfig(4).BandAndChannel = {[5 36]}; nodeConfig(4).Bandwidth = 20; % In MHz```

Configure STA4.

```nodeConfig(5).NodeName = "STA4"; nodeConfig(5).NodePosition = nodePositions(5,:); nodeConfig(5).BandAndChannel = {[5 36]}; nodeConfig(5).Bandwidth = 20; % In MHz```

#### Application Traffic

The `wlanTrafficConfig.mat` file contains structure to configure the application at each node. To set DL traffic at an AP, set the `SourceNode` and `DestinationNode` values in the `trafficConfig` structure with the corresponding AP and STA node names, respectively.

To configure multiple applications, perform these steps.

1. Copy the default configuration to each element of the `trafficConfig` structure vector.

2. Update the traffic configuration for the new nodes.

Load the application traffic configuration for WLAN nodes.

```load('wlanTrafficConfig.mat'); trafficConfig = repmat(wlanTrafficConfig,1,4);```

Configure DL application traffic for STA1.

```trafficConfig(1).SourceNode = "AP"; trafficConfig(1).DestinationNode = "STA1"; trafficConfig(1).DataRateKbps = 100000; trafficConfig(1).PacketSize = 100; % In bytes trafficConfig(1).AccessCategory = 0; % Best Effort (0), Background (1), Video (2), and Voice (3)```

Configure DL application traffic for STA2.

```trafficConfig(2).SourceNode = "AP"; trafficConfig(2).DestinationNode = "STA2"; trafficConfig(2).DataRateKbps = 100000; trafficConfig(2).PacketSize = 100; % In bytes trafficConfig(2).AccessCategory = 0; % Best Effort (0), Background (1), Video (2), and Voice (3)```

Configure DL application traffic for STA3.

```trafficConfig(3).SourceNode = "AP"; trafficConfig(3).DestinationNode = "STA3"; trafficConfig(3).DataRateKbps = 100000; trafficConfig(3).PacketSize = 100; % In bytes trafficConfig(3).AccessCategory = 0; % Best Effort (0), Background (1), Video (2), and Voice (3)```

Configure DL application traffic for STA4.

```trafficConfig(4).SourceNode = "AP"; trafficConfig(4).DestinationNode = "STA4"; trafficConfig(4).DataRateKbps = 100000; trafficConfig(4).PacketSize = 100; % In bytes trafficConfig(4).AccessCategory = 0; % Best Effort (0), Background (1), Video (2), and Voice (3)```

### Create WLAN Scenario

Use the `hCreateWLANNodes` helper function to perform these tasks:

• Create WLAN nodes with the application (APP), MAC, and PHY layers configured with the specified parameters.

• Add a custom scheduler algorithm.

This example uses abstracted MAC and PHY at each WLAN node, and supports OFDMA for only abstracted MAC and PHY. For more information about abstracted MAC and PHY, see the Get Started with WLAN System-Level Simulation in MATLAB example.

Select STAs for each transmission by using the `hSchedulerRoundRobin` function. You can modify this function to incorporate your own algorithm or implement a new object by inheriting the `hScheduler` helper function.

To model a random TGax fading channel between each node, this example uses “`TGax Evaluation Methodology Appendix 1`” PHY abstraction. When you model a fading channel, the probability of packet transmission success is dependent on these factors.

• Quality of the channel between an AP and STA for the selected RU.

• Modulation and coding scheme (MCS)

In this example, the scheduler does not consider the quality of the channel between the AP and each STA. Therefore, if the channel quality between an AP and a STA is poor and the selected MCS is high, packet loss is likely to occur. If you do not want to model frequency-selective fading channel between the nodes, set `PHYAbstractionType` to “`TGax Simulation Scenarios MAC Calibration`”.

Configure scheduling algorithm at MAC.

```schedulerAlgorithm = hSchedulerRoundRobin(numNodes); wlanNodes = hCreateWLANNodes(nodeConfig,trafficConfig,'MACScheduler',schedulerAlgorithm,... 'MACFrameAbstraction', true, ... 'PHYAbstractionType',"TGax Evaluation Methodology Appendix 1");```

### Simulation

Initialize the visualization parameters and simulate the WLAN scenario by using the `hWLANStatsLogger` and `hWirelessNetworkSimulator` helper functions, respectively.

```visualizationInfo = struct; visualizationInfo.Nodes = wlanNodes; statsLogger = hWLANStatsLogger(visualizationInfo); if showLiveStateTransitionPlot hPlotStateTransition(visualizationInfo); end```

Initialize the wireless network simulator.

`networkSimulator = hWirelessNetworkSimulator(wlanNodes);`

Schedule an event to refresh the state transition visualization. When you run the example from the MATLAB® command prompt, this event pauses the execution to refresh visualization after every five milliseconds.

`scheduleEvent(networkSimulator,@() pause(0.001),[],0,5);`

For more information on scheduling events, enter this command at the MATLAB® command prompt.

`help hWirelessNetworkSimulator.scheduleEvent`

Run all of the nodes in the network for the specified simulation time and visualize the state transition periods of the nodes.

`run(networkSimulator,simulationTime);`

### Results

At each node, the simulation captures these network statistics.

• MAC throughput

• Time spent in the contend state, idle state, and sending data state

• Transmitter and receiver statistics at the APP, MAC, and PHY

Retrieve the statistics and save them in a MAT-file.

`statistics = getStatistics(statsLogger,displayStatistics);`
```Statistics table for band 5 and channel number 36 ```
```statisticsTable=157×5 table AP STA1 STA2 STA3 STA4 __________ _____ _____ _____ _____ Frequency 5.18 5.18 5.18 5.18 5.18 ActiveOperationInFreq 1 1 1 1 1 AppTxAC_BE 50004 0 0 0 0 AppTxAC_BK 0 0 0 0 0 AppTxAC_VI 0 0 0 0 0 AppTxAC_VO 0 0 0 0 0 AppTxBytes 5.0004e+06 0 0 0 0 AppRxAC_BE 0 380 760 579 170 AppRxAC_BK 0 0 0 0 0 AppRxAC_VI 0 0 0 0 0 AppRxAC_VO 0 0 0 0 0 AppRxBytes 0 38000 76000 57900 17000 AppTxOverflow 47257 0 0 0 0 AppAvgPacketLatency 0 43595 27472 28663 42062 AppAvgPacketLatencyAC_BE 0 43595 27472 28663 42062 AppAvgPacketLatencyAC_BK 0 0 0 0 0 ⋮ ```
`save('statistics.mat','statistics');`

You can access all of the statistics from this table by using the `statistics.mat` file. For more information about the statistics captured at each node, see Statistics Captured in WLAN System-Level Simulation.

Plot the throughput, packet loss ratio, and average packet latency at each node. This plot shows the throughput in Mbps and packet-loss ratio, the ratio of unsuccessful data transmissions to the total data transmissions, at the AP and STAs. The plot also shows the average packet latency at the STA. The average packet latency represents the average latency that the STA incurs to receive the DL traffic from the AP.

`hPlotNetworkStats(statistics,wlanNodes);`

At the end of simulation, remove the `mlWLANSystemSimulation` folder from the path.

`rmpath(genpath(fullfile(pwd,'mlWLANSystemSimulation')));`

Clean up the persistent variables used in functions.

`clear hPlotStateTransition;`

### Throughput Comparison of OFDM and OFDMA

Generate throughput results of these OFDM and OFDMA transmission scenarios.

• An AP serving a maximum of 140 STAs in an OFDMA configuration. To configure this scenario, set the `DLOFDMAFrameSequence` parameter to 1.

• An AP serving a maximum of 140 STAs in an OFDMA configuration. To configure this scenario, set the `DLOFDMAFrameSequence` parameter to 2.

• An AP serving a maximum of 140 STAs with OFDM configuration. To configure this scenario, set the `TxFormat` node parameter for AP node to 'HE_SU' and `MaxDLStations` to 1.

In these simulations `PHYAbstractionType` is set to “`TGax Simulation Scenarios MAC Calibration`” and AP node is configured with the values shown in this table.

Plot the throughput results as a function of the number of DL STAs for OFDM (HE SU`)` and OFDMA (HE MU`)` configurations. At the end of each simulation run, retrieve the throughput values for each node from the `statistics.mat` file. Calculate the total throughput by aggregating these throughput values.

Plot the throughput results for OFDM and OFDMA configurations.

`plotThroughput;`

The above plot shows the 802.11ax throughput comparison of OFDM and OFDMA with two DL frame exchange sequences. The throughput obtained with OFDMA for both frame exchange sequences is greater than the throughput obtained using OFDM. Increasing the number of DL STAs has no impact on the OFDM throughput. The throughput obtained using an OFDMA DL sequence with `DLOFDMAFrameSequence` set to `1` is higher than the sequence with `DLOFDMAFrameSequence` set to `2` because of the added overhead for transmitting MU-BAR as a separate frame.

This example enables you to model a DL OFDMA communication in a multinode IEEE 802.11ax network. The APP configuration enables you to configure multiple applications to different destination STAs. The example uses the round-robin scheduling strategy to select STAs for next transmission. The assignment of RUs is fixed for a given number of users and bandwidth. The simulation results confirm that the throughput at AP with OFDMA is higher than the throughput obtained using OFDM.

### Local Functions

```function plotThroughput figure; % Number of DL STAs numStations = [1 2 6 8 9 15 20 25 30 40 50 60 74 100 140]; % Throughput results for OFDMA configuration (Mbps) with node parameter, DLOFDMAFrameSequence set to 1. throughputOFDMASeq1 = [23.3623 36.5026 47.0532 60.1624 69.2308 115.3846 150.6410 188.3013 221.1538 288.4615 360.3099 423.0769 498.0769 509.1404 509.9359]; % Throughput results for OFDMA configuration (Mbps) with node parameter, DLOFDMAFrameSequence set to 2. throughputOFDMASeq2 = [20.4911 32.0026 43.2692 57.6081 63.3739 105.7692 137.7295 168.2692 197.1154 250.0000 304.4872 346.1538 403.2051 414.4166 414.5658]; % Throughput results for OFDM configuration (Mbps). throughputOFDM = [33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76 33.76]; % Plot throughput obtained from OFDM simulations plot(numStations, throughputOFDM,'-o'); % Retain OFDM throughput plot hold on; % Plot throughput obtained from OFDMA simulations with sequence 1 plot(numStations, throughputOFDMASeq1,'-x'); % Retain OFDM throughput plot hold on; % Plot throughput obtained from OFDMA simulations with sequence 2 plot(numStations, throughputOFDMASeq2,'-+'); grid on; xlabel('Number of DL Stations'); ylabel('Throughput (Mbps)'); legend({"OFDM", "OFDMA"+newline+"DL-PPDU TRS Control", "OFDMA"+newline+"DL-PPDU MU-BAR Trigger"}, 'Location', 'northeastoutside'); title('Downlink Throughput at AP'); end```

### References

[1] IEEE Std 802.11ax™-2021. "Amendment 6: Enhancements for High Efficiency WLAN." Draft Standard for Information technology - Telecommunications and information exchange between systems Local and metropolitan area networks - Specific requirements -Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.

[2] IEEE Std 802.11-2020. "Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications." IEEE Standard for Information technology-Telecommunications and information exchange between systems, Local and metropolitan area networks-Specific requirements.