Main Content

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 and Communications Toolbox™ Wireless Network Simulation Library.

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.

Additionally, you can use this example script to perform these tasks.

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, seeBluetooth-WLAN Coexistence

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.

scenario (6).jpg

Check for Support Package Installation

Check if the 'Communications Toolbox Wireless Network Simulation Library' support package is installed.

wirelessnetworkSupportPackageCheck

Configure Coexistence Scenario

Set the seed for the random number generator to1to ensure repeatability of results. 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(1,"twister");

Create a wireless network simulator object.

networkSimulator = wirelessNetworkSimulator.init;

Create a Bluetooth LE node and set the role to"central"by using thebluetoothLENodeobject. Set the properties of the Central node.

centralNode = bluetoothLENode("central",。..Name="Central Node",。..Position=[5 0 0],。..% x-, y-, and z-coordinates in metersTransmitterPower=0);% In dBm

Create a Bluetooth LE node and set the role to"peripheral"。边缘节点的属性集。

peripheralNode = bluetoothLENode("peripheral",。..Name="Peripheral Node",。..Position=[10 0 0],。..% x-, y-, and z-coordinates in metersTransmitterPower=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 secondsconnectionConfig.ActivePeriod = 0.01;% In secondsconnectionConfig.ConnectionOffset = 0;% In secondsconnectionConfig.AccessAddress ="12345678";% In hexadecimalconfigureConnection(connectionConfig,centralNode,peripheralNode);

Configure Application Traffic

Create anetworkTrafficOnOffobject 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 secondsDataRate=150,。..% In KbpsPacketSize=100,。..% In bytesGeneratePacket=true); addTrafficSource(centralNode,central2PeripheralTrafficSource,。..DestinationNode=peripheralNode.Name);

Attach application traffic from the Peripheral to the Central nodes.

peripheral2CentralTrafficSource = networkTrafficOnOff(。..OnTime=Inf,。..DataRate=150,。..PacketSize=100,。..GeneratePacket=true); addTrafficSource(peripheralNode,peripheral2CentralTrafficSource,。..DestinationNode=centralNode.Name);

Configure WLAN Signal Interference

广告d WLAN signal interference, set theenableWLANInterferenceflag to true.

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 one of these options.

  • "Generated"- To add a WLAN toolbox™ signal to interfere with the communication between Bluetooth LE nodes, select this option and uncomment the WLAN configuration object code.

  • "BasebandFile"- To add a WLAN signal from a baseband file with the。bbextension to interfere with the communication between Bluetooth nodes, select this option. You can specify the file name using theBasebandFileinput argument. If you do not specify a baseband file, the example adds the default file,WLANHESUBandwidth20to the WLAN signal.

To determine the path loss 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 thehelperInterferingWLANNodehelper object.

ifenableWLANInterference wlanInterferenceSource ="BasebandFile"; numWLANNodes = 2; wlanNodePositions = [0 7 5; 10 8 5];% x-, y-, and z-coordinates in meterswlanCenterFrequency = [2.412e9; 2.442e9];% Center frequency (in Hz) based on the channel of operationwlanNodes = helperInterferingWLANNode.empty(0,numWLANNodes);forwlanIdx=1:numWLANNodes wlanNodeObj = helperInterferingWLANNode(。..WaveformSource=wlanInterferenceSource,。..Position=wlanNodePositions(wlanIdx,:),。..Name="WLAN node",。..TransmitterPower=15,。..% In dBmCenterFrequency=wlanCenterFrequency(wlanIdx),。..Bandwidth = 20e6,。..% In HzSignalPeriodicity=0.0029);% In seconds%% % To add interfering signal generated using WLAN Toolbox, uncomment this code% if strcmpi(wlanInterferenceSource, "Generated")% wlanNodeObj.FormatConfig = wlanHTConfig("ChannelBandwidth","CBW20");% end%wlanNodes(wlanIdx) = wlanNodeObj;endend

Create Bluetooth LE Network

Create a Bluetooth LE network consisting of the Bluetooth LE nodes and any WLAN interfering nodes.

bluetoothNodes = [centralNode peripheralNode];

Add the Bluetooth and any WLAN nodes to the simulator.

addNodes(networkSimulator,bluetoothNodes);ifenableWLANInterference addNodes(networkSimulator,wlanNodes);end

Configure Visualization and Channel Classification

Specify the simulation time by using thesimulationTimevariable. Enable the option to visualize the Bluetooth LE coexistence with WLAN and the channel hopping sequence.

simulationTime = 2;% In seconds

To implement channel classification, enable theenableChannelClassificationvariable.

enableChannelClassification =true;

Schedule Channel Classification

The Bluetooth LE signal transmitted in a particular channel suffers interference from the WLAN signals. The Bluetooth LE node pseudorandomly selects a new channel from the channel map by using frequency hopping. This example classifies the channels using the AFH algorithm only when you enable channel classification. For each Peripheral node, the Central node periodically classifies the channels as "good" or "bad" 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.

