[ns] timer on tcl
Vincent Chimaobi Emeakaroha
e0027525 at student.tuwien.ac.at
Mon May 25 05:57:52 PDT 2009
Hi
how do you mean that the simulation doesn't take 50s? Bear in mind that
simulation time ist not equal to clock time!! So you don't expect your
simulation to last exactly 50s clock time. This is actually the essence
of simulation.
greetings
Vincent.
El hadi Cherkaoui wrote:
> hi all,
>
> i want ot creat a timer on tcl
>
> set ns [new Simulator]
> set bw bw2.dat
> set f [open $bw w]
>
> proc timer {} {
>
> global ns f
> set time 10
> set now [$ns now]
>
> set cost [expr floor( rand() * 40) + 20] ;# exemple
> puts $f "$now : $cost"
> $ns at [expr $now+$time] "timer"
>
>
> }
>
> proc finish {} {
> puts "Stop simulation"
> global ns f
> $ns flush-trace
> close $f
> exit 0
> }
>
> $ns at 0.0 "timer"
> $ns at 50 "finish"
> $ns run
>
>
> i have 5 values every 10s but the simulation doesn't take 50 s why ?
>
>
>
>
More information about the Ns-users
mailing list