You must be logged in to reply to this topic.
I have to repeat a NS2 simulation a number of times, each time changing the number of network nodes, and calculate the average congestion window. Tcl script creates a file named “winfile” after the execution, in which the first column is the time, the second the value of the congestion window. I wrote a perl script to implement this:
$sum=0;
$average=0;
$j=0;
for($i=2; $i<=10;$i++){
system ("ns tesina.tcl $i");
open (DATA,"<$winfile")
|| die "Can't open $winfile $!";
while () {
@x=split(' ');
$sum=$sum+$x[1];
$j++;
}
$average=$sum/$j;
print STDOUT "$i $averagen";
$sum=0;
$average=0;
$j=0;
}
close DATA;
exit(0);
but when I run it tells me can not open the file, despite being created from the execution of the tcl files. By modifying the file in this way
$infile=argv[0];
...
it works. but I always get the same average value, which is impossible. It seems that the script does not run tcl but analyze a file previously created.
how can I fix that?
You must be logged in to reply to this topic.