Main Content

addMobility

Add random waypoint mobility model to UE node

Since R2023b

    Description

    addMobility(ue) adds a default mobility model (random waypoint) to one or more new radio (NR) user equipment (UE) nodes, ue. 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. This feature also requires the Wireless Network Toolbox™ product.

    addMobility(ue,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 UE node to 0.02 seconds. If you add 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 wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create a gNB node with these specifications.

    • Duplex mode — Time division duplex

    • Channel bandwidth — 20 MHz

    • Subcarrier spacing — 30 KHz

    gnb = nrGNB(ChannelBandwidth=20e6,DuplexMode="TDD",SubcarrierSpacing=30e3);

    Create a UE node with a transmit power of 20 dBm.

    ue = nrUE(TransmitPower=20);

    Add a random way point mobility model to the UE node.

    addMobility(ue,BoundaryShape="rectangle")

    Establish a connection between the UE and gNB nodes.

    connectUE(gnb,ue)

    Create a voice over Internet protocol (VoIP) application traffic pattern object.

    traffic = networkTrafficVoIP;

    Add the data traffic source to the gNB node. Set the destination node as the UE node.

    addTrafficSource(gnb,traffic,DestinationNode=ue)

    Add the gNB node to the wireless network simulator.

    addNodes(networkSimulator,gnb)

    Add the UE node to the wireless network simulator.

    addNodes(networkSimulator,ue)

    Specify the simulation time, in seconds.

    simulationTime = 0.3;

    Run the simulation for the specified simulation time.

    run(networkSimulator,simulationTime)

    Obtain the statistics for the gNB and UE nodes.

    gnbStats = statistics(gnb);
    ueStats = statistics(ue);

    Input Arguments

    collapse all

    UE node, specified as an nrUE object or a vector of nrUE 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(ue,PauseDuration=0.02) sets the pause duration for a UE 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 UE 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 UE 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

    Version History

    Introduced in R2023b

    expand all

    See Also

    Objects