Use of Mobility models in ns2 Karthik Dantu
Use of Mobility models in ns-2 Karthik Dantu Shyam Kapadia
Random Waypoint setdest –n <num nodes> –p <pause time> –s <speed> –t <Time> –x <x> –y <y> n Parameters n n n 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 10 -4 -500
Traffic generation n User cbrgen. tcl Syntax: ns cbrgen. tcl [-type cbr|tcp] [-nn nodes] –seed [seed] [-mc connections] [rate] Eg: ns cbrgen. tcl -type cbr -nn 3 -seed 43578 -mc 2 -rate 10. 0 > cbr-3 -2 -10 n Similarly TCP traffic can be generated n
Pre-generated Scenarios ~ns/ns-2. 1 b 8 a/tcl/mobility/scene Scen-1500 x 300 -60 -0 -20 -2 n n n n Area – 1500 x 300 Nodes – 60 Pause time – 0. 0 Max speed – 20. 00 Time 900 s Other files n Scen-670 X 670 -50 -600 -20 -0, Scen-670 X 670 -50 -600 -20 -1, Scen-670 X 670 -50 -600 -20 -2
Pre-generated traffic patterns ~ns/ns-2. 1 b 8 a/tcl/mobility/scene cbr-50 -10 -4 -512 n n n Nodes – 50 Max. Connections – 10 Seed – 95813843. 243 Send Interval – 4. 0 Other Examples cbr-10 -1 -10 -20, cbr-50 -20 -4 -512, cbr-3 -test n
Usage in ns scripts Mobility model and traffic pattern files are input to the ns script Eg: . . From wireless-test. tcl n set opt(cp) ". . /mobility/scene/cbr-3 -test" set opt(sc) ". . /mobility/scene/scen-3 -test” …… Source $opt(cp) Source $opt(sc)
Viewing traces n n Trace file – Needs to be parsed Use awk or perl script at http: //nile. wpi. edu/NS/Example/column r 160. 093884945 _9_ RTR --- 1 tcp 1492 [a 2 4 6 800] ------[655 36: 0 16777984: 0 31 16777984: 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 0. 267662078 -Hs 0 -Hd -1 -Ni 0 -Nx 5. 00 -Ny 2. 00 -Nz 0. 00 -Ne -1. 000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 0. 255 -Id -1. 255 -It message -Il 32 -If 0 -Ii 0 -Iv 32 - detailed explanation in NS Manual Chapter 16
Visualization Using nam n n Enable tracing 1. 2. n $ns_ namtrace-all-wireless <namtrace> <x> <y> $mobilenode namattach <namtracefd> $ns_ node-config - agent. Trace ON - router. Trace ON - mac. Trace ON
- Slides: 8