Main Content

runNode

(To be removed) Run Bluetooth LE node

Since R2022a

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

    Description

    example

    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.

    Examples

    collapse all

    Check if the Communications Toolbox™ Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.

    wirelessnetworkSupportPackageCheck;

    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.

    configureConnection(cfgConnection,centralNode,peripheralNode);

    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, ...
        GeneratePacket=true);
    addTrafficSource(centralNode,traffic,"DestinationNode",peripheralNode.Name);

    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);
    end
    Warning: runNode will be removed in a future release. To simulate the Bluetooth LE node, use the <a href="matlab:doc('wirelessNetworkSimulator')">wirelessNetworkSimulator</a> object, instead.
    
    Warning: runNode will be removed in a future release. To simulate the Bluetooth LE node, use the <a href="matlab:doc('wirelessNetworkSimulator')">wirelessNetworkSimulator</a> object, instead.
    

    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};
        txPacket = txNode.TransmitBuffer;
        if (txPacket.Type ~= 0)
            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
                    pushChannelData(rxNode,txPacket);
                end
            end
        end
    end
    Warning: channelInvokeDecision will be removed in a future release. To simulate the Bluetooth LE node, use the <a href="matlab:doc('wirelessNetworkSimulator')">wirelessNetworkSimulator</a> object, instead.
    
    Warning: channelInvokeDecision will be removed in a future release. To simulate the Bluetooth LE node, use the <a href="matlab:doc('wirelessNetworkSimulator')">wirelessNetworkSimulator</a> object, instead.
    
    Warning: pushChannelData will be removed in a future release. To simulate the Bluetooth LE node, use the <a href="matlab:doc('wirelessNetworkSimulator')">wirelessNetworkSimulator</a> object, instead.
    

    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

    References

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

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

    Version History

    Introduced in R2022a

    expand all