# Estimate Packet Delivery Ratio of LE Broadcast Audio in Residential Scenario

This example shows you how to estimate the packet delivery ratio (PDR) of Bluetooth® low energy (LE) audio isochronous broadcast streams in a residential scenario by using the Bluetooth® Toolbox.

Using this example, you can:

• Create and configure a residential scenario to simulate Bluetooth LE audio broadcast network.

• Add a custom path loss model to the wireless channel.

• Add WLAN interference and explore the performance of the LE audio broadcast network with and without WLAN interference.

• Visualize PDR at different receiver locations in the residential scenario through a heatmap.

### Isochronous Broadcasting in LE Audio

The Bluetooth Core Specification 5.2 [2], defined by the Special Interest Group (SIG), enhances LE audio technology by adding the functionality to broadcast one or more audio streams to an unlimited number of audio receiver nodes in LE audio. To implement this functionality, the Bluetooth Core Specification 5.2 [2] defines a new state, isochronous broadcasting, to the link layer (LL) state machine. In the isochronous broadcasting state, the LL transmits the isochronous data packets on an isochronous physical channel. If a Bluetooth LE node is in the isochronous broadcasting state then it is called an isochronous broadcaster.

To realize connectionless broadcast isochronous communication, the Bluetooth Core Specification 5.2 [2] defines broadcast isochronous streams (BIS) and broadcast isochronous group (BIG) events. A BIS is a logical transport that enables a Bluetooth LE node to transfer isochronous data (framed or unframed). A BIG contains one or more BISes that have the same isochronous interval.

### Residential Scenario Description

This example demonstrates a system-level simulation to evaluate the performance of a Bluetooth LE broadcast audio network in a residential scenario. The residential scenario consists of a building with two floors. This figure shows the residential scenario simulated in this example.

These are the characteristics of the residential scenario:

• Each floor consists of four rooms, each having dimensions 8 m $×$ 8 m $×$ 3 m.

• The building has one broadcaster, five receivers, and one WLAN interferer, placed in random x- and y- locations at a height of 1.5 meters from the floor.

### Configure Simulation Parameters

Set the seed for the random number generator to 1 to ensure repeatability of results. The seed value controls the pattern of random number generation. For high fidelity simulation results, change the seed value and average the results over multiple simulations.

`rng(1,"twister");`

Create a wireless network simulator object.

`networkSimulator = wirelessNetworkSimulator.init;`

#### Residential Scenario

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

• `BuildingLayout` `-` Specifies the number of rooms along the length, breadth, and height of the building.

• `RoomSize` `-` Specifies the size of each room in meters.

```scenario = struct; scenario.BuildingLayout = [2 2 2]; scenario.RoomSize = [8 8 3]; % In meters```

Set the position of the broadcaster in the network.

`broadcasterPosition = [2 2 1.5]; % x-, y-, and z- coordinates in meters`

Create a Bluetooth LE node with the role set to `isochronous-broadcaster`. Specify the transmitter properties.

```broadcasterNode = bluetoothLENode("isochronous-broadcaster"); broadcasterNode.Name = "Broadcaster"; broadcasterNode.Position = broadcasterPosition(1,:); broadcasterNode.TransmitterPower = 10 % In dBm```
```broadcasterNode = bluetoothLENode with properties: TransmitterPower: 10 TransmitterGain: 0 ReceiverRange: 100 ReceiverGain: 0 ReceiverSensitivity: -100 NoiseFigure: 0 InterferenceFidelity: 0 Name: "Broadcaster" Position: [2 2 1.5000] Read-only properties: Role: "isochronous-broadcaster" BIGConfig: [1x1 bluetoothLEBIGConfig] TransmitBuffer: [1x1 struct] ID: 1 ```

Specify the number of receivers and their respective positions in the network.

```numReceivers = 5; receiverPositions = [9 7 4.5; ... 4 4 4.5; ... 12 12 4.5; ... 3 3 1.5; ... 14 12 1.5]; % x-, y-, and z- coordinates in meters```

Create Bluetooth LE nodes with the role set as `synchronized-receiver`.

```receiverNodes = bluetoothLENode.empty(0,numReceivers); for rxIdx = 1:numReceivers rxNode = bluetoothLENode("synchronized-receiver"); rxNode.Name = ['Receiver ' num2str(rxIdx)]; rxNode.Position = receiverPositions(rxIdx,:); receiverNodes(rxIdx) = rxNode; end```

#### Configure BIG parameters

Create a Bluetooth LE BIG configuration object with default BIG parameters.

`cfgBIG = bluetoothLEBIGConfig`
```cfgBIG = bluetoothLEBIGConfig with properties: SeedAccessAddress: "78E52493" PHYMode: "LE1M" NumBIS: 1 ISOInterval: 0.0050 BISSpacing: 0.0022 SubInterval: 0.0022 MaxPDU: 251 BurstNumber: 1 PretransmissionOffset: 0 RepetitionCount: 1 NumSubevents: 1 BISArrangement: "sequential" BIGOffset: 0 ReceiveBISNumbers: 1 UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... ] InstantOffset: 6 BaseCRCInitialization: "1234" ```

