Pages

Sunday 11 November 2012

Wireless Simulation Scenario and CBR Traffic Generation in NS-2.xx

Scenario  Generation:

      Instead of specifying and control each nodes' position and movement pattern, we can use a CMU tool "Setdest" to generate large number of nodes and their movements. The tool uses a random waypoint model.
Setdest:
Setdest tool is used to generate the positions of nodes and their moving speed and moving directions. There are two versions for setdest. Version 2 is most recently implemented and used.

Version 1:

The signature is:
         setdest -v 1 -n $numnodes -p $pt -M $maxspeed -t $simtime -x $maxx -y $maxy
For example: setdest -v 1 -n 50 -p 0 -M 20 -t 900 -x 1500 -y 300

        This will generate a 1500*300 topology with 50 nodes random distributed labeled by a XY(Z) coordinates. (Note that, there is a bug in the README file, which gives a wrong option for specifying the speed, we should use "-M" instead of "-s").

After the initial position information, the nodes are specified with their movement destination and speed.

Version 2:

The signature is:
setdest -v <2> -n <nodes> -s <speed type> -m <min speed> -M <max speed> -t <simulation time> -P <pause type> -p <pause time> -x <max X> -y <max Y>
Where,
  •  -v version number; Here 2
  • -n number of nodes. Generated node number will be 0 to (n-1)
  • -s speed type (uniform, normal); s=1 uniform speed from min to max; s=2 normal speed clipped from min to max.
  • -m minimum speed > 0 .
  • -M maximum speed
  • -P pause type (constant, uniform); P=1 constant pause; P=2 uniform pause [0, 2*p]
  • -p pause time (a median if uniform is chosen)
  • -x x dimension of space 
  • -y y dimension of space 
After running the command a scenario will be generated. Pipe the scenario in file
For Example:
    setdest -v 2 -n 10 -m 10 -M 100 -t 20 -P 1 -p 10 -x 200 -y 400 > scen-exp1

CBR Traffic Generation

Cbrgen:
This is done with the help of cbrgen.tcl file executing with ns command. Open terminal in ~ns-allinone-2.31/ns-2.31/indep-utils/cmu-scen-gen .

The signature is:
 ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate]
Where,
  • -type traffic type (tcp, udp/cbr)
  • -nn the highest node number(node number will be 0 to nn)
  • -seed seed for random variable generation which is used to create random number of source-destination pair
  • -mc maximum number of connections; i.e.; source-destination pair.
  • -rate it is the inverse of the interval between packet transmission & should be <0
After running the command a Cbr traffic will be generated. Pipe the traffic in file.

For Example :
ns cbrgen.tcl -type cbr -nn 9 -seed 1 -mc 10 -rate .25 > cbr-exp1

For Further Explanation: Go through the source code ~ns-allinone-2.31/ns-2.31/indep-utils/cmu-scen-gen/cbrgen.tcl

No comments:

Post a Comment