12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

X :layout lan-t time-n name-r r<strong>at</strong>e-D delay-o orient<strong>at</strong>ion-O orient<strong>at</strong>ion46.2 Ns comm<strong>and</strong>s for cre<strong>at</strong>ing <strong>and</strong> controlling nam anim<strong>at</strong>io<strong>ns</strong>This section describes different APIs in <strong>ns</strong>th<strong>at</strong> may be used to manipul<strong>at</strong>e nam anim<strong>at</strong>io<strong>ns</strong> for objects like nodes, links, queues<strong>and</strong> agents. <strong>The</strong> implement<strong>at</strong>ion of most of these APIs is contained in <strong>ns</strong>/tcl/lib/<strong>ns</strong>-namsupp.tcl. Demo<strong>ns</strong>tr<strong>at</strong>ion of nam APIsmay be found in <strong>ns</strong>/tcl/ex/nam-example.tcl.46.2.1 NodeNodes are cre<strong>at</strong>ed from the ”n” trace event in trace file. Each node represents a host or a router. Nam termin<strong>at</strong>es if thereare duplic<strong>at</strong>e definitio<strong>ns</strong> of the same node. Attributes specific to node are color, shape, label, label-color, position of label<strong>and</strong> adding/deleting mark on the node. Each node can have 3 shapes: circle (default), square, or hexagon. But once cre<strong>at</strong>ed,the shape of a node cannot be changed during the simul<strong>at</strong>ion. Different node may have different colors, <strong>and</strong> its color maybe changed during anim<strong>at</strong>ion. <strong>The</strong> following OTcl procedures are used to set node <strong>at</strong>tributes, they are methods of the classNode:$node color [color] ;# sets color of node$node shape [shape] ;# sets shape of node$node label [label] ;# sets label on node$node label-color [lcolor] ;# sets color of label$node label-<strong>at</strong> [ldirection] ;# sets position of label$node add-mark [name] [color] [shape] ;# adds a mark to node$node delete-mark [name] ;# deletes mark from node46.2.2 Link/QueueLinks are cre<strong>at</strong>ed between nodes to form a network topology. namlinks are internally simplex, but it is invisible to the users.<strong>The</strong> trace event ”l” cre<strong>at</strong>es two simplex links <strong>and</strong> other necessary setups, hence it looks to users identical to a duplex link.Link may have many colors <strong>and</strong> it can change its color during anim<strong>at</strong>ion. Queues are co<strong>ns</strong>tructed in nam between two nodes.Unlike link, nam queue is associ<strong>at</strong>ed to a simplex link. <strong>The</strong> trace event “q” only cre<strong>at</strong>es a queue for a simplex link. In nam,queues are visualized as stacked packets. Packets are stacked along a line, <strong>and</strong> the angle between the line <strong>and</strong> the horizontalline can be specified in the trace event “q”. Comm<strong>and</strong>s to setup different anim<strong>at</strong>ion <strong>at</strong>tributes of a link are as follows:$<strong>ns</strong> duplex-link-op <strong>The</strong> may be one of the following: orient, color, queuePos, label. Orient or the link orient<strong>at</strong>ion defines the anglebetween the link <strong>and</strong> horizontal. <strong>The</strong> optional orient<strong>at</strong>ion values may be difined in degrees or by text like right (0), right-up(45), right-down (-45), left (180), left-up (135), left-down (-135), up (90), down (-90). <strong>The</strong> queuePos or position of queue isdefined as the angle of the queue line with horizontal. Examples for each <strong>at</strong>tribute are given as following :411

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!