# 802.11ax Downlink OFDMA Multinode System-Level Simulation

This example shows how to simulate 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), by using WLAN Toolbox™ and the Communications Toolbox™ Wireless Network Simulation Library.

Using this example, you can:

• Simulate DL OFDMA communication from the AP to STAs.

• Visualize the time spent by each node in Idle, Contention, Transmission, and Reception state.

• Capture the application layer (APP), medium access control layer (MAC) and physical layer (PHY) statistics for each node.

The simulation results show performance metrics such as throughput, packet latency, and packet loss captured at each node.

### 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 (MU) environment. The fundamental objective of OFDMA is to efficiently use the available frequency space. OFDMA partitions the channel bandwidth into multiple mutually exclusive sub-bands, 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 MAC layer and minimizes the PHY layer 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.

### System-Level Simulation Scenario

The example creates, configures, and simulates this 802.11ax system-level scenario, consisting of one AP and four associated 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.

### Check for Support Package Installation

Check if the Communications Toolbox™ Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.

`wirelessnetworkSupportPackageCheck`

### Configure Simulation Parameters

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 several processes within the simulation, including backoff counter selection at the MAC layer and predicting packet reception success at the physical layer. To improve the accuracy of your simulation results after running the simulation, you can change the seed value, run the simulation again, and average the results over multiple simulations.

`rng(1,"combRecursive")`

Specify the simulation time in seconds. To visualize a live state transition plot for all of the nodes, set the `showLiveStateTransitionPlot` variable to `true`.

```simulationTime = 0.1; showLiveStateTransitionPlot = true;```

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

`PHYAbstractionMethod = "tgax-evaluation-methodology";`

### Configure WLAN Scenario

Initialize the wireless network simulator by using the `wirelessNetworkSimulator` object.

`networkSimulator = wirelessNetworkSimulator.init;`

#### Nodes

Specify the number of nodes in the network. The example scenario consists of one AP and four associated STAs.

```numNodes = 5; numSTAs = numNodes-1;```

Specify the positions of the AP and STA nodes. The `apPosition` and `staPositions` vectors specify the $\mathit{x}$-, $\mathit{y}$-, and $\mathit{z}$- Cartesian coordinates of the AP and STAs, respectively. Units are in meters.

```apPosition = [0 0 0]; staPositions = [((30/numSTAs).*(1:numSTAs))' ((30/numSTAs).*(numSTAs:-1:1))' zeros(numSTAs,1)];```

To model the scenario, create an AP and four STAs using `wlanNode` and `wlanDeviceConfig` objects. The `wlanDeviceConfig` object enables you to specify the configuration parameters for the AP and STAs. Create two WLAN device configuration objects, one for the AP and the other for the STAs. You can use the same device configuration object to configure all the STAs. To configure an AP and a STA, set the `Mode` property of the `wlanDeviceConfig` object to "AP" and "STA" respectively. Configure the `TransmissionFormat`, `MCS`, `DisableRTS`, `MPDUAggregationLimit`, `TransmitPower` properties of AP device configuration object. Note that AP and STA device configuration objects must have the same value of `MPDUAggregationLimit`.

The example simulates these DL OFDMA frame exchange sequences.

• Enable DL MU frames followed by MU block ack request (BAR) trigger frame to simultaneously solicit UL acknowledgment frames from multiple scheduled STAs.

• Optionally enables MU request to send request to send (RTS)/clear to send (CTS) exchanges by specifying the `DisableRTS` property of the `wlanDeviceConfig` object to `false`.

This example uses the round-robin scheduling strategy to select STAs for each transmission. The assignment of RUs is fixed for a given number of users and bandwidth.

```accessPointCfg = wlanDeviceConfig(Mode="AP",TransmissionFormat="HE-MU-OFDMA", ... % AP device configuration MCS=8,DisableRTS=true, ... MPDUAggregationLimit=5, ... TransmitPower=20); stationCfg = wlanDeviceConfig(Mode="STA",MPDUAggregationLimit=5); % STAs device configuration```

To create one AP and four STA nodes from the specified configuration, use the `wlanNode` objects. Specify the node names, node positions, and device configuration objects. You can use the `wlanNode` object to create multiple nodes at a time by providing multiple node positions. Specify the PHY abstraction method used by the AP and STAs. Configure the `MACFrameAbstraction` property to indicate that the MAC frames are abstracted by the nodes.

```accessPoint = wlanNode(Name="AP", ... Position=apPosition, ... DeviceConfig=accessPointCfg,... PHYAbstractionMethod=PHYAbstractionMethod, ... MACFrameAbstraction=true); stations = wlanNode(Name="STA"+(1:numSTAs), ... Position=staPositions, ... DeviceConfig=stationCfg, ... PHYAbstractionMethod=PHYAbstractionMethod, ... MACFrameAbstraction=true);```

Create a WLAN network consisting of an AP and four STAs.

`nodes = [accessPoint stations];`

