MassMobility

Package: inet.mobility.single

simple module MassMobility

This is a random mobility model for a mobile host with mass. It is the one used in “Optimized Smooth Handoffs in Mobile IP” by Perkins & Wang.

“An MH moves within the room according to the following pattern. It moves along a straight line for a certain period of time before it makes a turn. This moving period is a random number, normally distributed with an average of 5 seconds and a standard deviation of 0.1 second. When it makes a turn, the new direction (angle) in which it will move is a normally distributed random number with an average equal to the previous direction and a standard deviation of 30 degrees. Its speed is also a normally distributed random number, with a controlled average, ranging from 0.1 to 0.45 (unit/sec), and a standard deviation of 0.01 (unit/sec). A new such random number is picked as its speed when it makes a turn. This pattern of mobility is intended to model node movement during which the nodes have momentum and thus do not start, stop, or turn abruptly. When it hits a wall, it reflects off the wall at the same angle; in our simulated world, there is little other choice.”

This implementation can be parameterized further, using the changeInterval and angleDelta parameters. The parameters described above correspond to the following settings:

  • changeInterval = normal(5, 0.1)

  • angleDelta = normal(0, 30)

  • speed = normal(avgSpeed, 0.01)

3D (spatial movement) is also supported using the rotationAxisAngle parameter.

Author: Emin Ilker Cetinbas

inet.mobility.single.MassMobilityMassMobilitysimple

Inheritance diagram

Extends

Name

Type

Description

MovingMobilityBase

simple module

Abstract base module for mobility models.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“p: {position}\nv: {velocity}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

subjectModule

string

“^”

The module path that determines the subject module, the motion of which this mobility model describes. The default value is the parent module

coordinateSystemModule

string

“”

The module path of the geographic coordinate system module; optional, empty disables geographic conversion (and the {geo_position} directive)

updateDisplayString

bool

true

Enables continuous update of the subject module’s position by modifying its display string

constraintAreaMinX

double

-inf m

The minimum x position of the constraint area. It is unconstrained by default (negative infinity)

constraintAreaMinY

double

-inf m

The minimum y position of the constraint area. It is unconstrained by default (negative infinity)

constraintAreaMinZ

double

-inf m

The minimum z position of the constraint area. It is unconstrained by default (negative infinity)

constraintAreaMaxX

double

inf m

The maximum x position of the constraint area. It is unconstrained by default (positive infinity)

constraintAreaMaxY

double

inf m

The maximum y position of the constraint area. It is unconstrained by default (positive infinity)

constraintAreaMaxZ

double

inf m

The maximum z position of the constraint area. It is unconstrained by default (positive infinity)

updateInterval

double

0.1s

The simulation time interval used to regularly signal mobility state changes and update the display

faceForward

bool

true

initialX

double

uniform(constraintAreaMinX, constraintAreaMaxX)

initialY

double

uniform(constraintAreaMinY, constraintAreaMaxY)

initialZ

double

nanToZero(uniform(constraintAreaMinZ, constraintAreaMaxZ))

initialMovementHeading

double

uniform(0deg, 360deg)

Initial heading

initialMovementElevation

double

0deg

Initial elevation

initFromDisplayString

bool

true

Enables one-time initialization from the subject module’s display string

changeInterval

double

Frequency of changing speed and angle (can be random)

angleDelta

double

Rotate velocity vector by this much around the rotation axis defined by the rotationAxisAngle parameter (can be random)

rotationAxisAngle

double

0deg

Defines a vector in the plane perpendicular to the velocity, where 0 deg means the Z axis when bank is zero (can be random)

speed

double

Speed (can be random, updated every changeInterval)

Properties

Name

Value

Description

class

MassMobility

display

i=block/cogwheel

Signals

Name

Type

Unit

Description

mobilityStateChanged

inet::MobilityBase

It works in inet, but not in the extended module in another namespace

Source code

//
// This is a random mobility model for a mobile host with mass. It is the
// one used in "Optimized Smooth Handoffs in Mobile IP" by Perkins & Wang.
//
// "An MH moves within the room according to the following pattern. It moves
// along a straight line for a certain period of time before it makes a turn.
// This moving period is a random number, normally distributed with an average of
// 5 seconds and a standard deviation of 0.1 second. When it makes a turn, the
// new direction (angle) in which it will move is a normally distributed
// random number with an average equal to the previous direction and a standard
// deviation of 30 degrees. Its speed is also a normally distributed random
// number, with a controlled average, ranging from 0.1 to 0.45 (unit/sec), and
// a standard deviation of 0.01 (unit/sec). A new such random number is picked
// as its speed when it makes a turn. This pattern of mobility is intended to
// model node movement during which the nodes have momentum and thus do not
// start, stop, or turn abruptly. When it hits a wall, it reflects off the
// wall at the same angle; in our simulated world, there is little other
// choice."
//
// This implementation can be parameterized further, using the `changeInterval`
// and `angleDelta` parameters. The parameters described above
// correspond to the following settings:
// - changeInterval = normal(5, 0.1)
// - angleDelta = normal(0, 30)
// - speed = normal(avgSpeed, 0.01)
//
// 3D (spatial movement) is also supported using the `rotationAxisAngle` parameter.
//
// @author Emin Ilker Cetinbas
//
simple MassMobility extends MovingMobilityBase
{
    parameters:
        double initialX @unit(m) = default(uniform(constraintAreaMinX, constraintAreaMaxX));
        double initialY @unit(m) = default(uniform(constraintAreaMinY, constraintAreaMaxY));
        double initialZ @unit(m) = default(nanToZero(uniform(constraintAreaMinZ, constraintAreaMaxZ)));
        double initialMovementHeading @unit(deg) = default(uniform(0deg, 360deg)); // Initial heading
        double initialMovementElevation @unit(deg) = default(0deg); // Initial elevation
        bool initFromDisplayString = default(true); // Enables one-time initialization from the subject module's display string
        volatile double changeInterval @unit(s); // Frequency of changing speed and angle (can be random)
        volatile double angleDelta @unit(deg); // Rotate velocity vector by this much around the rotation axis defined by the rotationAxisAngle parameter (can be random)
        volatile double rotationAxisAngle @unit(deg) = default(0deg); // Defines a vector in the plane perpendicular to the velocity, where 0 deg means the Z axis when bank is zero (can be random)
        volatile double speed @mutable @unit(mps); // Speed (can be random, updated every changeInterval)
        @class(MassMobility);
}

File: src/inet/mobility/single/MassMobility.ned