Main Content


(To be removed) Run Bluetooth LE node

    runNode will be removed in a future release. To run the Bluetooth LE node, use the wirelessNetworkSimulator object, instead.



    nextInvokeTime = runNode(bluetoothLENodeObj,currentTime) runs the Bluetooth® LE node specified by the bluetoothLENodeObj object. The object function runs all the actions scheduled at the current time and returns the time instant nextInvokeTime at which the node runs again.


    collapse all

    Create a Bluetooth LE node, specifying the role as "central".

    centralNode = bluetoothLENode("central");

    Create a Bluetooth LE node, specifying the role as "peripheral".

    peripheralNode = bluetoothLENode("peripheral");

    Create a default Bluetooth LE configuration object to establish a connection between the Central and Peripheral nodes.

    cfgConnection = bluetoothLEConnectionConfig;

    Configure the connection between the Central and Peripheral nodes.


    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. Generate an application packet with a payload by enabling packet generation. Add application traffic from the Central to the Peripheral node by using the addTrafficSource object function.

    traffic = networkTrafficOnOff(DataRate=50, ...
        PacketSize=20, ...

    Create a Bluetooth LE network consisting of a Central and a Peripheral node.

    nodes = {centralNode peripheralNode};
    numNodes = length(nodes);

    Set the current simulation time in seconds.

    currentTime = 0;

    Run the Bluetooth LE nodes at the current simulation time. The runNode object function returns the time instant at which the node runs again.

    for index = 1:numNodes
        nextInvokeTime = runNode(nodes{index},currentTime);

    If the transmit buffer has packet to be transmitted, the channelInvokeDecision object function performs these tasks.

    • Determines whether the receiving node wants to receive the packet.

    • Retrieves the receiver information required to apply the channel to the transmitted packet.

    If the node wants to receive the packet, apply the channel to the transmitted packet and push the data from the channel to the reception buffer by using the pushChannelData object function.

    for txIndex = 1:numNodes
        txNode = nodes{txIndex};
        if (txNode.TransmitBuffer.Type ~= 0)
            txPacket = txNode.TransmitBuffer;
            for rxIndex = 1:numNodes
                rxNode = nodes{rxIndex};
                [flag,rxInfo] = channelInvokeDecision(rxNode,txPacket);
                if flag
                    % Apply a path loss to the transmitted data in this comment
                    % line before pushing the data to the reception buffer

    Input Arguments

    collapse all

    Bluetooth LE node object, specified as a bluetoothLENode object.

    Current simulation time, specified as a positive scalar. Specify the units in seconds.

    Data Types: double

    Output Arguments

    collapse all

    Time instant at which Bluetooth LE node runs again, returned as a nonnegative scalar. Specify the units in seconds.

    Data Types: double


    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 12, 2021.

    [2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification". v5.3.

    Version History

    Introduced in R2022a

    expand all