Main Content

802.11ax Multinode System-Level Simulation of Residential Scenario

This example shows how to model performance of an IEEE® 802.11ax™ [1] network in a residential scenario by using WLAN Toolbox™ and the Communications Toolbox™ Wireless Network Simulation Library.

Using this example, you can:

  • Simulate a residential scenario by configuring the network and channel parameters.

  • Simulate a multinode WLAN system and capture the network-related statistics.

  • Simulate the network by switching between the abstracted and full models of medium access control (MAC) and physical layer (PHY).

The simulation results show performance metrics such as throughput, latency, and packet loss.

Additionally, you can use this example script to export WLAN MAC frames to a PCAP or PCAPNG file. For more information, see Further Exploration.

Residential Scenario

This example demonstrates a system-level simulation to evaluate the performance of an 802.11ax network in a residential scenario. The residential scenario consists of a building with three floors. These are the characteristics of the residential scenario:

  • The spacing between the floors is three meters.

  • Each floor consists of four rooms, and the dimensions of each room are 10-by-10-by-3 meters.

  • Each room has an access point (AP) and two stations (STAs) placed at random x- and y-locations at a height of 1.5 meters from the floor.

  • Each AP transmits data to the associated STAs in the same room.

The simulation scenario specifies a path loss model based on the distance between the nodes, and the number of walls and floors traversed by the WLAN signal. This figure shows the residential scenario simulated in this example.

Example Residential Scenario

To confirm compliance with the IEEE 802.11 standard [2], the features in this example are validated with Box-3 and Box-5 scenarios specified in the TGax evaluation methodology [3]. The network throughputs that are calculated for TGax simulation scenarios [4] are validated against the published calibration results from the TGax Task Group.

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.


Configuration Parameters

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 PHY 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.


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.12;
showLiveStateTransitionPlot = true;

This example uses the abstract models of MAC and PHY layers at all the nodes (APs and STAs) by default. To use the full MAC layer model, set the MACFrameAbstraction variable to false. Similarly, to use the full PHY layer model, set the PHYAbstractionMethod variable to none. For more information about MAC and PHY, see the Get Started with WLAN System-Level Simulation in MATLAB example.

MACFrameAbstraction = true;
PHYAbstractionMethod = "tgax-evaluation-methodology";

Residential Scenario Parameters

The ScenarioParameters structure defines the size and layout of the residential building by using these parameters.

  • BuildingLayout — Specify the number of rooms along the length, breadth, and height of the building.

  • RoomSize — Specify the size of each room in meters.

  • NumRxPerRoom — Specify the number of stations per room.

The example assumes each room contains one transmitting AP and two receiving STAs.

ScenarioParameters = struct;
ScenarioParameters.BuildingLayout = [2 2 3];
ScenarioParameters.RoomSize = [10 10 3];
ScenarioParameters.NumRxPerRoom = 2;

Configure WLAN Scenario

Initialize the wireless network simulator by using the wirelessNetworkSimulator object.

networkSimulator = wirelessNetworkSimulator.init;


The example creates a residential scenario consisting of 36 nodes. Node 1 to Node 12 are APs, and Node 13 to Node 36 are STAs. The hGetIDsAndPositions helper function returns node IDs and random positions for the AP and STAs within each room. The function returns an array, nodeIDs, where each row stores the IDs of the AP and its associated STAs in the same room. The apPositions and staPositions outputs contain the x-, y-, and z-Cartesian coordinates of the APs and STAs, respectively. Units are in meters.

[nodeIDs,apPositions,staPositions] = hGetIDsAndPositions(ScenarioParameters);

The wlanDeviceConfig object enables you to set the configuration parameters for the APs and STAs. Create two wlanDeviceConfig objects to initialize the configuration parameters for the APs and the STAs. Specify the operating mode, modulation and coding scheme, and the transmission power (in dBm) for the APs and STAs.

accessPointCfg = wlanDeviceConfig(Mode="AP",MCS=2,TransmitPower=15);    % AP device configuration
stationCfg = wlanDeviceConfig(Mode="STA",MCS=2,TransmitPower=15);       % STA device configuration

Create two arrays of wlanNode objects, corresponding to the AP nodes and STA nodes, by specifying their Position properties as apPosition and staPosition, respectively. Each array contains a number of objects equal to the number of positions specified by the corresponding value. Specify the Name, DeviceConfig, PHYAbstractionMethod, and MACFrameAbstraction properties of wlanNode objects.

