]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
added monitor for missing Padiwa
authorJan Michel <j.michel@gsi.de>
Wed, 5 Nov 2014 17:53:41 +0000 (18:53 +0100)
committerJan Michel <j.michel@gsi.de>
Wed, 5 Nov 2014 17:53:41 +0000 (18:53 +0100)
dmon/code/Dmon.pm
dmon/scripts/dmon_padiwatemp.pl
users/cern_cbmrich/dmon_config.pl

index 6ee69ced3cea4a4d87d1404e3360498aac5401d5..a01fd837302c0a39c72a808f533f7d8328c6c54b 100644 (file)
@@ -4,7 +4,7 @@ use Data::Dumper;
 use warnings;
 use strict;
 use HADES::TrbNet;
-
+use Time::HiRes qq|usleep|;
 
 print STDERR "Script started at ".strftime("%d.%m.%y %H:%M:%S", localtime()).".\n";
 
@@ -294,5 +294,33 @@ sub SciNotation {
 }
 
 
+############################################
+# Sends a command to a Padiwa
+sub PadiwaSendCmd {
+  my ($cmd,$board,$chain) = @_;
+  my $c = [$cmd,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1<<$chain,0x10001];
+  my $errcnt = 0;
+  while(1){
+    trb_register_write_mem($board,0xd400,0,$c,scalar @{$c});
+
+    if (trb_strerror() =~ "no endpoint has been reached") {return -1;}
+    if (trb_strerror() ne "No Error") {
+      usleep 1E5;
+      if($errcnt >= 12) {
+        return "SPI still blocked\n";
+        }
+      elsif($errcnt++ >= 10) {
+        trb_register_read($board,0xd412);
+        }
+      }
+    else {
+      last;
+      }
+    } 
+  return trb_register_read($board,0xd412);
+  }
+
+
+
 1;
 __END__
index 0e563030ea31d12d087566ec2aaf31f92394050b..1d8026eea97ba1f970e72ecf68eacf0bbd4ead9e 100755 (executable)
@@ -7,7 +7,7 @@ use HADES::TrbNet;
 use Dmon;
 use HPlot;
 use Data::Dumper;
-use Time::HiRes qq|usleep|;
+
 
 my %config = Dmon::StartUp();
 
@@ -27,47 +27,28 @@ HPlot::PlotInit({
   buffer  => 0
   });
 
-my $str = Dmon::MakeTitle(6,7,"PadiwaTemp",0);
+my $str  = Dmon::MakeTitle(6,6,"PadiwaTemp",0);
    $str .= qq@<img src="%ADDPNG PadiwaTemp.png%" type="image/png">@;
    $str .= Dmon::MakeFooter();
 Dmon::WriteFile("PadiwaTemp",$str);  
-  
-  
-sub sendcmd {
-  my ($cmd,$board,$chain) = @_;
-  my $c = [$cmd,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1<<$chain,0x10001];
-  my $errcnt = 0;
-  while(1){
-    trb_register_write_mem($board,0xd400,0,$c,scalar @{$c});
 
-    if (trb_strerror() =~ "no endpoint has been reached") {return -1;}
-    if (trb_strerror() ne "No Error") {
-      usleep 1E5;
-      if($errcnt >= 12) {
-        return "SPI still blocked\n";
-        }
-      elsif($errcnt++ >= 10) {
-        trb_register_read($board,0xd412);
-        }
-      }
-    else {
-      last;
-      }
-    } 
-  return trb_register_read($board,0xd412);
-  }
-   
 
 while(1) {
   my $max = 1; 
   my $min = 100;  
   my ($maxboard, $minboard);
   my $i = -1;
+  my $notonline = "";
+  my $notonlinecnt = 0;
 
   foreach my $b (@{$config{PadiwaTrbAdresses}}) {
     $i++;
-    my $r = sendcmd(0x10040000,$b,0);
-    next unless defined $r;
+    my $r = Dmon::PadiwaSendCmd(0x10040000,$b,0);
+    unless (defined $r) {
+      $notonline .= sprintf(" %04x",$b);
+      $notonlinecnt++;
+      next;
+      }
     my $temp = (($r->{$b} & 0xFFF))/16;
     unless ($temp < 10 || $temp > 90) {
       if ($max < $temp) {
@@ -82,6 +63,8 @@ while(1) {
       }  
     else {
       HPlot::PlotFill('PadiwaTemp',10,$i);      
+      $notonline .= sprintf(" %04x",$b);
+      $notonlinecnt++;
       }
     }
   
@@ -89,9 +72,15 @@ while(1) {
   my $value    = sprintf("%.1f",$max);
   my $longtext = sprintf("Maximum: %.1f on board 0x%04x<br>Minimum: %.1f on board 0x%04x",$max,$maxboard,$min,$minboard);
   my $status   = Dmon::GetQAState('below',$max,(50,60,70));
+  Dmon::WriteQALog($config{flog},"padiwatemp",30,$status,$title,$value,$longtext,"10-PadiwaTemp");
+
+  $title    = "Online";
+  $value    = sprintf("%i / %i",(scalar @{$config{PadiwaTrbAdresses}})-$notonline,scalar @{$config{PadiwaTrbAdresses}});
+  $longtext = "Boards not reacting:".$notonline;
+  $status   = Dmon::GetQAState('above',$notonline,(0,1,4));
+  Dmon::WriteQALog($config{flog},"padiwaonline",30,$status,$title,$value,$longtext,"10-PadiwaOnline");  
   
   HPlot::PlotDraw('PadiwaTemp');
-  Dmon::WriteQALog($config{flog},"padiwatemp",30,$status,$title,$value,$longtext,"10-PadiwaTemp");
 
   sleep(15);
 }
index 2088f3882bfb45706c81e9708f0f2214e568949a..0681c6db6bf8d8d234a7812e3e3b0ba9b259baa8 100644 (file)
@@ -5,7 +5,7 @@
 activeScripts => [['time','ping','-','-','daqop'],
                   ['numfee','temperature','reftime','billboard','mbs'],
                   ['trgrate','datarate','deadtime','-','-'],
-                  ['heatmaprich','padiwatemp','-','-','-'],
+                  ['heatmaprich','padiwatemp','padiwaonline','-','-'],
                   ['cbmnetlink','cbmnetdata','cbmnetsync','-','-'],],
                   
 #Names to be shown in left column of Overview (max 4 letters!)