The Simulator class provides a number of methods used to set up the simulation. They generally fall into three categories: methods to create and manage the topology (which in turn consists of managing the nodesChapterchap:nodes and managing t
he linksChapterchap:links), methods to perform tracingChapterchap:trace, and helper functions to deal with the scheduler. The following is a list of the non-topology related simulator methods:
Simulator instproc now {} # return scheduler's notion of current time; Simulator instproc at args # schedule execution of code at specified time; Simulator instproc cancel args # cancel event; Simulator instproc run args # start scheduler; Simulator instproc halt {} # stop (pause) the scheduler; Simulator instproc flush-trace {} # flush all trace object write buffers; Simulator instproc create-trace { type files src dst } # create trace object; Simulator instproc create_packetformat # set up the simulator's packet format; \clearpage \section{Commands at a glance} \label{sec:simcommand} \begin{flushleft} Synopsis: {\tt ns \\<otclfile\\> \\<arg\\> \\<arg\\>..}\\ Description: Basic command to run a simulation script in ns. The simulator (ns) is invoked via the ns interpreter, an extension of the vanilla otclsh command shell. A simulation is defined by a OTcl script (file). Several examples of OTcl scripts can be found under \ns/tcl/ex directory. The following is a list of simulator commands commonly used in simulation scripts: {\tt set ns\_ [new Simulator]}\\ This command creates an instance of the simulator object. {\tt set now [\$ns\_ now]}\\ The scheduler keeps track of time in a simulation. This returns scheduler's notion of current time. {\tt \$ns\_ halt}\\ This stops or pauses the scheduler. {\tt \$ns\_ run}\\ This starts the scheduler. {\tt \$ns\_ at \\<time\\> \\<event\\>}\\ This schedules an \(which is normally a piece of code) to be executed at the specified \