]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
more options to the power supply config file
authorJan Michel <j.michel@gsi.de>
Fri, 12 Jul 2013 18:09:34 +0000 (20:09 +0200)
committerJan Michel <j.michel@gsi.de>
Fri, 12 Jul 2013 18:09:34 +0000 (20:09 +0200)
web/htdocs/index.html
web/htdocs/tools/pwr/build_index.pl
web/htdocs/tools/pwr/pwr.conf
web/htdocs/tools/pwr/pwr.pl
web/htdocs/tools/pwr/pwr_hmp.htm

index 2b0c8bf367a645be73f8c88d922949dc4fdb14d8..4a2e2a15d6744d56814e4c02cd962ad32f7f2368 100755 (executable)
@@ -47,7 +47,7 @@ The main documentation of the network can be found in these two documents:
 <h3>Further Tools</h3>
 <div class="index">
 <ul>
-<li><a href="tools/pwr/index.html">Control for GW-Instek PSP-405 power supplies</a>
+<li><a href="tools/pwr/index.html" title="Currently supported: GW-Instek PSP-405 family, HMP2020 - HMP4040 family">Control for power supplies</a>
 </ul>
 </div>
 
index 62af2e4c47d7170b8bbd0de137846d0d4e57ab9a..efcfa575eb402c739dbb300d05113ad806abc8eb 100755 (executable)
@@ -10,16 +10,17 @@ open(LESEN,"htdocs/tools/pwr/pwr.conf")
 
 while(defined(my $i = <LESEN>)) {
 
-       if( $i =~ /^PWRSPLY:([^:]+):([^:]+):([^:]+):([^:]+)/g ) {
+       if( $i =~ /^PWRSPLY:([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)/g ) {
                my $ser_dev=$1;
-               my $dev_id=$2;
-               my $type=$3;
-               my $channels=$4;
+    my $speed=$2;
+               my $dev_id=$3;
+               my $type=$4;
+               my $channels=$5;
 
 if($type eq "PSP") {
 print <<EOF;
 <p>
-<iframe name="inlineframe" src="pwr.htm?device=$ser_dev&id=$dev_id" frameborder="0" scrolling="auto" width="800" height="340" ></iframe>
+<iframe name="inlineframe" src="pwr.htm?device=$ser_dev&id=$dev_id&speed=$speed" frameborder="0" scrolling="auto" width="800" height="340" ></iframe>
 </p>
 EOF
 }
@@ -27,7 +28,7 @@ EOF
 if($type =~ /HMP/) {
 print <<EOF;
 <p>
-<iframe name="inlineframe" src="pwr_hmp.htm?device=$ser_dev&id=$dev_id&type=$type&channels=$channels" frameborder="0" scrolling="auto" width="1000" height="400" ></iframe>
+<iframe name="inlineframe" src="pwr_hmp.htm?device=$ser_dev&id=$dev_id&type=$type&channels=$channels&speed=$speed" frameborder="0" scrolling="auto" width="800" height="340" ></iframe>
 </p>
 EOF
 }
index d7aad6dabb69568fd100c266c62743becc0723d0..e23ad0558e5283af11dfeac5b82a9b7b30544519 100644 (file)
@@ -1,4 +1,4 @@
-//PWRSPLY:/path/to/device:Device_ID:Type:Channels
+//PWRSPLY:/path/to/device:speed:Name:Type:Channels
 //type can be HMP, PSP
-PWRSPLY:/dev/ttyUSB0:PWR_DEFAULT:HMP:3
-PWRSPLY:/dev/ttyUSB1:PWR_OLD:PSP:1
\ No newline at end of file
+PWRSPLY:/dev/ttyUSB0:38400:HMP4030:HMP:3
+PWRSPLY:/dev/ttyUSB1:2400:PSP-405:PSP:1
\ No newline at end of file
index 676e1d5c78ca0bbd47d099176d6b4f71ab1979a3..5363c536b62367ddf5735af613e2b3d837e0d407 100755 (executable)
@@ -20,6 +20,10 @@ $ser_dev = "/dev/ttyUSB0" unless defined $ser_dev;
 my $ser_type = shift(@new_command);
 $ser_type = "PSP" unless defined $ser_type;
 
+my $ser_speed = shift(@new_command);
+$ser_speed = "2400" unless defined $ser_speed;
+
+
 my $port = new Device::SerialPort($ser_dev);
 unless ($port)
 {
@@ -28,8 +32,7 @@ unless ($port)
 }
 
 $port->user_msg('ON'); 
-$port->baudrate(2400) if $ser_type eq "PSP"; 
-$port->baudrate(115200) if $ser_type eq "HMP"; 
+$port->baudrate($ser_speed); 
 $port->parity("none"); 
 $port->databits(8); 
 $port->stopbits(1); 
@@ -154,7 +157,7 @@ sub receive_answer_HMP {
     $port->write("$command\r\n");
 #     print "i sent the command: $command\n";
     #print "\n\nokay.\n";
-    usleep 1E5;
+    usleep 5E4;
     while(my $a = $port->lookfor) {
       print $a."&"; # debug output
       }
index c9b402b6f285ec5cd97edc39b4b321fd52aa528d..036f7747993587ee15d27149ac7ad71f98459ba0 100644 (file)
@@ -15,7 +15,7 @@
 
 <form acion="">
 <table id="settings" class="smallboxes">
-<tr><th><th colspan=2>Chan 1<th colspan=2>Chan 2<th colspan=2>Chan 3<th colspan=2>Chan 4
+<tr><th><th colspan=2 id="chan1">Chan 1<th colspan=2 id="chan2">Chan 2<th colspan=2 id="chan3">Chan 3<th colspan=2 id="chan4">Chan 4
 <tr class="sep"><td align="right">Voltage [V]
   <td><input type="text" id="form_v1" name="voltage" value=""><td><input type="button" onClick="set_v(1)" value="set">
   <td><input type="text" id="form_v2" name="voltage" value=""><td><input type="button" onClick="set_v(2)" value="set">
@@ -59,9 +59,20 @@ var ser_dev = getParameterByName("device");
 var dev_id = getParameterByName("id");
 var type = getParameterByName("type");
 var channels = getParameterByName("channels");
+var speed = getParameterByName("speed");
 
+if (channels<2) {
+  document.getElementById("chan2").style.color = "#eee";
+  }
+if (channels<3) {
+  document.getElementById("chan3").style.color = "#eee";
+  }
+if (channels<4) {
+  document.getElementById("chan4").style.color = "#eee";
+  }
 
 function set_v(chan) {
+  if (chan > channels) return;
        var value = parseFloat(document.getElementById("form_v"+chan).value);
        var command;
   if(type=="HMP") command = "INST OUT"+chan+"&VOLT "+value.toFixed(3);
@@ -69,6 +80,7 @@ function set_v(chan) {
 }
 
 function set_v_lim(chan) {
+  if (chan > channels) return;
        var value = parseInt(document.getElementById("form_v_lim"+chan).value);
        var command;
   if(type=="HMP") command = "INST OUT"+chan+"&VOLT:PROT "+value.toFixed(3);
@@ -76,6 +88,7 @@ function set_v_lim(chan) {
 }
 
 function set_c_lim(chan) {
+  if (chan > channels) return;
        var value = parseFloat(document.getElementById("form_c_lim"+chan).value);
        var command;
   if(type=="HMP") command = "INST OUT"+chan+"&CURR "+value.toFixed(3);
@@ -83,10 +96,12 @@ function set_c_lim(chan) {
 }
 
 function turn_on(chan) {
+  if (chan > channels) return;
        if(type=="HMP") new_commands.push("INST OUT"+chan+"&OUTP ON");
 }
 
 function turn_off(chan) {
+  if (chan > channels) return;
   if(type=="HMP") new_commands.push("INST OUT"+chan+"&OUTP OFF");
 }
 
@@ -97,8 +112,6 @@ function update(data) {
 
   
 function updatereads(data) {
-  if(document.getElementById("readings"))
-    document.getElementById("readings").innerHTML=data;
   var e = data.split("&");
   for(i=0;i<channels;i++) {
     document.getElementById("vol"+(i+1)).value=e[i*2];
@@ -111,14 +124,14 @@ function communication() {
   cmds = new_commands.join('&');
   if (cmds != "") {
     clearInterval(updateTask);
-    getdata('pwr.pl?'+ser_dev+'&'+type+'&'+cmds,update);
+    getdata('pwr.pl?'+ser_dev+'&'+type+"&"+speed+'&'+cmds,update);
     }
   else if(document.getElementById("showreadings").checked) {
     clearInterval(updateTask);
     cmds = "";
     for(i=1;i<=channels;i++)
       cmds +="&INST OUT"+i+"&MEAS:VOLT%3F&MEAS:CURR%3F";
-    getdata('pwr.pl?'+ser_dev+'&'+type+cmds,updatereads);
+    getdata('pwr.pl?'+ser_dev+'&'+type+"&"+speed+cmds,updatereads);
     }
        new_commands = new Array();
 }