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

[ns] Queue size obtained by Flowmon & from RED not the same.




Hi, 

I set up a simple simulation using RED, by sending a TCP and a UDP flow thru' a
common link ( R2 -R3).  ( TCP starts at 10 sec, UDP starts at 50sec) .I wrote a
proc  to get the average and current queue szie in RED. At the same time I set
up a queue monitor too, to get the packet dropped and queue size as well.
After looking at the data from both monitors ...   I found out that the current
queue size from RED and Queue Monitor sometimes doesn't match. Since they are
monitor the same link , it should match right???  


The following is my code:

=============================================================
Simulator instproc get-link {node1 node2} {
	$self instvar link_
	set id1 [$node1 id]
	set id2 [$node2 id]
	return $link_($id1:$id2)
}


set l [$ns get-link $R2 $R3]
set qred [$l queue]



# write RED information
# linterm_  --> dropping pobability varies from 0 to 1/linterm_
# ave_  --> average queue size
# curq_ --> current queue size
# prob1_  --> dropping pobability

proc avgqueue {qred} {
	global ns avg status redq
	
	set maxpr [$qred set linterm_]   
	set egz [$qred set ave_]
	set cur [$qred set curq_]
	set prob [$qred set prob1_]
	set curt [$ns now]
	
	puts $redq [format "%9.3f %9.3f %9.3f %9.3f %9.3f" $curt $egz $cur $prob	$maxpr]
	
}


# set up queue monitor

set qlink [$ns link $R2 $R3]
set qmon [$qlink queue]
set qlnk [$ns monitor-queue $R2 $R3 $qmon]


# write queue size (link) to file
# format : Time; current queue size; packets dropped; packets arrived; 
#	   packets departed.


proc lnkqueue {qlnk} {
	global ns linkq status
	
	set cur [$qlnk set pkts_]
	set pdrop [$qlnk set pdrops_]
	set parrv [$qlnk set parrivals_]
	set pdep [$qlnk set pdepartures_]
	set curt [$ns now]
	
	puts $linkq [format "%9.3f %9.3f %9.3f %9.3f %9.3f" $curt $cur $pdrop $parrv $pdep]
}


===============================================================

I have attached the data file (extract of where it all went wrong).

Navidad.exe