This example shows how to simulate a wireless local area network (WLAN) by using WLAN Toolbox™ with the Communications Toolbox™ Wireless Network Simulation Library.
Using 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, setting the mode to "AP"
. Use this configuration to create a WLAN node, specifying its name and position.
Create a WLAN node with the default device configuration. Confirm that the default mode is STA
.
Associate the STA node with the AP node.
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. Enable packet generation to generate an application packet with a payload.
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.
Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.
Get and display the physical layer (PHY) statistics that correspond to the AP node and STA node.
TransmittedPackets: 126
TransmittedPayloadBytes: 4095
ReceivedPackets: 125
ReceivedPayloadBytes: 1750
DroppedPackets: 0
TransmittedPackets: 125
TransmittedPayloadBytes: 1750
ReceivedPackets: 126
ReceivedPayloadBytes: 4095
DroppedPackets: 0