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.

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 (Bluetooth Toolbox) and Configure Bluetooth BR/EDR Channel with WLAN Interference and Pass the Waveform Through Channel (Bluetooth Toolbox).

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

Configure the Coexistence Scenario

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. 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");

Initialize the wireless network simulation by using the wirelessNetworkSimulator (Bluetooth Toolbox) object function of wirelessNetworkSimulator (Bluetooth Toolbox) object.

networkSimulator = wirelessNetworkSimulator.init();

Create a Bluetooth LE node and set the role to "central" by using the bluetoothLENode (Bluetooth Toolbox) 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 (Bluetooth Toolbox) 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, set the enableWLANInterference flag 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 (.bb) to interfere with the communication between Bluetooth nodes, select this option. You can specify the file name using the BasebandFile 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 = helperInterferingWLANNode.empty(0,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;
% 
% %       To add interfering signal generated using WLAN Toolbox, uncomment these code lines
%         if strcmpi(wlanInterferenceSource, "Generated")
%             wlanNode.FormatConfig = wlanHTConfig("ChannelBandwidth","CBW20");
%         end
%
    end
end

Create Bluetooth LE Network

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

bluetoothNodes = [centralNode peripheralNode];

Add the Bluetooth and WLAN nodes (if any) to the simulator.

addNodes(networkSimulator,bluetoothNodes);
if enableWLANInterference 
    addNodes(networkSimulator,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.75;                        % In seconds

To implement channel classification, enable the enableChannelClassification parameter.

enableChannelClassification = true;

Schedule Channel Classification

The Bluetooth LE signal transmitted in a particular channel suffers interference from the WLAN signals. The Bluetooth LE node pseudo-randomly selects a new channel from the channel map by using frequency hopping. This example classifies the channels by AFH algorithm only when channel classification is enabled. 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. To update the status of the channel for each packet reception, listener is created by using the addlistener function inside the helperBluetoothChannelClassification helper object. When the PacketReceptionEnded event is triggered at the Central node object, the listener listens to the event.

This example implements channel classification by periodic evaluation of the packet failures of each channel. For each Peripheral node, create a channel classification object by using the helperBluetoothChannelClassification helper object and schedule the action for each Peripheral nodes. The network simulator provides the flexibility to schedule a custom action in the simulation by using the scheduleAction (Bluetooth Toolbox) object function of the wirelessNetworkSimulator (Bluetooth Toolbox) 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 helperBluetoothChannelClassification helper object. Schedule the channel classification for the periodicity of the callback by using the scheduleAction (Bluetooth Toolbox) object function of the wirelessNetworkSimulator (Bluetooth Toolbox) object. To perform a channel classification for the Peripheral nodes, create and schedule the action for individual destinations.

if enableChannelClassification 
    classifierObj = helperBluetoothChannelClassification(...
        centralNode,peripheralNode,PERThreshold=50);
    classifyFcn = @(varargin) classifierObj.classifyChannels;
    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

Visualization

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

enableVisualization = true;

Initialize coexistence visualization by using the helperVisualizeCoexistence helper 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 the addlistener function inside the helperVisualizeCoexistence helper object. When the ChannelMapUpdated and PacketReceptionEnded events are triggered at the Central node object, the listener listens to those events.

if enableVisualization && enableWLANInterference
    coexistenceVisualization = helperVisualizeCoexistence(simulationTime,bluetoothNodes,wlanNodes);
elseif enableVisualization && ~enableWLANInterference
    coexistenceVisualization = helperVisualizeCoexistence(simulationTime,bluetoothNodes);
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);
Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.

Figure contains an axes object. The axes object with title Success rate per channel 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 runtime 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) for all the channels 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 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 && enableVisualization
    bluetoothLEChannelStats = classificationStatistics(coexistenceVisualization,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
                                           _________    _________    _________    _________    _________    _________    _________    _________    _________    _________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________    __________

    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            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    
    RxPacketsFailedTillClassification_1        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    
    ChannelStatusTillClassification_2          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    
    RxPacketsTillClassification_2              0            8            8            8            8            8            8            8            8            8             8             8             0            8             8             8             8             0             8              8            8             8             0             8              8             8             8             0             8             8             8             8             0             8             8             8             8    
    RxPacketsFailedTillClassification_2        0            6            6            5            5            6            5            5            5            0             0             0             0            6             5             6             5             0             5              4            6             6             0             5              0             0             0             0             0             0             0             0             0             0             0             0             0    
    ChannelStatusTillClassification_3          1            0            1            0            0            0            0            1            0            1             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    
    RxPacketsTillClassification_3              8            8            8            8            8            8            8            8            8            8            16            16             8            8             8             8             8             8             8              8            8             8             8             8              8            16             8             8             8            16            16             8             8             8            16             8             8    
    RxPacketsFailedTillClassification_3        5            6            6            5            5            6            5            5            5            0             0             0             0            6             5             6             5             6             5              4            6             6             6             5              0             0             0             0             0             0             0             0             0             0             0             0             0    
    ChannelStatusTillClassification_4          0            0            0            0            0            0            0            0            0            1             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    
    RxPacketsTillClassification_4              8            8            8            8            8            8            8            8            8           24            24            32            32            8             8             8             8             8             8             24            8             8             8             8             24            24            24            16            16            24            16            16            16            24            24            24            16    
    RxPacketsFailedTillClassification_4        5            6            6            5            5            6            5            5            5            0             0             0             0            6             5             6             5             6             5             16            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            1             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    
    RxPacketsTillSimulationEnds                8            8            8            8            8            8            8            8            8           40            24            32            32            8             8             8             8             8             8             24            8             8             8             8             24            40            24            24            16            24            16            16            24            24            24            24            16    
    RxPacketsFailedTillSimulationEnds          5            6            6            5            5            6            5            5            5            0             0             0             0            6             5             6             5             6             5             16            6             6             6             5              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 contains an object of type bar. Axes object 2 contains an object of type bar.

Get the Central and Peripheral node statistics by using the statistics (Bluetooth Toolbox) object function.

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

The example simulation generates these results.

  1. A runtime 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, 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.

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

  4. 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, set the value of WaveformSource parameter of the wlanNode or a helperInterferingWLANNode object to "Generated". Uncomment the code lines in the WLAN Signal Interference section as specified. You can modify the WLAN packet format configuration object in FormatConfig of wlanNode and assign it to the WLAN node. Set the bandwidth of the signal based on the assigned configuration object.

Add Custom Channel Classification

To add 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 the scheduleAction (Bluetooth Toolbox) object function.

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

  4. Update the status of the received packets by using the updateRxStatus object function.

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

  1. Create Peripheral nodes by using the bluetoothLENode (Bluetooth Toolbox) object with role set to "peripheral".

  2. Create a connection configuration by using the bluetoothLEConnectionConfig (Bluetooth Toolbox) object.

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

Related Topics