Use of Mobility models in ns-2 Karthik Dantu Shyam Kapadia
Random Waypoint setdest –n –p –s –t –x –y Parameters Number of nodes (N) Pause Time (P) Max speed (S) Simulation Time (T) Max X (X) Max Y(Y) Eg:./setdest -n 10 -p 4 -s 5 -t 10 -x 500 -y 500 > scen
Traffic generation User cbrgen.tcl Syntax: ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] –seed [seed] [-mc connections] [- rate rate] Eg: ns cbrgen.tcl -type cbr -nn 3 -seed mc 2 -rate 10.0 > cbr Similarly TCP traffic can be generated
Pre-generated Scenarios ~ns/ns-2.1b8a/tcl/mobility/scene Scen-1500x Area – 1500x300 Nodes – 60 Pause time – 0.0 Max speed – Time 900s Other files Scen-670X , Scen-670X , Scen-670X
Pre-generated traffic patterns ~ns/ns-2.1b8a/tcl/mobility/scene cbr Nodes – 50 Max. Connections – 10 Seed – Send Interval – 4.0 Other Examples cbr , cbr , cbr-3-test
Usage in ns scripts Mobility model and traffic pattern files are input to the ns script Eg:.. From wireless-test.tcl set opt(cp) "../mobility/scene/cbr-3-test" set opt(sc) "../mobility/scene/scen-3-test” …… Source $opt(cp) Source $opt(sc)
Viewing traces Trace file – Needs to be parsed Use awk or perl script at r _9_ RTR tcp 1492 [a ] [655 36: : :0] [1 0] 2 0 Eg: cat out.tr | grep “RTR” | awk ‘{print $2}’ > rtr-time.tr Gives trace of times of RTR packets. Revised Trace Format s -t Hs 0 -Hd -1 -Ni 0 -Nx Ny Nz Ne Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is Id It message -Il 32 -If 0 -Ii 0 -Iv 32 - detailed explanation in NS Manual Chapter 16
Visualization Using nam Enable tracing 1. $ns_ namtrace-all-wireless 2. $mobilenode namattach $ns_ node-config - agentTrace ON - routerTrace ON - macTrace ON