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

nmlab.korea.ac.kr
from nmlab.korea.ac.kr More from this publisher
12.07.2015 Views

$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

$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

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

Saved successfully!

Ooh no, something went wrong!