#!/bin/perl
do "parameters.pl";
# Open the file for reading.
open DATA, "usbscopes" or die "can't open usbscopes $!";
my @data = <DATA>;
close (DATA);
@Time=0;
$UloopMax=0;
@Uloop=0;
$Total=0;
open FH, ">Uloop_dp.csv";
for ($i = 0; $i < $LineCount; ++$i)
{
@row = split(' ',$data[$i]);
$Time+=$DeltaT;
$Total+=abs(-$row[0])*$DeltaTs; #Bereme jen kladnou cast, protoze tyristor to nezasekne v zaporu a prumer by mohl byt spatny ...
printf FH "%3.2f;%4.3f\n",$Time,-$row[0];
if ( -$row[0] > $UloopMax ) {$UloopMax=-$row[0]};
}
close (FH);
open RESULT, ">UloopMax";
printf RESULT "%4.3f", $UloopMax;
close RESULT;
open RESULT, ">MeanUloop"; #Slouzi jen k detekci "failures"
printf RESULT "%3.2f", $Total/($LineCount*$DeltaTs);
close RESULT;