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

Re: loss monitor



Thanks for the reply. Here is the script. You can test it yourself:
 
set ns [new Simulator]

set f [open try-out.tr w]
$ns trace-all $f

set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
set qmon [$ns monitor-queue $n0 $n1 stdout]

set cbr0 [new Agent/CBR]
set lossMonitor [new Agent/LossMonitor]
$ns attach-agent $n0 $cbr0
$ns attach-agent $n1 $lossMonitor
$ns connect $cbr0 $lossMonitor 

$ns at 1.0 "$cbr0 start"

$ns at 3.0 "finish"

proc finish {} {
	global ns f qmon lossMonitor

	puts "Link statistics for link n1->n2:"
        puts "parrivals_=[$qmon set parrivals_], pdrops_=[$qmon set pdrops_], pdepartures_=[$qmon set pdepartures_]"
        puts "barrivals_=[$qmon set barrivals_], bdrops_=[$qmon set bdrops_], bdepartures_=[$qmon set bdepartures_]"

	puts "lossMonitor nlost: [$lossMonitor set nlost_]" 
	puts "lossMonitor nreceived: [$lossMonitor set npkts_]"
	puts "lossMonitor expected: [$lossMonitor set expected_]"
	puts "lossMonitor last packet time: [$lossMonitor set lastPktTime_]"
	puts "lossMonitor bytes: [$lossMonitor set bytes_]"
 	$ns flush-trace
 	close $f
 	exit 0
 }
$ns run
 -------------------------------
> > 
> > > Hello,
> > > 	I am using ns-2.0. I wrote a small script which creates 2 nodes. I used CBR on one node and LossMonitor on the other. Also, I used monitor-queue to monitor the link beween these 2 nodes. The output I had is:
> > > Output of state variables of the LossMonitor agent:
> > > lossMonitor nlost: 0
> > > lossMonitor nreceived: 531
> > > lossMonitor expected: 531
> > > 
> > > Output of state variables due to monitor-queue:
> > > parrivals_=534, pdrops_=0, pdepartures_=534
> > > 
> > > That is to say, the number of packets received by the LossMonitor is 531 which is less than the number reported when using the method  monitor-queue.
> > > So, would you please report on how this happened?
> > > 
> > > Randa
> > > 
> > 
> > its possible  that  when you at  the  end of simulation  3   pkts are in
> > transit. 
> > 
> > srihari
> > 
> 
>