```for rxIdx = 1:numReceivers configureBIG(cfgBIG,broadcasterNode,receiverNodes(rxIdx)); end```

Attach application traffic source to the broadcaster node. Configure the on-off application traffic pattern, by using the `networkTrafficOnOff` object, at the broadcaster node by specifying the application data rate, packet size, and on and off state duration.

```trafficSource = networkTrafficOnOff(OnTime=inf,DataRate=500,PacketSize=cfgBIG.MaxPDU, ... GeneratePacket=true,ApplicationData=randi([0 255], 100, 1)); addTrafficSource(broadcasterNode, trafficSource);```

#### WLAN Signal Interference

To add WLAN signal interference, enable the `wlanInterference` parameter.

`wlanInterference = true;`

The interfering WLAN nodes add interference in the Bluetooth network by transmitting WLAN signals periodically based on the configuration. They do not model the physical layer (PHY) and MAC behavior of WLAN.

Set the properties of the interfering WLAN nodes. Specify the source of WLAN interference by using the `WaveformSource` parameter of the `helperInterferingWLANNode` helper function. Specify the source of the WLAN interference by using one of these options.

• `'Generated'` - To add a WLAN Toolbox™ signal to interfere with the communication between Bluetooth nodes, select this option. For more information about how to add WLAN signal interference generated using the WLAN Toolbox features, see Add WLAN Signal Using WLAN Toolbox Features.

• `'BasebandFile'` - To add a WLAN signal from a baseband file (`.bb`) to interfere with the communication between Bluetooth nodes, select this option. You can specify the file name using the `BasebandFile` parameter. If you do not specify the `.bb` file, the example uses the default `.bb` file, `'WLANHESUBandwidth20.bb'`, to add the WLAN signal.

```if wlanInterference wlanNode = helperInterferingWLANNode; wlanNode.Name = "WLAN node"; wlanNode.Position = [14 14 4.5]; % x-, y- and z- coordinates in meters wlanNode.TransmitterPower = 5; % In dBm end```

### Create and Simulate Broadcast Isochronous Network

Create a broadcast isochronous network consisting of the LE audio broadcast nodes and WLAN interfering nodes (if present).

```addNodes(networkSimulator,[broadcasterNode receiverNodes]); nodes = num2cell([broadcasterNode receiverNodes]); if wlanInterference addNodes(networkSimulator,wlanNode); nodes = [nodes {wlanNode}]; end```

#### Visualize the Network

Create the building triangulation from the scenario parameters.

`buildingTriangulation = hTGaxResidentialTriangulation(scenario);`

Visualize the residential scenario in 3-D. Specify the nodes that you want to label together as individual cells of the `nodeGroups` parameter.

```nodeGroups = {broadcasterNode;receiverNodes}; legend = ["Bluetooth LE Broadcaster","Bluetooth LE Receiver"]; if wlanInterference nodeGroups = [nodeGroups; {wlanNode}]; legend = [legend,"Interfering WLAN node"]; end helperVisualizeResidentialScenario(buildingTriangulation,nodeGroups,legend,... "Bluetooth LE Broadcast Audio Network in a Residential scenario");```

#### Wireless Channel

Set the `customPathlossModel` to true to add your own custom path loss model. Specify the function handle of the custom model by using the `pathloss` parameter. If you set the `customPathlossModel` to false, the example uses a free-space path loss model.

`customPathlossModel = true;`

This example uses the TGax residential propagation model [4] to determine pathloss between the nodes. Path loss depends on the number of walls, number of floors, and the distance between nodes. Create a path loss model by using the hTGaxResidentialPathLoss helper function. Obtain the path loss between each pair of nodes in the network by using a function handle. Add a residential path loss model to the simulator.

```if customPathlossModel propModel = hTGaxResidentialPathLoss(Triangulation=buildingTriangulation,... FacesPerWall=1); % Propagation model pathloss = helperGeneratePathLossTable(propModel,nodes); % Pathloss function addChannelModel(networkSimulator,pathloss); end```

#### Run the Simulation

Set the simulation time in seconds.

`simulationTime = 1;`

Run all the nodes in the network for the specified simulation time.

`run(networkSimulator,simulationTime);`

### Simulation Results

At each receiver node, the simulation measures these metrics:

• PDR

• Average LL packet latency

• LL throughput

• Packet statistics at PHY and LL

• Time spent in listen state and sleep state

View the table of statistics by using the helperBLEBIGStatistics helper function.

