[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Tcl script
Just say "global qmon" in the procedure.
__Sridhar__
On Fri, 6 Apr 2001, gokul ramasubramanian wrote:
* >
* >
* >Hi all,
* >
* >sorry to bother you again with this trivial problem.
* >i am trying to run this piece of code...
* >i've appended only a small part of it.
* >
* >first, 8 queue monitor objects are instantiated.
* >The procedure record takes the 8 queuemonitor objects and calculates the
* >queue size for each queue every interval.
* >
* >
* >
* > for { set i 0} {$i < 8} {incr i} {
* > set qmon($i) [$ns monitor-queue $n($i) $n(8) ""]
* > }
* >
* >
* >proc record { } {
* >
* > global qmon(0) qmon(1) qmon(2) qmon(3) qmon(4) qmon(5) qmon(6) qmon(7)
* >f1
* >
* > set ns [Simulator instance]
* > set time .005
* > for {set i 0} {$i < 8} {incr i} {
* > set size [$qmon($i) set size_]
* > set now [$ns now]
* > puts $f1 "$now $size"
* > }
* > $ns at [expr $now+$time] "record"
* >}
* >
* >
* >
* >Erro i am getting is record: can't read "qmon(0)": no such variable
* > while executing
* >"$qmon($i) set size_"
* > (procedure "record" line 8)
* > invoked from within
* >"record"
* >
* >
* >
* >why is it not able to access qmon(0) or any other queue monitors even if
* >they are global??
* >
* >Gokul
* >
* >