This example implements channel classification by periodic evaluation of the packet failures of each channel. For each Peripheral node, create a channel classifier by using thehelperBluetoothChannelClassificationhelper object and schedule the action for each Peripheral node. You can schedule a custom action in the simulation by using thescheduleActionobject function of thewirelessNetworkSimulatorobject. 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 theclassifyChannelsobject function of thehelperBluetoothChannelClassificationhelper object. Schedule the channel classification for the periodicity of the callback by using thescheduleActionobject function of thewirelessNetworkSimulatorobject. To perform a channel classification for the Peripheral nodes, create and schedule the action for individual destinations.

ifenableChannelClassification classifierObj = helperBluetoothChannelClassification(。..centralNode,peripheralNode,PERThreshold=50); classifyFcn = @(varargin) classifierObj.classifyChannels; userData = [];% User data needed to be passed to the callback functioncallAt = 0;% Absolute simulation time, in secondsperiodicity = 125e-3;% In secondsscheduleAction(networkSimulator,classifyFcn,userData,callAt,periodicity);% Schedule channel classificationend

Visualization

Enable the option to visualize the Bluetooth coexistence with WLAN and the channel hopping sequence.

enableVisualization =true;

Initialize coexistence visualization by using thehelperVisualizeCoexistencehelper object. To update the channel map for each channel map update and the status of the channel for each packet reception, listeners are created by using theaddlistenerfunction of thehelperVisualizeCoexistencehelper object. When theChannelMapUpdatedandPacketReceptionEndedevents are triggered at the Central node object, the listener listens to those events.

ifenableVisualization && enableWLANInterference coexistenceVisualization = helperVisualizeCoexistence(simulationTime,bluetoothNodes,wlanNodes);elseifenableVisualization && ~enableWLANInterference coexistenceVisualization = helperVisualizeCoexistence(simulationTime,bluetoothNodes);end

Simulation Results

Run the simulation for the specified time and display the channel hopping sequence in the Bluetooth LE channels and the interference due to the WLAN signals. 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);
Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.

图包含一个坐标轴对象。坐标轴对象with title Success rate per channel, xlabel Bluetooth LE Channel Number, ylabel Success Rate (%) contains 2 objects of type bar. These objects represent Recent success rate, Cumulative success rate.

Retrieve Statistics

The example simulation generates these results.

  1. A run-time plot for each Central-Peripheral connection pair showing the status (good or bad) and success rate (recent and cumulative) of each channel.

  2. Channel classification statistics showing the total number of packets received and corrupted and the status (good or bad) of each channel for each classification interval.

  3. A bar plot for each peripheral showing the packet loss ratio and throughput between each channel map update.

  4. Application layer (APP), link layer (LL), and PHY statistics for Central and Peripheral nodes.

Retrieve the channel classification statistics by using theclassificationStatisticsobject function of thehelperVisualizeCoexistencehelper object. Use this object function to visualize the packet loss ratio and throughput between each channel map update for every Peripheral node.

