]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
plot for padiwa temp
authorJan Michel <j.michel@gsi.de>
Wed, 5 Nov 2014 17:30:02 +0000 (18:30 +0100)
committerJan Michel <j.michel@gsi.de>
Wed, 5 Nov 2014 17:30:02 +0000 (18:30 +0100)
dmon/scripts/dmon_heatmaprich.pl
dmon/scripts/dmon_padiwatemp.pl

index 988c49de38caf64085ef7e588391f40f0ab4dc9c..b50974eb820c4683f39cccaecaea7f564c77d7d3 100755 (executable)
@@ -79,7 +79,7 @@ while (1) {
   my $title  = "Heatmap";
   my $value = "";
   my $longtext = "See plot";
-  Dmon::WriteQALog($config{flog},"heatmaprich",5,$status,$title,$value,$longtext,'2-HeatmapRich');
+  Dmon::WriteQALog($config{flog},"heatmaprich",5,$status,$title,$value,$longtext,'1-HeatmapRich');
   $old = $o;
   $oldtime = time();
   sleep(1);
index e6ff64fb36052fcf95718cf634639e7faf0c0e1a..3077926aa486b69dbf4d8440af90e5275544dcf1 100755 (executable)
@@ -7,21 +7,46 @@ use HADES::TrbNet;
 use Dmon;
 use HPlot;
 use Data::Dumper;
+use Time::HiRes qq|usleep|;
 
 my %config = Dmon::StartUp();
 
 
+HPlot::PlotInit({
+  name    => "PadiwaTemp",
+  file    => Dmon::DMONDIR."PadiwaTemperature",
+  entries => scalar @{$config{PadiwaTrbAdresses}},
+  type    => HPlot::TYPE_HISTORY,
+  output  => HPlot::OUT_PNG,
+  xlabel  => "Board",
+  ylabel  => "Temperature",
+  sizex   => 300,
+  sizey   => 200,
+  ymin    => 10,
+  ymax    => 90,
+  xscale  => 1,
+  nokey   => 1,
+  buffer  => 1
+  });
 
+my $str = Dmon::MakeTitle(9,14,"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") {
-      sleep 1;
+      usleep 1E5;
       if($errcnt >= 12) {
-        die "SPI still blocked\n";
+        return "SPI still blocked\n";
         }
       elsif($errcnt++ >= 10) {
         trb_register_read($board,0xd412);
@@ -39,8 +64,9 @@ while(1) {
   my $max = 1; 
   my $min = 100;  
   my ($maxboard, $minboard);
+  my $i = 0;
 
-  foreach my $b ($config{PadiwaTrbAdresses}) {
+  foreach my $b (@{$config{PadiwaTrbAdresses}}) {
     my $r = sendcmd(0x10040000,$b,0);
     next unless defined $r;
     my $temp = (($r->{$b} & 0xFFF))/16;
@@ -53,15 +79,16 @@ while(1) {
       $min = $temp;
       $minboard = $b;
       }
+    HPlot::PlotFill('PadiwaTemp',$temp,$i++);      
     }
   
   my $title    = "Temperature";
   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,(60,75,80));
+  my $status   = Dmon::GetQAState('below',$max,(50,60,70));
   
   
-  Dmon::WriteQALog($config{flog},"padiwatemp",30,$status,$title,$value,$longtext);
+  Dmon::WriteQALog($config{flog},"padiwatemp",30,$status,$title,$value,$longtext,"10-PadiwaTemp");
 
   sleep(15);
 }