Hi all,
I have adopted the perl script to calculate the througpout for new
wireless format.
In my simulation script when i use old trace format then througput is
displayed but when i change the tcl script to new trace format then i get
throughput zero .
#######following is the throuhput script for new wireless trace
# type: perl throughput.pl <trace file> <nodeID> <granlarity> > output
file
$infile=$ARGV[0];
$nodeID=$ARGV[1];
$granularity=$ARGV[2];
#we compute how many bytes were transmitted during time interval specified
#by granularity parameter in seconds
$sum=0;
$clock=0;
open (DATA,"<$infile") || die "Can't open $infile $!";
while (<DATA>)
{
@x = split(' ');
#column 2 is time
if ($x[2]-$clock <= $granularity)
{
#checking if the event corresponds to a reception
if ($x[0] eq 'r')
{
#checking if the destination corresponds to arg 1
if ($x[8] eq $nodeID)
{
#checking if the packet type is UDP
if ($x[18] eq 'AGT')
{
$sum=$sum+$x[36];
}
}
}
}
else
{
$throughput=$sum/$granularity;
print STDOUT "In time=$x[2] throughput is bloody $throughput\n";
$clock=$clock+$granularity;
$sum=0;
}
}
$throughput=$sum/$granularity;
print STDOUT "In time=$x[2] throughput is bloody $throughput\n";
$clock=$clock+$granularity;
$sum=0;
close DATA;
exit(0);
#################################### a line of the new wireless trace format
s -t 12.018000900 -Hs 4 -Hd -2 -Ni 4 -Nx 100.00 -Ny 100.00 -Nz 0.00 -Ne
-1.000000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 4.0 -Id 0.3 -It cbr -Il
80 -If 0 -Ii 30314 -Iv 32 -Pn cbr -Pi 2391 -Pf 0 -Po 0
r -t 12.019122240 -Hs 0 -Hd -2 -Ni 0 -Nx 250.00 -Ny 250.00 -Nz 0.00 -Ne
-1.000000 -Nl MAC -Nw --- -Ma 39 -Md 0 -Ms 5 -Mt 0 -Is 5.0 -Id 0.4 -It cbr -Il
80 -If 0 -Ii 30315 -Iv 32 -Pn cbr -Pi 2387 -Pf 1 -Po 0
thanks in advance
Send instant messages to your online friends http://uk.messenger.yahoo.com