To ensure all the nodes are configured properly, use the `hCheckWLANNodesConfiguration` helper function.

`hCheckWLANNodesConfiguration(nodes)`

#### Association

Associate all the STAs to the AP by using the `associateStations` object function of the `wlanNode` object.

`associateStations(accessPoint,stations);`

#### Application Traffic

Create `networkTrafficOnOff` objects to generate an On-Off application traffic pattern. Configure the On-Off application traffic by specifying the application data rate and packet size. The number of objects created is equal to the number of AP-STA pairs that have downlink traffic exchange in the example. Add application traffic from the AP node to the corresponding STA node by using the `addTrafficSource` object function and specifying the associated STA as the destination.

```% Create four networkTrafficOnOff objects, one for each AP-STA pair in the scenario for staID=1:numNodes-1 trafficSource(staID) = networkTrafficOnOff(DataRate=100000,PacketSize=100); %#ok<SAGROW> addTrafficSource(accessPoint,trafficSource(staID),DestinationNode=stations(staID),AccessCategory=0); end```

#### Wireless Channel

To model a random TGax fading channel between each node, this example uses `hSLSTGaxMultiFrequencySystemChannel` helper function. When you model a fading channel, the probability of packet transmission success depends 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 RU allocation 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.

Add the channel model to the wireless network simulator by using the `addChannelModel` object function of the `wirelessNetworkSimulator` object.

```channel = hSLSTGaxMultiFrequencySystemChannel(nodes); addChannelModel(networkSimulator,channel.ChannelFcn)```

### Simulation

`addNodes(networkSimulator,nodes)`

To view the state transition and performance metrics plots, create a `hSimulationPlotViewer` helper object. The simulation shows the plots for all the nodes configured in the simulation. To visualize the state transitions and performance metrics of specific nodes, specify the corresponding node objects as the second argument to the helper object.

`viewerObj = hSimulationPlotViewer(showLiveStateTransitionPlot,nodes);`

Run the network simulation for the specified simulation time. The runtime visualization shows the time spent by the AP and the STA in Idle, Contention, Transmission, and Reception state.

`run(networkSimulator,simulationTime);`

### Results

Retrieve the APP, MAC, and PHY statistics at each node by using the `statistics` object function of the `wlanNode` object.

`stats = statistics(nodes);`

Plot the performance of each node by using the p`lotNetworkStats` object function of the `hSimulationPlotViewer` object. You can visualize these simulation plots.

• Throughput (in Mbps) at each transmitter (AP).

• Packet loss ratio (ratio of unsuccessful data transmissions to the total data transmissions) at each transmitter (AP and STA).

• Average packet latency incurred at each receiver (STAs). The average packet latency shows the average latency that each STA incurs to receive the downlink traffic from the AP.

`plotNetworkStats(viewerObj,simulationTime)`

### Further Exploration

#### Throughput Comparison of OFDM and OFDMA

Generate throughput results of these OFDM and OFDMA transmission scenarios by using the `hCompareOFDMvsOFDMAThroughputs` helper function.

• An AP serving a maximum of 140 STAs with OFDM configuration.

• An AP serving a maximum of 140 STAs in an OFDMA configuration.

Plot the throughput results as a function of the number of DL STAs for OFDM and OFDMA configurations. By default, the `hCompareOFDMvsOFDMAThroughputs` helper function plots the static throughput values of OFDM and OFDMA transmissions. To reproduce the results, set the `plotStaticThroughputValues` flag to `false`.

```plotStaticThroughputValues = true; hCompareOFDMvsOFDMAThroughputs(plotStaticThroughputValues);```

The preceding plot shows the throughput comparison of OFDM and OFDMA. Because of the simultaneous transmissions to multiple users, the throughput obtained by using OFDMA transmission is greater than the throughput obtained by using OFDM transmission. Increasing the number of DL STAs has minimal impact on the OFDM throughput.

#### Faster Execution Using Parallel Simulation Runs

If you want to run multiple simulations, you can speed up the simulations by enabling parallel computing using the `parfor` loop. The parfor loop is an alternative to the `for` loop. The parfor loop enables you to execute multiple simulation runs in parallel, thereby reducing the total execution time. To use parfor, you need to install the Parallel Computing Toolbox™. For more information about running multiple simulations by using parfor loop, see `hCompareOFDMvsOFDMAThroughputs` helper function.

### Appendix

The example uses these helpers:

### References

1. Institute of Electrical and Electronics Engineers (IEEE). IEEE 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 Amendment 1: Enhancements for High-Efficiency WLAN. IEEE 802.11ax-2021. IEEE, May 19, 2021. https://doi.org/10.1109/IEEESTD.2021.9442429.

2. Institute of Electrical and Electronics Engineers (IEEE). IEEE 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. IEEE 802.11-2020. IEEE, February 26, 2021. https://doi.org/10.1109/IEEESTD.2021.9363693.