From: hadaq Date: Sun, 13 Mar 2022 14:44:26 +0000 (+0100) Subject: update hmon files X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=36701971fb13d24fe1bba8bfca0b106046167d26;p=hadesdaq.git update hmon files --- diff --git a/.gitignore b/.gitignore index 97f8283..9e7fab0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ rich_thr* conf_sts* oracle rich/trb_dirich_threshold_bck +daq_readback +rush_read diff --git a/hmon/Hmon.pm b/hmon/Hmon.pm index 1de94a6..1e8dd95 100644 --- a/hmon/Hmon.pm +++ b/hmon/Hmon.pm @@ -139,7 +139,11 @@ sub SendEmail { } - +sub CallScript { + my ($script,$title,$msg) = @_; + system("$script $title msg"); + system("logger -p local1.info -t DAQ '".$title.": Called script ".$script." with content ".$msg."'"); + } ############################################################################### # Calculate Colors diff --git a/hmon/QA.pm b/hmon/QA.pm index 1ab3667..b561bfd 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -81,7 +81,7 @@ our $QAServer = "hades33"; our @FeeErrLimits = (0, 5, 10); our @MdcOepLimits = (372, 372-1, 372-3); -our @MdcVoltageLimits = (70, 90, 100); +our @MdcVoltageLimits = (80, 140, 200); our @MdcLockLimits = (0, 3, 5); our @MdcTempLimits = (75, 80, 85); our @EcalTempLimits = (55, 60, 65); @@ -123,7 +123,7 @@ our @PionLvCurrLimits = (4,5,6); our $PadiwaEcalNumber = 105; -our @PadiwaEcalLimits = (1, 4, 7); +our @PadiwaEcalLimits = (3, 5, 8); our $PadiwaItofNumber = 18; our @PadiwaItofLimits = (0, 0, 0); @@ -146,8 +146,8 @@ our $RichHvOff = 0; our $RichGasOff = 0; our $TofHvOff = 0; our $RpcHvOff = 0; -our $FwHvOff = 1; -our $MagnetOff = 0; +our $FwHvOff = 0; +our $MagnetOff = 1; our $StsHvOff = 0; our $StartHvOff = 1; our $ItofHvOff = 0; diff --git a/hmon/hmon_eberrbits_withreset.pl b/hmon/hmon_eberrbits_withreset.pl index 39cf172..7cc9951 100755 --- a/hmon/hmon_eberrbits_withreset.pl +++ b/hmon/hmon_eberrbits_withreset.pl @@ -209,6 +209,7 @@ print Dumper $store if $opt_verbose; # JAM2018 - same as before with epics: foreach my $k (sort keys %$store) { + next if $k eq "TRB_83C2"; #################################################################because of trigger input error if ($k ne "all") { foreach my $b (sort keys %{$store->{$k}}) { if(($b != 0)) { diff --git a/hmon/hmon_logsts.pl b/hmon/hmon_logsts.pl new file mode 100755 index 0000000..db22390 --- /dev/null +++ b/hmon/hmon_logsts.pl @@ -0,0 +1,6 @@ +#!/usr/bin/perl +while (1) { + system("cd /home/hadaq/trbsoft/hadesdaq/sts/settings/daq_readback/; /home/hadaq/trbsoft/hadesdaq/sts/settings/daq_readback/read_back_asic_am.sh"); + sleep 600; +} + diff --git a/hmon/hmon_spill.pl b/hmon/hmon_spill.pl index 49dbbca..361b2a5 100755 --- a/hmon/hmon_spill.pl +++ b/hmon/hmon_spill.pl @@ -89,16 +89,17 @@ while (1) { if($trbneterr == 0) { my $res = $rh_result->{0x0002} & 0xffff; - $evtrate += $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres; - $events += $evtrate; + my $evtrate2 = $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres; + $events += $evtrate2; + $evtrate += $evtrate2; $midlastres = $res; usleep(250000); $rh_result = trb_register_read(0x0002, 0x01) or $trbneterr = 1; #sleep 5 and next; $res = $rh_result->{0x0002} & 0xffff; - my $evtrate2 = $res >= $midlastres ? $res - $midlastres : ($res + 2**16) - $midlastres; + $evtrate2 = $res >= $midlastres ? $res - $midlastres : ($res + 2**16) - $midlastres; $events += $evtrate2; - $evtrate += $evtrate2; + $evtrate += $evtrate2; # When end of spill is detected... my $qastate; diff --git a/hmon/hmon_startrate.pl b/hmon/hmon_startrate.pl index 2dc8964..e8d4883 100755 --- a/hmon/hmon_startrate.pl +++ b/hmon/hmon_startrate.pl @@ -170,8 +170,8 @@ my $plot7a = { curvewidth => .9, key => 0, additional => " - set obj 1 rect from -1, 7E7 to 200, 10E7 fc rgb '#ffffbb' behind \n - set obj 2 rect from -1, 10E7 to 200, 100E7 fc rgb '#ffdddd' behind + set obj 1 rect from -1, 7E7 to 400, 10E7 fc rgb '#ffffbb' behind \n + set obj 2 rect from -1, 10E7 to 400, 100E7 fc rgb '#ffdddd' behind " }; HPlot::PlotInit($plot7a); @@ -199,8 +199,8 @@ my $plot7b = { curvewidth => .9, key => 0, additional => " - set obj 1 rect from -1, 7E7 to 200, 10E7 fc rgb '#ffffbb' behind \n - set obj 2 rect from -1, 10E7 to 200, 100E7 fc rgb '#ffdddd' behind + set obj 1 rect from -1, 7E7 to 400, 10E7 fc rgb '#ffffbb' behind \n + set obj 2 rect from -1, 10E7 to 400, 100E7 fc rgb '#ffdddd' behind " }; HPlot::PlotInit($plot7b); diff --git a/hmon/hmon_triggerratio.pl b/hmon/hmon_triggerratio.pl index 9c837e9..163674b 100755 --- a/hmon/hmon_triggerratio.pl +++ b/hmon/hmon_triggerratio.pl @@ -162,9 +162,10 @@ while (1) { my $m2 = $diff->{0x10}[0x50]; my $pt3 = $diff->{0x10}[218]; -# print $startdirect." ".$start."\n"; ###Ratio M2 over Start my $ratio = $m2/($startdirect||1); +# print "$inspill $startdirect $m2 $ratio\n"; + if ($startdirect <= $STARTRATELIMIT || !$inspill) { HPlot::PlotAdd("M2StartRatio",0,1); HPlot::PlotAdd("M2StartRatio","NaN",0) diff --git a/hmon/magnet_emergency_call.sh b/hmon/magnet_emergency_call.sh new file mode 100755 index 0000000..77de5f2 --- /dev/null +++ b/hmon/magnet_emergency_call.sh @@ -0,0 +1,7 @@ +ssh -i ~/.ssh/id_rsa_sipgate michael@hadesp59 magnet_torsten.call + +#ssh -i ~/.ssh/id_rsa_sipgate michael@hadesp59 magnet_jurek.call +ssh -i ~/.ssh/id_rsa_sipgate michael@hadesp59 magnet_michael.call +#ssh -i ~/.ssh/id_rsa_sipgate michael@hadesp59 magnet_operator.call + +#ssh -i ~/.ssh/id_rsa_sipgate michael@hadesp59 magnet_lukas.call diff --git a/hmon/permanent/hmon_frpchv.pl b/hmon/permanent/hmon_frpchv.pl index 58fbc1d..31ac297 100755 --- a/hmon/permanent/hmon_frpchv.pl +++ b/hmon/permanent/hmon_frpchv.pl @@ -90,11 +90,11 @@ while(1) { QA::WriteQALog($flog,"hv2","frpchv",30,$qastate,"fRPC",$value,$longtext); - $errorcounter = 65 if $errorcounter <= 0 && $temperature >= 34; - $errorcounter = 0 if $temperature < 34; - if ($errorcounter-- == 60) { - Hmon::SendEmail('rpc.slow.control@gmail.com',"fRPC Temperature too high","Temperature in fRPC is $temperature_s") ; - } +# $errorcounter = 65 if $errorcounter <= 0 && $temperature >= 34; +# $errorcounter = 0 if $temperature < 34; +# if ($errorcounter-- == 60) { +# Hmon::SendEmail('rpc.slow.control@gmail.com',"fRPC Temperature too high","Temperature in fRPC is $temperature_s") ; +# } sleep(10); } diff --git a/hmon/permanent/hmon_itofhv.pl b/hmon/permanent/hmon_itofhv.pl index 388fc99..acd4c5c 100755 --- a/hmon/permanent/hmon_itofhv.pl +++ b/hmon/permanent/hmon_itofhv.pl @@ -32,14 +32,14 @@ while(1) { $value = "HV is OFF" if $vals[1] < 20 || $QA::ItofHvOff == 1; my $qastate = QA::OK; - $qastate = QA::WARN_2 if $vals[2] >= 0.015; + $qastate = QA::WARN_2 if $vals[2] >= 0.017; $qastate = QA::ERROR if $vals[1] <= 29.5; $qastate = QA::ERROR if $vals[1] >= 30.5; $qastate = QA::NOTE if $QA::ItofHvOff == 1; QA::WriteQALog($flog,"hv2","itofhv",30,$qastate,"iTOF HV",$value,""); - Perl2Epics::Put("voltage",$vals[1]);# if (defined $vals[1] && $vals[1]>=0 && $vals[1] ne 'NaN'); + Perl2Epics::Put("voltage",$vals[1]) if (defined $vals[1] && $vals[1]>=0 && $vals[1] ne 'NaN'); Perl2Epics::Put("current",$vals[2]) if (defined $vals[2] && $vals[2]>=0 && $vals[2] ne 'NaN') ; Perl2Epics::Update(0.2); sleep(5); diff --git a/hmon/permanent/hmon_logbook.pl b/hmon/permanent/hmon_logbook.pl index 958d122..9d86a88 100755 --- a/hmon/permanent/hmon_logbook.pl +++ b/hmon/permanent/hmon_logbook.pl @@ -3,27 +3,26 @@ use warnings; binmode(STDOUT, ":utf8"); binmode(STDIN, ":utf8"); -use open qw( :encoding(ISO-8859-1) :std ); +# use open qw( :encoding(ISO-8859-1) :std ); +use open qw( :encoding(UTF-8) :std ); use LWP; use IPC::Run3; use Data::Dumper; -use Encode qw(encode from_to); +use Encode qw(decode encode from_to); use JSON; -my $firstrun =1; -my $command = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.show' -b /tmp/cookiefile -c /tmp/cookiefile -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=FEB22&p_begin=&p_end=&p_num_days=&p_num_entries=5&p_author=&p_action=Show&p_log_type=All&p_run_type=None&p_current=&p_filename=*&p_search_text=*' -u hades:6\\\$ectors 2>/dev/null"; +my $firstrun =1; +my $command = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.show' -b /tmp/cookiefile -c /tmp/cookiefile -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=FEB22&p_begin=&p_end=&p_num_days=&p_num_entries=5&p_author=&p_action=Show&p_log_type=All&p_run_type=None&p_current=&p_filename=*&p_search_text=*' -u hades:6\\\$ectors 2>/dev/null | iconv -f ISO-8859-1 -t UTF-8"; my $store; my $hash; $hash->{username}='daqi'; while(1) { -# print time()."\n"; - my @res = qx($command); #webserver uses iso-8859-1 -( + my @res = qx($command); # print Dumper @res; -# exit; my ($date,$topic,$user,$text); my $cnt = 0; @@ -35,37 +34,40 @@ while(1) { if ($line =~ /^{$date}==1) { + if (!($line =~ /^<\/tr>/) && $cnt > 6) { $text .= stripped($line);} + if ($line =~ /^<\/tr>/ && $cnt > 6) { $found++;} + + if($found == 6 && $cnt >= 6 && !$store->{$date}==1) { + $text = encode('UTF-8', $text); +# print $text."\n"; $store->{$date} = 1; - if (!$firstrun) { - my $cmd = "pandoc --from html --to markdown -t markdown-raw_html-native_divs-native_spans-fenced_divs-bracketed_spans"; + my $cmd = "pandoc --columns=7900 --from html-native_divs-native_spans-raw_html --to markdown_strict+pipe_tables"; run3($cmd, \$text, \@ret); - + my $string = "[$topic] **$user** ($date)\n"; $string .= join('',@ret); -# print $string; - - $hash->{text} = $string; +# print $string."\n\n"; + $hash->{"text"} = decode("UTF-8",$string); $string = encode_json($hash); my $ua = LWP::UserAgent->new(); my $req = new HTTP::Request( 'POST' => "https://coop.gsi.de/mm/hooks/85pmt5r7ypf9ibujt8keyjf3xh", - ['Content-Type' => 'application/json'], +# 'POST' => "https://coop.gsi.de/mm/hooks/s7x6m14bgfbbfkyrgzfgzwbw4h", #Test channel + ['Content-Type' => 'application/json; charset=UTF-8'], $string ); $ua->request($req); - # exit; } } - $found = 0 if $found == 5; + $found = 0 if $found == 6; $cnt++; } $firstrun=0; +# exit; sleep 60; } @@ -75,6 +77,17 @@ sub stripped { $str =~ s!^!!; $str =~ s!$!!; $str =~ s!
$!!; + $str =~ s!
!
!; + $str =~ s!]*>!!g; + $str =~ s!!!g; + $str =~ s!]*>!!g; + $str =~ s!!!g; + $str =~ s!]*>!

