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

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



Hi Brian and ns users,

At 08.45 15/08/2001 -0600, Brian Lee Bowers wrote:
>My suggestion to you is to learn another scripting language (whether
>it be Perl, or shell, or some other) to automate running ns scripts.

so I have searched "shell script" in the archive and I have found out that 
another solution to the problem is to use 2 tcl scripts.

So I have written a first script that makes a loop and "executes" the 
second script.
(You can find the first script at the end of this mail)

At the end of each simulation I'd like to run an awk script to post-process 
the trace file. But the trace files, in my case, are "indexed",
an example

sim 1 --> out_0.tr
sim 2 --> out_0.2.tr
sim 3 --> out_0.4.tr
... ...

I don't know how to do that. Could someone propose the necessary changes to 
the script?
Thanks,

Giuseppe Tringali

#
if {$argc != 1} {
# Must get a single argument or program fails.
puts "ERROR! ns called with wrong number of arguments!($argc)"
exit 1
} else {
set step [lindex $argv 0]
# step now holds the increment of error rate
set sim_count [expr 1 / $step + 1]
set rate 0

for {set i 1} {$i <= $sim_count } {incr i} {
puts "Running simulation $i of $sim_count with error rate $rate"
exec ns sat_tcp3.tcl $rate

# here I should call the awk script but how?

set rate [expr $rate + $step]
}
}