|
UNIX>> nam nam.input |
nam.input is the file that is generate by the NS simulation
|
# (0) Creat a NS simulator object set ns [new Simulator] # (1) Create the trace file set namfile [open out.nam w] # (2) Tell NS to write NAM network events to this trace file $ns namtrace-all $namfile # (3) Close output file at the end of the simulation run proc finish {} { global ns namfile $ns flush-trace ;# flush trace files close $namfile ;# close trace file exec nam out.nam & ;# OPTIONAL: run NAM from inside the NS simulation exit 0 } |
cd /home/cs455000/demo/NS2/progs ns Reno1+nam.ns |
$ns duplex-link-op $n0 $n1 orient left |
Make link n0-n1 orient to left |
| Make link n0-n1 orient to left-down |
$ns duplex-link-op $n0 $n1 orient left-up | Make link n0-n1 orient to left-up |
$ns duplex-link-op $n0 $n1 orient right |
Make link n0-n1 orient to right |
$ns duplex-link-op $n0 $n1 orient right-down | Make link n0-n1 orient to right-down |
$ns duplex-link-op $n0 $n1 orient right-up | Make link n0-n1 orient to right-up |
Run the program using ns Reno1-nam-2.tcl; it will produce "out.nam" as output
When it finishes, run: nam out.nam to see a nicer network animation
$tcp1 set fid_ 234 |
For example, if you want packets that has fid_ = 234 colored blue, then use:
$ns color 234 blue | This set the color of the packets of flow 234 to blue. When NAM is run, these packets will be colored blue. |
Run the program using ns Reno1-nam-3.tcl; it will produce "out.nam" as output
When it finishes, run: nam out.nam to see blue packets...