From: hadaq@countinghouse Date: Thu, 22 Dec 2016 13:27:44 +0000 (+0100) Subject: patched to gnuplot5 and perl 5.24 and many others just commited, mt X-Git-Tag: pre2018~2 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=7e56b07c29c588e8db02f5963ae63955058a60b5;p=hadesdaq.git patched to gnuplot5 and perl 5.24 and many others just commited, mt --- diff --git a/hmon/HPlot.pm b/hmon/HPlot.pm index 826e34a..b570357 100755 --- a/hmon/HPlot.pm +++ b/hmon/HPlot.pm @@ -45,9 +45,11 @@ sub setranges { } elsif(defined $min) { plot_write($fh,"set $name [$min:]"); - } + } } + + sub PlotInit { my ($c) = @_; @@ -56,6 +58,7 @@ sub PlotInit { my $fn = "gnuplot"; #my $fh = new FileHandle ("|$fn") or die "error: no gnuplot"; open my $fh, "|$fn" or die "error: no gnuplot"; + #open my $fh, ">delme_$name" or die "error: no gnuplot"; $fh->autoflush(1); @@ -73,18 +76,19 @@ sub PlotInit { $p->{$name}->{colors} = $p->{$name}->{colors} || \@color; $p->{$name}->{showvalues} = $p->{$name}->{showvalues} || 0; $p->{$name}->{storable} = $p->{$name}->{storable} || 0; + $p->{$name}->{plot_string} = ""; # to store the plot command my $filename = $p->{$name}->{file}; $filename =~ s%/%%; $storefile->{$name} = "/dev/shm/".$name.'-'.$p->{$name}->{curves}.'-'.$p->{$name}->{entries}.'-'.$filename.'.store'; - + foreach my $i (0..($c->{entries}-1)) { for my $j (0..($c->{curves}-1)) { push(@{$p->{$name}->{value}->[$j]},0) ; } } - + if($p->{$name}->{storable}) { if (-e $storefile->{$name}) { $p->{$name}->{value} = lock_retrieve($storefile->{$name}); @@ -120,73 +124,87 @@ sub PlotInit { setranges($fh,'zrange',$p->{$name}->{zmin},$p->{$name}->{zmax}); setranges($fh,'cbrange',$p->{$name}->{cbmin},$p->{$name}->{cbmax}); - - if($p->{$name}->{type} == TYPE_HISTORY) { - if($p->{$name}->{fill}) { + if ($p->{$name}->{type} == TYPE_HISTORY) { + if ($p->{$name}->{fill}) { plot_write($fh,"set style fill solid 1.00"); - } + } else { plot_write($fh,"set style fill solid 0"); - } + } plot_write($fh,"set boxwidth 2 absolute"); plot_write($fh,"set autoscale fix"); plot_write($fh,"set xtics autofreq"); #$p->{$name}->{entries} plot_write($fh,"set grid"); -# plot_write($fh,"set style fill solid 1.0"); - plot_write($fh,"plot ",1); - for(my $j=0; $j<$p->{$name}->{curves};$j++) { - if($p->{$name}->{fill}) { - plot_write($fh,"'-' using 1:2 with filledcurves x1 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); - } - elsif($p->{$name}->{dots}) { - plot_write($fh,"'-' using 1:2 with points pointsize 0.6 pointtype 2 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); - } + # plot_write($fh,"set style fill solid 1.0"); + #plot_write($fh,"plot ",1); + $p->{$name}->{plot_string} .= "plot "; + for (my $j=0; $j<$p->{$name}->{curves};$j++) { + if ($p->{$name}->{fill}) { + #plot_write($fh,"'-' using 1:2 with filledcurves x1 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); + $p->{$name}->{plot_string} .= "'-' using 1:2 with filledcurves x1 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" "; + } + elsif ($p->{$name}->{dots}) { + #plot_write($fh,"'-' using 1:2 with points pointsize 0.6 pointtype 2 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); + $p->{$name}->{plot_string} .= "'-' using 1:2 with points pointsize 0.6 pointtype 2 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" "; + } else { - plot_write($fh,"'-' using 1:2 with lines lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); - } - plot_write($fh,', ',1) unless ($j+1==$p->{$name}->{curves}); + #plot_write($fh,"'-' using 1:2 with lines lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); + $p->{$name}->{plot_string} .= "'-' using 1:2 with lines lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" "; } - plot_write($fh," "); + #plot_write($fh,', ',1) unless ($j+1==$p->{$name}->{curves}); + $p->{$name}->{plot_string} .= ', ' unless ($j+1==$p->{$name}->{curves}); } - elsif($p->{$name}->{type} == TYPE_BARGRAPH) { + #plot_write($fh," "); + $p->{$name}->{plot_string} .= " \n"; + plot_write($fh, $p->{$name}->{plot_string}); + } + elsif ($p->{$name}->{type} == TYPE_BARGRAPH) { plot_write($fh,"set style fill solid 1.00 border -1"); plot_write($fh,"set grid noxtics ytics"); plot_write($fh,"set boxwidth ".($p->{$name}->{curvewidth}||4)." absolute"); plot_write($fh,"set style histogram gap ".($p->{$name}->{bargap}||1)); - if(defined $p->{$name}->{bartitle} && scalar @{$p->{$name}->{bartitle}}) { + if (defined $p->{$name}->{bartitle} && scalar @{$p->{$name}->{bartitle}}) { plot_write($fh,"set xtics (",1); - for(my $j=0; $j{$name}->{bartitle}};$j++) { + for (my $j=0; $j{$name}->{bartitle}};$j++) { plot_write($fh,', ',1) if $j; plot_write($fh,"'".$p->{$name}->{bartitle}->[$j]."' $j ",1); - } - plot_write($fh,") offset 2.5,0 scale 0"); } + plot_write($fh,") offset 2.5,0 scale 0"); + } plot_write($fh,"set style histogram title offset character 0, 0, 0"); plot_write($fh,"set style data histograms"); - plot_write($fh,"plot ",1); - for(my $j=0; $j<$p->{$name}->{curves};$j++) { - plot_write($fh,', ',1) if $j; - plot_write($fh,"'-' lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); - } - plot_write($fh," "); + #plot_write($fh,"plot ",1); + $p->{$name}->{plot_string} .= "plot "; + for (my $j=0; $j<$p->{$name}->{curves};$j++) { + #plot_write($fh,', ',1) if $j; + $p->{$name}->{plot_string} .= ', ' if $j; + #plot_write($fh,"'-' lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1); + $p->{$name}->{plot_string} .= "'-' lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" "; } - elsif($p->{$name}->{type} == TYPE_HEATMAP) { + #plot_write($fh," "); + $p->{$name}->{plot_string} .= " \n"; + plot_write($fh, $p->{$name}->{plot_string}); + } + elsif ($p->{$name}->{type} == TYPE_HEATMAP) { plot_write($fh,"set view map"); plot_write($fh,"set palette rgbformulae 22,13,-31"); if ($p->{$name}->{showvalues} == 0) { - plot_write($fh,"splot '-' matrix with image"); - } + #plot_write($fh,"splot '-' matrix with image"); + $p->{$name}->{plot_string} .= "splot '-' matrix with image \n" + } else { - plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'"); -# plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)):3 with labels tc palette font ',10'"); - } + #plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'"); + $p->{$name}->{plot_string} .= "plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'"; + #### plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)):3 with labels tc palette font ',10'"); } + plot_write($fh, $p->{$name}->{plot_string}); + } else { die "Plot type not supported"; - } - } +} + sub PlotDraw { my($name) = @_; @@ -196,9 +214,10 @@ sub PlotDraw { if($p->{$name}->{run}>=1) { plot_write($p->{$name}->{fh},"set out \"".$p->{$name}->{file}.($p->{$name}->{buffer}?"tmp":"").".png\""); plot_write($p->{$name}->{fh},makeTimeString()); - plot_write($p->{$name}->{fh},"replot"); + #plot_write($p->{$name}->{fh},"replot"); + plot_write($p->{$name}->{fh}, $p->{$name}->{plot_string}); } - + if($p->{$name}->{type} == TYPE_HISTORY) { for(my $j=0; $j<$p->{$name}->{curves}; $j++) { for(my $i=0; $i< $p->{$name}->{entries}; $i++) { @@ -210,11 +229,11 @@ sub PlotDraw { } } plot_write($p->{$name}->{fh},"e"); - } + } } - - - if($p->{$name}->{type} == TYPE_BARGRAPH) { + + if($p->{$name}->{type} == TYPE_BARGRAPH) { + #plot_write($p->{$name}->{fh}, $p->{$name}->{plot_string}); for(my $j=0; $j<$p->{$name}->{curves}; $j++) { for(my $i=0; $i< $p->{$name}->{entries}; $i++) { plot_write($p->{$name}->{fh},' '.$p->{$name}->{value}->[$j]->[$i]); @@ -222,17 +241,16 @@ sub PlotDraw { plot_write($p->{$name}->{fh},"e"); } } - - - if($p->{$name}->{type} == TYPE_HEATMAP) { + + if($p->{$name}->{type} == TYPE_HEATMAP) { for(my $j=0; $j<$p->{$name}->{curves}; $j++) { for(my $i=0; $i< $p->{$name}->{entries}; $i++) { plot_write($p->{$name}->{fh},($p->{$name}->{value}->[$j]->[$i]||0)." ",1); } plot_write($p->{$name}->{fh}," ",0); } - plot_write($p->{$name}->{fh},"e"); - plot_write($p->{$name}->{fh},"e"); + plot_write($p->{$name}->{fh},"e"); + plot_write($p->{$name}->{fh},"e"); for(my $j=0; $j<$p->{$name}->{curves}; $j++) { for(my $i=0; $i< $p->{$name}->{entries}; $i++) { @@ -240,15 +258,15 @@ sub PlotDraw { } plot_write($p->{$name}->{fh}," ",0); } - plot_write($p->{$name}->{fh},"e"); - plot_write($p->{$name}->{fh},"e"); + plot_write($p->{$name}->{fh},"e"); + plot_write($p->{$name}->{fh},"e"); } - - + + $p->{$name}->{run}++; - - + + if($p->{$name}->{storable}) { lock_store($p->{$name}->{value},$storefile->{$name}); } @@ -268,6 +286,6 @@ sub PlotFill { $curve = 0 unless $curve; $p->{$name}->{value}->[$curve]->[$slot] = $value||0; } - + 1; diff --git a/hmon/QA.pm b/hmon/QA.pm index 608bff0..0c1ab3f 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -15,7 +15,8 @@ our $cats = {'main'=>"Main", 'endp'=>"Endp", 'feeerr'=>"Fee", 'other'=>"Other", - 'pion'=>"Pion"}; + 'pion'=>"Pion", + 'qa'=>'QA'}; # Order of categories our $entries->{'cats'} = ["main", @@ -27,8 +28,9 @@ our $entries->{'cats'} = ["main", "mdc", "endp", "feeerr", - "pion", +# "pion", "other", + "qa", ]; # Order of entries in each cat @@ -43,6 +45,7 @@ $entries->{'endp'} = ['mdc','rich', 'tof', 'rpc', 'other']; $entries->{'feeerr'} = ['rich', 'trb', 'feeerr','trginp','trgqual']; $entries->{'pion'} = ['nxstatus', 'HV', 'HVcurr', 'cooling','seu']; $entries->{'other'} = ['magnet','rich','shower','mdcinvalid','sequencer']; +$entries->{'qa'} = ['goofy','','','','']; our $QAServer = "hades33"; @@ -74,10 +77,10 @@ our @CPULimits = (95, 100, 100); our @TimeoutLimits = (0, 0, 1); our @LinkErrLimits = (50, 500, 1000); our @MdcEndpMissingLimits = (0, 0, 1); -our @RichEndpMissingLimits = (0, 0, 0); +our @RichEndpMissingLimits = (0, 30, 30); #!!!! our @TofEndpMissingLimits = (0, 0, 0); our @RpcEndpMissingLimits = (0, 0, 0); -our @OtherEndpMissingLimits = (0, 0, 0); +our @OtherEndpMissingLimits = (0, 30, 30);#!!! our @EBDeltaRateLimits = (10, 15, 25); our $TrgCheckPolarity = 1; our @Eventsbroken = (.5,5,10); @@ -87,6 +90,9 @@ our @MdcHVOffsetLimits = (5,10,20); our @PionLvCurrLimits = (4,5,6); +our $MdcHvOff = 1; +our $RichHvOff = 1; +our $MagnetOff = 1; our @LimitTriggerPerSpill = (1000, 0, 0); our $AcceleratorCycle = 7; @@ -96,7 +102,7 @@ use constant {CTSAddress => 0x0003}; # Missing Boards ############################################################################### -our @mdc_boards_removed =(0x2257); # 2233 added 2014-08-28 +our @mdc_boards_removed =(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23 our @mdc_chambers_removed =(); our @rich_boards_removed =(); our @tof_boards_removed =(); diff --git a/hmon/hmon_endpoints.pl b/hmon/hmon_endpoints.pl index 6c72b58..42761c8 100755 --- a/hmon/hmon_endpoints.pl +++ b/hmon/hmon_endpoints.pl @@ -93,8 +93,8 @@ while(1) { my @other_boards =( #shower -# 0x3200,0x3201,0x3202,0x3210,0x3211,0x3212,0x3220,0x3221,0x3222,0x3230,0x3231,0x3232,0x3240,0x3241,0x3242, -# 0x3250,0x3251,0x3252, + 0x3200,0x3201,0x3202,0x3210,0x3211,0x3212,0x3220,0x3221,0x3222,0x3230,0x3231,0x3232,0x3240,0x3241,0x3242, + 0x3250,0x3251,0x3252, #shower-hub # 0x8500,0x8501, #cts diff --git a/hmon/hmon_goofy.pl b/hmon/hmon_goofy.pl new file mode 100755 index 0000000..42dbc7b --- /dev/null +++ b/hmon/hmon_goofy.pl @@ -0,0 +1,100 @@ +#!/usr/bin/perl +use strict; +use IO::Handle; +use Hmon; +use QA; + +sub makeTimeString{ + return strftime("set label 100 \"%H:%M:%S\" at screen 0.02,0.02 left tc rgb \"#000044\" font \"monospace,8\"\n", localtime()) + } + + +open my $GP,'|gnuplot -background white'; + +my $fqa = QA::OpenQAFile() or die "No connection to QA Logfile"; + +my $str = Hmon::MakeTitle(24,20,"Goofy",0); + $str .= qq@@; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("goofy1",$str); + + +while(1) +{ +my $tmp_lines = qx{ssh hadesdaq01 tail -n 500 /home/hadaq/Documents/bitscope/EPICS/goofy/goofyApp/gas_quality.txt}; +open(TMP_FILE,">/tmp/last_gas_data.txt"); +print TMP_FILE $tmp_lines; +close(TMP_FILE); + +print {$GP} << '__GNUPLOT__'; +set term png size 1320,700 font "monospace,8" +set out "files/goofyplot1.png" +set multiplot +set size 0.5,0.5 +set origin 0,0.5 +set title "drift velocity" +set grid +set xdata time +set timefmt "%d/%m/%Y:%H:%M:%S" +set format x "%d/%m\n%H:%M" +set xlabel "time (dd/mm)" +set ylabel "drift velocity (cm/us)" +plot "/tmp/last_gas_data.txt" u 1:5 notitle +set size 0.5,0.25 +set origin 0.5,0.5 +set title "drift time top" +set grid +set xdata time +set timefmt "%d/%m/%Y:%H:%M:%S" +set format x "%d/%m\n%H:%M" +set xlabel "time (dd/mm)" +set ylabel "drift time top (us)" +plot "/tmp/last_gas_data.txt" u 1:6 notitle +set origin 0.5,0.75 +set title "drift time bottom" +set grid +set xdata time +set timefmt "%d/%m/%Y:%H:%M:%S" +set format x "%d/%m\n%H:%M" +set xlabel "time (dd/mm)" +set ylabel "drift time bottom (us)" +plot "/tmp/last_gas_data.txt" u 1:7 notitle +set size 0.5,0.5 +set origin 0,0 +set title "pickup bottom on pickup top amplitude ratio" +set grid +set xdata time +set timefmt "%d/%m/%Y:%H:%M:%S" +set format x "%d/%m\n%H:%M" +set xlabel "time (dd/mm)" +set ylabel "pickup bottom on pickup top amplitude ratio" +plot "/tmp/last_gas_data.txt" u 1:8 notitle +set origin 0.5,0 +set title "pickup bottom on pickup top area ratio" +set grid +set xdata time +set timefmt "%d/%m/%Y:%H:%M:%S" +set format x "%d/%m\n%H:%M" +set xlabel "time (dd/mm)" +set ylabel "pickup bottom on pickup top area ratio" +plot "/tmp/last_gas_data.txt" u 1:9 notitle +unset multiplot +reset +__GNUPLOT__ +$GP->autoflush; + +my $qastate = QA::OK; +#Replace 0 by the condition for ERROR on hmon Panel + +my $tmp_line = qx{ssh hadesdaq01 tail -n 1 /home/hadaq/Documents/bitscope/EPICS/goofy/goofyApp/gas_quality.txt}; +my @data = split(/ /,$tmp_line); +my ($dateS,$dateE,$countsT,$countsB,$dv,$dtT,$dtB,$ramp,$rar)=@data; + +$qastate = QA::ERROR if (0); +QA::WriteQALogvaleurs($fqa,"qa","goofy",120,$qastate,"Goofy","Running","Doing whatever needs to be done."); + +sleep(60); +} + +#<>; +close $GP; diff --git a/hmon/hmon_hadplotnew.sh b/hmon/hmon_hadplotnew.sh index 37da618..059a842 100755 --- a/hmon/hmon_hadplotnew.sh +++ b/hmon/hmon_hadplotnew.sh @@ -746,7 +746,7 @@ sub genreg { if (!(defined $regamount->[$i]) || $regamount->[$i] == 1) { # $c = "trbcmd r $address->[$i] $register->[$i] | sort"; $c = trb_register_read(($address->[$i]),($register->[$i])); - foreach my $s (keys $c) { + foreach my $s (keys %$c) { $c->{$s}=[$c->{$s}]; } } @@ -756,7 +756,7 @@ sub genreg { # print Dumper $c; } # my @out = qx($c); - foreach my $s (sort keys $c) { + foreach my $s (sort keys %$c) { for(my $r = 0; $r < scalar @{$c->{$s}};$r++) { my $tmp = ($c->{$s}->[$r]>>$regoffset->[$i])&(2**$regwidth->[$i]-1); my $val = $tmp; @@ -818,7 +818,7 @@ sub genhist { for(my $i = 0; $i[$i], $register->[$i]) or sleep 1 and print "Error\n" and next; - foreach my $o (sort keys $c) { + foreach my $o (sort keys %$c) { # if (($a,$s,$t) = $o =~ /^0x(\w{4})\s*0x(\w{8})\s*0x(\w{4})/) { $val += (($c->{$o}->{'value'}->[0]>>($regoffset->[$i]))&(2**($regwidth->[$i])-1)); diff --git a/hmon/hmon_hodo.pl b/hmon/hmon_hodo.pl old mode 100755 new mode 100644 diff --git a/hmon/hmon_hodo_hist.pl b/hmon/hmon_hodo_hist.pl index 8eaa656..2d0bb77 100755 --- a/hmon/hmon_hodo_hist.pl +++ b/hmon/hmon_hodo_hist.pl @@ -240,7 +240,7 @@ while (1) { } $t = trb_registertime_read(0xfe49,0x8132); if (defined $t) { - foreach my $b (keys $t) { + foreach my $b (keys %$t) { $o2->{$b}->{0x8132} = $t->{$b}; } } @@ -273,7 +273,7 @@ while (1) { } foreach my $b (keys %$o2) { - foreach my $a (keys $o2->{$b}) { + foreach my $a (keys %{$o2->{$b}}) { my $tdiff = $o2->{$b}->{$a}->{time}->[0] - ($oldtime->{$b}||0); my $vdiff = ($o2->{$b}->{$a}->{value}->[0]) - ($old2->{$b}->{$a}->{value}->[0]); if ($vdiff < 0) { $vdiff += 2**32;} diff --git a/hmon/hmon_mdc_ratecheck.pl b/hmon/hmon_mdc_ratecheck.pl index 409b80f..9cfe8c1 100755 --- a/hmon/hmon_mdc_ratecheck.pl +++ b/hmon/hmon_mdc_ratecheck.pl @@ -30,7 +30,7 @@ while (1) { my $rh_mdc_rates = trb_register_read(0xfffd, 0x910b) or sleep 5 and next; my $rh_evts = trb_register_read(0x0002, 0x0001) or sleep 5 and next; - foreach my $v (sort keys $rh_mdc_rates) { + foreach my $v (sort keys %$rh_mdc_rates) { $values->{$v} = ($rh_mdc_rates->{$v} || 0) - ($laststore->{$v} || $rh_mdc_rates->{$v} || 0); $laststore->{$v} = $rh_mdc_rates->{$v}; $sum += $values->{$v}; @@ -49,7 +49,7 @@ while (1) { if($rate > 1000 && $avg > 1000) { - foreach my $v (sort keys $values) { + foreach my $v (sort keys %$values) { # print($v." ".$values->{$v}."\n"); if($values->{$v} == 0) { $error++; @@ -70,4 +70,4 @@ while (1) { $iteration = 1; } sleep 10; - } \ No newline at end of file + } diff --git a/hmon/hmon_micro.pl b/hmon/hmon_micro.pl index 203e3b8..631aa96 100755 --- a/hmon/hmon_micro.pl +++ b/hmon/hmon_micro.pl @@ -36,6 +36,7 @@ while (1) { trb_register_setbit(0x8880,0xcf8f,1); my $a = trb_register_read(0x8880,0xcf82); my $length = $a->{0x8880}; + $length = 0 if(!defined $length); if($length > 0 && $length < 1E6) { $length = $length/100*1024; if($length < 500000) {$length = 500000;} diff --git a/hmon/hmon_pionovfl.pl b/hmon/hmon_pionovfl.pl index bf71752..5027699 100755 --- a/hmon/hmon_pionovfl.pl +++ b/hmon/hmon_pionovfl.pl @@ -27,9 +27,8 @@ if($plots) { $filter = trb_register_read($address, 0x8400); $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -37,7 +36,6 @@ if($plots) { } else { $str .= "${histname}"; } - $str .= ""; $str .= "\n"; @@ -47,8 +45,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -75,8 +73,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -98,8 +96,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -112,7 +110,7 @@ if($plots) { $str .= "\n"; $str .= Hmon::MakeFooter(); - Hmon::WriteFile("pion2ovfl",$str); + Hmon::WriteFile("pion2ovfl", $str); sleep(5); } } else { diff --git a/hmon/hmon_pionpileup.pl b/hmon/hmon_pionpileup.pl index 385584b..8e46f20 100755 --- a/hmon/hmon_pionpileup.pl +++ b/hmon/hmon_pionpileup.pl @@ -28,8 +28,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -47,8 +47,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -75,8 +75,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; @@ -98,8 +98,8 @@ if($plots) { $addonfilter = trb_register_read($address, 0x8420); $str .= ""; - if (($filter->{$address} & 0x80000000) == 0) { - if (($addonfilter->{$address} & 0x80000000) > 0) { + if (($addonfilter->{$address} & 0x80000000) != 0) { + if (($addonfilter->{$address} & 0x40000000) != 0) { $str .= "${histname} (TS Cut Level2)"; } else { $str .= "${histname} (TS Cut)"; diff --git a/hmon/hmon_pionrate.pl b/hmon/hmon_pionrate.pl index b54d090..862fffa 100755 --- a/hmon/hmon_pionrate.pl +++ b/hmon/hmon_pionrate.pl @@ -97,7 +97,7 @@ if($plots) { $str .= "\n"; $str .= Hmon::MakeFooter(); - Hmon::WriteFile("pion2rate",$str); + Hmon::WriteFile("pion2rate", $str); sleep(5); } } else { diff --git a/hmon/hmon_readoutstuck.pl b/hmon/hmon_readoutstuck.pl index 01bf99d..9a2678e 100755 --- a/hmon/hmon_readoutstuck.pl +++ b/hmon/hmon_readoutstuck.pl @@ -46,7 +46,7 @@ while (1) { if($rate == 0 && ($rh_status->{3} & (1 << 31)) && ($rh_status->{3} & 0x3ff00000)) { my $rh_hubs = trb_register_read(0xfffe,0x81) or sleep 5 and next; - foreach my $h (sort keys $rh_hubs) { + foreach my $h (sort keys %$rh_hubs) { if($rh_hubs->{$h} != 0) { # $boardlist .= sprintf("%04x, ",$h); if (isFeeHub($h)) { @@ -68,4 +68,4 @@ while (1) { QA::WriteQALog($fqa, "daq", "readout", 30, $qastate,"Read-out", $status,$longmsg); # print $qastate." ".$status." ".$longmsg."\n"; sleep(5); - } \ No newline at end of file + } diff --git a/hmon/hmon_shower.pl b/hmon/hmon_shower.pl index 54483e9..b8e8948 100755 --- a/hmon/hmon_shower.pl +++ b/hmon/hmon_shower.pl @@ -45,8 +45,8 @@ while (1) { my $hexval = sprintf("%x", $board); my @a = split("", $hexval); if($a[0] == "3" && $a[1] == "2") { - $values{$board}->{"bytes"} = %$bytes_sent->{$board} - ($values{$board}->{"prev_bytes"}||0) if defined %$bytes_sent->{$board}; - $values{$board}->{"prev_bytes"} = %$bytes_sent->{$board}; + $values{$board}->{"bytes"} = $bytes_sent->{$board} - ($values{$board}->{"prev_bytes"}||0) if defined $bytes_sent->{$board}; + $values{$board}->{"prev_bytes"} = $bytes_sent->{$board}; $sum += $values{$board}->{"bytes"}; } @@ -66,8 +66,8 @@ while (1) { my $patternSum = 0; my $thresholdSum = 0; foreach my $board (keys %$configuration) { - $pattern = sprintf("%x", ((%$configuration->{$board} & 0xf0) >> 4)); - $threshold = sprintf("%x", (%$configuration->{$board} & 0xf)); + $pattern = sprintf("%x", (($configuration->{$board} & 0xf0) >> 4)); + $threshold = sprintf("%x", ($configuration->{$board} & 0xf)); $patternSum += $pattern; $thresholdSum += $threshold; } @@ -81,14 +81,14 @@ while (1) { #analyze data from EPICS my $iSum = 0; foreach my $n (%$data) { - if (defined %$data->{$n}->{"val"}) { - $iSum += %$data->{$n}->{"val"}; + if (defined $data->{$n}->{"val"}) { + $iSum += $data->{$n}->{"val"}; } } foreach my $n (%$data) { - if (defined %$data->{$n}->{"val"}) { - if (%$data->{$n}->{"val"} > ($iSum / 18) + 0.5) { + if (defined $data->{$n}->{"val"}) { + if ($data->{$n}->{"val"} > ($iSum / 18) + 0.5) { $setAlert = 3; } } diff --git a/hmon/hmon_spill.pl b/hmon/hmon_spill.pl index 5a81dc0..cc318fe 100755 --- a/hmon/hmon_spill.pl +++ b/hmon/hmon_spill.pl @@ -2,6 +2,7 @@ use warnings; use Time::HiRes qw(usleep); +use List::Util qw(min max); use strict; use Data::Dumper; use Hmon; @@ -44,6 +45,7 @@ my $str = Hmon::MakeTitle(8,5,"Recorded Events per Spill (1000)",0); Hmon::WriteFile("EvtsPerSpill",$str); my $fqa = QA::OpenQAFile() or die "No connection to QA Logfile"; +my $lastqa = 0; trb_init_ports() or die trb_strerror(); @@ -54,18 +56,20 @@ while (1) { my $rh_result = trb_register_read(QA::CTSAddress, 0xa002) or $trbneterr = 1; #sleep 5 and next; my $stopped = trb_register_read(0x3,0xa0c0) or sleep 5 and next; $stopped = ($stopped->{3} || 0) & 0x400; - + my $sc = trb_register_read(0x3830,0xc00d); + if(!defined $sc) { + sleep 10; + next; + } my $spillcount = $sc->{0x3830} & 0x00ffffff; my $inspill = ($sc->{0x3830} & 0x80000000) >> 31; - my $data = Perl2Epics::GetAll(); - + $lastspill = $outofspill; $outofspill = ($rh_result->{QA::CTSAddress} || 0) & 0x10; $spilllength++ ; #if($outofspill); $rh_result = trb_register_read(0x0002, 0x01) or $trbneterr = 1; #sleep 5 and next; - # 0x3000 => a reliable guy to ask about rates - + if($trbneterr == 0) { my $res = $rh_result->{0x0002} & 0xffff; $evtrate = $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres; @@ -100,7 +104,8 @@ while (1) { $spillavgshort /= (scalar @spills < 10)?(scalar @spills):10; $qashort = QA::SciNotation($events)." (".$spilllength."s)"; - $qastate = QA::GetQAState('above', "$events", @QA::LimitTriggerPerSpill); + $qastate = min($lastqa,QA::GetQAState('above', "$events", @QA::LimitTriggerPerSpill)); + $lastqa = QA::GetQAState('above', "$events", @QA::LimitTriggerPerSpill); $qalong = sprintf("current spill: %s - 10-spill avg. %s - 50-spill avg. %s - Spill length %is", QA::SciNotation($events), QA::SciNotation($spillavgshort), @@ -115,9 +120,11 @@ while (1) { } elsif ($spilllength > 20) { QA::WriteQALog($fqa, "trg", "spill", 30, QA::NOTE, "Spill Sum", "No Spills", "No Spills detected at the moment"); - - if($spilllength >= 25 && !($spilllength%25)) { - if($data->{'prefix'}->{val} eq 'be') { + #print $spilllength."\n" unless $spilllength%10; + if($spilllength >= 25 && ($spilllength%25 == 0)) { + my $data = Perl2Epics::GetAll(); + print STDERR $data->{'prefix'}->{val}."\n"; + if(($data->{'prefix'}->{val} eq '-1') || ($data->{'prefix'}->{val} eq 'be')) { Hmon::Speak('nobeam', "No beam"); } } diff --git a/hmon/hmon_trgsource.pl b/hmon/hmon_trgsource.pl index 5a213a4..46d0f78 100755 --- a/hmon/hmon_trgsource.pl +++ b/hmon/hmon_trgsource.pl @@ -47,12 +47,14 @@ $plot->{type} = HPlot::TYPE_HISTORY; $plot->{output} = HPlot::OUT_PNG; $plot->{titles}->[0] = ""; $plot->{xlabel} = "Spill Number"; -$plot->{ylabel} = "Start Counts / Mcnt"; +$plot->{ylabel} = "Hodoscope Counts / Mcnt"; $plot->{sizex} = 630; $plot->{sizey} = 220; $plot->{nokey} = 1; +$plot->{buffer} = 1; +$plot->{storable} = 1; HPlot::PlotInit($plot); -my $str = Hmon::MakeTitle(8,5,"Start Counts per Spill (millions)",0); +my $str = Hmon::MakeTitle(8,5,"Hodoscope Counts per Spill (millions)",0); $str .= qq@@; $str .= Hmon::MakeFooter(); Hmon::WriteFile("StartCountSpill",$str); @@ -258,7 +260,7 @@ my $longmsgcheck = $longmsg; $spillsum = 0; } $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum)); - $startlongmsg = sprintf("Hodo counts per second %s/s - Hodo counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum)); + $startlongmsg = sprintf("Start counts per second %s/s - Start counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum)); QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Hodo Count", $startmsg, $startlongmsg); diff --git a/hmon/permanent/hmon_archiver.pl b/hmon/permanent/hmon_archiver.pl old mode 100755 new mode 100644 diff --git a/hmon/permanent/hmon_eb_run.pl b/hmon/permanent/hmon_eb_run.pl index 304f4fb..96f5998 100755 --- a/hmon/permanent/hmon_eb_run.pl +++ b/hmon/permanent/hmon_eb_run.pl @@ -80,8 +80,8 @@ while(1) { # 0x3000 => ?? - $rh_result = trb_register_read(0x3000, 0x1) or $trbneterr = 1; - my $res = ($rh_result->{0x3000} || 0) & 0xFFFF; + $rh_result = trb_register_read(0x3001, 0x1) or $trbneterr = 1; + my $res = ($rh_result->{0x3001} || 0) & 0xFFFF; $evtrate = $res - ($events || $res); $evtrate += 2**16 if $evtrate < 0; diff --git a/hmon/permanent/hmon_magnet.pl b/hmon/permanent/hmon_magnet.pl index 4f316f2..25162d0 100755 --- a/hmon/permanent/hmon_magnet.pl +++ b/hmon/permanent/hmon_magnet.pl @@ -9,7 +9,7 @@ use QA; use Getopt::Long; use Data::Dumper; -my $magnet_on = 1; +my $magnet_on = 1 - $QA::MagnetOff; my %range_list = ( 'Time' => {}, diff --git a/hmon/permanent/hmon_mdchv.pl b/hmon/permanent/hmon_mdchv.pl index d0442e7..caf4355 100755 --- a/hmon/permanent/hmon_mdchv.pl +++ b/hmon/permanent/hmon_mdchv.pl @@ -13,6 +13,7 @@ use Perl2Epics; use HADES::TrbNet; use HPlot; + my $timer = 0; my @colors = ("#000000", "#ff0000","#00ff00","#0000ff","#cccc00","#009955"); my @names = qw( S1 S2 S3 S4 S5 S6); @@ -22,6 +23,9 @@ if(!$connect_status) { die("could not connect to trbnetd"); } +my $currenterr = 0; +my $currenterrtimer = 0; +my $spikeString = ""; ########### #Change 3 for-loops to include all four planes again! @@ -35,10 +39,10 @@ foreach my $s (0..1) { $plot[$p*2+$s]->{name} = "P".$p.($s?'F':'C')."I"; $plot[$p*2+$s]->{file} = "files/MDCHV".$plot[$p*2+$s]->{name}; $plot[$p*2+$s]->{entries} = 360; - $plot[$p*2+$s]->{xscale} = 12; + $plot[$p*2+$s]->{xscale} = 1; $plot[$p*2+$s]->{type} = HPlot::TYPE_HISTORY; $plot[$p*2+$s]->{output} = HPlot::OUT_PNG; - $plot[$p*2+$s]->{xlabel} = "Minutes"; + $plot[$p*2+$s]->{xlabel} = "Seconds"; $plot[$p*2+$s]->{ylabel} = ($s?'F':'C')." Current"; $plot[$p*2+$s]->{sizex} = 700; $plot[$p*2+$s]->{sizey} = 240; @@ -56,10 +60,10 @@ foreach my $s (0..1) { $plot[$p*2+$s+8]->{name} = "P".$p.($s?'F':'C')."V"; $plot[$p*2+$s+8]->{file} = "files/MDCHV".$plot[$p*2+$s+8]->{name}; $plot[$p*2+$s+8]->{entries} = 360; - $plot[$p*2+$s+8]->{xscale} = 12; + $plot[$p*2+$s+8]->{xscale} = 1; $plot[$p*2+$s+8]->{type} = HPlot::TYPE_HISTORY; $plot[$p*2+$s+8]->{output} = HPlot::OUT_PNG; - $plot[$p*2+$s+8]->{xlabel} = "Minutes"; + $plot[$p*2+$s+8]->{xlabel} = "Seconds"; $plot[$p*2+$s+8]->{ylabel} = ($s?'F':'C')." Voltage"; $plot[$p*2+$s+8]->{sizex} = 700; $plot[$p*2+$s+8]->{sizey} = 240; @@ -75,8 +79,8 @@ foreach my $s (0..1) { } } - -for(my $i = 1; $i<=4; $i++) { +### default HV channels: + for(my $i = 1; $i<=4; $i++) { for(my $j = 1; $j<=6; $j++) { my $s = sprintf("HAD:MDC:HV:P%i:S%i:F:vmon",$i,$j); Perl2Epics::Connect("$i-$j-0-V",$s); @@ -84,15 +88,33 @@ for(my $i = 1; $i<=4; $i++) { Perl2Epics::Connect("$i-$j-1-V",$s); $s = sprintf("HAD:MDC:HV:P%i:S%i:F:imon",$i,$j); Perl2Epics::Connect("$i-$j-0-I",$s); - $s = sprintf("HAD:MDC:HV:P%i:S%i:C:imon",$i,$j); + $s = sprintf("HAD:MDC:HV:P%i:S%i:C:imon",$i,$j); Perl2Epics::Connect("$i-$j-1-I",$s); } } +#################################################################### +## CW 2.Oct 2014 individual layer HV: +for(my $i = 1; $i<=4; $i++) { + for(my $j = 1; $j<=6; $j++) { + my $s = sprintf("HAD:MDC:HV:Ind%i:F%i:vmon",$i,$j); + Perl2Epics::Connect("Ind-$i-$j-0-V",$s); + if($j == 6) { $s = sprintf("HAD:MDC:HV:Ind%i:C0%i:vmon",$i,$j);} + else { $s = sprintf("HAD:MDC:HV:Ind%i:C%i:vmon",$i,$j);} + Perl2Epics::Connect("Ind-$i-$j-1-V",$s); + $s = sprintf("HAD:MDC:HV:Ind%i:F%i:imon",$i,$j); + Perl2Epics::Connect("Ind-$i-$j-0-I",$s); + if($j == 6) { $s = sprintf("HAD:MDC:HV:Ind%i:C0%i:imon",$i,$j);} + else { $s = sprintf("HAD:MDC:HV:Ind%i:C%i:imon",$i,$j);} + Perl2Epics::Connect("Ind-$i-$j-1-I",$s); + } + } +##################################################################### + print "Connected.\n"; while(1) { my $data = Perl2Epics::GetAll(); - my $str = Hmon::MakeTitle(13, 6, "MDC HV", 1, ""); + my $str = Hmon::MakeTitle(18, 12, "MDC HV", 1, ""); $str .= ""; #
$str .= "
Sector 1Sector 2Sector 3Sector 4Sector 5Sector 6"; for(my $i = 1; $i<=4; $i++) { @@ -108,16 +130,44 @@ while(1) { $curr = -1 unless defined $curr; HPlot::PlotAdd("P".($i-1).(($v)?'C':'F')."I",$curr,$s-1); HPlot::PlotAdd("P".($i-1).(($v)?'C':'F')."V",$volt,$s-1); - my $tmp .= sprintf(" %4i V | %2.2f uA",$volt,$curr); + my $tmp .= sprintf(" %4i V | %3.2f uA",$volt,$curr); $tmp =~ s/\s/ /gi; $str .= "".$tmp; + } } #$str .= "
 \n"; } + $str .= "
\n ";#"; #
+ $str .= "Layer 1Layer 2Layer 3Layer 4Layer 5Layer 6/0"; + for(my $i = 1; $i<=4; $i++) { + $str .= "Chamber $i\n"; + for(my $v = 0; $v<=1; $v++) { + $str .= "".$layerlabel[$v]." "; + for(my $s = 1; $s<=6; $s++) { + my $voltI = $data->{"Ind-$i-$s-$v-V"}->{val}; + my $currI = $data->{"Ind-$i-$s-$v-I"}->{val}; + my $tvI = strftime("%H:%M:%S",localtime($data->{"Ind-$i-$s-$v-V"}->{tme} || 0)); + my $tcI = strftime("%H:%M:%S",localtime($data->{"Ind-$i-$s-$v-I"}->{tme} || 0)); + $voltI = -1 unless defined $voltI; + $currI = -1 unless defined $currI; + my $tmpI .= sprintf(" %4i V | %3.2f uA",$voltI,$currI); + $str .= "".$tmpI; + } + } + } $str .= "\n";#
{"$p-$s-$i-V"}->{val}; + my $current = $data->{"$p-$s-$i-I"}->{val}; if(! defined $mdcHvMin[$p] || $mdcHvMin[$p] > $volt) { $mdcHvMin[$p] = $volt; } if(! defined $mdcHvMax[$p] || $mdcHvMax[$p] < $volt) { $mdcHvMax[$p] = $volt; } +# if($p>2) { +# $logString .= " ".$volt." ".$current." "; +# } + if($current > 160) { + $spikeString .= "P$p S$s F/C $i: HV = ".$volt." , I = ".$current." - ".localtime()."\n"; + $currenterr++; + } + } } if($mdcHvMax[$p] > $QA::MdcNominalHV[$p-1] + $QA::MdcHVOffsetLimits[0]) {$qastate = max($qastate,QA::WARN);} @@ -153,13 +213,38 @@ while(1) { if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[1]) {$qastate = max($qastate,QA::WARN_2);} if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[2]) {$qastate = max($qastate,QA::ERROR);} } - + $qastate = min($qastate,$QA::MdcHvOff?QA::NOTE:200); my $value = sprintf("%.1f/%.1f/%.1f/%.1f",$mdcHvMin[1]/1000.,$mdcHvMin[2]/1000.,$mdcHvMin[3]/1000.,$mdcHvMin[4]/1000.); my $longtext = "MDC high voltage in all four planes". "
Minimum [V]: ".$mdcHvMin[1]." / ".$mdcHvMin[2]." / ".$mdcHvMin[3]." / ".$mdcHvMin[4]. "
Maximum [V]: ".$mdcHvMax[1]." / ".$mdcHvMax[2]." / ".$mdcHvMax[3]." / ".$mdcHvMax[4]. "
Nominal [V]: ".$QA::MdcNominalHV[0]." / ".$QA::MdcNominalHV[1]." / ".$QA::MdcNominalHV[2]." / ".$QA::MdcNominalHV[3]; QA::WriteQALog($flog,"other","mdcinvalid",10,$qastate,"MDC HV",$value,$longtext); + + + + if($currenterr > 0 ) { + $currenterrtimer++; + if( $currenterrtimer == 10 && $currenterr < 6){ + Hmon::SendEmail('c.wendisch@gsi.de',"MDC Current Spike","Currents in MDC was spiking in\n$spikeString"); + $currenterrtimer = 0; + } + if ($currenterrtimer == 20 && $currenterr >= 6 ){ + Hmon::SendEmail('c.wendisch@gsi.de',"MDC OVC","Current in MDC was too high in\n$spikeString"); + $currenterrtimer = 0; + } + if($currenterrtimer==0) { + $currenterr = 0; + $spikeString = ""; + } + } + my $fh; + + # $logString .= "\n"; + # open($fh, ">>",Hmon::HMONDIR."/archive/mdcCurrentslog.csv"); + # print $fh $logString; + # close $fh; + $timer++; sleep(1); } diff --git a/hmon/permanent/hmon_mdcpressure.pl b/hmon/permanent/hmon_mdcpressure.pl index 1203bed..4489266 100755 --- a/hmon/permanent/hmon_mdcpressure.pl +++ b/hmon/permanent/hmon_mdcpressure.pl @@ -262,33 +262,31 @@ while(1) { # $presserr++; # } - for my $i (1..3) { + for my $i (1..3) { # CW 1.4.2016 : only for Plane 1 to 3, as pressure values in plane 4 S5&6 are wrong - readout failure +planes for my $j (1..6) { - if($data->{"p$i$j"}->{val} > 50 ) { - $presserr++; + my $pressure_now = $data->{"p$i$j"}->{val}; + if( $pressure_now < 1.0 || $pressure_now > 55) { + # $presserr++; } } } - if($presserr >= 3) { - if($presserrtimer == 0) { + if($presserr > 0) { + $presserrtimer++; + if($presserrtimer > 3 && $presserr > 3) { $presserr = 0; my $valstr = ""; - $valstr.="CO2 concentration Plane1: ".$data->{"p1CO2"}->{val}." % \n"; - $valstr.="CO2 concentration Plane2: ".$data->{"p2CO2"}->{val}." % \n"; - for my $i (1..3) { - for my $j (1..6) { - $valstr.="P$i S$j: ".$data->{"p$i$j"}->{val}."\n"; + $valstr.="CO2 concentration Plane1: ".$data->{"p1CO2"}->{val}." % \n"; + $valstr.="CO2 concentration Plane2: ".$data->{"p2CO2"}->{val}." % \n"; + for my $i (1..4) { + for my $j (1..6) { + $valstr.="P$i S$j: ".$data->{"p$i$j"}->{val}."\n"; } } - $presserrtimer = 90; - Hmon::SendEmail('c.wendisch@gsi.de',"Warning: MDC Over-Pressure","Pressures in MDC are too high: \n$valstr"); - } - else { - $presserrtimer--; - } + $presserrtimer = 0; + # Hmon::SendEmail('c.wendisch@gsi.de',"Warning: MDC Over-Pressure","Pressures in MDC are too high: \n$valstr"); +< } } - - $timer++; sleep(10); } diff --git a/hmon/permanent/hmon_pionsupply.pl b/hmon/permanent/hmon_pionsupply.pl index 6d9ef1f..02c21b6 100755 --- a/hmon/permanent/hmon_pionsupply.pl +++ b/hmon/permanent/hmon_pionsupply.pl @@ -44,66 +44,69 @@ HPlot::PlotInit($plot2); while(1) { - - open(PIONLOG, Hmon::HMONDIR."hmon_permanent_tail -F ".Hmon::HMONDIR."pion/scmon.log|"); + + open(PIONLOG, Hmon::HMONDIR."hmon_permanent_tail -F ".Hmon::HMONDIR."pion/scmon.log|"); - my $readlines = 0; - my $str = ""; - my $oldtime = time(); - my $a; + my $readlines = 0; + my $str = ""; + my $oldtime = time(); + my $a; - while($a = ) { - $str = Hmon::MakeTitle(9,11,"PionSupplies",1); - my @val = split(/\s+/,$a); + while($a = ) { + $str = Hmon::MakeTitle(9,11,"PionSupplies",1); + my @val = split(/\s+/,$a); - #$str .= strftime("%H:%M:%S",localtime($val[0])); - $str .= "
HV (V)HV (μA)Temp. (°C)"; - $str .= sprintf("
Pion1:%.1fV%.3fuA%.1f°C",$val[3],$val[4],$val[47]); - $str .= sprintf("
Pion2:%.1fV%.3fuA%.1f°C",$val[25],$val[26],$val[53]); - $str .= "
"; - $str .= qq@
\n@; - $str .= qq@\n@; - $str .= Hmon::MakeFooter(); - Hmon::WriteFile("PionSupplies",$str); - - HPlot::PlotAdd('HighVoltage',$val[3],0); - HPlot::PlotAdd('HighVoltage',$val[25],1); - HPlot::PlotDraw("HighVoltage"); - - HPlot::PlotAdd('HVCurrent',$val[4],0); - HPlot::PlotAdd('HVCurrent',$val[26],1); - HPlot::PlotDraw("HVCurrent"); - - - my $shorttext = sprintf("%.1f/%.3f",$val[3],$val[4]); - my $longtext = sprintf("Pion 1: %.1f V / %.4fuA",$val[3],$val[4]); - my $state = QA::OK; - $state = QA::WARN if($val[3]<140); - $state = QA::WARN if($val[4] > 1.0); - $state = QA::FATAL if($val[4] > 5); - - QA::WriteQALog($flog, "pion", "HV", 30, - $state, 'Pion 0 HV', $shorttext, $longtext); + #$str .= strftime("%H:%M:%S",localtime($val[0])); + $str .= "
HV (V)HV (μA)Temp. (°C)"; + $str .= sprintf("
Pion1:%.1fV%.3fuA%.1f°C",$val[3],$val[4],$val[47]); + $str .= sprintf("
Pion2:%.1fV%.3fuA%.1f°C",$val[25],$val[26],$val[53]); + $str .= "
"; + $str .= qq@
\n@; + $str .= qq@\n@; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("PionSupplies",$str); + + HPlot::PlotAdd('HighVoltage',$val[3],0); + HPlot::PlotAdd('HighVoltage',$val[25],1); + HPlot::PlotDraw("HighVoltage"); + + HPlot::PlotAdd('HVCurrent',$val[4],0); + HPlot::PlotAdd('HVCurrent',$val[26],1); + HPlot::PlotDraw("HVCurrent"); + + + my $shorttext = sprintf("%.1f/%.3f",$val[3],$val[4]); + my $longtext = sprintf("Pion 1: %.1f V / %.4fuA",$val[3],$val[4]); + my $state = QA::OK; + $state = QA::WARN if($val[3]<140); + $state = QA::WARN if($val[4] > 1.0); + $state = QA::FATAL if($val[4] > 5); + + QA::WriteQALog($flog, "pion", "HV", 30, + $state, 'Pion 0 HV', $shorttext, $longtext); - $shorttext = sprintf("%.1f/%.3f",$val[25],$val[26]); - $longtext = sprintf("Pion 2: %.2f V / %.3fuA",$val[25],$val[26]); - $state = QA::OK; - $state = QA::WARN if($val[25]<140); - $state = QA::WARN if($val[26] > 1.5); - $state = QA::FATAL if($val[26] > 5); - - QA::WriteQALog($flog, "pion", "HVcurr", 30, - $state, 'Pion 1 HV', $shorttext, $longtext); + $shorttext = sprintf("%.1f/%.3f",$val[25],$val[26]); + $longtext = sprintf("Pion 2: %.2f V / %.3fuA",$val[25],$val[26]); + $state = QA::OK; + $state = QA::WARN if($val[25]<140); + $state = QA::WARN if($val[26] > 1.5); + $state = QA::FATAL if($val[26] > 5); + + QA::WriteQALog($flog, "pion", "HVcurr", 30, + $state, 'Pion 1 HV', $shorttext, $longtext); - $shorttext = sprintf("%.1f° / %.1f°",$val[47],$val[53]); - $longtext = sprintf("Pion 1: is %.1f°, soll %.1f°
Pion 2: is %.1f°, soll %.1f°",$val[47],$val[49],$val[53],$val[55]); - $state = QA::OK; - $state = QA::WARN if($val[47]>-15 || $val[53]>-15); - - - QA::WriteQALog($flog, "pion", "cooling", 120, - $state, 'Pion Cool', $shorttext, $longtext); - + $shorttext = sprintf("%.1f° / %.1f°", $val[47], $val[53]); + $longtext = sprintf("Pion 1: is %.1f°, soll %.1f°
Pion 2: is %.1f°, soll %.1f°", $val[47], $val[49], $val[53], $val[55]); + $state = QA::OK; + $state = QA::WARN if ($val[47] >-15 || $val[53] >- 15); + if ($val[50] != 1 || $val[56] != 1) { + $longtext = $longtext . sprintf("
--------- CHILLER OFFLINE ERROR ---------
Pion1: %s
Pion2: %s", \ + $val[50] != 1 ? "OFF" : "ON", $val[56] != 1 ? "OFF" : "ON"); + $state = QA::ERROR; + } + + QA::WriteQALog($flog, "pion", "cooling", 120, + $state, 'Pion Cool', $shorttext, $longtext); } } diff --git a/hmon/permanent/hmon_richhv.pl b/hmon/permanent/hmon_richhv.pl index 71f7ab9..941e198 100755 --- a/hmon/permanent/hmon_richhv.pl +++ b/hmon/permanent/hmon_richhv.pl @@ -95,8 +95,8 @@ while(1) { $str .= "Volt."; for(my $v = 1; $v<=6; $v++) { $str .= sprintf(" %i V\n",$data->{"U$v"}->{val} || -1); - $min = min($min,$data->{"U$v"}->{val}||1E6); - $max = max($max,$data->{"U$v"}->{val}||0); + $min = min($min,$data->{"U$v"}->{val}||-1); + $max = max($max,$data->{"U$v"}->{val}||-1); } $str .= "\n"; $str .= qq@\n@; @@ -124,33 +124,35 @@ while(1) { else { $errortimer = 0; } - if($errortimer >= 800) { + if($errortimer >= 800 && !$QA::RichHvOff) { $qastate = QA::ERROR; if (!($errortimer%200)) { Hmon::Speak('richhv', "Rich high voltage error"); } } +$qastate = QA::NOTE if ($QA::RichHvOff == 1); + if( $timer % (4*$OVERCURRENT_period) == 0) { $value = sprintf("%.2f / %.2f kV",$min/1000,$max/1000); $longtext = sprintf("Averaged current in RICH HV: %i uA",$current_average); - $longtext.= sprintf("
HV settings: %i, %i, %i, %i, %i, %i V", $data->{"U1"}->{val}, $data->{"U2"}->{val}, - $data->{"U3"}->{val}, $data->{"U4"}->{val}, - $data->{"U5"}->{val}, $data->{"U6"}->{val}); + $longtext.= sprintf("
HV settings: %i, %i, %i, %i, %i, %i V", $data->{"U1"}->{val}||-1, $data->{"U2"}->{val}||-1, + $data->{"U3"}->{val}||-1, $data->{"U4"}->{val}||-1, + $data->{"U5"}->{val}||-1, $data->{"U6"}->{val}||-1); #print "current_average: $current_average, sum: $current_sum\n"; - + $current_sum = 0; QA::WriteQALog($flog,"other","rich",30,$qastate,"RICH HV",$value,$longtext); } for(my $i = 1; $i<=6;$i++) { - HPlot::PlotAdd("RichCurr",$data->{"I$i"}->{val},$i-1); + HPlot::PlotAdd("RichCurr",$data->{"I$i"}->{val}||-1,$i-1); } if($timer%8 == 0) { HPlot::PlotDraw("RichCurr"); for(my $i = 1; $i<=6;$i++) { - HPlot::PlotAdd("RichCurrLong",$data->{"I$i"}->{val},$i-1); + HPlot::PlotAdd("RichCurrLong",$data->{"I$i"}->{val}||-1,$i-1); } HPlot::PlotDraw("RichCurrLong"); } diff --git a/hmon/permanent/hmon_sequencer.pl b/hmon/permanent/hmon_sequencer.pl index d85bca4..2b5da0f 100755 --- a/hmon/permanent/hmon_sequencer.pl +++ b/hmon/permanent/hmon_sequencer.pl @@ -11,6 +11,10 @@ use Perl2Epics; my @names; my $errorcounter; + + +#HAD:FWHV:G7:status:alive:roc:average + my @variables = qw( HAD:TOFHV:G1:status:alive:roc:average @@ -19,7 +23,6 @@ HAD:TOFHV:G3:status:alive:roc:average HAD:TOFHV:G4:status:alive:roc:average HAD:TOFHV:G5:status:alive:roc:average HAD:TOFHV:G6:status:alive:roc:average -HAD:FWHV:G7:status:alive:roc:average HAD:RPCHV:G8:status:alive:roc:average HAD:RPCHV:G9:status:alive:roc:average HAD:RICH:HV:G25:status:alive:roc:average @@ -99,7 +102,9 @@ for my $v (@variables) { Perl2Epics::Connect($name,$v); } -sleep(10); +sleep(10); +Perl2Epics::GetAll(); +sleep(20); while(1) { my $qastate = QA::OK; diff --git a/hmon/start.sh b/hmon/start.sh index c1e0f04..cc311fc 100755 --- a/hmon/start.sh +++ b/hmon/start.sh @@ -13,7 +13,7 @@ echo " No tunnel found, digging new one"; ssh -f -R 8888:hades33.gsi.de:80 -R 3060:hades33.gsi.de:80 -R 8889:hades33.gsi.de:1234 -R 9999:lxhadeb06.gsi.de:80 cerberus.x-matter.uni-frankfurt.de -N & fi -killall speakdaemon.pl +killall -f speakdaemon.pl cd /home/hadaq/trbsoft/hadesdaq/hmon/ # cd permanent