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 ...
$rng seed This command seeds the RNG. If 0 is specified, the RNG is seeded heuristically. Otherwise the RNG is seeded with thevalue .$rng next-randomThis returns the next random number from RNG.$rng uniform This returns a number uniformly distributed on and .$rng integer This returns an integer uniformly distributed on 0 and k-1.$rng exponentialThis returns a number that has exponential distribution with average 1.set rv [new Randomvariable/]This creates an instance of a random variable object that generates random variables with specific distribution. The differenttypes of random variables derived from the base class are:RandomVariable/Uniform, RandomVariable/Exponential, RandomVariable/Pareto, RandomVariable/Constant,RandomVariable/HyperExponential. Each of these distribution types are parameterized with values of appropriateparameters. For details see section 25.2 of this chapter.$rv use-rng This method is used to associated a random variable object with a non-default RNG. Otherwise by default, the randomvariable object is associated with the default random number generator.229
Chapter 26Trace and Monitoring SupportThe procedures and functions described in this chapter can be found in ~ns/trace.{cc, h}, ~ns/tcl/lib/ns-trace.tcl, ~ns/queuemonitor.{cc,h}, ~ns/tcl/lib/ns-link.tcl, ~ns/packet.h, ~ns/flowmon.cc, and ~ns/classifier-hash.cc.There are a number of ways of collecting output or trace data on a simulation. Generally, trace data is either displayed directlyduring execution of the simulation, or (more commonly) stored in a file to be post-processed and analyzed. There are twoprimary but distinct types of monitoring capabilities currently supported by the simulator. The first, called traces, record eachindividual packet as it arrives, departs, or is dropped at a link or queue. Trace objects are configured into a simulation as nodesin the network topology, usually with a Tcl “Channel” object hooked to them, representing the destination of collected data(typically a trace file in the current directory). The other types of objects, called monitors, record counts of various interestingquantities such as packet and byte arrivals, departures, etc. Monitors can monitor counts associated with all packets, or on aper-flow basis using a flow monitor below (Section 26.7).To support traces, there is a special common header included in each packet (this format is defined in ~ns/packet.h ashdr_cmn). It presently includes a unique identifier on each packet, a packet type field (set by agents when they generatepackets), a packet size field (in bytes, used to determine the transmission time for packets), and an interface label (usedfor computing multicast distribution trees).Monitors are supported by a separate set of objects that are created and inserted into the network topology around queues.They provide a place where arrival statistics and times are gathered and make use of the class Integrator (Section 25.3)to compute statistics over time intervals.26.1 Trace SupportThe trace support in OTcl consists of a number of specialized classes visible in OTcl but implemented in C++, combined witha set of Tcl helper procedures and classes defined in the ns library.All following OTcl classes are supported by underlying C++ classes defined in ~ns/trace.cc. Objects of the following typesare inserted directly in-line in the network topology:230
- Page 179 and 180: $satrouteobject_ compute_routeswher
- Page 181 and 182: This will add an error model to the
- Page 183 and 184: lh_firstnameobj‘‘name’’ is
- Page 185 and 186: from routing agentto Node->entrySat
- Page 187 and 188: $satnode add-isl This method c
- Page 189 and 190: set prop [new Propagation/FreeSpace
- Page 191 and 192: 18.3.2 Using shadowing modelBefore
- Page 193 and 194: Chapter 19Energy Model in nsEnergy
- Page 195 and 196: Chapter 20Directed DiffusionThe dir
- Page 197 and 198: However if we have a large and dens
- Page 199 and 200: yr application in the ns context. T
- Page 201 and 202: value of opt(pre-stop) is usually t
- Page 203 and 204: 21.2 Implementation of XCP in NSIn
- Page 205 and 206: the persistent queue length in the
- Page 207 and 208: Thruput2 0.054024 60000residue_pos_
- Page 209 and 210: Chapter 22DelayBox: Per-Flow Delay
- Page 211 and 212: $ns attach-agent $n_sink $sink# mak
- Page 213 and 214: Chapter 23Changes made to the IEEE
- Page 215 and 216: Part IIISupport214
- Page 217 and 218: endenddocument pargvcPrint out argc
- Page 219 and 220: 24.4.2 Memory Conservation TipsSome
- Page 221 and 222: Chapter 25Mathematical SupportThe s
- Page 223 and 224: set run [lindex $argv 0]}if {$run <
- Page 225 and 226: }$sizeRNG next-substream# print the
- Page 227 and 228: protected:RNG* rng_;};Classes deriv
- Page 229: ns-random is implemented in ~ns/mis
- Page 233 and 234: The monitor-queue function is const
- Page 235 and 236: also used to accumulate packet drop
- Page 237 and 238: }name,th->size(),flags,iph->flowid(
- Page 239 and 240: PT_TORA,PT_DSR,PT_AODV,// insert ne
- Page 241 and 242: The QueueMonitor class is not deriv
- Page 243 and 244: $ns_ trace-all This is the command
- Page 245 and 246: Chapter 27Test Suite SupportThe ns
- Page 247 and 248: ... ...}$ns_ at $opt(stop).1 "$self
- Page 249 and 250: Example: To enable debugging in Que
- Page 251 and 252: Chapter 29Unicast RoutingThis secti
- Page 253 and 254: Asymmetric Routing Asymmetric routi
- Page 255 and 256: class RouteLogic This class defines
- Page 257 and 258: — The procedure init-all{} is a g
- Page 259 and 260: Global Actions Once the detailed ac
- Page 261 and 262: This dumps next hop information in
- Page 263 and 264: $ns mrtproto ST;# specify shared tr
- Page 265 and 266: Dense Mode The Dense Mode protocol
- Page 267 and 268: and unique label (id). Thus, “inc
- Page 269 and 270: add-iif{ifid link},add-oif{link if}
- Page 271 and 272: CtrMcastComp is the centralised mul
- Page 273 and 274: $ns_ mrtproto This command specifi
- Page 275 and 276: Chapter 31Network DynamicsThis chap
- Page 277 and 278: v 0.8123 link-up 3 5v 0.8123 link-u
- Page 279 and 280: The first argument is the time at w
$rng seed This comm<strong>and</strong> seeds the RNG. If 0 is specified, the RNG is seeded heuristically. Otherwise the RNG is seeded with thevalue .$rng next-r<strong>and</strong>omThis retur<strong>ns</strong> the next r<strong>and</strong>om number from RNG.$rng uniform This retur<strong>ns</strong> a number uniformly distributed on <strong>and</strong> .$rng integer This retur<strong>ns</strong> an integer uniformly distributed on 0 <strong>and</strong> k-1.$rng exponentialThis retur<strong>ns</strong> a number th<strong>at</strong> has exponential distribution with average 1.set rv [new R<strong>and</strong>omvariable/]This cre<strong>at</strong>es an i<strong>ns</strong>tance of a r<strong>and</strong>om variable object th<strong>at</strong> gener<strong>at</strong>es r<strong>and</strong>om variables with specific distribution. <strong>The</strong> differenttypes of r<strong>and</strong>om variables derived from the base class are:R<strong>and</strong>omVariable/Uniform, R<strong>and</strong>omVariable/Exponential, R<strong>and</strong>omVariable/Pareto, R<strong>and</strong>omVariable/Co<strong>ns</strong>tant,R<strong>and</strong>omVariable/HyperExponential. Each of these distribution types are parameterized with values of appropri<strong>at</strong>eparameters. For details see section 25.2 of this chapter.$rv use-rng This method is used to associ<strong>at</strong>ed a r<strong>and</strong>om variable object with a non-default RNG. Otherwise by default, the r<strong>and</strong>omvariable object is associ<strong>at</strong>ed with the default r<strong>and</strong>om number gener<strong>at</strong>or.229