ifenableChannelClassification && enableVisualization bluetoothLEChannelStats = classificationStatistics(coexistenceVisualization,centralNode,peripheralNode);end
频道分类统计的外围de 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 _________ _________ _________ _________ _________ _________ _________ _________ _________ _________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ ChannelStatusTillClassification_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 1 RxPacketsTillClassification_1 0 3 2 2 2 5 1 2 1 3 7 3 3 3 1 5 1 0 3 0 4 0 1 3 3 6 3 3 3 3 6 3 3 3 3 5 3 RxPacketsFailedTillClassification_1 0 2 2 2 2 4 1 2 1 0 0 0 0 0 1 4 1 0 2 0 3 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_2 1 1 1 1 1 0 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 RxPacketsTillClassification_2 0 4 2 3 2 5 4 2 2 3 7 6 3 6 1 5 3 0 5 0 4 3 1 6 3 6 3 3 6 3 6 3 3 7 3 5 3 RxPacketsFailedTillClassification_2 0 3 2 3 2 4 3 2 2 0 0 0 0 0 1 4 2 0 4 0 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_3 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_3 0 4 5 3 5 5 4 3 2 6 7 6 6 6 1 5 3 0 5 1 4 3 1 6 7 6 6 3 6 6 6 6 3 7 6 5 6 RxPacketsFailedTillClassification_3 0 3 4 3 3 4 3 3 2 0 0 0 0 0 1 4 2 0 4 1 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_4 1 0 1 1 0 0 0 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_4 2 4 5 3 5 5 4 3 2 9 11 6 6 6 1 5 3 2 5 1 4 3 4 6 7 9 6 9 6 6 9 6 6 7 6 8 6 RxPacketsFailedTillClassification_4 2 3 4 3 3 4 3 3 2 0 0 0 0 0 1 4 2 2 4 1 3 2 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_5 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_5 2 4 5 6 5 5 4 3 4 9 11 13 6 9 1 5 4 2 5 1 4 5 4 9 7 9 12 9 9 6 9 6 6 10 6 8 6 RxPacketsFailedTillClassification_5 2 3 4 5 3 4 3 3 4 0 0 0 0 0 1 4 3 2 4 1 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_6 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_6 2 4 5 6 5 5 4 6 4 15 11 16 9 9 2 5 4 2 5 3 4 5 4 9 11 9 12 9 9 9 9 9 6 10 9 8 9 RxPacketsFailedTillClassification_6 2 3 4 5 3 4 3 5 4 0 0 0 0 0 2 4 3 2 4 3 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_7 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_7 4 4 5 6 5 5 4 6 4 15 15 16 12 9 2 5 4 2 5 3 4 5 4 9 11 11 12 12 13 9 11 9 9 14 9 13 9 RxPacketsFailedTillClassification_7 3 3 4 5 3 4 3 5 4 0 0 0 0 0 2 4 3 2 4 3 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_8 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_8 4 4 5 6 5 5 4 6 4 17 17 21 17 13 4 5 4 2 5 5 4 5 4 12 14 11 13 12 16 13 11 15 9 17 12 13 12 RxPacketsFailedTillClassification_8 3 3 4 5 3 4 3 5 4 0 0 0 0 0 3 4 3 2 4 5 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillClassification_9 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillClassification_9 4 4 5 6 5 5 4 6 4 27 26 30 25 16 4 5 4 4 5 5 4 5 4 17 17 18 15 17 18 15 15 18 20 21 14 18 16 RxPacketsFailedTillClassification_9 3 3 4 5 3 4 3 5 4 0 0 0 0 0 3 4 3 4 4 5 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ChannelStatusTillSimulationEnds 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 RxPacketsTillSimulationEnds 4 4 5 6 5 5 4 6 4 27 28 30 25 17 4 5 4 4 5 5 4 5 4 18 17 18 15 17 20 15 15 18 20 23 14 18 19 RxPacketsFailedTillSimulationEnds 3 3 4 5 3 4 3 5 4 0 0 0 0 0 3 4 3 4 4 5 3 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Figure contains 2 axes objects and another object of type subplottext. Axes object 1 with xlabel Classification, ylabel Packet Loss Ratio contains an object of type bar. Axes object 2 with xlabel Classification, ylabel Throughput In Kbps contains an object of type bar.

Get the Central and Peripheral node statistics by using thestatisticsobject function.

centralStats = statistics(centralNode); peripheralStats = statistics(peripheralNode);

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 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

Add WLAN Signal Using WLAN Toolbox Features

广告d a WLAN signal using WLAN Toolbox features, set the value ofWaveformSourceparameter of thewlanNodeObjor ahelperInterferingWLANNodeobject to "Generated"。Uncomment the code lines in theWLAN Signal Interferencesection. You can modify the WLAN packet format configuration object in the佛rmatConfigproperty ofwlanNodeObj,并将其分配给WLAN节点。设置带宽of the signal based on the assigned configuration object.

Capture Bluetooth LE Packets to PCAP or PCAPNG file

捕获数据包在任何蓝牙节点packet capture (PCAP) or packet capture next generation (PCAPNG) file, add the following code before you run the simulation. The packets are captured into individual PCAP/PCAPNG files for each of the Bluetooth LE node. The name of the PCAP file for a node is in the format: .. Node ID is a unique number generated internally for each node. Node ID is a read-only property for all the nodes. Use thehelperPacketCaptureobject and specify the Bluetooth LE nodes to capture. Specify the file extension as "pcap" or "pcapng".

% clear packetCaptureObj; % Clear the packet capture handle if exists% packetCaptureObj = helperPacketCapture(bluetoothNodes,"pcap");

Add Custom Channel Classification

广告d a custom channel classification algorithm, perform these steps:

  1. Create a custom channel classification object.

  2. Classify the channels by passing the classification function at an absolute simulation time or at a particular periodicity by using thescheduleActionobject function.

  3. Instead of scheduling or calling the classification at certain simulation time instances, you can implement a custom channel classification algorithm by classifying the channels based on the status of the received packets.

  4. Update the status of the received packets by using theupdateRxStatusobject function.

  5. Classify the channels based on the status of the received packets by using theclassifyChannelsobject function.

Add Multiple Peripheral Nodes To A Piconet

广告d multiple Peripheral nodes to a piconet, perform these steps:

  1. Create Peripheral nodes by using thebluetoothLENodeobject, setting theRoleproperty to"peripheral"

  2. Create a connection configuration by using thebluetoothLEConnectionConfigobject.

  3. Assign the configuration to the Central node and each Peripheral node.

  4. Generate and add application traffic at the Central and Peripheral nodes.

  5. Create a Bluetooth BR network with all the nodes.

  6. Enable channel classification at the Central node for each of the Peripheral nodes by creating an array of classifier objects.

  7. Schedule the action for each of the Peripheral nodes. Retrieve the statistics for all Peripheral nodes.

Appendix

The example uses these helper functions:

References

  1. Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed September 20, 2022.https://www.bluetooth.com/

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

  3. 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

  4. 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

  5. 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

See Also

Functions

Objects

Related Topics