You are on page 1of 4

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

xx
http://2bytes4u.blogspot.in/search?updated-max=2012-11-28T17:54:00%2B05:30&max-results=10 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-allinone2.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 sourcedestination 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-scengen/cbrgen.tcl Posted by Hema K Yarnagula Labels: Linux, NS2 No comments: Email ThisBlogThis!Share to TwitterShare to Facebook Links to this post Reactions: Adding a new module and Recompiling NS2 using Make command To add a module in Ns-2 is not a simple task especially for beginner. There are two cases in which the NS2 need to be recompiled. 1. Modifying the existing algorithm (use the same header and the C++ source files) 2. Adding new files/Protocols (adding new header and C++ source files)

Modifying the Existing Algorithm: Step 1: open the shell prompt and go to the ns-allinone-2.34/ns-2.34/ folder(there are 3 makefiles, Makefile.vc, Makefile, Makefile.in, for adding any new file should be done at the Makefile.in file) Step 2: Once the existing algorithm is changed, go to step 1. Step 3: execute the following command, make clean make depend make If you have no errors in the modified code, then the compilation will be success and NS will be created, else you may get errors, which needs to be fixed. Step 4: Test your TCL script for the new algorithm.

Adding New Protocol: Step 1: open the shell prompt and go to the /home/user/ns-allinone-2.34/ns-2.34/ folder(there are 3 makefiles namely Makefile.vc, Makefile, Makefile.in, for adding any new file should be done at the Makefile.in file)

Step 2: You may create new header and C++ source files for your new proposed algorithm and hence you need to tell that information to the Makefile.in (which is available in ns-allinone-2.34/ns-2.34/).

Step 3: Put all your files inside a respective folder under the folder /home/user/ns-allinone-2.34/ns2.34/

Step 4: Now open the Makefile.in using any editor (usually vi or gedit) and add the folder information to the OBJ_CC variable)

Step 5: anywhere inside the OBJ_CC variable, put the New file/folder information. For example: "newfolder/newfile.o \"

Step 6: after editing the file entry, follow these procedures: 1. Go to NS2 location in terminal (If you are using ns-allinone-2.xx, then go to ns-allinone2.xx/ns2x) 2. Then type "./configure" in terminal (The Makefile will be replaced with modified one.) 3. Then type "make clean" (*optional))[use this, If you want to recompile the whole ns2. This will remove all the object files in NS2]. Then type "make" [this will make all object files which are missing]

4.

If you have no errors in your modified code, then the compilation will be success, else you may get errors, which needs to be corrected.

Step 7: Now test your TCL script for the new protocol.

You might also like