]> jspc29.x-matter.uni-frankfurt.de Git - hades_mdc_settings.git/commitdiff
add database for power channel numbers
authorJan Michel <michel@physik.uni-frankfurt.de>
Wed, 11 Jan 2023 10:00:52 +0000 (11:00 +0100)
committerJan Michel <michel@physik.uni-frankfurt.de>
Wed, 11 Jan 2023 10:00:52 +0000 (11:00 +0100)
documents/PowerBoardControl.md
installation/power_outputs.db [new file with mode: 0644]
scripts/MDC.pm
scripts/mdc_voltage.pl
scripts/merge_and_flash_settings.pl

index a09057bced667baeaaa72d592bbecaf67139c85d..f7d0a27be999ec17c6ee25e597c00ccb10f364dd 100644 (file)
@@ -20,6 +20,7 @@
 
 
 ### OEP Numbers
+Default assignment of outputs. Can be adjusted in power_outputs.db
 
     ------------------- --------- -------------------
     |  4   5   6   7  | |       | |  8   9   A   B  |
diff --git a/installation/power_outputs.db b/installation/power_outputs.db
new file mode 100644 (file)
index 0000000..e953800
--- /dev/null
@@ -0,0 +1,403 @@
+#Plane   Sector   MBO     Power   Output
+##########################################
+0        0        0        0        0
+0        0        1        0        1
+0        0        2        0        2
+0        0        3        0        3
+0        0        4        1        0
+0        0        5        1        1
+0        0        6        1        2
+0        0        7        1        3
+0        0        8        2        0
+0        0        9        2        1
+0        0        10       2        2
+0        0        11       2        3
+0        0        12       3        0
+0        0        13       3        1
+
+0        1        0        0        0
+0        1        1        0        1
+0        1        2        0        2
+0        1        3        0        3
+0        1        4        1        0
+0        1        5        1        1
+0        1        6        1        2
+0        1        7        1        3
+0        1        8        2        0
+0        1        9        2        1
+0        1        10       2        2
+0        1        11       2        3
+0        1        12       3        0
+0        1        13       3        1
+
+0        2        0        0        0
+0        2        1        0        1
+0        2        2        0        2
+0        2        3        0        3
+0        2        4        1        0
+0        2        5        1        1
+0        2        6        1        2
+0        2        7        1        3
+0        2        8        2        0
+0        2        9        2        1
+0        2        10       2        2
+0        2        11       2        3
+0        2        12       3        0
+0        2        13       3        1
+
+0        3        0        0        0
+0        3        1        0        1
+0        3        2        0        2
+0        3        3        0        3
+0        3        4        1        0
+0        3        5        1        1
+0        3        6        1        2
+0        3        7        1        3
+0        3        8        2        0
+0        3        9        2        1
+0        3        10       2        2
+0        3        11       2        3
+0        3        12       3        0
+0        3        13       3        1
+
+0        4        0        0        0
+0        4        1        0        1
+0        4        2        0        2
+0        4        3        0        3
+0        4        4        1        0
+0        4        5        1        1
+0        4        6        1        2
+0        4        7        1        3
+0        4        8        2        0
+0        4        9        2        1
+0        4        10       2        2
+0        4        11       2        3
+0        4        12       3        0
+0        4        13       3        1
+
+0        5        0        0        0
+0        5        1        0        1
+0        5        2        0        2
+0        5        3        0        3
+0        5        4        1        0
+0        5        5        1        1
+0        5        6        1        2
+0        5        7        1        3
+0        5        8        2        0
+0        5        9        2        1
+0        5        10       2        2
+0        5        11       2        3
+0        5        12       3        0
+0        5        13       3        1
+
+##########################################
+
+1        0        0        0        0
+1        0        1        0        1
+1        0        2        0        2
+1        0        3        0        3
+1        0        4        1        0
+1        0        5        1        1
+1        0        6        1        2
+1        0        7        1        3
+1        0        8        2        0
+1        0        9        2        1
+1        0        10       2        2
+1        0        11       2        3
+1        0        12       3        0
+1        0        13       3        1
+1        0        14       3        2
+1        0        15       3        3
+
+1        1        0        0        0
+1        1        1        0        1
+1        1        2        0        2
+1        1        3        0        3
+1        1        4        1        0
+1        1        5        1        1
+1        1        6        1        2
+1        1        7        1        3
+1        1        8        2        0
+1        1        9        2        1
+1        1        10       2        2
+1        1        11       2        3
+1        1        12       3        0
+1        1        13       3        1
+1        1        14       3        2
+1        1        15       3        3
+
+1        2        0        0        0
+1        2        1        0        1
+1        2        2        0        2
+1        2        3        0        3
+1        2        4        1        0
+1        2        5        1        1
+1        2        6        1        2
+1        2        7        1        3
+1        2        8        2        0
+1        2        9        2        1
+1        2        10       2        2
+1        2        11       2        3
+1        2        12       3        0
+1        2        13       3        1
+1        2        14       3        2
+1        2        15       3        3
+
+1        3        0        0        0
+1        3        1        0        1
+1        3        2        0        2
+1        3        3        0        3
+1        3        4        1        0
+1        3        5        1        1
+1        3        6        1        2
+1        3        7        1        3
+1        3        8        2        0
+1        3        9        2        1
+1        3        10       2        2
+1        3        11       2        3
+1        3        12       3        0
+1        3        13       3        1
+1        3        14       3        2
+1        3        15       3        3
+
+1        4        0        0        0
+1        4        1        0        1
+1        4        2        0        2
+1        4        3        0        3
+1        4        4        1        0
+1        4        5        1        1
+1        4        6        1        2
+1        4        7        1        3
+1        4        8        2        0
+1        4        9        2        1
+1        4        10       2        2
+1        4        11       2        3
+1        4        12       3        0
+1        4        13       3        1
+1        4        14       3        2
+1        4        15       3        3
+
+1        5        0        0        0
+1        5        1        0        1
+1        5        2        0        2
+1        5        3        0        3
+1        5        4        1        0
+1        5        5        1        1
+1        5        6        1        2
+1        5        7        1        3
+1        5        8        2        0
+1        5        9        2        1
+1        5        10       2        2
+1        5        11       2        3
+1        5        12       3        0
+1        5        13       3        1
+1        5        14       3        2
+1        5        15       3        3
+
+##########################################                                
+
+2        0        0        0        0
+2        0        1        0        1
+2        0        2        0        2
+2        0        3        0        3
+2        0        4        1        0
+2        0        5        1        1
+2        0        6        1        2
+2        0        7        1        3
+2        0        8        2        0
+2        0        9        2        1
+2        0        10       2        2
+2        0        11       2        3
+2        0        12       3        0
+2        0        13       3        1
+2        0        14       3        2
+2        0        15       3        3
+
+2        1        0        0        0
+2        1        1        0        1
+2        1        2        0        2
+2        1        3        0        3
+2        1        4        1        0
+2        1        5        1        1
+2        1        6        1        2
+2        1        7        1        3
+2        1        8        2        0
+2        1        9        2        1
+2        1        10       2        2
+2        1        11       2        3
+2        1        12       3        0
+2        1        13       3        1
+2        1        14       3        2
+2        1        15       3        3
+
+2        2        0        0        0
+2        2        1        0        1
+2        2        2        0        2
+2        2        3        0        3
+2        2        4        1        0
+2        2        5        1        1
+2        2        6        1        2
+2        2        7        1        3
+2        2        8        2        0
+2        2        9        2        1
+2        2        10       2        2
+2        2        11       2        3
+2        2        12       3        0
+2        2        13       3        1
+2        2        14       3        2
+2        2        15       3        3
+
+2        3        0        0        0
+2        3        1        0        1
+2        3        2        0        2
+2        3        3        0        3
+2        3        4        1        0
+2        3        5        1        1
+2        3        6        1        2
+2        3        7        1        3
+2        3        8        2        0
+2        3        9        2        1
+2        3        10       2        2
+2        3        11       2        3
+2        3        12       3        0
+2        3        13       3        1
+2        3        14       3        2
+2        3        15       3        3
+
+2        4        0        0        0
+2        4        1        0        1
+2        4        2        0        2
+2        4        3        0        3
+2        4        4        1        0
+2        4        5        1        1
+2        4        6        1        2
+2        4        7        1        3
+2        4        8        2        0
+2        4        9        2        1
+2        4        10       2        2
+2        4        11       2        3
+2        4        12       3        0
+2        4        13       3        1
+2        4        14       3        2
+2        4        15       3        3
+
+2        5        0        0        0
+2        5        1        0        1
+2        5        2        0        2
+2        5        3        0        3
+2        5        4        1        0
+2        5        5        1        1
+2        5        6        1        2
+2        5        7        1        3
+2        5        8        2        0
+2        5        9        2        1
+2        5        10       2        2
+2        5        11       2        3
+2        5        12       3        0
+2        5        13       3        1
+2        5        14       3        2
+2        5        15       3        3
+
+##########################################
+
+3        0        0        0        0
+3        0        1        0        1
+3        0        2        0        2
+3        0        3        0        3
+3        0        4        1        0
+3        0        5        1        1
+3        0        6        1        2
+3        0        7        1        3
+3        0        8        2        0
+3        0        9        2        1
+3        0        10       2        2
+3        0        11       2        3
+3        0        12       3        0
+3        0        13       3        1
+3        0        14       3        2
+3        0        15       3        3
+
+3        1        0        0        0
+3        1        1        0        1
+3        1        2        0        2
+3        1        3        0        3
+3        1        4        1        0
+3        1        5        1        1
+3        1        6        1        2
+3        1        7        1        3
+3        1        8        2        0
+3        1        9        2        1
+3        1        10       2        2
+3        1        11       2        3
+3        1        12       3        0
+3        1        13       3        1
+3        1        14       3        2
+3        1        15       3        3
+
+3        2        0        0        0
+3        2        1        0        1
+3        2        2        0        2
+3        2        3        0        3
+3        2        4        1        0
+3        2        5        1        1
+3        2        6        1        2
+3        2        7        1        3
+3        2        8        2        0
+3        2        9        2        1
+3        2        10       2        2
+3        2        11       2        3
+3        2        12       3        0
+3        2        13       3        1
+3        2        14       3        2
+3        2        15       3        3
+
+3        3        0        0        0
+3        3        1        0        1
+3        3        2        0        2
+3        3        3        0        3
+3        3        4        1        0
+3        3        5        1        1
+3        3        6        1        2
+3        3        7        1        3
+3        3        8        2        0
+3        3        9        2        1
+3        3        10       2        2
+3        3        11       2        3
+3        3        12       3        0
+3        3        13       3        1
+3        3        14       3        2
+3        3        15       3        3
+
+3        4        0        0        0
+3        4        1        0        1
+3        4        2        0        2
+3        4        3        0        3
+3        4        4        1        0
+3        4        5        1        1
+3        4        6        1        2
+3        4        7        1        3
+3        4        8        2        0
+3        4        9        2        1
+3        4        10       2        2
+3        4        11       2        3
+3        4        12       3        0
+3        4        13       3        1
+3        4        14       3        2
+3        4        15       3        3
+
+3        5        0        0        0
+3        5        1        0        1
+3        5        2        0        2
+3        5        3        0        3
+3        5        4        1        0
+3        5        5        1        1
+3        5        6        1        2
+3        5        7        1        3
+3        5        8        2        0
+3        5        9        2        1
+3        5        10       2        2
+3        5        11       2        3
+3        5        12       3        0
+3        5        13       3        1
+3        5        14       3        2
+3        5        15       3        3
index 37c22179ccd3fda9082b66433072cadedb8b101c..d705cfebe6d9ee95af83bb3f4038226370e636d4 100644 (file)
@@ -69,8 +69,20 @@ sub get_power_output {
   close FILE;  
   
   my $hostname = sprintf("mdcpd%03x",$id);
-     $hostname = -1 if $id==-1;
-  return($hostname,int($b/4),$b%4);
+  return(-1,0,0) if $id==-1;
+     
+  open FILE, "../installation/power_outputs.db" or die $!."\npower_outputs.db not found.";
+  while (my $a = <FILE>) {
+    if(my @values = $a =~ /^\s*(\d)\s+(\d)\s+(\d+)\s+(\d)\s+(\d)/) {
+      if($values[0] == $p && $values[1] == $s && $values[2] == $b) {
+        return($hostname,$values[3],$values[4]);
+        }
+      }
+    }
+     
+  close FILE;   
+     
+  return($hostname,-1,-1);
   }
   
 1;
