Main Content


Add random waypoint mobility model to Bluetooth BR/EDR node

Since R2023b

    Download Required: To use addMobility, first download the Communications Toolbox Wireless Network Simulation Library add-on. For more information, see Get and Manage Add-Ons.


    addMobility(bnode) adds a random waypoint mobility model to Bluetooth® basic rate/enhanced data rate (BR/EDR) nodes, bnode. In the random waypoint model, a wireless node pauses for some duration at a location before moving towards its next random destination (waypoint) with a random speed. The node repeats this process at each waypoint.


    addMobility(bnode,Name=Value) sets the random waypoint mobility configuration parameters using one or more optional name-value arguments. For example, PauseDuration=0.02 sets the pause duration of a Bluetooth BR/EDR node to 0.02 seconds. If you add random waypoint mobility models to multiple wireless nodes in a single addMobility function call, all the nodes use the mobility parameter values specified by the name-value arguments.


    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.


    Initialize the wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create two Bluetooth BR nodes, one with the "central" role and the other with the "peripheral" role. Specify the position of the Peripheral node, in meters.

    centralNode = bluetoothNode("central");
    peripheralNode = bluetoothNode("peripheral",Position=[1 0 0]);

    Add a random waypoint mobility model to the peripheral node. Set the shape of the node's mobility area to "circle".


    Create a default Bluetooth BR/EDR connection configuration object to configure and share a connection between the Bluetooth BR Central and Peripheral nodes.

    cfgConnection = bluetoothConnectionConfig;

    Configure the connection between the Central and the Peripheral nodes.

    connection = configureConnection(cfgConnection,centralNode,peripheralNode)
    connection = 
      bluetoothConnectionConfig with properties:
        CentralToPeripheralACLPacketType: "DH1"
        PeripheralToCentralACLPacketType: "DH1"
                           SCOPacketType: "None"
                     HoppingSequenceType: "Connection adaptive"
                            UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 ... ] (1x79 double)
                            PollInterval: 40
                           InstantOffset: 240
                        TransmitterPower: 20
                      SupervisionTimeout: 32000
                          CentralAddress: "D091BBE70001"
                        PrimaryLTAddress: 1

    Create and configure a networkTrafficOnOff object to generate an On-Off application traffic pattern.

    traffic = networkTrafficOnOff(DataRate=200,PacketSize=27, ...

    Add application traffic from the Central to the Peripheral node.


    Add the Central and Peripheral nodes to the wireless network simulator.

    addNodes(networkSimulator,[centralNode peripheralNode]);

    Specify the simulation time, in seconds.

    simulationTime = 0.3;

    Run the simulation for the specified simulation time.


    Retrieve the application, baseband, and physical layer (PHY) statistics corresponding to the Central and Peripheral nodes.

    centralStats = statistics(centralNode)
    centralStats = struct with fields:
            Name: "Node1"
              ID: 1
             App: [1x1 struct]
        Baseband: [1x1 struct]
             PHY: [1x1 struct]
    peripheralStats = statistics(peripheralNode)
    peripheralStats = struct with fields:
            Name: "Node2"
              ID: 2
             App: [1x1 struct]
        Baseband: [1x1 struct]
             PHY: [1x1 struct]

    Input Arguments

    collapse all

    Bluetooth BR/EDR node, specified as a bluetoothNode object or an array of bluetoothNode objects.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: addMobility(bnode,PauseDuration=0.02) sets the pause duration for a Bluetooth BR/EDR node, after it reaches a target waypoint, to 0.02 seconds.

    Speed range, specified as a two-element numeric vector. The function sets the speed of the Bluetooth BR/EDR node according to a continuous uniform distribution based on this range. The first element of the vector specifies the minimum speed of the node, while the second specifies the maximum speed, in meters per second.

    Data Types: double

    Pause duration of the Bluetooth BR/EDR node after reaching a target waypoint, specified as a nonnegative scalar. Units are in seconds.

    Data Types: double

    Shape of the node mobility area, specified as "rectangle" or "circle".

    Data Types: char | string

    Center coordinates and dimensions of the mobility area, specified as a three-element or four-element numeric vector, depending on the value of the BoundaryShape argument.

    • "rectangle" — Specify a four-element numeric vector of the form [xcenter ycenter length width]. The default value is [xcurrent ycurrent 10 10], where the first two elements specify the xy-coordinates of current node position.

    • "circle" — Specify a three-element numeric vector of the form [xcenter ycenter radious]. The default value is [xcurrent ycurrent 10], where the first two elements specify the xy-coordinates of current node position.

    Data Types: double

    Version History

    Introduced in R2023b