#!/usr/bin/perl 

# Bernoulli Packet Loss experiment (Section IV-C, Figure 7)

# settings for Bernoulli loss rate
@lossset = (0.0001,0.0005,0.001,0.005,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.10);

$bnqueuetype = 0;  	# DropTail
$losstype = 1;		# Bernoulli loss model
$fgrtt = 0.075;		# RTT 75 ms for foreground flows
$simtime = 1000.0;

qx!rm -f sim.data!;
foreach $uniloss (@lossset) {
	$time = qx!date!; print("\nStart time: $time"); 
	print "\n>./ns http.tcl  -bnqueuetype $bnqueuetype -bnbw 15Mb -bnqueue 25000 -losstype $losstype  -uniloss $uniloss -fgrtt $fgrtt -ftpbkgflows 0  -httpbkgflows 0   -simtime $simtime ";
	qx!rm -f bnlink.data!;
	$output = qx!./ns http.tcl  -bnqueuetype $bnqueuetype -bnbw 15Mb -bnqueue 25000 -losstype $losstype  -uniloss $uniloss -fgrtt $fgrtt -ftpbkgflows 0  -httpbkgflows 0   -simtime $simtime !;
	print "\n$output\n";
	qx!cat bnlink.data >> sim.data !;
	$time = qx!date!; print("\nEnd time: $time"); 
}