accessPoints = wlanNode(Position=apPositions, ...
    Name="AP"+(1:size(apPositions,1)), ...
    DeviceConfig=accessPointCfg, ...
    PHYAbstractionMethod=PHYAbstractionMethod, ...
stations = wlanNode(Position=staPositions, ...
    Name="STA"+(1:size(staPositions,1)), ...
    DeviceConfig=stationCfg, ...
    PHYAbstractionMethod=PHYAbstractionMethod, ...

Create a WLAN network consisting of APs and STAs.

nodes = [accessPoints stations];

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


Association and Application Traffic

Associate the STAs in each room to the corresponding AP by using the associateStations object function of the wlanNode object. Configure the APs with continuous application traffic to their associated STAs by using the FullBufferTraffic argument.

numAPs = prod(ScenarioParameters.BuildingLayout);                                         % One AP per room
for apID = 1:numAPs

Create Network

Create transmitter and receiver sites from the node configurations by using the hCreateSitesFromNodes helper function. Create the building geometry from the residential scenario parameters by using the hTGaxResidentialTriangulation helper object. Visualize the residential building along with the transmitter and receiver sites by using the hVisualizeScenario helper function.

[txSites,rxSites] = hCreateSitesFromNodes(nodes);
triangulationObj = hTGaxResidentialTriangulation(ScenarioParameters);

Figure contains an axes object. The axes object with xlabel x, ylabel y contains 40 objects of type patch, line, text, scatter. These objects represent AP, STA.

Wireless Channel

This example uses the TGax residential propagation model to determine path loss between nodes. Path loss is a function of the number of walls, number of floors, and distance between nodes. Create a path loss model by using the hTGaxResidentialPathLoss helper function. Obtain the path loss function handle by using the hCreatePathlossTable helper function.

propModel = hTGaxResidentialPathLoss(Triangulation=triangulationObj,ShadowSigma=0,FacesPerWall=1);
[~,pathLossFcn] = hCreatePathlossTable(txSites,rxSites,propModel);

To add a channel object to the wireless network simulator, create a hSLSTGaxMultiFrequencySystemChannel helper object by using the path loss function handle. Add the residential path loss model to the network simulator by using the addChannelModel object function of the wirelessNetworkSimulator object.

channel = hSLSTGaxMultiFrequencySystemChannel(nodes,PathLossModel="custom",PathLossModelFcn=pathLossFcn);


Add your nodes to the wireless network simulator.


To view the state transition and performance metrics plots, create a hSimulationPlotViewer helper object. By default, this helper object 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.


Figure MAC State Transitions Over Time contains an axes object and another object of type uicontrol. The axes object with xlabel Node Timeline (Microseconds), ylabel Node Names contains 4988 objects of type bar, rectangle. These objects represent Contention, Transmission, Reception, Reception (Destined to node), Other (EIFS/SIFS/Idle/Busy).


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 plotNetworkStats 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 (APs).

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


Figure contains 3 axes objects. Axes object 1 with title Throughput at Each Transmitter, xlabel Node Names, ylabel Throughput (Mbps) contains an object of type bar. Axes object 2 with title Packet Loss at Each Transmitter, xlabel Node Names, ylabel Packet Loss Ratio contains an object of type bar. Axes object 3 with title Average Packet Latency at Each Receiver, xlabel Node Names, ylabel Average Packet Latency (s) contains an object of type bar.

Further Exploration

Export WLAN MAC Frames to PCAP or PCAPNG File

You can capture packets at both AP and STA nodes by using the hExportWLANPackets helper object. Specify the node objects at which you want to capture the packets. To capture packets at multiple nodes, specify the corresponding node objects as an array. You can export the packets captured at the AP and STA nodes to a PCAP or PCAPNG file. For more information about capturing packets, and exporting captured packets to a PCAP or PCAPNG file, see the Get Started with WLAN System-Level Simulation in MATLAB example.


The example uses these helpers:


  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.

  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.

  3. Institute of Electrical and Electronics Engineers (IEEE). 11ax Evaluation Methodology. IEEE 802.11-14/0571r12. IEEE, January 2016.

  4. Institute of Electrical and Electronics Engineers (IEEE). TGax Simulation Scenarios. IEEE 802.11-14/0980r16. IEEE, 2015.

See Also



Related Topics