This example shows how to simulate a Bluetooth LE piconet with periodic advertisements by following these steps:
Create and configure a Bluetooth LE piconet with Broadcaster and Observer nodes.
Create and Configure a PAT between the Broadcaster and Observer nodes.
Configure and add application traffic at the Broadcaster node.
Simulate the Bluetooth LE piconet and retrieve the statistics of the Broadcaster and Observer nodes.
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 Bluetooth LE node, specifying the role as "broadcaster". Specify the name and position of the node.
Create two Bluetooth LE nodes, specifying their roles as "observer". Specify the names and positions of the nodes.
Create a PAT between the Broadcaster and Observer nodes by using the Bluetooth LE periodic advertisements configuration object.
Configure the PAT between the Broadcaster and Observer nodes.
cfgPeriodicAdvUpdated =
bluetoothLEPeriodicAdvConfig with properties:
PeriodicAdvInterval: 60
PeriodicAdvOffset: 0
PHYMode: "LE2M"
UsedChannels: [10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30]
AccessAddress: 'D9DA7BEA'
Create a networkTrafficOnOff object to generate an On-Off application traffic pattern. Specify the data rate in kb/s and the packet size in bytes. Add application traffic at the Broadcaster node.
Add the Broadcaster and Observer nodes to the wireless network simulator.
Set the simulation time in seconds, and run the simulation.
Retrieve statistics corresponding to the Broadcaster and Observer nodes. For more information about the statistics, see Bluetooth LE Node Statistics.