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 ...
This event is very generic, in that it may execute several different procedures at a given time, as long as it is in one line(no more than 256 characters). There may be white spaces in the string which are passed as arguments to the tcl procedure.Unlike other events, the order of flags and the tcl procedure call is important.Here are some examples of this event in use:Setting playback speedNormally the user chooses a playback rate via the rate slider in the animation window. A trace file may set the playback ratevia the set_rate_ext command:v -t -e set_rate_ext For example:v -t 2.5 -e set_rate_ext 20ms 1For compatibility with earlier versions of nam, the set_rate command is also supported. Instead of specifying the stepsize directly, you use 10 × log 10 . For example:v -t 2.5 -16.9897000433602 1In order to have more readable files, set_rate_ext is preferred.AnnotationThis procedure is used for displaying text annotation at specfic times:v -t -e sim_annotation For example:v -t 4 -e sim_annotation 4 3 node 0 added one markThis line calls a special tcl function sim_annotation in nam, which inserts the given string node 0 added onemark into nam’s annotation pane. Look at Animator instproc sim_annotation in tcl/annotation.tcl for the implementationdetails.Node Exec ButtonIn nam releases, version 1.0a10 and later there is support for running external userdefinable scripts or programs from nam byclicking on a node button.v -t 1.0 -e node_tclscript This line when read in a tracefile will add an extra button to node objects that will execute a tcl script when clicked.For example:401
v -t 1.0 -e node_tclscript 2 "Echo Hello" {puts [exec echo hello]}The above line adds a button to node 2’s info window with the label "Echo Hello" and when this button is pressed the shellcommand "echo hello" will be run and it’s output will be returned to nam and then output to the terminal via the tcl procedureputs.The functions that implement the different nam trace formats described above may be found in the following files: ns/trace.cc,ns/trace.h, ns/tcl/lib/ns-namsupp.tcl.46.1.10 Using Streams for Realtime ApplicationsIn addtion to reading from files nam can also read from a stream such as STDIN. Here is a little tutorial on how to send a namtrace stream to nam to make it operate with real-time data. First some background on how nam works internally. Basically, itthinks it is reading from a nam tracefile. The file has a format to it. Each line is a nam event. The first character on the linedefines the type of event and is followed by several flags to set options on that event. Each event is terminated by a newlinecharacter. A nam tracefile has 2 sections, static configuration events and animation events. All events with -t * in them areconfiguration events and should be sent to nam in one burst. Lines beginning with a # are comment lines. Currently commentsshould only be place in the animation section of the file after the first animation event.First of all you need to pipe your data to nam’s stdin and add the ’-’ flag to the nam command.For example:% cat wireless.nam | nam -nam will read the information from stdinFollowing is a short wireless animation example. The first part of the script has line with -t * which tells nam that these areinitial configuration information.V -t * -v 1.0a5 -a 0W -t * -x 600 -y 600The first 2 lines are used in the nam initialization. They need to be the first 2 lines sent to nam from your program. V is theminimum nam version needed to correctly run this script. W means this is script contains wireless nodes which will be withinthe canvas size of width x and height y.n -t * -s 0 -x 0.0 -y 0.0 -z 20 -v circle -c black -wn -t * -s 1 -x 0.0 -y 200.0 -z 20 -v box -c black -wNext is the network layout information. The first line n creates a wireless (-w) circular (-v circle) node with id 0 (-s 0) atposition 0.0,0.0 (-x 0.0 -y 0.0). It’s size (-z) is 20 and it’s color (-c) is black. The second is a wireless square (-v box) nodewith id 1 (-s 1) at 0.0,200.0. Each node has to have a unique id number given by the -s flag.A -t * -n 1 -p 0 -o 0xffffffff -c 31 -a 1A -t * -h 1 -m 2147483647 -s 0402
- Page 351 and 352: PagePool/ProxyTrace takes these two
- Page 353 and 354: }int id_; // object IDWebTrafSessio
- Page 355 and 356: An Http/Server object waits for inc
- Page 357 and 358: set tmp [new RandomVariable/Exponen
- Page 359 and 360: Object Type Event Type Explaination
- Page 361 and 362: Chapter 40Worm ModelIn this chapter
- Page 363 and 364: $w local-p 0.5Following are some co
- Page 365 and 366: (nsnode) clientcloudPackM ime(nsnod
- Page 367 and 368: HTTP responsesclients servers Delay
- Page 369 and 370: 41.5 Commands at a GlanceThe follow
- Page 371 and 372: • HTTP response size (bytes)• s
- Page 373 and 374: Chapter 42Session-level Packet Dist
- Page 375 and 376: 42.1.2 Inserting a Loss ModuleWhen
- Page 377 and 378: Delay and Loss Modules Each receive
- Page 379 and 380: Chapter 43Asim: approximate analyti
- Page 381 and 382: set n(1) [$ns node]set link(0:1) [$
- Page 383 and 384: Part VIIIEmulation382
- Page 385 and 386: When using the emulation mode, a sp
- Page 387 and 388: set intf [$pf1 open readonly]puts "
- Page 389 and 390: puts "install nets into taps..."$a0
- Page 391 and 392: Chapter 45Nam45.1 IntroductionNam i
- Page 393 and 394: • Button 6 (Chevron logo) - Close
- Page 395 and 396: Second, when dealing with randomly
- Page 397 and 398: dst_portaddr,seqno,flags,sname);A n
- Page 399 and 400: • up• down• right• left•
- Page 401: 46.1.7 Agent TracingAgent trace eve
- Page 405 and 406: If nam ever gets to the end of an e
- Page 407 and 408: l :link-t time-s source id-d des
- Page 409 and 410: E :D :P :a :session enqueue-t time
- Page 411 and 412: v :V :N :W :g :A :c :q :execute tcl
- Page 413 and 414: $ns duplex-link-op orient right$ns
- Page 415 and 416: Chapter 47Educational use of NS and
- Page 417 and 418: Bibliography[1] C. Alaettinoğlu, A
This event is very generic, in th<strong>at</strong> it may execute several different procedures <strong>at</strong> a given time, as long as it is in one line(no more than 256 characters). <strong>The</strong>re may be white spaces in the string which are passed as arguments to the tcl procedure.Unlike other events, the order of flags <strong>and</strong> the tcl procedure call is important.Here are some examples of this event in use:Setting playback speedNormally the user chooses a playback r<strong>at</strong>e via the r<strong>at</strong>e slider in the anim<strong>at</strong>ion window. A trace file may set the playback r<strong>at</strong>evia the set_r<strong>at</strong>e_ext comm<strong>and</strong>:v -t -e set_r<strong>at</strong>e_ext For example:v -t 2.5 -e set_r<strong>at</strong>e_ext 20ms 1For comp<strong>at</strong>ibility with earlier versio<strong>ns</strong> of nam, the set_r<strong>at</strong>e comm<strong>and</strong> is also supported. I<strong>ns</strong>tead of specifying the stepsize directly, you use 10 × log 10 . For example:v -t 2.5 -16.9897000433602 1In order to have more readable files, set_r<strong>at</strong>e_ext is preferred.Annot<strong>at</strong>ionThis procedure is used for displaying text annot<strong>at</strong>ion <strong>at</strong> specfic times:v -t -e sim_annot<strong>at</strong>ion For example:v -t 4 -e sim_annot<strong>at</strong>ion 4 3 node 0 added one markThis line calls a special tcl function sim_annot<strong>at</strong>ion in nam, which i<strong>ns</strong>erts the given string node 0 added onemark into nam’s annot<strong>at</strong>ion pane. Look <strong>at</strong> Anim<strong>at</strong>or i<strong>ns</strong>tproc sim_annot<strong>at</strong>ion in tcl/annot<strong>at</strong>ion.tcl for the implement<strong>at</strong>iondetails.Node Exec ButtonIn nam releases, version 1.0a10 <strong>and</strong> l<strong>at</strong>er there is support for running external userdefinable scripts or programs from nam byclicking on a node button.v -t 1.0 -e node_tclscript This line when read in a tracefile will add an extra button to node objects th<strong>at</strong> will execute a tcl script when clicked.For example:401