index bf9dd67ed1acd990ae7391756c9064db872bcafc..b6a6d2d7473bcea39215cf50fc583881f8f1eca0 100755 (executable)
@@ -67,21 +67,28 @@ if(defined $setting && ($setting < 0 || $setting > 7)) {
   }
 
 #Load all settings  
-if(defined $load) {
+if(defined $load && !defined $board) {
   my $ret = MDCPower::set_all_voltages();
   }
 
 #Read settings from file  
-elsif(!defined $setting || !defined $channel) {
+elsif(defined $board && (!defined $setting || !defined $channel)) {
   my ($v1,$v2) = MDCPower::get_voltage($board);
   die "Settings not found\n" if $v1 == -1 && $v2 == -1;
   
   print ("Board\tV0\tV1\n");
-  printf("%04x\t%u\t%u\n\n",$board,$v1,$v2)
+  printf("%04x\t%u\t%u\n\n",$board,$v1,$v2);
+  
+  if(defined $load) {
+    MDCPower::set_voltage($board,0,$v1,0);
+    die "Setting voltage failed $_" unless $_ == 1;
+    MDCPower::set_voltage($board,1,$v2,0);
+    die "Setting voltage failed $_" unless $_ == 1;
+    }
   }
 
 #Update settings on board and file  
-elsif(defined $board) {
+elsif(defined $board && defined $setting  && defined $channel) {
   print("Change Settings\n");
   my $ret = MDCPower::set_voltage($board,$channel,$setting,0);
   die "Invalid Settings\n" if $ret == -1;
index dc45ebf37862635adcd527201c75a5e2f0eb1267..4963fb16f0d902bfe890d1d10139d3e5a4d20659 100755 (executable)
@@ -5,5 +5,3 @@ use FileHandle;
 use Getopt::Long;
 use Data::Dumper;
 use HADES::TrbNet;
-
-