Mobility models for ad-hoc networks
Pursue model
The '+' simbol denotes the gravity center.
The '.' points are the reference locations of the nodes.
The "0" node is the target point, it is not animated.
Click with the mouse to move the target to this position. The other nodes will go for it.
public static Pos move_pursue(int node) {
// let's the maximum step a node can do in the direction of the target
is
// one third of the distance
Pos p=(Pos)loc.get(new Integer(node));
double d=p.distance(target);
if(d<15.0)d=15.0; // min movement (acceleration)
if(d>50.0)d=50.0; // max movement
int xi=(int)(Math.random()*d/3);
int yi=(int)(Math.random()*d/3);
if (p.isLeft(target)) xi+=p.x; else xi=p.x-xi;
if (p.isUp(target)) yi+=p.y; else yi=p.y-yi;
return new Pos(xi,yi);
}
If you have not the correct behavior, please let your browser to totally reload the
contents of this page. The complete source code of these applets is here.
Miguel Sanchez 1998
|