]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
update hmon files
authorhadaq <jan@lxhadeb07>
Sun, 13 Mar 2022 14:44:26 +0000 (15:44 +0100)
committerhadaq <jan@lxhadeb07>
Sun, 13 Mar 2022 14:44:26 +0000 (15:44 +0100)
16 files changed:
.gitignore
hmon/Hmon.pm
hmon/QA.pm
hmon/hmon_eberrbits_withreset.pl
hmon/hmon_logsts.pl [new file with mode: 0755]
hmon/hmon_spill.pl
hmon/hmon_startrate.pl
hmon/hmon_triggerratio.pl
hmon/magnet_emergency_call.sh [new file with mode: 0755]
hmon/permanent/hmon_frpchv.pl
hmon/permanent/hmon_itofhv.pl
hmon/permanent/hmon_logbook.pl
hmon/permanent/hmon_magnet.pl
hmon/permanent/hmon_mdcpressure.pl
hmon/permanent/hmon_open_ssh_master_channels.pl
hmon/permanent/hmon_richIsobutan.pl

index 97f82837ef8d638265a4987718e0fc1d0e1eea24..9e7fab06b01b3e69029d09b7353823a06d9dd0b9 100644 (file)
@@ -26,3 +26,5 @@ rich_thr*
 conf_sts*
 oracle
 rich/trb_dirich_threshold_bck
+daq_readback
+rush_read
index 1de94a6fe22c0fd39bc9616d4dc87972541649e0..1e8dd95244bd3741784ca3b78727759e72bc39aa 100644 (file)
@@ -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
index 1ab3667bcb6cc03a42c34d1afcefc02a1c901190..b561bfdb1582ae3aac786000cc0d7ac5debff1c6 100644 (file)
@@ -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;
index 39cf1721ce9a6feabb2a607044f3ccfdd78f2231..7cc99517abf52e86dc33b8654cd9361c88036991 100755 (executable)
@@ -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 (executable)
index 0000000..db22390
--- /dev/null
@@ -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;
+}
+
index 49dbbca1cb7f755a77af056cf8f503f9810905c8..361b2a5dddb93f04fc48ba87eed767c5af12cc71 100755 (executable)
@@ -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;
index 2dc8964100f4f5ce487db95e3b15e5e5386c73b6..e8d488387845dc72756aeed5058020cd004d92eb 100755 (executable)
@@ -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);
index 9c837e935636754bdcca984c19805b22494c56c0..163674bd30ae443dc82ecb33ee6ed1750af2c34e 100755 (executable)
@@ -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 (executable)
index 0000000..77de5f2
--- /dev/null
@@ -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
index 58fbc1dee65654ea2027e559c575a0bc32ccc14e..31ac297cffd6a95d65e61fc532938026392cdee1 100755 (executable)
@@ -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);
   }
index 388fc99be267e6f23ed39484e13b8849ad5c6711..acd4c5c15d236231ef63a8b02314eb08c51a77dd 100755 (executable)
@@ -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);
index 958d12207b563b1735c86854cc037cdb760c4e71..9d86a883e7f2ebbc668bbe0dd53e029b00b4bc3d 100755 (executable)
@@ -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 =~ /^<td /  && $cnt == 4) { $topic = stripped($line);$found++;}
     if ($line =~ /^<td /  && $cnt == 5) { $user = stripped($line); $found++;}
     if ($line =~ /^<td /  && $cnt == 6) { $text = stripped($line); $found++;}
-    
-    if($found == 5 && $cnt == 6 && !$store->{$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!^<td class="l">!!;
   $str =~ s!</td>$!!;
   $str =~ s!<br/>$!!;
+  $str =~ s!<br/>!<br>!;
+  $str =~ s!<span[^>]*>!!g;
+  $str =~ s!</span>!!g;
+  $str =~ s!<font[^>]*>!!g;
+  $str =~ s!</font>!!g;
+  $str =~ s!<div[^>]*>!<p>!g;
+  $str =~ s!</div>!</p>!g;
+  $str =~ s!<sup>([^<]*)</sup>!\^$1 !g;
+  $str =~ s!&nbsp;! !g;
+  $str =~ s! style="[^"]*"! !g;
+  $str =~ s!\|!!g;
   chomp $str;
   return $str;
   }
index f330b287144f40645973e48a54f7de0623382b25..a4878560872d7e349bfbda48ef3fc381acc7f130 100755 (executable)
@@ -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);
 }
index 47f04b475b987ddee5dfa41525f9af993b15865f..fb19d7e0d6d4f27b4a6868771efe173d0da4c3b8 100755 (executable)
@@ -399,7 +399,12 @@ while(1) {
 
   $longmsg =  sprintf("%s E-7 mbar low vacuum <br> %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.="<br>No Data";
+    $qastat = QA::WARN_2;
+    }      
+  elsif ($data->{"Gate"}->{val}!=1) {
     $msg="ERROR";
     $longmsg.="<br>Valve not open";
     $qastat = QA::ERROR;
index 64181da1635d8e2b60a92e4919ea2dd018836a59..ab81a25b722f4747d8e88a3297f87f3c7dc90337 100755 (executable)
@@ -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 >/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);
index 0c4eaa7cdc0b94fd9835364541cf918d185c1fd0..9535c84614ca02ea5b65d92f2865bdcdbd86924b 100755 (executable)
@@ -197,5 +197,5 @@ while(1) {
     HPlot::PlotDraw('RichIsobScale');
   }  
     
-  sleep 1;
+  usleep 0.8E6;
 }