MATES 3.0-rc2

org.mates.sim.models.mobility
Class GridMobilityModel

java.lang.Object
  extended byorg.mates.sim.models.mobility.GridMobilityModel
All Implemented Interfaces:
MobilityModel

public class GridMobilityModel
extends java.lang.Object
implements MobilityModel

Mobility model for a grid. Hosts randomly move to an adjacent grid entry. This mobility model is meant to be used with a link model such as QuadraticLinkModel and GridLinkModel.

Hosts using this link model must have a position of type Position2D.

This model is akin to the City Section Mobility Model, described in:

Camp, T.; Boleng, J.; and Davies, V. 2002. A survey of mobility models for ad hoc network research. Wireless Communication & Mobile Computing (WCMC): Special Issue on Mobile Ad Hoc Networking: Research, Trends and Applications 2(5):483--502.

Note that, with the current implementation, externally modifying anything within the grid object passed to this class with have unknown results.

Author:
Evan Sultanik

Constructor Summary
GridMobilityModel(Grid grid, double x, double y, double width, double height, int move_iterations, java.util.Random random)
          Constructs a grid mobility model.
 
Method Summary
 void moveHost(Host host)
          Moves a host to an adjacent grid point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridMobilityModel

public GridMobilityModel(Grid grid,
                         double x,
                         double y,
                         double width,
                         double height,
                         int move_iterations,
                         java.util.Random random)
Constructs a grid mobility model.

Parameters:
grid - should be shared with every host using this mobility model. This object is used to store the hosts' positions.
x - the x coordinate of the upper-left corner of the grid within the domain
y - the y coordinate of the upper-left corner of the grid within the domain
width - the width of the grid
height - the height of the grid
move_iterations - the number of iterations required for a host to move from one grid point to an adjacent grid point
random - the random number generator to use. This should almost always be the random number generator from the simulator (Simulator.getRandom()).
Method Detail

moveHost

public void moveHost(Host host)
Moves a host to an adjacent grid point. If the host is currently on a grid point, it randomly selects one of the adjacent points to move to next. If the host is currently in transit to a grid point, the path is linearly interpolated such that it gets to the other point on time.

Specified by:
moveHost in interface MobilityModel

MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik