[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] Running multiple simulations with a single tcl script



It's been a few months since I did this, so the details might need
looking up, but the general idea will work (and did for me!)

Assume that the ns script you want to run multiple times is called
'nsrun' and that it takes a parameter 'x' which probably has many
components, but in this case we'll assume all it is is an output file
name. 

The nsrun script would start with something like 

set ns [new Simulator]
set f [open $argv w]
$ns trace-all $f
blah blah blah
and end just like a normal ns script.

Then, create another script that is something like

exec ns outputfile1
exec ns outputfile2
exec ns outputfile3

and called, say, nsruns.
 
Then from the command line, do 

ns nsruns


Basically, all you are doing is telling ns to fire up another copy of ns
with your script, and run it several times.

Again, it's been a few months, and I no longer have access to my code
that did this, but it worked. For references to the tcl commands (like
exec) try http://www.arsdigita.com/books/tcl/index.



Giuseppe Tringali wrote:
> 
> At 11.41 15/08/2001 -0400, you wrote:
> >Or, you can have TCL call NS. (one less language to learn!)
> 
> Could you tell me something more?
> Thanks,
> 
> Giuseppe Tringali