メインコンテンツ

addMobility

Class: wnet.Node
Namespace: wnet

Add mobility to wireless node

Since R2026a

Description

addMobility(wirelessNode) applies random waypoint mobility to the specified wireless node.

addMobility(wirelessNode,Name=Value) sets mobility configuration parameters using one or more optional name-value arguments. For example, MobilityModel="constant-velocity" sets the mobility model to "constant-velocity".

You can add a mobility model to multiple wireless nodes in a single addMobility call, but the method applies the same mobility parameter values to all the nodes.

Input Arguments

expand all

Wireless node, specified as an object of a subclass of wnet.Node or a vector of objects of a subclass of wnet.Node.

Name-Value Arguments

expand 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(wirelessNode,MobilityModel="constant-velocity") sets the mobility model to "constant-velocity".

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 method generates a copy of the mobility model object and associates it with the node. Consequently, after the method 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 row vector. The function sets the speed of the wireless 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. Units are 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 wireless 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".

Center coordinates and dimensions of the node 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 the 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 the current node position.

Dependencies

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

Data Types: double

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

Dependencies

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

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

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

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

Refresh Interval, specified as a nonnegative scalar. This argument specifies how frequently the node updates its position and velocity information. A refresh occurs at each fixed interval, but only when the node requests it. The units are in seconds. If you set RefreshInterval to 0, the function updates position and velocity information immediately whenever you request it.

Data Types: double

Version History

Introduced in R2026a