`receiverStatistics = helperBLEBIGStatistics(nodes)`
```receiverStatistics=5×17 table Position PDR LL Average Packet Latency (seconds) Successful Data Packets Received Signals Total Signals with Collision Signals with Co-channel Interference Successful Control Packets Empty Packets Duplicate Packets PHY Decoding Failures Invalid Access Address Invalid Payload Length CRC Failures Listen Time (seconds) Sleep Time (seconds) Standby Time (seconds) ________________ _______ ___________________________________ _______________________ ________________ ____________________________ ____________________________________ __________________________ _____________ _________________ _____________________ ______________________ ______________________ ____________ _____________________ ____________________ ______________________ Receiver 1 9 7 4.5 0.76617 0.002089 154 201 61 61 0 0 0 0 25 0 21 0.4178 0 0.5822 Receiver 2 4 4 4.5 0.99502 0.002089 200 201 61 61 0 0 0 0 0 0 0 0.4178 0 0.5822 Receiver 3 12 12 4.5 0.66667 0.002089 134 201 61 61 0 0 0 5 61 0 0 0.4178 0 0.5822 Receiver 4 3 3 1.5 0.99502 0.002089 200 201 61 61 0 0 0 0 0 0 0 0.4178 0 0.5822 Receiver 5 14 12 1.5 0.85572 0.002089 172 201 61 61 0 0 0 0 7 0 21 0.4178 0 0.5822 ```

### Further Exploration

#### Add WLAN Signal Using WLAN Toolbox Features

To add a WLAN signal using WLAN Toolbox features, perform these steps:

Set the value of the `WaveformSource` parameter of the `helperInterferingWLANNode` helper object to '`Generated`'.

```% wlanNode = helperInterferingWLANNode; % wlanNode.WaveformSource = 'Generated';```

Create a WLAN packet format configuration object and assign it to the node.

```% cfgHT = wlanHTConfig("ChannelBandwidth","CBW40"); % wlanNode.FormatConfig = cfgHT;```

Set the bandwidth of the signal.

`% wlanNode.Bandwidth = 40e6;`

#### Heatmap of PDR

The floors in the residential building are divided into a grid. Each cell of the grid has a receiver placed in the center of it. To observe the variation in PDR when a receiver moves within the building, you can run the simulation for different positions of a receiver with a fixed broadcaster. Store the receiver positions in a matrix, `receiverPositions`, and the corresponding PDR values in a column vector, `pdr`. Observe the variation of PDR with respect to the distance from the broadcaster by using this code snippet.

```% helperVisualizeResidentialScenario(buildingTriangulation,{broadcasterNode;wlanNode},... % ["Bluetooth LE Broadcaster","Interfering WLAN node"],... % "PDR Heatmap at Different Receiver Locations in the Residential scenario"); % pdr = receiverStatistics.PDR; % plotHeatmap(scenario,receiverPositions,pdr); % % % Function to plot the heatmap of PDR values % function plotHeatmap(scenario, receiverPositions, pdr) % numFloors = scenario.BuildingLayout(3); % floorDim = [scenario.RoomSize(1:2).*scenario.BuildingLayout(1:2) scenario.RoomSize(3)]; % floorHeights = scenario.RoomSize(3):scenario.RoomSize(3):scenario.RoomSize(3)*numFloors; % % % Create x-. and y-axis inputs for surf function % [X, Y] = meshgrid(0:1:max(floorDim(1), floorDim(2))); % % for f = 1:numFloors % pdrValues = zeros(size(X)); % floorIdx = receiverPositions(:,3)>(floorHeights(f)-floorDim(3)) & receiverPositions(:,3)<=floorHeights(f); % receiversInFloor = receiverPositions(floorIdx, :); % receiversPDR = pdr(floorIdx); % for idx = 1:numel(receiversInFloor)/3 % index = (X == (receiversInFloor(idx,1)) & Y == (receiversInFloor(idx,2))); % pdrValues(index) = receiversPDR(idx); % end % Z = (floorHeights(f)-floorDim(3)/2)*ones(size(X)); % surf(X,Y,Z,pdrValues); % end % c = colorbar; % c.Label.String = 'PDR'; % colormap('jet'); % clim([0 1]); % end```

This heatmap plots the set of PDRs captured at each receiver placed in a cell of dimension 0.5 m $×$ 0.5 m. The simulation generates the heatmap by using these configuration parameters.

BIG configuation

• Isochronous interval: 0.015 seconds

• Number of subevents: 4

• Burst number: 4

• Maximum protocol data unit (PDU) size: 20 bytes

• Transmitter power: 5 dBm

• On-off traffic: 1000 Kbps data rate and 20 bytes packet size

Interfering WLAN node configuration

• Transmitter power: 20 dBm

• Bandwidth: 80 MHz

You can analyze the improvement in PDR in the presence of interference by changing the configuration parameters. To observe an increase in PDR, you can:

• Increase the transmission power of the broadcaster node by using the `TransmitterPower` property of the `bluetoothLENode` object.

• Increase the number of retransmissions by using the `RepetitionCount` property of the `bluetoothLEBIGConfig` object.

• Create time diversity in the copies of a packet by setting a nonzero pre-transmission offset by using the `PretransmissionOffset` property of the `bluetoothLEBIGConfig` object.

• Avoid hopping to bad channels by setting the good channels using the `updateChannelList` object function of the broadcaster node.

### Appendix

The example uses these helpers:

### Selected Bibliography

[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 10, 2021. https://www.bluetooth.com/.

[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.2. https://www.bluetooth.com/.

[3] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

[4] "TGax Channel Models.", doc. IEEE 802.11-14/0882r4.