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 ?



      

Reply via email to