[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Integrator question.
I'm attempting to use an integrator to determine the average link utilization
in my script and am missing something in my script.
============
set r1 [$ns node]
set r2 [$ns node]
set rcv [$ns simplex-link $r1 $r2 1.544Mb 20ms DropTail]
set xmt [$ns simplex-link $r2 $r1 1.544Mb 20ms DropTail]
set rcvqm [$ns monitor-queue $r1 $r2 "" 0.1]
# set up various traffic flows..
proc bwupdate {} {
global dt bw rcvqm ns weight
set rcvin [$rcvqm get-pkts-integrator]
#
# Update the estimated bandwidth utilization
#
set x [$ns now]
set y [$rcvqm set bdepartures_]
set xa [$rcvin set lastx_]
set ya [$rcvin set lasty_]
set dt [expr $dt * (1.0 - $weight) + \
($y - $ya) / (($x - $xa) * 1930.0) * $weight]
puts $bw [list $x $y $xa $ya $dt]
$ns at [expr $x + 0.1] "bwupdate"
}
$ns at 0.1 "bwupdate"
============
The file that "dt" writes to indicates that the lastx_ values are increasing
over time but the lasty_ values are not. If I change the script around so
that I'm not using the integrator object -- saving the last values of 'now'
and 'bdepartures_' in globals -- it works fine. The fact that I'm saving 'x'
but not 'y' suggests to me that a periodic measurement of the queue is
occuring but the integrator is either looking at something else or that the
'y' values may be a current rather than a cumulative total?