Browse Source

updated whole HV monitoring part

Thomas Thümmler 4 năm trước cách đây
mục cha
commit
b7b1f7a1cc
1 tập tin đã thay đổi với 113 bổ sung65 xóa
  1. 113 65
      SDS_status_main.php

+ 113 - 65
SDS_status_main.php

@@ -548,101 +548,149 @@ if (($MSmode == 5) or ($MSmode == 4))
 
     if ($MSmode == 5)
       { // only display in MS operation mode High-Voltage
-    
+
+        $K35_value = $adeiValue[30][0];
+        $K35_link = $adeiChannel[30][0];
+        $K35_TS = $adeiValue[30][1];
+        $K35_RunFlag = $adeiValue[30][2];
+	$K35_text = "not connected";
+
+        $K65_value = $adeiValue[30][3];
+        $K65_link = $adeiChannel[30][3];
+        $K65_TS = $adeiValue[30][4];
+        $K65_RunFlag = $adeiValue[30][5];
+
+	// Kal1 = JRL at PS vessel voltage
+        $Kal1_value = $adeiValue[30][6];
+        $Kal1_link = $adeiChannel[30][6];
+        $Kal1_TS = $adeiValue[30][7];
+        $Kal1_RunFlag = $adeiValue[30][8];
+	$Kal1_text = "JRL50 @ PS Tank";
+	
 	$time_conversion_factor = 2082844800;
-	$timestamp = ($adeiValue[30][3] - $time_conversion_factor);
-	$timestamp_ps = ($adeiValue[30][5] - $time_conversion_factor);
-	echo '<font size="4" color="#000000">&nbsp;HV meas. timestamp: ' . date("r", $timestamp ) . ' </font><br>';
+        $most_recent_TS = max($K35_TS,$K65_TS,$Kal1_TS);
+	if (max($K35_RunFlag,$K65_RunFlag,$Kal1_RunFlag) > 0)
+	  {
+	    $timestamp = ($most_recent_TS - $time_conversion_factor);
+	    echo '<font size="4" color="#000000">&nbsp;HV meas. timestamp: ' . date("r", $timestamp ) . ' </font><br>';
+	  }
+	  else echo '<font size="4" color="#000000">&nbsp;HV meas. OFFLINE </font><br>';
 	
 	// HV switch for K35
 	$hv_switch1103_k35 = $adeiValue[35][2];
-	if ($hv_switch1103_k35 == 1) $k35_text = "K35 @ MoS Voltage";
-	else if ($hv_switch1103_k35 == 0) $k35_text = "K35 @ MS  Voltage";
-	$k35_text = "JRL50 @ PS Tank";
+	if ($hv_switch1103_k35 == 1) $K35_text = "K35 @ MoS Voltage";
+	else if ($hv_switch1103_k35 == 0) $K35_text = "K35 @ MS  Voltage";
 	
 	// voltage monitoring readout K35
 	$color = "#000000";
 	$factor_m = 5000.1021;
-	$offset = 0.0;
-	$gain = 1.0;
-    $value = ($adeiValue[30][4] - $offset) * $gain * $factor_m;
+	$offset = 4.529e-6;
+	$gain = 0.999997525656185;
+	$value = ($K35_value - $offset) * $gain * $factor_m;
 	//        $voltage_error = abs($value * 2e-3);
 	$voltage_error = abs($value * 10e-6);
 	if ($voltage_error*100 < 1) { $voltage_error = 0.2; }
 	
 	// voltage display K35
-	$link = $adeiChannel[30][4];
-	$text = "436-REU-0-0401-0001, precision voltage value of JRL50 at PS";
-//	$text = "K35 divider readout 436-REU-0-0201-0001, precision voltage value, in 2019 used for JRL50 at PS";
-	//placeText(385, 716, $k35_text, 130, 2, $color); // K35 voltage reading
-	//placeTextWithLink(363, 696, sprintf('%.3F', $value ) . "(" . sprintf('%.0F', $voltage_error ) .") V" , 170, 4, $color, $text, $link);
+	$link = $K35_link;
+	$text = "K35 divider readout 436-REU-0-0201-0001, precision voltage value";
+
+	if ($K35_RunFlag > 0)
+	  {
+	    placeText(321, 811, $K35_text, 140, 2, $color); // K35 voltage reading
+	    placeTextWithLink(293, 746, "U<sub>0</sub> = ".sprintf('%.3F', $value ) . "(" . sprintf('%.0F', $voltage_error ) .") V" , 270, 5, $color, $text, $link);
+	    if (($value < -19724.6) & ($value > -19724.7)) placeText(280, 796, "calibration in progress", 170, 2, "green"); // calibration ongoing
+	  }
 	
-    // only display PS value if timestamp is ok
-    //if($timestamp < $timestamp_ps + 2000)
-    {
-    	placeText(520, 136, $k35_text, 130, 2, $color); // K35 voltage reading
-    	if (abs($value) > 36000) placeText(490, 116, "calibration in progress", 170, 2, "green"); // calibration ongoing
-    	placeTextWithLink(502, 116, sprintf('%.2F', $value ) . "(" . sprintf('%.0F', $voltage_error*100 ) .") V" , 170, 4, $color, $text, $link);
-    }
-      
 	// HV switch for K65
 	$hv_switch1102_k65 = $adeiValue[35][1];
-	$k65_text = "K65 @ MS Tank + IE";
-	//$k65_text = "Fluke E @ Reference";
-	//if ($hv_switch1102_k65 == 1) $k65_text = "K65 @ MoS Voltage";
-	//if ($hv_switch1102_k65 == 0) $k65_text = "K65 @ MS  Voltage";
+	$K65_text = "K65 @ MS Tank + IE";
+	//$K65_text = "Fluke E @ Reference";
+	//if ($hv_switch1102_k65 == 1) $K65_text = "K65 @ MoS Voltage";
+	//if ($hv_switch1102_k65 == 0) $K65_text = "K65 @ MS  Voltage";
 	
 	// voltage monitoring readout K65
 	$color = "#000000";
-	//$factor_m = 1972.449;
-	//$factor_m_rel_error = 0.01/$factor_m;
-	//$offset = 3.49e-6;
-	//$gain = 0.999999669;
-	$factor_m = 1818.1;
+        $factor_m = 1818.1;
 	$factor_m_rel_error = 0.02/$factor_m;
 	$offset = -4.1e-6;
 	$gain = 1.00000136;
-	$value = ($adeiValue[30][1] - $offset) * $gain * $factor_m;
+	//$factor_m = 1972.449;
+	//$factor_m_rel_error = 0.01/$factor_m;
+	//$offset = 3.831e-06;
+	//$gain = 1.00000037602556;
+	$value = ($K65_value - $offset) * $gain * $factor_m;
 	$voltage_error = abs($value * $factor_m_rel_error * 1e3); // in mV
 	if ($voltage_error < 1) { $voltage_error = 1; }
 	
 	// voltage display K65
-	$link = $adeiChannel[30][1];
+	$link = $K65_link;
 	$text = "K65 divider readout 436-REU-0-0301-0001, precision voltage value, in 2019 used for K35";
 
-    if (($value < -19724.6) & ($value > -19724.7)) placeText(340, 796, "calibration in progress", 170, 2, "green"); // calibration ongoing      
-        
-    placeTextWithLink(353, 756, "U<sub>0</sub> = ".sprintf('%.3F', $value ) . "(" . sprintf('%.0F', $voltage_error ) .") V" , 250, 5, $color, $text, $link);
+	if ($K65_RunFlag > 0)
+	  {
+	    if (($value < -19724.6) & ($value > -19724.7)) placeText(340, 796, "calibration in progress", 170, 2, "green"); // calibration ongoing
+	    placeTextWithLink(353, 746, "U<sub>0</sub> = ".sprintf('%.3F', $value ) . "(" . sprintf('%.0F', $voltage_error ) .") V" , 270, 5, $color, $text, $link);
+
+	    
+	    //display stability indicators
+	    //if ($local)
+	    {
+	      if (sizeof($flukeE) > 2)
+		{
+		  placeText(381, 811, $K65_text, 140, 2, $color); // K65 voltage reading
+		  
+		  if ($flukeE[0]['ppmdev'] <= 2e-6) $color1 = "lightgreen";
+		  if ($flukeE[1]['ppmdev'] <= 2e-6) $color2 = "lightgreen";
+		  if ($flukeE[2]['ppmdev'] <= 2e-6) $color3 = "lightgreen";
+		  if ($flukeE[3]['ppmdev'] <= 2e-6) $color4 = "lightgreen";
+		  
+		  if ($flukeE[0]['ppmdev'] > 2e-6) $color1 = "orange";
+		  if ($flukeE[1]['ppmdev'] > 2e-6) $color2 = "orange";
+		  if ($flukeE[2]['ppmdev'] > 2e-6) $color3 = "orange";
+		  if ($flukeE[3]['ppmdev'] > 2e-6) $color4 = "orange";
+		  
+		  if ($flukeE[0]['ppmdev'] > 5e-6) $color1 = "#FFA0A0";
+		  if ($flukeE[1]['ppmdev'] > 5e-6) $color2 = "#FFA0A0";
+		  if ($flukeE[2]['ppmdev'] > 5e-6) $color3 = "#FFA0A0";
+		  if ($flukeE[3]['ppmdev'] > 5e-6) $color4 = "#FFA0A0";
+		  
+		  placeBox(396, 915, "10s", 35, 1, $color1);
+		  placeBox(396, 880, "20s", 35, 1, $color2);
+		  placeBox(396, 845, "1m", 35, 1, $color3);
+		  placeBox(396, 810, "5m", 35, 1, $color4);
+		  
+		  echo '<font size="4" color="#000000">&nbsp;HV status timestamp: ' . $extraction_time_HV . ' </font><br>';
+		}
+	      else placeText(381, 811, $K65_text, 140, 2, $color); // K65 voltage reading
+	    }
+	  }
+	
+	// voltage monitoring readout Kal1 e.g. JRL at PS
+	$color = "#000000";
+	$factor_m = 5000.1021;
+	$offset = 4.529e-6;
+	$gain = 0.999997525656185;
+	$value = ($Kal1_value - $offset) * $gain * $factor_m;
+	//        $voltage_error = abs($value * 2e-3);
+	$voltage_error = abs($value * 10e-6);
+	if ($voltage_error*100 < 1) { $voltage_error = 0.2; }
 	
-	//display stability indicators
-	//if ($local) {
-	if (sizeof($flukeE) > 2) {
-	  placeText(381, 811, $k65_text, 140, 2, $color); // K65 voltage reading
-	  
-	  if ($flukeE[0]['ppmdev'] <= 2e-6) $color1 = "lightgreen";
-	  if ($flukeE[1]['ppmdev'] <= 2e-6) $color2 = "lightgreen";
-	  if ($flukeE[2]['ppmdev'] <= 2e-6) $color3 = "lightgreen";
-	  if ($flukeE[3]['ppmdev'] <= 2e-6) $color4 = "lightgreen";
-	  
-	  if ($flukeE[0]['ppmdev'] > 2e-6) $color1 = "orange";
-	  if ($flukeE[1]['ppmdev'] > 2e-6) $color2 = "orange";
-	  if ($flukeE[2]['ppmdev'] > 2e-6) $color3 = "orange";
-	  if ($flukeE[3]['ppmdev'] > 2e-6) $color4 = "orange";
-	  
-	  if ($flukeE[0]['ppmdev'] > 5e-6) $color1 = "#FFA0A0";
-	  if ($flukeE[1]['ppmdev'] > 5e-6) $color2 = "#FFA0A0";
-	  if ($flukeE[2]['ppmdev'] > 5e-6) $color3 = "#FFA0A0";
-	  if ($flukeE[3]['ppmdev'] > 5e-6) $color4 = "#FFA0A0";
-	  
-	  placeBox(396, 915, "10s", 35, 1, $color1);
-	  placeBox(396, 880, "20s", 35, 1, $color2);
-	  placeBox(396, 845, "1m", 35, 1, $color3);
-	  placeBox(396, 810, "5m", 35, 1, $color4);
-	  
-	  echo '<font size="4" color="#000000">&nbsp;HV status timestamp: ' . $extraction_time_HV . ' </font><br>';
+	// voltage display K35
+	$link = $Kal1_link;
+	$text = "JRL divider at Kal1 monitoring input 436-REU-0-0501-0001, precision voltage value";
+
+	if ($Kal1_RunFlag > 0)
+	{
+	  placeText(520, 136, $Kal1_text, 130, 2, $color); // Kal1 voltage reading
+	  if (abs($value) > 36000) placeText(490, 116, "calibration in progress", 170, 2, "green"); // calibration ongoing
+	  placeTextWithLink(502, 116, sprintf('%.2F', $value ) . "(" . sprintf('%.0F', $voltage_error*100 ) .") V" , 170, 4, $color, $text, $link);
 	}
-	else placeText(381, 811, $k65_text, 140, 2, $color); // K65 voltage reading
-      }
+	
+  }  // end of PCS7 mode switch
+
+    
+  
     
     //placeText(180, 845, "MS WEST IE", 70, 2,"#808080"); // west IE being displayed in loop below
     //placeText(450, 845, "MS EAST IE", 70, 2,"#808080"); // east IE