!g; + $str =~ s!!

!g; + $str =~ s!([^<]*)!\^$1 !g; + $str =~ s! ! !g; + $str =~ s! style="[^"]*"! !g; + $str =~ s!\|!!g; chomp $str; return $str; } diff --git a/hmon/permanent/hmon_magnet.pl b/hmon/permanent/hmon_magnet.pl index f330b28..a487856 100755 --- a/hmon/permanent/hmon_magnet.pl +++ b/hmon/permanent/hmon_magnet.pl @@ -8,77 +8,78 @@ use Hmon; use QA; use Getopt::Long; use Data::Dumper; +use Perl2Epics; my $magnet_on = 1 - $QA::MagnetOff; my %range_list = ( - 'Time' => {}, - 'TC1200' => {'min' => 5.2 , 'max' =>5.6 }, - 'TC1266' => {'min' => 4.9 , 'max' =>5.1 }, - 'TC1202' => {'min' => 4.4 , 'max' =>4.6 }, - 'TC1208' => {'min' => 4.5 , 'max' =>4.8 }, - 'TC1214' => {'min' => 4.4 , 'max' =>4.6 }, - 'TC1220' => {'min' => 4.4 , 'max' =>4.6 }, - 'TC1226' => {'min' => 4.5 , 'max' =>4.8 }, - 'TC1232' => {'min' => 4.4 , 'max' =>4.6 }, - 'TC1206' => {'min' => 4.0 , 'max' =>6.0 }, - 'TC1212' => {'min' => 3.7 , 'max' =>6.0 }, - 'TC1218' => {'min' => 6.0 , 'max' =>7.0 }, - 'TC1224' => {'min' => 6.0 , 'max' =>8.0 }, - 'TC1230' => {'min' => 4.6 , 'max' =>8.0 }, - 'TC1236' => {'min' => 4.4 , 'max' =>6.0 }, - 'TC1238' => {'min' => 4.6 , 'max' =>4.9 }, - 'TC1248' => {'min' => 4.5 , 'max' =>4.7 }, - 'FI1400' => {'min' => 0.36 , 'max' =>0.62 }, - 'PSUI_rbk' => {'min' => 2990 , 'max' =>3210 }, - 'PSUV_rbk' => {'min' => 0 , 'max' =>1 }, - 'BBI' => {'min' => 419 , 'max' =>620 }, - 'LL1708' => {'min' => 55.2 , 'max' =>63.0 }, - 'TP1240' => {'min' => 75.5 , 'max' =>89.0 , 'cal_max' => 2}, - 'PI2610' => {'min' => 1.7 , 'max' =>3.1 }, - 'TP2200' => {'min' => 83.0 , 'max' =>85.5 , 'cal_max' => 2}, - 'TP2202' => {'min' => 81.0 , 'max' =>87.0 , 'cal_max' => 2}, - 'TP2204' => {'min' => 81.0 , 'max' =>85.5 , 'cal_max' => 2}, - 'TP2206' => {'min' => 81.0 , 'max' =>85.0 , 'cal_max' => 2}, - 'TP2208' => {'min' => 87.0 , 'max' =>95.0 , 'cal_max' => 2}, - 'TP2210' => {'min' => 80.0 , 'max' =>85.0 , 'cal_max' => 2}, - 'TP2212' => {'min' => 82.0 , 'max' =>92.0 , 'cal_max' => 2}, - 'TP2214' => {'min' => 80.0 , 'max' =>85.0 , 'cal_max' => 2}, - 'TP2216' => {'min' => 80.0 , 'max' =>84.0 , 'cal_max' => 2}, - 'TP2218' => {'min' => 84.0 , 'max' =>90.5 , 'cal_max' => 2}, - 'TP2220' => {'min' => 80.0 , 'max' =>84.0 , 'cal_max' => 2}, - 'TP2222' => {'min' => 80.0 , 'max' =>86.0 , 'cal_max' => 2}, - 'TP2224' => {'min' => 81.0 , 'max' =>85.0 , 'cal_max' => 2}, - 'TP2226' => {'min' => 80.0 , 'max' =>100 , 'cal_max' => 2}, - 'TP2228' => {'min' => 85 , 'max' =>94.0 , 'cal_max' => 2}, - 'TP2230' => {'min' => 80.0 , 'max' =>85.5 , 'cal_max' => 2}, - 'PI2600' => {'min' => 1.65 , 'max' =>2.0 }, - 'VG3000' => {'min' => -6.5 , 'max' =>-5.5 }, - 'PI1600' => {'min' => 2.94 , 'max' =>3.03 }, - 'PI1602' => {'min' => 1.30 , 'max' =>1.37 }, - 'PI1604' => {'min' => 2.7 , 'max' =>2.99 }, - 'PI1612' => {'min' =>0 , 'max' =>12.0}, - 'EV1100R' => {'min' => 27 , 'max' =>45 }, - 'EV1122R' => {'min' => 55 , 'max' =>61 }, - 'EV1128R' => {'min' => 73 , 'max' =>88 }, - 'TC1200M' => {'min' => 6.5 , 'max' =>8.5 }, - 'PI1600I' => {'min' => 1.28 , 'max' =>1.37 }, - 'MV2102X' => {}, - 'MV2102L' => {}, - 'MV2102LUX(a)' => {'min' => .8 , 'max' =>8.0}, - 'MV2102U' => {}, - 'EV2128E' => {}, - 'EV2128F' => {}, - 'EV2128FG(a)' => {}, - 'EV2128G' => {}, - 'EV2128L' => {}, - 'EV2128LUX(a)' => {}, - 'EV2128U' => {}, - 'EV2128X' => {}, - 'HR3104(a)' => {}, - 'HR3108R' => {}, - 'MV1106R' => {}, - ); + 'Time' => {}, + 'TC1200' => {'min' => 5.2 , 'max' =>5.6 }, + 'TC1266' => {'min' => 4.9 , 'max' =>5.1 }, + 'TC1202' => {'min' => 4.4 , 'max' =>4.6 }, + 'TC1208' => {'min' => 4.5 , 'max' =>4.8 }, + 'TC1214' => {'min' => 4.4 , 'max' =>4.6 }, + 'TC1220' => {'min' => 4.4 , 'max' =>4.6 }, + 'TC1226' => {'min' => 4.5 , 'max' =>4.8 }, + 'TC1232' => {'min' => 4.4 , 'max' =>4.6 }, + 'TC1206' => {'min' => 4.0 , 'max' =>6.0 }, + 'TC1212' => {'min' => 3.7 , 'max' =>6.0 }, + 'TC1218' => {'min' => 6.0 , 'max' =>7.0 }, + 'TC1224' => {'min' => 6.0 , 'max' =>8.0 }, + 'TC1230' => {'min' => 4.6 , 'max' =>8.0 }, + 'TC1236' => {'min' => 4.4 , 'max' =>6.0 }, + 'TC1238' => {'min' => 4.6 , 'max' =>4.9 }, + 'TC1248' => {'min' => 4.5 , 'max' =>4.7 }, + 'FI1400' => {'min' => 0.36 , 'max' =>0.62 }, + 'PSUI_rbk' => {'min' => 2990 , 'max' =>3210 }, + 'PSUV_rbk' => {'min' => 0 , 'max' =>1 }, + 'BBI' => {'min' => 419 , 'max' =>620 }, + 'LL1708' => {'min' => 54 , 'max' =>65.0, 'minerror' => 53 }, + 'TP1240' => {'min' => 75.5 , 'max' =>89.0 , 'cal_max' => 2}, + 'PI2610' => {'min' => 1.7 , 'max' =>3.1 }, + 'TP2200' => {'min' => 83.0 , 'max' =>85.5 , 'cal_max' => 2}, + 'TP2202' => {'min' => 81.0 , 'max' =>87.0 , 'cal_max' => 2}, + 'TP2204' => {'min' => 81.0 , 'max' =>85.5 , 'cal_max' => 2}, + 'TP2206' => {'min' => 81.0 , 'max' =>85.0 , 'cal_max' => 2}, + 'TP2208' => {'min' => 87.0 , 'max' =>95.0 , 'cal_max' => 2}, + 'TP2210' => {'min' => 80.0 , 'max' =>85.0 , 'cal_max' => 2}, + 'TP2212' => {'min' => 82.0 , 'max' =>92.0 , 'cal_max' => 2}, + 'TP2214' => {'min' => 80.0 , 'max' =>85.0 , 'cal_max' => 2}, + 'TP2216' => {'min' => 80.0 , 'max' =>84.0 , 'cal_max' => 2}, + 'TP2218' => {'min' => 84.0 , 'max' =>90.5 , 'cal_max' => 2}, + 'TP2220' => {'min' => 80.0 , 'max' =>84.0 , 'cal_max' => 2}, + 'TP2222' => {'min' => 80.0 , 'max' =>86.0 , 'cal_max' => 2}, + 'TP2224' => {'min' => 81.0 , 'max' =>85.0 , 'cal_max' => 2}, + 'TP2226' => {'min' => 80.0 , 'max' =>100 , 'cal_max' => 2}, + 'TP2228' => {'min' => 85 , 'max' =>94.0 , 'cal_max' => 2}, + 'TP2230' => {'min' => 80.0 , 'max' =>85.5 , 'cal_max' => 2}, + 'PI2600' => {'min' => 1.65 , 'max' =>2.0 }, + 'VG3000' => {'min' => -6.5 , 'max' =>-5.5 }, + 'PI1600' => {'min' => 2.94 , 'max' =>3.03 }, + 'PI1602' => {'min' => 1.30 , 'max' =>1.37 }, + 'PI1604' => {'min' => 2.7 , 'max' =>2.99 }, + 'PI1612' => {'min' =>0 , 'max' =>12.0}, + 'EV1100R' => {'min' => 27 , 'max' =>45 }, + 'EV1122R' => {'min' => 55 , 'max' =>61 }, + 'EV1128R' => {'min' => 73 , 'max' =>88 }, + 'TC1200M' => {'min' => 6.5 , 'max' =>8.5 }, + 'PI1600I' => {'min' => 1.28 , 'max' =>1.37 }, + 'MV2102X' => {}, + 'MV2102L' => {}, + 'MV2102LUX(a)' => {'min' => .8 , 'max' =>8.0}, + 'MV2102U' => {}, + 'EV2128E' => {}, + 'EV2128F' => {}, + 'EV2128FG(a)' => {}, + 'EV2128G' => {}, + 'EV2128L' => {}, + 'EV2128LUX(a)' => {}, + 'EV2128U' => {}, + 'EV2128X' => {}, + 'HR3104(a)' => {}, + 'HR3108R' => {}, + 'MV1106R' => {}, + ); @@ -104,146 +105,180 @@ foreach my $rh_val (keys %$range_list_href) { } } +Perl2Epics::Connect("TS105", "HAD:CRYO:TS105"); +my $callEmergency = 0; -while(1) { - my $fatal_error_string = ""; - my $current = "OFF"; - my $get_filename_command = "ssh -o BatchMode=yes magnet\@hadesp28 \"ls -rtl /home/magnet/Hades_Magnet_Labview/Log/log1 | tail -n 1\""; - my @get_filename_result = qx($get_filename_command); - #printf("$get_filename_result[0]"); +while (1) { - my $title = "Magnet"; - my $value = ""; - my $longtext = ""; - my $time = "--"; + my $fatal_error_string = ""; + my $current = "OFF"; + my $get_filename_command = "ssh -o BatchMode=yes magnet\@hadesp28 \"ls -rtl /home/magnet/Hades_Magnet_Labview/Log/log1 | tail -n 1\""; + my @get_filename_result = qx($get_filename_command); + #printf("$get_filename_result[0]"); - if ((scalar @get_filename_result) != 1) { + my $title = "Magnet"; + my $value = ""; + my $longtext = ""; + my $time = "--"; + + +#ssh Log Loop + if ((scalar @get_filename_result) != 1) { #if (!defined $ssh_fh || eof($ssh_fh)) { - $red_error_counter++; - $fatal_error_string = "No ssh connection to magnet PC"; - } else { - my ($Sekunden, $Minuten, $Stunden, $Tag, $Monat, - $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - $Monat += 1; - $Jahr += 1900; - my $log_localtime = sprintf('%02d%02d%04d', $Tag, $Monat, $Jahr); + $red_error_counter++; + $fatal_error_string = "No ssh connection to magnet PC"; + } else { + my ($Sekunden, $Minuten, $Stunden, $Tag, $Monat, + $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + $Monat += 1; + $Jahr += 1900; + my $log_localtime = sprintf('%02d%02d%04d', $Tag, $Monat, $Jahr); - my @get_filename_array = split(/\s+/,$get_filename_result[0]); - #printf("@get_filename_array\n"); - $get_filename_array[8] =~ s/\n//g; + my @get_filename_array = split(/\s+/,$get_filename_result[0]); + #printf("@get_filename_array\n"); + $get_filename_array[8] =~ s/\n//g; - #printf("$log_localtime $get_filename_array[8]\n"); - if (!($log_localtime eq $get_filename_array[8])) { - $fatal_error_string = "Log file is not up-to-date"; - $red_error_counter++; + #printf("$log_localtime $get_filename_array[8]\n"); + if (!($log_localtime eq $get_filename_array[8])) { + $fatal_error_string = "Log file is not up-to-date"; + $red_error_counter++; + } else { + my $log_file = "/home/magnet/Hades_Magnet_Labview/Log/log1/" . $log_localtime; + #check if file is increasing + if ($started == 1) { + $started = 0; + $last_mod_time = $Sekunden + 60*$Minuten + 60*60*$Stunden; + $last_size = $get_filename_array[4]; + } + if ($last_size != $get_filename_array[4]) { + $last_mod_time = $Sekunden + 60*$Minuten + 60*60*$Stunden; + $last_size = $get_filename_array[4]; + } + my $time_diff = ($Sekunden + 60*$Minuten + 60*60*$Stunden) - $last_mod_time; + if ($time_diff > 3*60+20) { + $fatal_error_string = "Log file not increased since $time_diff sec."; + $red_error_counter++; } else { - my $log_file = "/home/magnet/Hades_Magnet_Labview/Log/log1/" . $log_localtime; - #check if file is increasing - if ($started == 1) { - $started = 0; - $last_mod_time = $Sekunden + 60*$Minuten + 60*60*$Stunden; - $last_size = $get_filename_array[4]; - } - if ($last_size != $get_filename_array[4]) { - $last_mod_time = $Sekunden + 60*$Minuten + 60*60*$Stunden; - $last_size = $get_filename_array[4]; - } - my $time_diff = ($Sekunden + 60*$Minuten + 60*60*$Stunden) - $last_mod_time; - if ($time_diff > 3*60+20) { - $fatal_error_string = "Log file not increased since $time_diff sec."; - $red_error_counter++; - } else { - my $get_filename_command = "ssh -o BatchMode=yes magnet\@hadesp28 \"tail -n 1 /home/magnet/Hades_Magnet_Labview/Log/log1/$get_filename_array[8] \""; - my @get_value_array = qx($get_filename_command); - #printf("$get_filename_command"); - #printf("@get_value_array"); - $get_filename_command = "ssh -o BatchMode=yes magnet\@hadesp28 \"head -n 1 /home/magnet/Hades_Magnet_Labview/Log/log1/$get_filename_array[8] \""; - my @get_header_array = qx($get_filename_command); - #printf("@get_header_array"); - if (scalar @get_header_array != 1 || scalar @get_value_array != 1) { - $fatal_error_string = "Log file has no header line"; - $red_error_counter++; - } else { - my @get_header_array_split = split(/\s+/,$get_header_array[0]); - my @get_value_array_split = split(/\t+/,$get_value_array[0]); - if ((scalar @get_header_array_split) != (scalar @get_value_array_split) + 1) { - $fatal_error_string = "Log file entries not consistent"; - print scalar @get_header_array_split . ":" . scalar @get_value_array_split . "\n"; - $red_error_counter++; - #print $fatal_error_string . "\n"; - } else { - my $old_error_counter = $red_error_counter; - my $old_red_error_counter = $red_error_counter; - my $old_fatal_error_counter = $fatal_error_counter; - $time = $get_value_array_split[0]; - $red_error_counter = 0; - $fatal_error_counter = 0; - $yellow_error_counter = 0; - #print scalar @get_header_array_split . ":" . scalar @get_value_array_split . ":" . $nrOfValues . "\n"; - for (my $i = 1; $i < scalar @get_header_array_split; $i++) { - #print $name . "\n"; - - my $name = $get_header_array_split[$i]; - my $val = $get_value_array_split[$i-1]; - if (!defined $range_list_href->{$name}) { - $fatal_error_string = "Found entry '$name' which is not existing"; - $red_error_counter = $old_red_error_counter + 1; - } else { - if($name eq 'PSUI_rbk') { - $current = $val; + my $get_filename_command = "ssh -o BatchMode=yes magnet\@hadesp28 \"tail -n 1 /home/magnet/Hades_Magnet_Labview/Log/log1/$get_filename_array[8] \""; + my @get_value_array = qx($get_filename_command); + #printf("$get_filename_command"); + #printf("@get_value_array"); + $get_filename_command = "ssh -o BatchMode=yes magnet\@hadesp28 \"head -n 1 /home/magnet/Hades_Magnet_Labview/Log/log1/$get_filename_array[8] \""; + my @get_header_array = qx($get_filename_command); + #printf("@get_header_array"); + if (scalar @get_header_array != 1 || scalar @get_value_array != 1) { + $fatal_error_string = "Log file has no header line"; + $red_error_counter++; + } else { + my @get_header_array_split = split(/\s+/,$get_header_array[0]); + my @get_value_array_split = split(/\t+/,$get_value_array[0]); + if ((scalar @get_header_array_split) != (scalar @get_value_array_split) + 1) { + $fatal_error_string = "Log file entries not consistent"; + print scalar @get_header_array_split . ":" . scalar @get_value_array_split . "\n"; + $red_error_counter++; + #print $fatal_error_string . "\n"; + } else { + my $old_error_counter = $red_error_counter; + my $old_red_error_counter = $red_error_counter; + my $old_fatal_error_counter = $fatal_error_counter; + $time = $get_value_array_split[0]; + $red_error_counter = 0; + $fatal_error_counter = 0; + $yellow_error_counter = 0; + #print scalar @get_header_array_split . ":" . scalar @get_value_array_split . ":" . $nrOfValues . "\n"; + for (my $i = 1; $i < scalar @get_header_array_split; $i++) { + #print $name . "\n"; + + my $name = $get_header_array_split[$i]; + my $val = $get_value_array_split[$i-1]; + if (!defined $range_list_href->{$name}) { + $fatal_error_string = "Found entry '$name' which is not existing"; + $red_error_counter = $old_red_error_counter + 1; + } else { + if ($name eq 'PSUI_rbk') { + $current = $val; + } + + + $range_list_href->{$name}->{'value'} = $val; + if (defined $range_list_href->{$name}->{'max'} && $val > $range_list_href->{$name}->{'max'}) { + if ($yellow_error_counter>0) { + $fatal_error_string .= ", Value '$name' has $val, maximum is $range_list_href->{$name}->{'max'}"; + } else { + $fatal_error_string .= "Value '$name' has $val, maximum is $range_list_href->{$name}->{'max'}"; + } + $yellow_error_counter++; + $red_error_counter++ if (defined $range_list_href->{$name}->{'maxerror'} && $val > $range_list_href->{$name}->{'maxerror'}); + $callEmergency++ if (defined $range_list_href->{$name}->{'maxerror'} && $val > $range_list_href->{$name}->{'maxerror'});; + } + if (defined $range_list_href->{$name}->{'min'} && $val < $range_list_href->{$name}->{'min'}) { + if ($yellow_error_counter>0) { + $fatal_error_string .= ", Value '$name' has $val, minimum is $range_list_href->{$name}->{'min'}"; + } else { + $fatal_error_string .= "Value '$name' has $val, minimum is $range_list_href->{$name}->{'min'}"; + } + $yellow_error_counter++; + $red_error_counter++ if (defined $range_list_href->{$name}->{'minerror'} && $val < $range_list_href->{$name}->{'minerror'}); + $callEmergency++ if (defined $range_list_href->{$name}->{'minerror'} && $val < $range_list_href->{$name}->{'minerror'}); + } + } + } #for + if ($yellow_error_counter>2) { + #print $yellow_error_counter . "\n"; + $fatal_error_counter = $old_fatal_error_counter + $yellow_error_counter; + } + } } - - - $range_list_href->{$name}->{'value'} = $val; - if (defined $range_list_href->{$name}->{'max'} && $val > $range_list_href->{$name}->{'max'}) { - if ($yellow_error_counter>0) { - $fatal_error_string .= ", Value '$name' has $val, maximum is $range_list_href->{$name}->{'max'}"; - } else { - $fatal_error_string .= "Value '$name' has $val, maximum is $range_list_href->{$name}->{'max'}"; - } - $yellow_error_counter++; - } - if (defined $range_list_href->{$name}->{'min'} && $val < $range_list_href->{$name}->{'min'}) { - if ($yellow_error_counter>0) { - $fatal_error_string .= ", Value '$name' has $val, minimum is $range_list_href->{$name}->{'min'}"; - } else { - $fatal_error_string .= "Value '$name' has $val, minimum is $range_list_href->{$name}->{'min'}"; - } - $yellow_error_counter++; - } - } - } #for - if ($yellow_error_counter>2) { - #print $yellow_error_counter . "\n"; - $fatal_error_counter = $old_fatal_error_counter + $yellow_error_counter; - } - } - } - } } } + } +#EPICS Loop + my $epics = Perl2Epics::GetAll(); + my $val = $epics->{"TS105"}->{val} if $epics->{"TS105"}->{tme} != -1; +# print Dumper $epics; + if(defined $val && ($val < 116 || $val > 121)) { + $red_error_counter++; + $fatal_error_string .= " Value \"TS105\" has $val, range is 116 to 121"; + $callEmergency++; + $fatal_error_counter=4; + } + elsif (defined $val) { + $callEmergency=0; + } - if(!$magnet_on) {$fatal_error_string .= "-- MAGNET IS DEFINED TO BE OFF --"; $value = "$current";} - #print $fatal_error_string . "\n"; - if ($fatal_error_counter>3) { - $fatal_error_string .= " (last good check at $last_good_time)"; - my $state = $magnet_on?(QA::FATAL):(QA::NOTE); - QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string); - } elsif ($red_error_counter > 0) { - $fatal_error_string .= " (last good check at $last_good_time)"; - my $state = $magnet_on?(QA::ERROR):(QA::NOTE); - QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string); - } elsif ($yellow_error_counter > 0) { - $fatal_error_string .= " (last good check at $last_good_time)"; - my $state = $magnet_on?(QA::WARN):(QA::NOTE); - QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string); - } else { - $longtext = "Checked at $time"; - QA::WriteQALog($flog,"misc","magnet",$interval+20,QA::OK,$title,$value,$longtext); - $last_good_time = $time; - } + #Make Calls + printf "call Emergency: $callEmergency : not off: %d\n", !$QA::MagnetOff; + if(($callEmergency==3 || $callEmergency==6 ) && !$QA::MagnetOff) { + Hmon::CallScript("./magnet_emergency_call.sh","Magnet/Cryo","Fehler am Magnet"); + } + if($callEmergency >= 60) { + $callEmergency = 0; + } - sleep($interval); +#Output + if (!$magnet_on) { + $fatal_error_string .= "-- MAGNET IS DEFINED TO BE OFF --"; $value = "$current"; + } + #print $fatal_error_string . "\n"; + if ($fatal_error_counter>3) { + $fatal_error_string .= " (last good check at $last_good_time)"; + my $state = $magnet_on?(QA::FATAL):(QA::NOTE); + QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string); + } elsif ($red_error_counter > 0) { + $fatal_error_string .= " (last good check at $last_good_time)"; + my $state = $magnet_on?(QA::ERROR):(QA::NOTE); + QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string); + } elsif ($yellow_error_counter > 0) { + $fatal_error_string .= " (last good check at $last_good_time)"; + my $state = $magnet_on?(QA::WARN):(QA::NOTE); + QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string); + } else { + $longtext = "Checked at $time"; + QA::WriteQALog($flog,"misc","magnet",$interval+20,QA::OK,$title,$value,$longtext); + $last_good_time = $time; + } + print $fatal_error_string."\n"; + sleep($interval); } diff --git a/hmon/permanent/hmon_mdcpressure.pl b/hmon/permanent/hmon_mdcpressure.pl index 47f04b4..fb19d7e 100755 --- a/hmon/permanent/hmon_mdcpressure.pl +++ b/hmon/permanent/hmon_mdcpressure.pl @@ -399,7 +399,12 @@ while(1) { $longmsg = sprintf("%s E-7 mbar low vacuum
%s E-7 high vacuum",QA::SciNotation($data->{"Vaclow"}->{val}*1E7),QA::SciNotation($data->{"Vachigh"}->{val}*1E7)); - if ($data->{"Gate"}->{val}!=1) { + if ($data->{"Gate"}->{tme}==-1) { + $msg="ERROR"; + $longmsg.="
No Data"; + $qastat = QA::WARN_2; + } + elsif ($data->{"Gate"}->{val}!=1) { $msg="ERROR"; $longmsg.="
Valve not open"; $qastat = QA::ERROR; diff --git a/hmon/permanent/hmon_open_ssh_master_channels.pl b/hmon/permanent/hmon_open_ssh_master_channels.pl index 64181da..ab81a25 100755 --- a/hmon/permanent/hmon_open_ssh_master_channels.pl +++ b/hmon/permanent/hmon_open_ssh_master_channels.pl @@ -6,13 +6,17 @@ use v5.10.0; my @cpus = qw | -hades30 hades33 hadesdaq01 hadesdaqp02 hadesdaqp03 hadesdaqp04 hadesp30 hadesp31 hadesp33 hadesp57 hadesp63 hadesp66 hadesp70 lxhaddcs05p lxhaddcs06p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p lxhadeb07p lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb13p lxhadeb14p lxhadeb15p lxhadeb16p lxhadesdaqp +hades30 hades33 hadesdaq01 hadesdaqp02 hadesdaqp03 hadesdaqp04 hadesp28 hadesp30 hadesp31 hadesp33 hadesp57 hadesp63 hadesp66 hadesp70 lxhaddcs05p lxhaddcs06p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p lxhadeb07p lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb13p lxhadeb14p lxhadeb15p lxhadeb16p lxhadesdaqp |; #lxhadeb07 lxhadeb08 lxhadeb09 lxhadeb10 lxhadeb11 lxhadeb12 lxhadeb13 lxhadeb14 lxhadeb15 lxhadeb16 lxhaddcs05 lxhaddcs06 lxhaddcs11 lxhadesdaq hadesdaq01 hades30 ha#desp31 hades33 lxhadeb07p lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb13p lxhadeb14p lxhadeb15p lxhadeb16p lxhaddcs05p lxhaddcs06p lxhaddcs11p lxhad#esdaqp hadesdaqp02 hadesdaqp03 hadesdaqp04 hadesp30 hadesp33 hadesp57 hadesp70 for my $cpu (@cpus) { my $c = "~/trbsoft/hadesdaq/hmon/hmon_ssh hadaq\@$cpu -N -f /dev/null&"; + + if ($cpu =~ /hadesp28/) { + $c=~s/hadaq\@/magnet\@/; + } #my $c = "~/trbsoft/hadesdaq/hmon/hmon_ssh hadaq\@$cpu -N -f"; print "command: $c\n"; system($c); diff --git a/hmon/permanent/hmon_richIsobutan.pl b/hmon/permanent/hmon_richIsobutan.pl index 0c4eaa7..9535c84 100755 --- a/hmon/permanent/hmon_richIsobutan.pl +++ b/hmon/permanent/hmon_richIsobutan.pl @@ -197,5 +197,5 @@ while(1) { HPlot::PlotDraw('RichIsobScale'); } - sleep 1; + usleep 0.8E6; }