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.

4.4 Comm<strong>and</strong>s <strong>at</strong> a glanceSynopsis:<strong>ns</strong> ..Description:Basic comm<strong>and</strong> to run a simul<strong>at</strong>ion script in <strong>ns</strong>.<strong>The</strong> simul<strong>at</strong>or (<strong>ns</strong>) is invoked via the <strong>ns</strong> interpreter, an exte<strong>ns</strong>ion of thevanilla otclsh comm<strong>and</strong> shell. A simul<strong>at</strong>ion is defined by a OTcl script(file). Several examples of OTcl scripts can be found under <strong>ns</strong>/tcl/exdirectory.<strong>The</strong> following is a list of simul<strong>at</strong>or comm<strong>and</strong>s commonly used in simul<strong>at</strong>io<strong>ns</strong>cripts:set <strong>ns</strong>_ [new Simul<strong>at</strong>or]This comm<strong>and</strong> cre<strong>at</strong>es an i<strong>ns</strong>tance of the simul<strong>at</strong>or object.set now [$<strong>ns</strong>_ now]<strong>The</strong> scheduler keeps track of time in a simul<strong>at</strong>ion. This retur<strong>ns</strong> scheduler’snotion of current time.$<strong>ns</strong>_ haltThis stops or pauses the scheduler.$<strong>ns</strong>_ runThis starts the scheduler.$<strong>ns</strong>_ <strong>at</strong> This schedules an (which is normally a piece of code) to be executed<strong>at</strong> the specified .e.g $<strong>ns</strong>_ <strong>at</strong> $opt(stop) "puts ¨NS EXITING..¨ ; $<strong>ns</strong>_ halt"or, $<strong>ns</strong>_ <strong>at</strong> 10.0 "$ftp start"42

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

Saved successfully!

Ooh no, something went wrong!