]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
update to dmon tools
authorJan Michel <j.michel@gsi.de>
Fri, 11 Jul 2014 16:23:53 +0000 (18:23 +0200)
committerJan Michel <j.michel@gsi.de>
Fri, 11 Jul 2014 16:23:58 +0000 (18:23 +0200)
dmon/code/Dmon.pm
dmon/code/styles.css
dmon/example_config.pl
dmon/scripts/dmon_reftime.pl [new file with mode: 0755]
dmon/scripts/dmon_trgrate.pl

index 1b69ba717cd2b14b04b418c10f4466a887711e52..8bfd4ce2628f0c08452ab5a918014d9e5299c431 100644 (file)
@@ -171,6 +171,7 @@ sub OpenQAFile {
 # $longtext  Long description text (PopUp)
 sub WriteQALog {
   my ($fh, $entry, $ttl, $status, $title, $value, $longtext,$link) = @_;
+  $link = "" unless defined $link;
   my $tmp = time()."\t$entry\t$ttl\t$status\t$title\t$value\t$longtext\t$link\n";
 
   if ($fh == 0) {
index b44708b6b1258a54b623973f7d71806e3b85eabf..cd0a8ffc2d6e6fb8748bd591eaf7a198b50c0541 100644 (file)
@@ -387,11 +387,11 @@ svg {
 .byg {background:#ac0;}
 .bye {background:#ff2;}
 .bor {background:#fa0;}
-.brd {background:#f00; }
+.brd {background:#f00;}
 .bgr {background:#000;color:#aaa !important;}
 .bwh {background:#eee;}
-.bmg {background:#f0a ;}
-.bbl {background:#9bf};
+.bmg {background:#f0a;}
+.bbl {background:#9bf;}
 
 .blinkon .brdb {
   background:#f00;
index 45b53f78d6dbee892e21f26af070d5ab1565df97..aaf85ae1e868e75afefabbe2cabac70d3a8d6983 100644 (file)
@@ -1,13 +1,20 @@
 #This a an example configuration file. Copy this file to your user directory and give 
 #start.pl a link to this file as first argument.
 
-
+#Scripts to start & order of icons in the Overview
 activeScripts => [['time','-','-','-','daqop'],
-                  ['numfee','temperature','-','-','-'],
+                  ['numfee','temperature','reftime','-','-'],
                   ['trgrate','-','-','-','-'],
                   ['-','-','-','-','-'],],
-
+                  
+#Names to be shown in left column of Overview
 qaNames => ['system','main','trigger','-','-','-'],                  
 
-NumberOfFpga => 11,       #Expected number of FPGAs in system
-CtsAddress   => 0x8000,   #The address of the CTS
\ No newline at end of file
+#Expected number of FPGAs in system
+NumberOfFpga => 11,       
+
+#The address of the CTS
+CtsAddress   => 0x8000,   
+
+#Addresses of all TDCs. Either single or broadcast addresses
+TdcAddress   => [0xfe48,0xfe4e,0x8000],  
\ No newline at end of file
diff --git a/dmon/scripts/dmon_reftime.pl b/dmon/scripts/dmon_reftime.pl
new file mode 100755 (executable)
index 0000000..db61483
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use POSIX qw(strftime);
+use FileHandle;
+use lib "./code";
+use lib "../tools";
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Dmon;
+use Data::Dumper;
+
+
+my %config = do $ARGV[0];
+my $flog = Dmon::OpenQAFile();
+trb_init_ports() or die trb_strerror();
+
+
+my $value, my $longtext, my $status;
+
+my $lasterrors = 0;
+while(1) {
+  my $errors = 0;
+  foreach my $b (@{$config{TdcAddress}}) {
+    my $r = trb_register_read($b,0xc100);
+    foreach my $c (%{$r}) {
+      if ($c & 0x10000) {$errors++;}
+      }
+    }
+  my $title    = "Ref Polarity";
+  
+  if ($errors) { $value = $errors." errors"; }
+  else         { $value = "OK";}
+  
+  my $longtext = "Polarity of the reference time signals on TDCs seems to be: ".$value;
+  if($errors && $lasterrors) {  $status   = Dmon::GetQAState('below',$errors,(0,1,4));}
+  else                       {  $status   = Dmon::OK;}
+  Dmon::WriteQALog($flog,"reftime",10,$status,$title,$value,$longtext);
+  $lasterrors = $errors;
+  sleep 10;
+  }
index f02d3ebcde7457104b3607d96d26e144bb19237a..e01e007091e028488b58ec29543c8a482cd4995f 100755 (executable)
@@ -12,59 +12,59 @@ use HPlot;
 
 my %config = do $ARGV[0];
 my $flog = Dmon::OpenQAFile();
-trb_init_ports() or die trb_strerror();
+
 
 my $old;
 my $summing = 0;
 my $cnt = 0;
 
-
-my $plot = ();
-$plot->{name}    = "TriggerRate";
-$plot->{file}    = Dmon::DMONDIR."TriggerRate";
-$plot->{entries} = 600;
-$plot->{type}    = HPlot::TYPE_HISTORY;
-$plot->{output}  = HPlot::OUT_PNG;
-$plot->{titles}->[0] = "";
-$plot->{xlabel}  = "Time [s]";
-$plot->{ylabel}  = "Rate [Hz]";
-$plot->{sizex}   = 750;
-$plot->{sizey}   = 270;
-$plot->{xscale}  = 5;
-$plot->{nokey}   = 1;
-$plot->{buffer}  = 1;
-HPlot::PlotInit($plot);
+HPlot::PlotInit({
+  name    => "TriggerRate",
+  file    => Dmon::DMONDIR."TriggerRate",
+  entries => 600,
+  type    => HPlot::TYPE_HISTORY,
+  output  => HPlot::OUT_PNG,
+  titles  => ["Trigger Rate"],
+  xlabel  => "Time [s]",
+  ylabel  => "Rate [Hz]",
+  sizex   => 750,
+  sizey   => 270,
+  xscale  => 5,
+  nokey   => 1,
+  buffer  => 1
+  });
 
 my $str = Dmon::MakeTitle(10,6,"TriggerRate",0);
    $str .= qq@<img src="%ADDPNG TriggerRate.png%" type="image/png">@;
    $str .= Dmon::MakeFooter();
 Dmon::WriteFile("TriggerRate",$str);
 
-
-
-
 while(1) {
-  my $r = trb_register_read($config{CtsAddress},0xa000);
-  my $value    = $r->{$config{CtsAddress}};
-  my $rate     = ($value||0) - ($old||0);
-     $rate += 2**32 if $rate < 0;
-  
-  if( defined $old) {
-    $summing += $rate;
-    HPlot::PlotAdd('TriggerRate',$rate*5,0);
-    print $rate;
+  trb_init_ports() or die trb_strerror();
+
+  while(1) {
+    my $r = trb_register_read($config{CtsAddress},0xa000);
+    my $value    = $r->{$config{CtsAddress}};
+    my $rate     = ($value||0) - ($old||0);
+      $rate += 2**32 if $rate < 0;
     
-    unless($cnt++ % 10) {
-      my $title    = "Rate";
-      my $value    = $summing/2;
-      my $longtext = $value." triggers pre second";
-      my $status   = Dmon::GetQAState('above',$value,(15,2,1));
-      Dmon::WriteQALog($flog,"trgrate",5,$status,$title,$value,$longtext,'2-TriggerRate');
-      HPlot::PlotDraw('TriggerRate');
-      $summing = 0;
+    if( defined $old) {
+      $summing += $rate;
+      HPlot::PlotAdd('TriggerRate',$rate*5,0);
+      
+      unless($cnt++ % 10) {
+        my $title    = "Rate";
+        my $value    = $summing/2;
+        my $longtext = $value." triggers pre second";
+        my $status   = Dmon::GetQAState('above',$value,(15,2,1));
+        Dmon::WriteQALog($flog,"trgrate",5,$status,$title,$value,$longtext,'2-TriggerRate');
+  
+        HPlot::PlotDraw('TriggerRate');
+        $summing = 0;
+        }
       }
+    $old = $value;    
+    usleep(200000);
     }
-  $old = $value;    
-  usleep(200000);
-}
+  sleep 10;
+  }