tags:

views:

92

answers:

1

Just started reading on random way point mobility for MANET. I found a lot of work implements this model. Hence, I assumed the Matlab code will be available which I could look into to understand it better. Unfortunately, I found none.

Any body can suggest any good tutorial or codes available on random way point ? Help appreciated.

UPDATE:

Random Waypoint (RWP) model is a commonly used synthetic model for mobility, e.g., in Ad Hoc networks. It is an elementary model which describes the movement pattern of independent nodes by simple terms.

Briefly, in the RWP model:

Each node moves along a zigzag line from one waypoint to the next The waypoints are uniformly distributed over the given convex area, e.g. unit disk. At the start of each leg a random velocity is drawn from the velocity distribution (in the basic case the velocity is constant 1) Optionally, the nodes may have so-called "thinking times" when they reach each waypoint before continuing on the next leg, where durations are independent and identically distributed random variables

![1. Common Problems with Random Waypoint Model][1]

Zig-zag trajectories: RWP model is elementary and it is easy to argue about the paths being unnatural. Then again, any practical protocol or mechanism should be robust and give a reasonable performance with a wide range of moving patterns, including movement similar to RWP model. Velocity distribution: The most common problem with simulation studies using random waypoint model is a poor choice of velocity distribution [4], e.g., uniform distribution U(0,Vmax). Such velocity distributions (which seem to be common with NS-2 simulations!) lead to a situation where at the stationary state each node stops moving. In order to avoid this the velocity distribution should be such that 1/E[1/V] > 0 Note that the mean time a node spends on a single leg is proportional to 1/E[1/V]. 2. Random Waypoint on the Border (RWPB)

In the (standard) RWP model the waypoints are uniformly distributed over the given domain. Alternatively, the waypoints can be uniformly distributed on the border of the domain and this model is referred to as the "Random waypoint on the border" (RWPB) model. The spatial node density resulting from RWPB model is quite different from the RWP model, i.e. the probability mass shifts from the center of the area to the borders. In particular, if the border contains a straight line segment, then there is a positive probability that a random leg resides on the line segment (resulting in a 1-dimension pdf on each line segment on the border).

[1]: http://i.imgur.com/VKobC.gif [source:http://www.netlab.tkk.fi/~esa/java/rwp/rwp-model.shtml]

This is what I found a good source. How can I implement this model in MATLAB?

UPDATE

RANDOM NETWORK TOPOLOGY:

 maxx=1000;
 maxy=1000;
 maxn=100;
%node generation
 node = rand(maxn,2);
 node(:,1) = node(:,1)*maxx;
 node(:,2) = node(:,2)*maxy;
 maxd=2;
 noded = rand(maxd,2);
 noded(:,1) = noded(:,1)*maxx;
 noded(:,2) = noded(:,2)*maxy;
 maxs=4;
 nodes = rand(maxs,2);
 nodes(:,1) = nodes(:,1)*maxx;
 nodes(:,2) = nodes(:,2)*maxy;
    % make background white, run only once
    colordef none,  whitebg
    figure(1);
    axis equal
    hold on 
    box on;
    plot(node(:, 1), node(:, 2), 'k.', 'MarkerSize', 25);
    hold on 

   % plot(noded(:, 1), noded(:, 2), 'r.', 'MarkerSize', 25);
    hold on
  %  plot(nodes(:, 1), nodes(:, 2), 'b.', 'MarkerSize', 25);
    hold on
    title('Network topology');
    xlabel('X');
    ylabel('Y'); 
    grid on
    Xminor grid on 
    axis([0, maxx, 0, maxy]);
    set(gca, 'XTick', [0; maxx]);
    set(gca, 'YTick', [maxy]);

Result:

RANDOM WAY POINT MOBILITY:

clear;
hold on;
X = 1500;
Y = 500;

MINSPEED = 0;
MAXSPEED = 20;
PAUSETIME = 2;
TIME = 900;
N = 10;
AMOSTRAS = 30;
nodes = zeros(N,6);
nodes_speed = zeros(N,TIME);
nodes_speed_mean = zeros (AMOSTRAS,TIME);

for a=1:AMOSTRAS
    for i=1:N
        j=1;
        x = rand*X;
        y = rand*Y;
        waypointX = rand*X;
        waypointY = rand*Y;
        speed = MINSPEED+(MAXSPEED - MINSPEED)*rand;
        time = 1;
        node = [x y speed waypointX waypointY time];
        nodes(j,:) =node;
        while time <= TIME
            node = nodes(j,:);
            x = node(1);
            y = node(2);
            speed = node(3);
            waypointX = node(4);
            waypointY = node(5);
            dist = sqrt((x-waypointX)^2+(y-waypointY)^2);
            new_waypointX = rand*X;
            new_waypointY = rand*Y;
            new_speed =  MINSPEED+(MAXSPEED - MINSPEED)*rand;
            time = time + dist/speed + PAUSETIME;
            node = [waypointX waypointY new_speed new_waypointX new_waypointY time];
            j=j+1;
            nodes(j,:) =node;
        end
        for k=1:j-1
            node_ant = nodes(k,:);
            speed = node_ant(3);
            time_ant = node_ant(6);
            node_next = nodes(k+1,:);
            time_next = node_next(6);
            if time_next >TIME
                time_next = TIME;
            end
            times = ceil(time_ant):floor(time_next);
            if ~isempty(times)
                nodes_speed(i,times) = speed ;
            end
        end
    end
    nodes_speed_mean(a,:) = mean(nodes_speed);
end
plot (mean(nodes_speed_mean),'r');
grid on 

![alt text][3]

  1. I generated the network topology which is static in the first code. In the second code I generated RWP mobility. Now, my question is, Can I do like this:

    The generates the network randomly prints it . Next the mobility model is applied the network. I shall plot the network again and see the nodes have moved. Lat I plot the spedd as (figure 2.).

Thanks for the help.

A: 

So at each step you need to generate 3 random numbers:

  1. to represent the time that the actor stays at the current location.

  2. to represent the x-coordinate of the actor's next step.

  3. to represent the y-coordinate of the actor's next step.

(You might replace the x- and y-coordinates with a velocity vector, but you still need 2 random numbers.)

Now all you have to do is figure out what distributions to draw the random numbers from to fit your model. A very naive Matlab approach would be to execute:

rand(10,3)-0.5

to represent the starting point and the first 9 steps taken by one of your actors. As well as selecting your distributions carefully, you'll want to scale the steps taken.

High Performance Mark
Done and done. Thanks for the help.
Tinglin

related questions