Simulate a wireless local area network (WLAN) using WLAN Toolbox™ with the Communications Toolbox™ Wireless Network Simulation Library.
In this example, you:
Create and configure a WLAN with an access point (AP) node and a station (STA) node.
Add application traffic from the AP node to the STA node.
Simulate the WLAN and retrieve the statistics of the AP node and the STA node.
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.
Create a wireless network simulator.
Create a wlanDeviceConfig
object, specifying the operating mode and beacon interval. Use this configuration to create a WLAN node and specify its name and position.
Create a WLAN node with the default device configuration. Confirm that the default mode is STA
.
Add a random waypoint mobility model to the WLAN node with the default device configuration. Set the shape of the node's mobility area to "circle"
.
Associate the STA node with the AP node using the associateStations
function.
Create a networkTrafficOnOff
object to generate an On-Off application traffic pattern. Specify the data rate in kilobits per second and the packet size in bytes.
Add application traffic from the AP node to the STA node.
Add the AP node and STA node to the wireless network simulator.
Set the simulation time in seconds and run the simulation.
Get and display the physical layer (PHY) statistics that correspond to the AP node and STA node.
TransmittedPackets: 135
TransmittedPayloadBytes: 6165
ReceivedPackets: 126
ReceivedPayloadBytes: 1764
DroppedPackets: 0
TransmittedPackets: 126
TransmittedPayloadBytes: 1764
ReceivedPackets: 135
ReceivedPayloadBytes: 6165
DroppedPackets: 0