]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
bugfix in adcmon.pl UI
authorwww@jspc55 <www@jspc55>
Wed, 5 Feb 2014 12:14:24 +0000 (13:14 +0100)
committerwww@jspc55 <www@jspc55>
Wed, 5 Feb 2014 12:14:24 +0000 (13:14 +0100)
layout/adcmon.css
tools/Common.pm
tools/adcmon.pl

index 7228c59e4b03e6716c645a89ada92c05dec9e6ac..1f99875ccffc072d77a1c164d0fa7e54c99fdb1d 100644 (file)
@@ -21,7 +21,7 @@
    float:right;
    position:absolute;
    position:fixed;
-   top: 0px;
+   top: 50px;
    left: 640px;
    width:280px;
    padding:10px;
@@ -36,7 +36,7 @@
 /*    position:fixed; */
 /*    width:320px; */
    left:0px;
-   top:0px;
+   top:50px;
    min-width: 600px;
    min-height: 400px;
    padding:10px;
index 87ababc4734625567ce7a1087c510f4b495bd4e6..b75f9213dd9939c09f8ce284b7b02cedff145aa5 100644 (file)
@@ -245,6 +245,32 @@ sub writeFieldInRegister {
 ## misc utilities
 ###############################
 
+sub average{
+        my($data) = @_;
+        if (not @$data) {
+                die("Empty array\n");
+        }
+        my $total = 0;
+        foreach (@$data) {
+                $total += $_;
+        }
+        my $average = $total / @$data;
+        return $average;
+}
+
+sub stdev{
+        my($data) = @_;
+        if(@$data == 1){
+                return 0;
+        }
+        my $average = &average($data);
+        my $sqtotal = 0;
+        foreach(@$data) {
+                $sqtotal += ($average-$_) ** 2;
+        }
+        my $std = ($sqtotal / (@$data-1)) ** 0.5;
+        return $std;
+}
 
 
 
index 97bbd722da62d47851fa40e26f774f623b165c46..1cd0e1082ea69ff9f155e4d39cf61a1cea22fadb 100755 (executable)
@@ -1,6 +1,24 @@
 #!/usr/bin/perl -w
 
 
+##############
+## CGI options to this tool
+##############
+
+# adcmon.pl?option1=value1&option2=value2 ...
+# 
+# options:
+#   DAQOPSERVER = hostname:ports
+#   FGPA        = FPGA address in hex (with leading 0x)
+#   CB          = number of ConverterBoard connected to selected FPGA [0,1]
+#   chip        = number of Sensor connected to selected ConverterBoard [0,1]
+#   channel     = comma separated list of ADC channels. These channels get
+#                 preselected in the selection checkbox list.
+
+# Example:
+# http://jspc55/mvdsensorcontrol/tools/adcmon.pl?DAQOPSERVER=jspc55:88&FPGA=0xd882&CB=0&chip=0&channel=CurrentDigital,CurrentAnalog
+
+
 my $me = "adcmon.pl";
 
 use strict;
@@ -74,6 +92,9 @@ sub page_body{
 init_html();
 my $q = shift;
 
+print h2 "Converter Board ADC Monitor";
+
+
 print '<div id="selectors" class="plasticBox">';
 print_selectors($q);
 print '</div>';
@@ -91,6 +112,7 @@ print '<div id="debugStuff" class="debugFeature">';
 print_debugStuff($q);
 print '</div>';
 
+
 }
 
 sub print_selectors {
@@ -99,7 +121,7 @@ sub print_selectors {
   my $FPGA = $q->param('FPGA');
   my $CB = $q->param('CB');
   my $chip = $q->param('chip');
-  my $channel = $q->param('channel');
+
   
   print "<div class='header'>Settings</div>";
   
@@ -187,17 +209,26 @@ sub print_selectors {
   
   print "<table id='checkboxTable'>";
   
-  my $xmldb = AccessXmlDb->new( entityFile => $xmldbEntityFile );
-  for my $element ( @{$xmldb->channelList()}) {
-    print "<tr>";
-    print "<td>";
-    print "$element";
-    print "</td>";
-    print "<td>";
-    print "<input type='checkbox' class='channelCheckbox' id='checkbox_"
-    .$FPGA."-".$CB."-".$chip."-".$element."'>";
-    print "</td>";
-    print "</tr>";
+  my @channels = split(",",$q->param('channel')) if defined($q->param('channel'));
+  my %channel_hash;
+  for my $channel (@channels){
+    $channel_hash{$channel} = 1;
+  }
+  if(defined($FPGA) && defined($CB) && defined($chip)){
+    my $xmldb = AccessXmlDb->new( entityFile => $xmldbEntityFile );
+    for my $element ( @{$xmldb->channelList()}) {
+      print "<tr>";
+      print "<td>";
+      print "$element";
+      print "</td>";
+      print "<td>";
+      print "<input type='checkbox' class='channelCheckbox' id='checkbox_"
+      .$FPGA."-".$CB."-".$chip."-".$element."' ";
+      print "checked='true'" if ($channel_hash{$element});
+      print ">";
+      print "</td>";
+      print "</tr>";
+    }
   }
   
   print "</table>";
@@ -228,7 +259,8 @@ sub plot_request {
   print "<div class='header'>Plots</div>";
 
   my $q= shift;
-  my @requestStrings = split(",",$q->param('requestStrings'));
+  my @requestStrings = ();
+  @requestStrings = split(",",$q->param('requestStrings')) if defined($q->param('requestStrings'));
   return if (@requestStrings == 0);
 
   $ENV{'DAQOPSERVER'} = $q->param('DAQOPSERVER') if defined $q->param('DAQOPSERVER');