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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

node or link will be up <strong>and</strong> down respectively. <strong>The</strong> default up <strong>and</strong> down interval values are 10s. <strong>and</strong> 1s.respectively. Any of these values can be specified as “−” to default to the original value.<strong>The</strong> following are example specific<strong>at</strong>io<strong>ns</strong> of parameters to this model:0.8 1.0 1.0 ;# start <strong>at</strong> 0.8s., up/down = 1.0s., finish is default5.0 0.5 ;# start is default, up/down = 5.0s, 0.5s., finish is default- 0.7 ;# start, up interval are default, down = 0.7s., finish is default- - - 10 ;# start, up, down are default, finish <strong>at</strong> 10s.2. <strong>The</strong> deterministic on/off model is similar to the exponential model above, <strong>and</strong> takes four parameters: 〈[starttime], up interval, down interval, [finish time]〉. 〈start time〉 defaults to the start of the simul<strong>at</strong>ion, 〈finish time〉defaults to the end of the simul<strong>at</strong>ion. Only the interpret<strong>at</strong>ion of the up <strong>and</strong> down interval is different; 〈upinterval〉 <strong>and</strong> 〈down interval〉 specify the exact dur<strong>at</strong>ion th<strong>at</strong> the node or link will be up <strong>and</strong> down respectively.<strong>The</strong> default values for these parameters are: 〈start time〉 is 0.5s. from start of simul<strong>at</strong>ion, 〈up interval〉 is 2.0s.,〈down interval〉 is 1.0s., <strong>and</strong> 〈finish time〉 is the dur<strong>at</strong>ion of the simul<strong>at</strong>ion.3. <strong>The</strong> trace driven model takes one parameter: the name of the trace file. <strong>The</strong> form<strong>at</strong> of the input trace file isidentical to th<strong>at</strong> output by the dynamics trace modules, viz., v 〈time〉 link-〈oper<strong>at</strong>ion〉 〈node1〉〈node2〉. Lines th<strong>at</strong> do not correspond to the node or link specified are ignored.v 0.8123 link-up 3 5v 3.5124 link-down 3 54. <strong>The</strong> manual one-shot model takes two parameters: the oper<strong>at</strong>ion to be performed, <strong>and</strong> the time th<strong>at</strong> it is to beperformed.• <strong>The</strong> rest of the arguments to the rtmodel{} procedure define the node or link th<strong>at</strong> the model will be applied to.If only one node is specified, it is assumed th<strong>at</strong> the node will fail. This is modeled by making the links incidenton the node fail. If two nodes are specified, then the comm<strong>and</strong> assumes th<strong>at</strong> the two are adjacent to each other,<strong>and</strong> the model is applied to the link incident on the two nodes. If more than two nodes are specified, only the firstis co<strong>ns</strong>idered, the subsequent arguments are ignored.• i<strong>ns</strong>tance variable, traceAllFile_ is set.<strong>The</strong> comm<strong>and</strong> retur<strong>ns</strong> the h<strong>and</strong>le to the model th<strong>at</strong> was cre<strong>at</strong>ed in this call.Internally, rtmodel{} stores the list of route models cre<strong>at</strong>ed in the class Simul<strong>at</strong>or i<strong>ns</strong>tance variable, rtModel_.— <strong>The</strong> i<strong>ns</strong>tance procedure rtmodel-delete{} takes the h<strong>and</strong>le of a route model as argument, removes it from thertModel_ list, <strong>and</strong> deletes the route model.— <strong>The</strong> i<strong>ns</strong>tance procedure rtmodel-<strong>at</strong>{} is a special interface to the <strong>Manual</strong> model of network dynamics.<strong>The</strong> comm<strong>and</strong> takes the time, oper<strong>at</strong>ion, <strong>and</strong> node or link as arguments, <strong>and</strong> applies the oper<strong>at</strong>ion to the node or link <strong>at</strong>the specified time. Example uses of this comm<strong>and</strong> are:$<strong>ns</strong> rtmodel-<strong>at</strong> 3.5 up $n0$<strong>ns</strong> rtmodel-<strong>at</strong> 3.9 up $n(3) $n(5)$<strong>ns</strong> rtmodel-<strong>at</strong> 40 down $n4Finally, the i<strong>ns</strong>tance procedure trace-dynamics{} of the class rtModel enables tracing of the dynamics effected by thismodel. It is used as:set fh [open "dyn.tr" w]$rtmodel1 trace-dynamics $fh$rtmodel2 trace-dynamics $fh$rtmodel1 trace-dynamics stdoutIn this example, $rtmodel1 writes out trace entries to both dyn.tr <strong>and</strong> stdout; $rtmodel2 only writes out trace entries todyn.tr. A typical sequence of trace entries written out by either model might be:275

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

Saved successfully!

Ooh no, something went wrong!