Create, Configure, and Simulate an 802.11ax Mesh Network
This example shows how to create, configure, and simulate an IEEE® 802.11ax™ (Wi-Fi 6) mesh network.
Using this example, you can:
Create and configure an 802.11ax mesh network consisting of four mesh nodes.
Generate, configure, and add on-off application traffic between the mesh nodes.
Add mesh paths to route application traffic from the source node to the sink node.
Simulate the 802.11ax mesh network and visualize the statistics.
The example simulates this mesh network scenario.
The mesh node 1 (source) generates and transmits application traffic to mesh node 4 (sink) through intermediate relay nodes, mesh node 2, and mesh node 3. The example simulates mesh network communication in the 5 GHz band.
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;
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.
simulationTime = 0.5;
Initialize the wireless network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Specify the names and positions of the mesh nodes.
nodeNames = ["MeshNode1","MeshNode2","MeshNode3","MeshNode4"]; nodePositions = [10 0 0; 20 0 0; 30 0 0; 40 0 0]; % x-, y-, and z-coordinates, in meters
Set the configuration parameters of the mesh nodes by using the wlanDeviceConfig
object.
meshNodeCfg = wlanDeviceConfig(Mode="mesh",BandAndChannel=[5 36],MCS=7,TransmitPower=15);
Create the mesh nodes from the specified configuration by using the wlanNode
object.
meshNodes = wlanNode(Name=nodeNames, ... Position=nodePositions, ... DeviceConfig=meshNodeCfg);
Generate an on-off application traffic pattern by using the networkTrafficOnOff
object. Configure the on-off application traffic by specifying the application data rate and packet size. Add application traffic from mesh node 1 to mesh node 4.
trafficSource = networkTrafficOnOff(DataRate=50000,PacketSize=1500); addTrafficSource(meshNodes(1),trafficSource,DestinationNode=meshNodes(4));
Add mesh paths to propagate the application traffic from the source mesh node 1 to the destination mesh node 4. The application traffic flows from mesh node 1 to mesh node 4 through the intermediate relay nodes mesh node 2 and mesh node 3.
addMeshPath(meshNodes(1),meshNodes(4),meshNodes(2)); addMeshPath(meshNodes(2),meshNodes(4),meshNodes(3)); addMeshPath(meshNodes(3),meshNodes(4));
Add nodes to the wireless network simulator.
addNodes(networkSimulator,meshNodes);
Run the network simulation for the specified simulation time.
run(networkSimulator,simulationTime);
At each mesh node, the simulation captures the statistics by using the statistics
object function. The stats
variable captures the application statistics, MAC layer statistics, physical layer statistics, and mesh forwarding statistics for each node. For more information about these statistics, see the WLAN System-Level Simulation Statistics topic.
stats = statistics(meshNodes)
stats=1×4 struct array with fields:
Name
ID
App
MAC
PHY
Mesh