Showing posts with label links colors in NS2. Show all posts
Showing posts with label links colors in NS2. Show all posts

Monday, 17 March 2014

NAM colors,annotations

Hello pals, 
                   One can always enchance the look and feel of  NAM UI . it mainly helpful while demonstrating to others. 
                   Colors , annotations, labels, packet colors, control play back all these plays vital role in enriching NAM animator in NS2
                   We will see one by one . 
   

1. Wired Link options

$ns duplex-link-op $n1 $n2 label “user defined text here”
$ns duplex-link-op $n1 $n2 color blue
$ns duplex-link-op $n1 $n2 label-at up
$ns duplex-link-op $n1 $n2 label-color green

2. Node options — color, shape, label
    $n1 ---> means node 1 that you defined in your Tcl file . 

$n1 color blue    // sets the node color to blue
$n1 shape hexagon
$n1 label-at up // sets the label up the link
$n2 label “user defined text here”   // sets for node 2
$n2 label-color green // label color set to green


3.Packet colors

$agent set fid_ $node
$ns color $node blue 
4. Control playback
$ns set-animation-rate 3ms   // control playback time in milli seconds

5. Annotation

set text "this is annotation shows at run time of nam"
set time 4.0
$ns at $time “$ns trace-annotate $text”  // at 4.0 , an annotation will display 

 //  its highly useful when packet transfer completed or show some attacks in the networks.transmission rate, no of nodes in the network etc..