Main Content

addMobility

Add random waypoint mobility model to Bluetooth BR/EDR node

Since R2023b

    Description

    This feature also requires the Wireless Network Toolbox™ product.

    addMobility(btNode) adds a default mobility model (random waypoint) to Bluetooth® basic rate/enhanced data rate (BR/EDR) nodes, btNode. 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(btNode,Name=Value) sets the 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 the mobility model to multiple wireless nodes in a single addMobility function call, all the nodes use the mobility parameter values specified by the name-value arguments.

    example

    Examples

    collapse all

    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 1]);

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

    addMobility(peripheralNode,BoundaryShape="circle",RefreshInterval=0.1)

    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 … ] (1×79 double)
                            PollInterval: 40
                           InstantOffset: 240
                        TransmitterPower: 20
                      SupervisionTimeout: 32000
                          CentralAddress: "D091BBE70001"
                        PrimaryLTAddress: 1
    
    

    Create and configure a networkTrafficOnOff (Wireless Network Toolbox) object to generate an On-Off application traffic pattern.

    traffic = networkTrafficOnOff(DataRate=200,PacketSize=27,OnTime=inf);

    Add application traffic from the Central to the Peripheral node.

    addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode);

    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.

    run(networkSimulator,simulationTime);

    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: [1×1 struct]
        Baseband: [1×1 struct]
             PHY: [1×1 struct]
    
    
    peripheralStats = statistics(peripheralNode)
    peripheralStats = struct with fields:
            Name: "Node2"
              ID: 2
             App: [1×1 struct]
        Baseband: [1×1 struct]
             PHY: [1×1 struct]
    
    

    Input Arguments

    collapse all

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

    Name-Value Arguments

    collapse all

    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.

    Since R2026a

    Mobility model, specified as "random-waypoint", "random-walk", "constant-velocity", or an object of a subclass of wnet.Mobility. When you provide a custom mobility object, the function generates a copy of the mobility model object and associates it with the node. Consequently, after the function assigns the mobility model to the node, changes you make to the original mobility model object do not affect the node.

    If you specify a custom mobility model object, the function ignores any other mobility parameters provided as name-value arguments.

    Speed range, specified as a two-element positive 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.

    To set the speed to a constant value, specify SpeedRange as a two-element row vector with identical values.

    Dependencies

    To specify this argument, you must specify the MobilityModel argument as "random-waypoint" or "random-walk".

    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.

    Dependencies

    To specify this argument, you must specify the MobilityModel argument as "random-waypoint".

    Data Types: double

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

    Dependencies

    To specify this argument, you must specify the MobilityModel argument as "random-waypoint" or "random-walk".

    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. Units are in meters.

    • "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 radius]. The default value is [xcurrent ycurrent 10], where the first two elements specify the xy-coordinates of current node position.

    Dependencies

    To specify this argument, you must specify the MobilityModel argument as "random-waypoint" or "random-walk".

    Data Types: double

    Since R2026a

    Mode of random walk, specified as "time" or "distance".

    Dependencies

    To specify this argument, you must specify the MobilityModel argument as "random-walk".

    Since R2026a

    Time after which the speed and direction change, specified as a positive scalar. Units are in seconds.

    Dependencies

    To specify this argument, you must specify the WalkMode argument as "time" and the MobilityModel argument as "random-walk".

    Data Types: double

    Since R2026a

    Distance after which the speed and direction change, specified as a positive scalar. Units are in meters.

    Dependencies

    To specify this argument, you must specify the WalkMode argument as "distance" and the MobilityModel argument as "random-walk".

    Data Types: double

    Since R2026a

    Current node velocity in Cartesian x-, y-, and z-coordinates, specified as a numeric vector of the form [vx vy vz]. vx, vy, and vz are velocity components in the x-, y-, and z-directions, respectively. Units are in meters per second.

    Dependencies

    To specify this argument, you must specify the MobilityModel argument as "constant-velocity".

    Data Types: double

    Since R2026a

    Refresh Interval, specified as a nonnegative scalar. This argument indicates how often the node updates its position and velocity information, with a single refresh occurring at each fixed interval. The units are in seconds.

    Data Types: double

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed January 10, 2026. https://www.bluetooth.com/.

    [2] Bluetooth Core Specifications Working Group. "Bluetooth Core Specification" v6.1. https://www.bluetooth.com/specifications/specs/core-specification-6-1/.

    Version History

    Introduced in R2023b

    expand all