Noncollaborative Bluetooth LE Coexistence with WLAN Signal Interference
This example shows how to simulate Bluetooth low energy (LE) noncollaborative coexistence with WLAN interference by using Bluetooth® Toolbox.
Using this example, you can:
Create and configure a Bluetooth LE piconet with Central and Peripheral nodes.
Analyze the performance of the Bluetooth LE network with and without WLAN interference.
Visualize Bluetooth LE coexistence with WLAN interference for each Peripheral node by implementing adaptive frequency hopping (AFH).
Visualize the status (good or bad) and success rate (recent and cumulative) of each channel.
The example also enables you to add a custom channel selection algorithm.
Noncollaborative Bluetooth LE-WLAN Coexistence Scenario
Interference between Bluetooth and WLAN can be mitigated by two types of coexistence mechanisms: collaborative and noncollaborative. Noncollaborative coexistence mechanisms do not exchange information between two wireless networks. Collaborative coexistence mechanisms collaborate and exchange network-related information between two wireless networks. These coexistence mechanisms are applicable only after a WLAN or Bluetooth piconet is established and the data is to be transmitted. This example demonstrates a noncollaborative AFH technique deployed between Bluetooth LE and WLAN nodes to mitigate interference. AFH enables a Bluetooth node to adapt to its environment by identifying fixed sources of WLAN interference and excluding them from the list of available channels. For more information about coexistence between Bluetooth LE and WLAN, see Bluetooth-WLAN Coexistence and Configure Bluetooth BR/EDR Channel with WLAN Interference and Pass the Waveform Through Channel.
The Bluetooth LE piconet consists of one Bluetooth LE Central node and one Peripheral node. The scenario consists of two WLAN nodes, which introduce interference in the Bluetooth LE signal. The example simulates this coexistence scenario between Bluetooth LE and WLAN.
Configure the Coexistence Scenario
For reproducibility, set the default seed for the random number generator. The seed value controls the pattern of random number generation. Initializing the random number generator using the same seed, assures the same result. For high fidelity simulation results, change the seed value and average the results over multiple simulations.
rng("default");
Create a Bluetooth LE node and set the role to "central"
by using the bluetoothLENode
object. Set the properties of the Central node.
centralNode = bluetoothLENode("central", ... Name="Central Node", ... Position=[5 0 0], ... % x-, y-, and z-coordinates in meters TransmitterPower=0); % In dBm
Create a Bluetooth LE node and set the role to "peripheral"
. Set the properties of the Peripheral node.
peripheralNode = bluetoothLENode("peripheral", ... Name="Peripheral 1", ... Position=[10 0 0], ... % x-, y-, and z-coordinates in meters TransmitterPower=0); % In dBm
Create a Bluetooth LE configuration object. Set the connection interval, active period, connection offset, and access address for each connection. Connection events are established for every connection interval duration throughout the simulation. The connection offset specifies the offset from the beginning of the connection interval. The active period specifies the active communication period for a connection after which connection event is ended. Assign the configuration to the Central and Peripheral nodes.
connectionConfig = bluetoothLEConnectionConfig; connectionConfig.ConnectionInterval = 0.01; % In seconds connectionConfig.ActivePeriod = 0.01; % In seconds connectionConfig.ConnectionOffset = 0; % In seconds connectionConfig.AccessAddress = "12345678"; % In hexadecimal configureConnection(connectionConfig,centralNode,peripheralNode);
Application Traffic
Create a networkTrafficOnOff
object to generate an On-Off application traffic pattern. Configure the On-Off application traffic pattern at the Central and Peripheral nodes by specifying the application data rate, packet size, and on state duration. Attach application traffic from the Central to the Peripheral nodes.
central2PeripheralTrafficSource = networkTrafficOnOff(... OnTime=inf, ... % In seconds DataRate=150, ... % In Kbps PacketSize=20, ... % In bytes GeneratePacket=true); addTrafficSource(centralNode,central2PeripheralTrafficSource, ... DestinationNode=peripheralNode.Name);
Attach application traffic from the Peripheral to the Central nodes.
peripheral2CentralTrafficSource = networkTrafficOnOff(... OnTime=inf, ... DataRate=150, ... PacketSize=20, ... GeneratePacket=true); addTrafficSource(peripheralNode,peripheral2CentralTrafficSource, ... DestinationNode=centralNode.Name);
WLAN Signal Interference
To add WLAN signal interference, enable the enableWLANInterference
parameter.
enableWLANInterference =
true;
Specify the number of WLAN nodes and their positions in the network. The WLAN nodes introduce interference in the network and do not model the PHY and MAC behavior.
Set the properties of the WLAN nodes. Specify the source of WLAN interference by using the wlanInterferenceSource
parameter. Use one of these options to specify the source of the WLAN interference.
"Generated"
- To add a WLAN toolbox™ signal to interfere with the communication between Bluetooth LE nodes, select this option. For steps showing how to add this signal, 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 theBasebandFile
input argument. If you do not specify the.bb
file, the example uses the default.bb
file,"WLANHESUBandwidth20.bb"
, to add the WLAN signal.
To determine the pathloss of the channel during the transmission, the example uses the distance between the nodes. Create WLAN nodes to introduce interference in the network by using the helperInterferingWLANNode helper object.
if enableWLANInterference wlanInterferenceSource ="BasebandFile"; numWLANNodes = 2; wlanNodePositions = [0 7 5; 0 3 0]; % x-, y-, and z-coordinates in meters wlanCenterFrequency = [2.412e9; 2.442e9]; % Center frequency (in Hz) based on the channel of operation wlanNodes = cell(1,numWLANNodes); for wlanIdx=1:numWLANNodes wlanNode = helperInterferingWLANNode(... WaveformSource=wlanInterferenceSource, ... Position=wlanNodePositions(wlanIdx,:), ... Name="WLAN node", ... TransmitterPower=20, ... % In dBm CenterFrequency=wlanCenterFrequency(wlanIdx), ... Bandwidth = 20e6, ... % In Hz SignalPeriodicity=0.0029); % In seconds wlanNodes{wlanIdx} = wlanNode; end end
Create Bluetooth LE Network
Create a Bluetooth LE network consisting of the Bluetooth LE nodes and WLAN interfering nodes (if any).
nodes = {centralNode peripheralNode}; if enableWLANInterference nodes = [nodes wlanNodes]; end
Configure Visualization and Channel Classification
Specify the simulation time by using the simulationTime
variable. Enable the option to visualize the Bluetooth LE coexistence with WLAN and the channel hopping sequence.
simulationTime = 0.6; % In seconds enableVisualization =true;
To implement channel classification, enable the enableChannelClassification
parameter.
enableChannelClassification =
true;
Initialize coexistence visualization by using the helperVisualizeCoexistence helper function.
if enableVisualization coexistenceVisualization = ... helperVisualizeCoexistence(simulationTime,nodes,enableChannelClassification); end
To simulate the scenario, initialize the wireless network by using the helperWirelessNetwork helper object.
networkSimulator = helperWirelessNetwork(nodes);
Schedule Channel Classification
The Bluetooth LE signal transmitted in a particular channel suffers interference from the WLAN signals. A new channel is selected from the channel map pseudo-randomly based on adaptive channel hopping. This example classifies the channel only when channel classification is enabled. For each Peripheral node, the Central node periodically classifies the channels as "good channels" or "bad channels" based on the total packets received and failed in that channel. If the current number of good channels is less than the preferred number of good channels, the example reclassifies all the bad channels as good channels. The Central node maintains a different channel map for each Peripheral node.
This example implements channel classification based on the statistics of each channel. For each Peripheral node, create a channel classification object by using the helperBluetoothLEChannelClassification helper object and schedule the action for individual destinations. The network simulator provides the flexibility to schedule a custom action in the simulation by using the scheduleAction object function of the helperWirelessNetwork helper object. For example, each time you call the simulator, you can schedule an action to plot the state transitions. Specify the function handle, input argument, absolute simulation time, and periodicity of the callback.
Create a function handle to classify the channel by using the classifyChannels object function of the helperBluetoothLEChannelClassification helper object. Schedule the channel classification for the periodicity of the callback by using the scheduleAction object function of the helperWirelessNetwork helper object. To perform a channel classification for the Peripheral node, create and schedule the action for individual destinations. You can modify or rewrite the helperBluetoothLEChannelClassification helper object or the functions of the class to implement a custom channel classification algorithm as discussed in the Add Custom Channel Classification section.
if enableChannelClassification classifierObj = helperBluetoothLEChannelClassification(... connectionConfig.UsedChannels, ... DestinationNode=peripheralNode.Name, ... DestinationID=peripheralNode.ID, ... PERThreshold=50); classifyFcn = @() classifierObj.classifyChannels(centralNode); userData = []; % User data needed to be passed to the callback function callAt = 0; % Absolute simulation time, in seconds periodicity = 125e-3; % In seconds scheduleAction(networkSimulator,classifyFcn,userData,callAt,periodicity); % Schedule channel classification end
Create Listeners
Add a listener for an event by using the addlistener
function. To update the channel map and status of the channel for each channel map update, create a listener that listens for when the ChannelMapUpdated
and PacketReceptionEnded
events are triggered on the Central node object. The source object for the listener is set to the Central node because the channel classification for all the Peripheral nodes happens at the Central node. Update the visualization by using the updateBluetoothLEVisualization object function of the helperVisualizeCoexistence helper object for each Peripheral node in the visualization.
if enableVisualization && enableChannelClassification addlistener(centralNode,"ChannelMapUpdated", ... @(nodeobj,eventdata) updateBluetoothLEVisualization(coexistenceVisualization,nodeobj,eventdata,classifierObj)); addlistener(centralNode,"PacketReceptionEnded", ... @(nodeobj,eventdata) updateBluetoothLEVisualization(coexistenceVisualization,nodeobj,eventdata,classifierObj)); elseif enableVisualization && ~enableChannelClassification addlistener(centralNode,"ChannelMapUpdated", ... @(nodeobj,eventdata) updateBluetoothLEVisualization(coexistenceVisualization,nodeobj,eventdata)); addlistener(centralNode,"PacketReceptionEnded", ... @(nodeobj,eventdata) updateBluetoothLEVisualization(coexistenceVisualization,nodeobj,eventdata)); end
For each packet reception, update the channel information and success rates of the channel by performing these steps.
1. Create a listener that listens for the ChannelMapUpdated
and PacketReceptionEnded
events are triggered on the central node object.
2. Create a callback for the updateRxStatus object function and updateChannelStatus object function of the helperBluetoothLEChannelClassification helper object.
if enableChannelClassification addlistener(centralNode,"ChannelMapUpdated", ... @(nodeobj,eventdata) updateChannelStatus(classifierObj,nodeobj,eventdata)); addlistener(centralNode,"PacketReceptionEnded", ... @(nodeobj,eventdata) updateRxStatus(classifierObj,nodeobj,eventdata)); end
Simulation Results
The example runs the simulation for the specified time and displays the channel hopping sequence in the Bluetooth LE channels and the interference caused by the WLAN channels. Visualize the state transitions, status (good or bad), and success rate (recent and cumulative) of each channel. The recent success rate represents the cumulative success rates between each channel classification interval. The overall success rate represents the cumulative success rate throughout the simulation time.
run(networkSimulator,simulationTime);
Retrieve Statistics
Retrieve the channel classification statistics by using the classificationStatistics object function of the helperVisualizeCoexistence helper object. Use this object function to visualize the packet loss ratio and throughput between each channel map update for every Peripheral node.
if enableChannelClassification bluetoothLEChannelStats = classificationStatistics(classifierObj, ... centralNode,peripheralNode); end
Channel classification statistics of Peripheral 1 Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 Channel 5 Channel 6 Channel 7 Channel 8 Channel 9 Channel 10 Channel 11 Channel 12 Channel 13 Channel 14 Channel 15 Channel 16 Channel 17 Channel 18 Channel 19 Channel 20 Channel 21 Channel 22 Channel 23 Channel 24 Channel 25 Channel 26 Channel 27 Channel 28 Channel 29 Channel 30 Channel 31 Channel 32 Channel 33 Channel 34 Channel 35 Channel 36 _________ _________ _________ _________ _________ _________ _________ _________ _________ _________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ RxPacketsTillClassification1 0 8 0 8 0 8 8 0 8 0 8 8 0 8 0 8 8 0 8 0 8 0 0 8 0 8 0 0 8 0 8 0 0 8 0 8 0 RxPacketsFailedTillClassification1 0 6 0 5 0 6 5 0 5 0 0 0 0 6 0 6 5 0 5 0 6 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification2 0 0 8 8 8 8 0 8 8 8 0 0 0 8 8 8 0 0 8 8 8 8 0 8 8 0 8 0 0 8 0 8 0 0 8 0 8 RxPacketsFailedTillClassification2 0 0 6 5 5 6 0 6 5 6 0 0 0 6 5 6 0 0 5 4 6 6 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification2 1 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification3 8 0 0 8 8 8 0 0 8 8 8 0 16 8 8 8 0 8 8 0 8 8 8 8 0 8 0 8 0 0 16 0 8 0 0 8 0 RxPacketsFailedTillClassification3 5 0 0 5 5 6 0 0 5 6 0 0 0 6 5 6 0 6 5 0 6 6 6 5 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification3 1 0 1 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification4 8 0 0 8 8 8 0 0 8 8 0 24 0 8 8 8 0 8 8 8 8 8 8 8 8 0 16 0 16 0 0 0 0 16 0 8 8 RxPacketsFailedTillClassification4 5 0 0 5 5 6 0 0 5 6 0 0 0 6 5 6 0 6 5 5 6 6 6 5 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification4 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillSimulationEnds 8 0 0 8 8 8 0 0 8 8 0 0 0 8 8 8 0 8 8 8 8 8 8 8 0 8 8 0 0 0 0 8 0 0 0 0 8 RxPacketsFailedTillSimulationEnds 5 0 0 5 5 6 0 0 5 6 0 0 0 6 5 6 0 6 5 5 6 6 6 5 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillSimulationEnds 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 TotalRxPackets 8 8 8 8 8 8 8 8 8 8 16 32 16 8 8 8 8 8 8 16 8 8 8 8 16 24 32 8 24 8 24 16 8 24 8 24 24 TotalRxPacketsFailed 5 6 6 5 5 6 5 6 5 6 0 0 0 6 5 6 5 6 5 9 6 6 6 5 0 0 0 0 0 0 0 0 0 0 0 0 0
Get the Central and Peripheral node statistics by using the statistics
object function.
centralStats = statistics(centralNode); peripheralStats = statistics(peripheralNode);
The example simulation generates these results.
A runtime plot for each Central-Peripheral connection pair showing the status (good or bad) and success rate (recent and cumulative) of each channel.
Channel classification statistics, such as the total number of packets received and corrupted and the status (good or bad) for all the channels for each classification interval, are displayed.
A bar plot for each peripheral showing the packet loss ratio and throughput between each channel map update is displayed.
The statistics at the application layer, link layer, and PHY layer are captured for the Central and Peripheral nodes.
The Bluetooth LE Central and Peripheral nodes avoid the interfered channels through channel classification and communicate with each other to avoid packet loss. The success rate is calculated at each Bluetooth LE channel. This example concludes that for high transmit power of a WLAN channel, the achieved success rate of the respective Bluetooth LE channel is low. Therefore, these channels are not used for communication between Bluetooth LE Central and Peripheral nodes.
Further Exploration
You can use this example to further explore these options:
Add WLAN signal interference generated using WLAN Toolbox.
Add a custom channel classification algorithm.
Add multiple Peripheral nodes in a piconet.
Add WLAN Signal Using WLAN Toolbox Features
To add a WLAN signal using WLAN Toolbox features, follow these steps:
Set the value of WaveformSource
parameter of the helperInterferingWLANNode 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;
Add Custom Channel Classification
You can add a custom channel classification algorithm by creating a custom channel classification object. Classify the channels by passing the classification function at an absolute simulation time or at a particular periodicity by using the scheduleAction object function. The scheduleActionAfter object function can also be used to schedule an action to process at a specified time after the current simulation time or at a particular periodicity. Instead of scheduling or calling the classification at certain simulation time instances, you can implement a custom channel classification by classifying the channels based on the status of the received packets. Analyze the status of the received packets by using the updateRxStatus object function. Classify the channels based on the status of the received packets by using the classifyChannels object function.
Add Multiple Peripheral Nodes in Piconet
To add multiple Peripheral nodes to a piconet, perform these steps:
Set the number of Bluetooth LE Peripheral nodes.
Create Peripheral nodes by using the
bluetoothLENode
object with role set to"peripheral"
.Assign the configuration to the Central node and each Peripheral node.
Generate and add application traffic at the Central and Peripheral nodes.
Enable channel classification at the Central node for each of the peripherals by creating an array of classifier objects.
Schedule the action for individual destinations. Retrieve the statistics for all Peripheral nodes.
Appendix
The example uses these helper functions:
helperInterferingWLANNode - Configure and simulate interfering WLAN node
helperVisualizeCoexistence - Visualize the coexistence model
helperWirelessNetwork - Create an object to simulate wireless network
helperBluetoothLEChannelClassification - Create an object to classify the Bluetooth LE channels
References
Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 10, 2021. https://www.bluetooth.com/.
Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification". Version 5.3. https://www.bluetooth.com/
IEEE® Standard 802.15.2™. "Coexistence of Wireless Personal Area Networks with Other Wireless Devices Operating in Unlicensed Frequency Bands". IEEE Recommended Practice for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements; IEEE Computer Society
IEEE P802.11ax™/D3.1. "Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications - Amendment 6: Enhancements for High Efficiency WLAN". Draft Standard for Information technology - Telecommunications and information exchange between systems Local and metropolitan area networks - Specific requirements; LAN/MAN Standards Committee of the IEEE Computer Society
IEEE Std 802.11™. "Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications". IEEE Standard for Information technology - Telecommunications and information exchange between systems - Local and metropolitan area networks - Specific requirements; LAN/MAN Standards Committee of the IEEE Computer Society