Browse Source

some code cleanup

Jan Behrens 2 years ago
parent
commit
04b23fa096
14 changed files with 4047 additions and 3617 deletions
  1. 682 632
      SDS_status_channels.php
  2. 78 96
      SDS_status_functions.php
  3. 2036 1633
      SDS_status_main.php
  4. 453 471
      aircoils_settings.php
  5. 94 77
      index.php
  6. 87 69
      index_beta.php
  7. 43 47
      list.php
  8. 254 263
      mace_settings.php
  9. 0 0
      oldfiles/aircoils_convert_csv_to_array.php
  10. 0 0
      oldfiles/getADEIData.php
  11. 0 0
      oldfiles/getDAQData.php
  12. 0 0
      oldfiles/getFluxTube.php
  13. 215 221
      poll_HV_data.php
  14. 105 108
      poll_adei_data.php

+ 682 - 632
SDS_status_channels.php

@@ -1,638 +1,688 @@
-
 <?php
 
 // ########## SLOW CONTROL CHANNELS ##########
-
 $adeiChannel = array(
-		     array(                                 //EMCS+LFCS currents
-			   "aircoils__aircoils_rep__0__2",  //433-ELV-1-0101
-			   "aircoils__aircoils_rep__0__3",  //433-ELV-1-0201
-			   "aircoils__aircoils_rep__0__4",  //433-ELV-1-0301
-			   "aircoils__aircoils_rep__0__5",  //433-ELV-1-0401
-			   "aircoils__aircoils_rep__0__6",  //433-ELV-1-0501
-			   "aircoils__aircoils_rep__0__7",  //433-ELV-1-0601
-			   "aircoils__aircoils_rep__0__8",  //433-ELV-1-0701
-			   "aircoils__aircoils_rep__0__9",  //433-ELV-1-0801
-			   "aircoils__aircoils_rep__0__10",  //433-ELV-1-0901
-			   "aircoils__aircoils_rep__0__11",  //433-ELV-1-1001
-			   "aircoils__aircoils_rep__0__12",  //433-ELV-1-1101
-			   "aircoils__aircoils_rep__0__13",  //433-ELV-1-1201
-			   "aircoils__aircoils_rep__0__14",  //433-ELV-1-1301
-			   "aircoils__aircoils_rep__0__15",  //433-ELV-1-1401
-			   "aircoils__aircoils_rep__0__16",  //433-ELV-1-1501
-			   "aircoils__aircoils_rep__0__17",  //433-ELV-1-1601
-			   "aircoils__aircoils_rep__0__18",  //433-ELV-1-1701
-			   "aircoils__aircoils_rep__0__19",  //433-ELV-1-1801
-			   "aircoils__aircoils_rep__0__20",  //433-ELV-1-1901
-			   "aircoils__aircoils_rep__0__21",  //433-ELV-1-2001
-			   "aircoils__aircoils_rep__0__22",  //433-ELV-1-2101
-			   "aircoils__aircoils_rep__0__23"   //433-ELV-1-2201
-			      ),
-		     array(                                  //EMCS+LFCS Voltages
-			   "aircoils__aircoils_rep__0__24",  //433-ELV-1-0101   
-			   "aircoils__aircoils_rep__0__25",  //433-ELV-1-0201
-			   "aircoils__aircoils_rep__0__26",  //433-ELV-1-0301
-			   "aircoils__aircoils_rep__0__27",  //433-ELV-1-0401
-			   "aircoils__aircoils_rep__0__28",  //433-ELV-1-0501
-			   "aircoils__aircoils_rep__0__29",  //433-ELV-1-0601
-			   "aircoils__aircoils_rep__0__30",  //433-ELV-1-0701
-			   "aircoils__aircoils_rep__0__31",  //433-ELV-1-0801
-			   "aircoils__aircoils_rep__0__32",  //433-ELV-1-0901
-			   "aircoils__aircoils_rep__0__33",  //433-ELV-1-1001
-			   "aircoils__aircoils_rep__0__34",  //433-ELV-1-1101
-			   "aircoils__aircoils_rep__0__35",  //433-ELV-1-1201
-			   "aircoils__aircoils_rep__0__36",  //433-ELV-1-1301
-			   "aircoils__aircoils_rep__0__37",  //433-ELV-1-1401
-			   "aircoils__aircoils_rep__0__38",  //433-ELV-1-1501
-			   "aircoils__aircoils_rep__0__39",  //433-ELV-1-1601
-			   "aircoils__aircoils_rep__0__40",  //433-ELV-1-1701
-			   "aircoils__aircoils_rep__0__41",  //433-ELV-1-1801
-			   "aircoils__aircoils_rep__0__42",  //433-ELV-1-1901
-			   "aircoils__aircoils_rep__0__43",  //433-ELV-1-2001
-			   "aircoils__aircoils_rep__0__44",  //433-ELV-1-2101
-			   "aircoils__aircoils_rep__0__45"   //433-ELV-1-2201
-			   ),
-		     array(                                   // LEM Status all coils
-			   "aircoils__aircoils_rep__0__116",  //433-ELV-1-0101
-			   "aircoils__aircoils_rep__0__117",  //433-ELV-1-0201
-			   "aircoils__aircoils_rep__0__118",  //433-ELV-1-0301
-			   "aircoils__aircoils_rep__0__119",  //433-ELV-1-0401
-			   "aircoils__aircoils_rep__0__120",  //433-ELV-1-0501
-			   "aircoils__aircoils_rep__0__121",  //433-ELV-1-0601
-			   "aircoils__aircoils_rep__0__122",  //433-ELV-1-0701
-			   "aircoils__aircoils_rep__0__123",  //433-ELV-1-0801
-			   "aircoils__aircoils_rep__0__124",  //433-ELV-1-0901
-			   "aircoils__aircoils_rep__0__125",  //433-ELV-1-1001
-			   "aircoils__aircoils_rep__0__126",  //433-ELV-1-1101
-			   "aircoils__aircoils_rep__0__127",  //433-ELV-1-1201
-			   "aircoils__aircoils_rep__0__128",  //433-ELV-1-1301
-			   "aircoils__aircoils_rep__0__129",  //433-ELV-1-1401
-			   "aircoils__aircoils_rep__0__130",  //433-ELV-1-1501
-			   "aircoils__aircoils_rep__0__131",  //433-ELV-1-1601
-			   "aircoils__aircoils_rep__0__132",  //433-ELV-1-1701
-			   "aircoils__aircoils_rep__0__133",  //433-ELV-1-1801
-			   "aircoils__aircoils_rep__0__134",  //433-ELV-1-1901
-			   "aircoils__aircoils_rep__0__135",  //433-ELV-1-2001
-			   "aircoils__aircoils_rep__0__136",  //433-ELV-1-2101
-			   "aircoils__aircoils_rep__0__137",  //433-ELV-1-2201
-			   "aircoils__aircoils_rep__0__138"   // HV dipole trigger status
-			   ),
-		     array(
-			   "aircoils__aircoils_rep__0__112",  //PS1 + PS2 current 
-			   "aircoils__aircoils_rep__0__113",
-			   "aircoils__aircoils_rep__0__114",  //PS1 + PS2 Status
-			   "aircoils__aircoils_rep__0__115"
-			   ),
-		     array(
-			   "fpd__katrin_rep__0__153",
-			   "fpd__katrin_rep__0__158"
-			   ),
-		     // Baffle vacuum  (index 5, former egun part)
-		     array(
-			   "csms__ControlSystem_MS__432VAK_Kryoleitung__9"
-			   ),
-		     array(
-			   "fpd__katrin_rep__0__43",
-			   "fpd__katrin_rep__0__66",
-			   "fpd__katrin_rep__0__80",
-			   "fpd__katrin_rep__0__99",
-			   "fpd__katrin_rep__0__112",
-			   "fpd__katrin_rep__0__113",
-			   "fpd__katrin_rep__0__116",
-			   "fpd__katrin_rep__0__117",
-			   "fpd__katrin_rep__0__118",
-			   "fpd__katrin_rep__0__60",
-			   "fpd__katrin_rep__0__62",
-			   "fpd__katrin_rep__0__114",
-			   "fpd__katrin_rep__0__45"
-			   ),
-		     array(
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__33",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__6",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__12",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__18",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__57",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__60",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__63",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__36",
-			   "csms__ControlSystem_MS__432VAK_PumpPort2__29"  // time stamp for RPH-2330 as general vacuum time stamp
-			   ),
-		     array(
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__24",
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__6",
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__12",
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__18",
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__42",
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__45",
-			   "csms__ControlSystem_MS__432VAK_PumpPort3__48"
-			   ),
-		     array(  // index 9, vacuum MS tank
-			   "csms__ControlSystem_MS__432VAK_Tank__9",   // RPM 0106
-			   "csms__ControlSystem_MS__432VAK_Tank__12",  // RPV 0220
-			   "csms__ControlSystem_MS__432VAK_Tank__3",   // RPI 0096
-			   "csms__ControlSystem_MS__432VAK_Tank__15",  // VAI 0105 Pos OK
-			   "csms__ControlSystem_MS__432VAK_Tank__24",  // VAO 0095
-			   "csms__ControlSystem_MS__432VAK_Tank__27",  // VAO 0101  
-			   "csms__ControlSystem_MS__432VAK_Tank__6",   // RPI 0098
-			   "csms__ControlSystem_MS__432VAK_Tank__21",  // VAI 0105 Soll
-			   "csms__ControlSystem_MS__432VAK_Tank__33",  // PS-MS Flapper VMO 4110 AUF
-			   "csms__ControlSystem_MS__432VAK_Tank__36"   // PS-MS Flapper VMO 4110 AUF
-			     ),
-		     array(                                  //HV subsystem , index 10
-			   "hv__katrin-hv_rep__0__39",    // MS vessel U_IST
-			   "hv__katrin-hv_rep__0__38",    // MS vessel U_SOLL
-			   "hv__katrin-hv_rep__0__87",    // MS IE Common electrode IST
-			   "hv__katrin-hv_rep__0__86",    // MS IE Common electrode SOLL
-			   "hv__katrin-hv_rep__0__71",    // MS IE dipole west IST
-			   "hv__katrin-hv_rep__0__70",    // MS IE dipole west SOLL
-			   "hv__katrin-hv_rep__0__79",    // MS IE dipole east IST
-			   "hv__katrin-hv_rep__0__78",    // MS IE dipole east SOLL
-			   "hv__katrin-hv_rep__0__63",    // Anti Penning south U ist
-			   "hv__katrin-hv_rep__0__62",    // Anti Penning south U soll
-			   "hv__katrin-hv_rep__0__55",    // Anti Penning north U ist 
-			   "hv__katrin-hv_rep__0__54",    // Anti Penning north U soll
-			   "hv__katrin-hv_rep__0__132",   // dipole relay status 
-			   "hv__katrin-hv_rep__0__131",   // dipole relay status
-			   "hv__katrin-hv_rep__0__95",    // PS vessel IST
-			   "hv__katrin-hv_rep__0__94",    // PS vessel SOLL
-			   "hv__katrin-hv_rep__0__103",   // PS IE1 Ch1A IST
-			   "hv__katrin-hv_rep__0__102",   // PS IE1 Ch1A SOLL
-			   "hv__katrin-hv_rep__0__111",   // PS IE2 Ch1B IST
-			   "hv__katrin-hv_rep__0__110",   // PS IE2 Ch1B SOLL
-			   "hv__katrin-hv_rep__0__119",   // PS IE3 Ch2A IST
-			   "hv__katrin-hv_rep__0__118",   // PS IE3 Ch2A SOLL
-			   "hv__katrin-hv_rep__0__127",   // PS IE4 Ch2B IST
-			   "hv__katrin-hv_rep__0__126",   // PS IE4 Ch2B SOLL
-			   "hv__katrin-hv_rep__0__47",    // MS IE Precision Supply IST
-			   "hv__katrin-hv_rep__0__46",    // MS IE Precision Supply SOLL
-			   "hv__katrin-hv_rep__0__134",   // K35 regulated temperature actual value
-			   "hv__katrin-hv_rep__0__140",   // K65 regulated temperature actual value
-			   "hv__katrin-hv_rep__0__41",    // MS vessel I_IST  (#28)
-			   "hv__katrin-hv_rep__0__165",   // Post regulation PID running flag (#29)
-			   "hv__katrin-hv_rep__0__164",   // Post regulation PID set point (#30)
-			   "hv__katrin-hv_rep__0__162"    // Post regulation triode current (#31)
-			    ),
-		     array(
-			   "hv__katrin-hv_rep__1__3",
-			   "hv__katrin-hv_rep__1__10",
-			   "hv__katrin-hv_rep__1__17",
-			   "hv__katrin-hv_rep__1__24",
-			   "hv__katrin-hv_rep__1__31",
-			   "hv__katrin-hv_rep__1__38",
-			   "hv__katrin-hv_rep__1__45",
-			   "hv__katrin-hv_rep__1__52",
-			   "hv__katrin-hv_rep__1__59",
-			   "hv__katrin-hv_rep__1__66",
-			   "hv__katrin-hv_rep__1__73",
-			   "hv__katrin-hv_rep__1__80",
-			   "hv__katrin-hv_rep__1__87",
-			   "hv__katrin-hv_rep__1__94",
-			   "hv__katrin-hv_rep__1__101",
-			   "hv__katrin-hv_rep__1__108",
-			   "hv__katrin-hv_rep__1__115",
-			   "hv__katrin-hv_rep__1__122",
-			   "hv__katrin-hv_rep__1__129",
-			   "hv__katrin-hv_rep__1__136",
-			   "hv__katrin-hv_rep__1__143",
-			   "hv__katrin-hv_rep__1__150",
-			   "hv__katrin-hv_rep__1__157",
-			   "hv__katrin-hv_rep__1__164"
-			   ),
-		     array(
-			   "hv__katrin-hv_rep__1__2",
-			   "hv__katrin-hv_rep__1__9",
-			   "hv__katrin-hv_rep__1__16",
-			   "hv__katrin-hv_rep__1__23",
-			   "hv__katrin-hv_rep__1__30",
-			   "hv__katrin-hv_rep__1__37",
-			   "hv__katrin-hv_rep__1__44",
-			   "hv__katrin-hv_rep__1__51",
-			   "hv__katrin-hv_rep__1__58",
-			   "hv__katrin-hv_rep__1__65",
-			   "hv__katrin-hv_rep__1__72",
-			   "hv__katrin-hv_rep__1__79",
-			   "hv__katrin-hv_rep__1__86",
-			   "hv__katrin-hv_rep__1__93",
-			   "hv__katrin-hv_rep__1__100",
-			   "hv__katrin-hv_rep__1__107",
-			   "hv__katrin-hv_rep__1__114",
-			   "hv__katrin-hv_rep__1__121",
-			   "hv__katrin-hv_rep__1__128",
-			   "hv__katrin-hv_rep__1__135",
-			   "hv__katrin-hv_rep__1__142",
-			   "hv__katrin-hv_rep__1__149",
-			   "hv__katrin-hv_rep__1__156",
-			   "hv__katrin-hv_rep__1__163"
-			   ),
-		     array(
-			   "hv__katrin-hv_rep__2__3",
-			   "hv__katrin-hv_rep__2__10",
-			   "hv__katrin-hv_rep__2__17",
-			   "hv__katrin-hv_rep__2__24",
-			   "hv__katrin-hv_rep__2__31",
-			   "hv__katrin-hv_rep__2__38",
-			   "hv__katrin-hv_rep__2__45",
-			   "hv__katrin-hv_rep__2__52",
-			   "hv__katrin-hv_rep__2__59",
-			   "hv__katrin-hv_rep__2__66",
-			   "hv__katrin-hv_rep__2__73",
-			   "hv__katrin-hv_rep__2__80",
-			   "hv__katrin-hv_rep__2__87",
-			   "hv__katrin-hv_rep__2__94",
-			   "hv__katrin-hv_rep__2__101",
-			   "hv__katrin-hv_rep__2__108",
-			   "hv__katrin-hv_rep__2__115",
-			   "hv__katrin-hv_rep__2__122",
-			   "hv__katrin-hv_rep__2__129",
-			   "hv__katrin-hv_rep__2__136",
-			   "hv__katrin-hv_rep__2__143",
-			   "hv__katrin-hv_rep__2__150",
-			   "hv__katrin-hv_rep__2__157",
-			   "hv__katrin-hv_rep__2__164"
-			   ),
-		     array(
-			   "hv__katrin-hv_rep__2__2",
-			   "hv__katrin-hv_rep__2__9",
-			   "hv__katrin-hv_rep__2__16",
-			   "hv__katrin-hv_rep__2__23",
-			   "hv__katrin-hv_rep__2__30",
-			   "hv__katrin-hv_rep__2__37",
-			   "hv__katrin-hv_rep__2__44",
-			   "hv__katrin-hv_rep__2__51",
-			   "hv__katrin-hv_rep__2__58",
-			   "hv__katrin-hv_rep__2__65",
-			   "hv__katrin-hv_rep__2__72",
-			   "hv__katrin-hv_rep__2__79",
-			   "hv__katrin-hv_rep__2__86",
-			   "hv__katrin-hv_rep__2__93",
-			   "hv__katrin-hv_rep__2__100",
-			   "hv__katrin-hv_rep__2__107",
-			   "hv__katrin-hv_rep__2__114",
-			   "hv__katrin-hv_rep__2__121",
-			   "hv__katrin-hv_rep__2__128",
-			   "hv__katrin-hv_rep__2__135",
-			   "hv__katrin-hv_rep__2__142",
-			   "hv__katrin-hv_rep__2__149",
-			   "hv__katrin-hv_rep__2__156",
-			   "hv__katrin-hv_rep__2__163"
-			   ),
-		     array(
-			   "csms__ControlSystem_MS__430KRYO_Baffel__111",  // RTP 1081
-			   "csms__ControlSystem_MS__430KRYO_Baffel__123",  // RTP 2081
-			   "csms__ControlSystem_MS__430KRYO_Baffel__135",  // RTP 3081
-			   "csms__ControlSystem_MS__430KRYO_Baffel__147",  // VAI 5411
-			   "csms__ControlSystem_MS__430KRYO_Baffel__153",  // VAI 5421
-			   "csms__ControlSystem_MS__430KRYO_Baffel__159",  // VAI 5431
-			   "csms__ControlSystem_MS__430KRYO_Baffel__84",  // LN2 Tank level, RLY 6102
-			   "csms__ControlSystem_MS__430KRYO_Baffel__87",  // LN2 Tank pressure, RLY 6101
-			   "csms__ControlSystem_MS__430KRYO_Baffel__113"  // RTP1081 time stamp
-			   ),
-		     array(
-			   "precmm0__PrecMagnet__NorthRing__0",
-			   "precmm0__PrecMagnet__NorthRing__1",
-			   "precmm0__PrecMagnet__NorthRing__2",
-			   "precmm0__PrecMagnet__NorthRing__7",
-			   "precmm0__PrecMagnet__NorthRing__8",
-			   "precmm0__PrecMagnet__NorthRing__9",
-			   "precmm0__PrecMagnet__NorthRing__14",
-			   "precmm0__PrecMagnet__NorthRing__15",
-			   "precmm0__PrecMagnet__NorthRing__16",
-			   "precmm0__PrecMagnet__NorthRing__21",
-			   "precmm0__PrecMagnet__NorthRing__22",
-			   "precmm0__PrecMagnet__NorthRing__23"
-			   ),
-		     array(
-			   "precmm0__PrecMagnet__MidRing__0",
-			   "precmm0__PrecMagnet__MidRing__1",
-			   "precmm0__PrecMagnet__MidRing__2",
-			   "precmm0__PrecMagnet__MidRing__7",
-			   "precmm0__PrecMagnet__MidRing__8",
-			   "precmm0__PrecMagnet__MidRing__9",
-			   "precmm0__PrecMagnet__MidRing__14",
-			   "precmm0__PrecMagnet__MidRing__15",
-			   "precmm0__PrecMagnet__MidRing__16",
-			   "precmm0__PrecMagnet__MidRing__21",
-			   "precmm0__PrecMagnet__MidRing__22",
-			   "precmm0__PrecMagnet__MidRing__23",
-			   "precmm0__PrecMagnet__MidRing__28",
-			   "precmm0__PrecMagnet__MidRing__29",
-			   "precmm0__PrecMagnet__MidRing__30",
-			   "precmm0__PrecMagnet__MidRing__35",
-			   "precmm0__PrecMagnet__MidRing__36",
-			   "precmm0__PrecMagnet__MidRing__37"
-			   ),
-		     array(
-			   "precmm0__PrecMagnet__SouthRing__0",
-			   "precmm0__PrecMagnet__SouthRing__1",
-			   "precmm0__PrecMagnet__SouthRing__2",
-			   "precmm0__PrecMagnet__SouthRing__7",
-			   "precmm0__PrecMagnet__SouthRing__8",
-			   "precmm0__PrecMagnet__SouthRing__9",
-			   "precmm0__PrecMagnet__SouthRing__21",
-			   "precmm0__PrecMagnet__SouthRing__22",
-			   "precmm0__PrecMagnet__SouthRing__23",
-			   "precmm0__PrecMagnet__SouthRing__14",
-			   "precmm0__PrecMagnet__SouthRing__15",
-			   "precmm0__PrecMagnet__SouthRing__16"
-			   ),
-		     // FPD status values (index 19)
-		     array(
-			   "fpd__katrin_rep__0__198",
-			   "fpd__katrin_rep__0__199",
-			   "fpd__katrin_rep__0__200",
-			   "fpd__katrin_rep__0__180"   // saphire window at port 0100 temperature
-			   ),
-		     array(
-			   "csms__ControlSystem_MS__435HZ_Temperatur__27",
-			   "csms__ControlSystem_MS__435HZ_Temperatur__33",
-			   "csms__ControlSystem_MS__435HZ_Temperatur__42",
-			   "csms__ControlSystem_MS__435HZ_Temperatur__45"
-			   ),
-		     array(                                  // EMCS+LFCS current set points (index 21)
-			   "aircoils__aircoils_rep__1__2",   //433-ELV-1-0101
-			   "aircoils__aircoils_rep__1__3",   //433-ELV-1-0201
-			   "aircoils__aircoils_rep__1__4",   //433-ELV-1-0301
-			   "aircoils__aircoils_rep__1__5",   //433-ELV-1-0401
-			   "aircoils__aircoils_rep__1__6",   //433-ELV-1-0501
-			   "aircoils__aircoils_rep__1__7",   //433-ELV-1-0601
-			   "aircoils__aircoils_rep__1__8",   //433-ELV-1-0701
-			   "aircoils__aircoils_rep__1__9",   //433-ELV-1-0801
-			   "aircoils__aircoils_rep__1__10",   //433-ELV-1-0901
-			   "aircoils__aircoils_rep__1__11",   //433-ELV-1-1001
-			   "aircoils__aircoils_rep__1__12",   //433-ELV-1-1101
-			   "aircoils__aircoils_rep__1__13",   //433-ELV-1-1201
-			   "aircoils__aircoils_rep__1__14",   //433-ELV-1-1301
-			   "aircoils__aircoils_rep__1__15",   //433-ELV-1-1401
-			   "aircoils__aircoils_rep__1__16",   //433-ELV-1-1501
-			   "aircoils__aircoils_rep__1__17",   //433-ELV-1-1601
-			   "aircoils__aircoils_rep__1__18",   //433-ELV-1-1701
-			   "aircoils__aircoils_rep__1__19",   //433-ELV-1-1801
-			   "aircoils__aircoils_rep__1__20",   //433-ELV-1-1901
-			   "aircoils__aircoils_rep__1__21",   //433-ELV-1-2001
-			   "aircoils__aircoils_rep__1__22",   //433-ELV-1-2101
-			   "aircoils__aircoils_rep__1__23",   //433-ELV-1-2201
-			   ),
-		     array(                                  // all flip box polarity set points
-			   "aircoils__aircoils_rep__1__24",   //433-ELV-1-0101
-			   "aircoils__aircoils_rep__1__25",   //433-ELV-1-0201
-			   "aircoils__aircoils_rep__1__26",   //433-ELV-1-0301
-			   "aircoils__aircoils_rep__1__27",   //433-ELV-1-0401
-			   "aircoils__aircoils_rep__1__28",   //433-ELV-1-0501
-			   "aircoils__aircoils_rep__1__29",   //433-ELV-1-0601
-			   "aircoils__aircoils_rep__1__30",   //433-ELV-1-0701
-			   "aircoils__aircoils_rep__1__31",   //433-ELV-1-0801
-			   "aircoils__aircoils_rep__1__32",   //433-ELV-1-0901
-			   "aircoils__aircoils_rep__1__33",   //433-ELV-1-1001
-			   "aircoils__aircoils_rep__1__34",   //433-ELV-1-1101
-			   "aircoils__aircoils_rep__1__35",   //433-ELV-1-1201
-			   "aircoils__aircoils_rep__1__36",   //433-ELV-1-1301
-			   "aircoils__aircoils_rep__1__37",   //433-ELV-1-1401
-			   "aircoils__aircoils_rep__1__38",   //433-ELV-1-1501
-			   "aircoils__aircoils_rep__1__39",   //433-ELV-1-1601
-			   "aircoils__aircoils_rep__1__40",   //433-ELV-1-1701
-			   "aircoils__aircoils_rep__1__41",   //433-ELV-1-1801
-			   "aircoils__aircoils_rep__1__42",   //433-ELV-1-1901
-			   "aircoils__aircoils_rep__1__43",   //433-ELV-1-2001
-			   "aircoils__aircoils_rep__1__44",   //433-ELV-1-2101
-			   "aircoils__aircoils_rep__1__45",   //433-ELV-1-2201
-			   ),
-		     array(                                   // all flip boxes mask value (for pulsing)
-			   "aircoils__aircoils_rep__1__55",   //433-ELV-1-0101
-			   "aircoils__aircoils_rep__1__56",   //433-ELV-1-0201
-			   "aircoils__aircoils_rep__1__57",   //433-ELV-1-0301
-			   "aircoils__aircoils_rep__1__58",   //433-ELV-1-0401
-			   "aircoils__aircoils_rep__1__59",   //433-ELV-1-0501
-			   "aircoils__aircoils_rep__1__60",   //433-ELV-1-0601
-			   "aircoils__aircoils_rep__1__61",   //433-ELV-1-0701
-			   "aircoils__aircoils_rep__1__62",   //433-ELV-1-0801
-			   "aircoils__aircoils_rep__1__63",   //433-ELV-1-0901
-			   "aircoils__aircoils_rep__1__64",   //433-ELV-1-1001
-			   "aircoils__aircoils_rep__1__65",   //433-ELV-1-1101
-			   "aircoils__aircoils_rep__1__66",   //433-ELV-1-1201
-			   "aircoils__aircoils_rep__1__67",   //433-ELV-1-1301
-			   "aircoils__aircoils_rep__1__68",   //433-ELV-1-1401
-			   "aircoils__aircoils_rep__1__69",   //433-ELV-1-1501
-			   "aircoils__aircoils_rep__1__70",   //433-ELV-1-1601
-			   "aircoils__aircoils_rep__1__71",   //433-ELV-1-1701
-			   "aircoils__aircoils_rep__1__72",   //433-ELV-1-1801
-			   "aircoils__aircoils_rep__1__73",   //433-ELV-1-1901
-			   "aircoils__aircoils_rep__1__74",   //433-ELV-1-2001
-			   "aircoils__aircoils_rep__1__75",   //433-ELV-1-2101
-			   "aircoils__aircoils_rep__1__76",   //433-ELV-1-2201
-			   "aircoils__aircoils_rep__1__50"  // 433-ECB-1-0061-0001 FB mode single/cycle (puls mode on/off)
-			   ),
-		     // CPS current (index 24)
-		     array(
-			   "cscps__ControlSystem_CPS__320_MAG_Stromzufuhr__0"
-			   ) ,
-		     // PP2 TMP temps (index 25)
-		     array(
-			   "csms__ControlSystem_MS__435HZ_PumpPort2__78",
-			   "csms__ControlSystem_MS__435HZ_PumpPort2__81",
-			   "csms__ControlSystem_MS__435HZ_PumpPort2__84"
-			   ),
-		     // PP3 TMP temps (index 26)
-		     array(
-			   "csms__ControlSystem_MS__435HZ_PumpPort3__60",
-			   "csms__ControlSystem_MS__435HZ_PumpPort3__63",
-			   "csms__ControlSystem_MS__435HZ_PumpPort3__66"
-			   ),
-		     // PS vacuum system (index 27)
-		     array(
-			   "csps__ControlSystem_PS__412VAK_PumpPort__30",  // CC1232
-			   "csps__ControlSystem_PS__412VAK_PumpPort__6",   // TMP 1122 speed
-			   "csps__ControlSystem_PS__412VAK_PumpPort__12",  // TMP 1123 speed
-			   "csps__ControlSystem_PS__412VAK_PumpPort__54",  // VAO 1313 ZUST
-			   "csps__ControlSystem_PS__412VAK_PumpPort__57",  // VAO 1314 ZUST
-			   "csps__ControlSystem_PS__412VAK_PumpPort__21",   // Ex1221
-			   "csps__ControlSystem_PS__412VAK_PumpPort__42",   // Gas Inlet 1342 PosOK signal
-			   "csps__ControlSystem_PS__412VAK_PumpPort__45",   // Gas Inlet 1342 Pos setpoint
-			   ),
-		     // MS PP1 vacuum (index 28)
-		     array(
-			   "csms__ControlSystem_MS__432VAK_PumpPort1__0"
-			   ),
-		     // PS Temperatures (index 29)
-		     array(
-			   "csps__ControlSystem_PS__415HZ_Tank__132", //RTP4023
-			   "csps__ControlSystem_PS__415HZ_Tank__138",  //RTP4033
-			   "csps__ControlSystem_PS__415HZ_Tank__144",   //RTP4043
-			   "csps__ControlSystem_PS__415HZ_Tank__150",  // TLK wall			 
-			   "csps__ControlSystem_PS__415HZ_Tank__24",  // RTP3901
-			   "csps__ControlSystem_PS__415HZ_Tank__66",  // RTP3902/3900 NEG Pump Regelsensor
-			   "csps__ControlSystem_PS__415HZ_Tank__69",  // RTP3903 NEG Pump
-			   "csps__ControlSystem_PS__415HZ_Tank__72",  // RTP2904 NEG Pump
-			   "csps__ControlSystem_PS__415HZ_Tank__30",  // RTP3911/3910 NEG Pump Regelsensor
-			   "csps__ControlSystem_PS__415HZ_Tank__75",  // RTP3912 NEG Pump		 
-			   "csps__ControlSystem_PS__415HZ_Tank__78",  // RTP3913 NEG Pump		 
-			   "csps__ControlSystem_PS__415HZ_Tank__81"  // RTP3914 NEG Pump		 
-			   ) ,
-		     // Voltage monitoring K35 etc. (index 30)
-		     array(
-			   "hv__katrin-hv_rep__7__2",  //K35 divider voltage reading
-			   "hv__katrin-hv_rep__7__3",  //K35 divider voltage timestamp
-			   "hv__katrin-hv_rep__7__4",  //K35 divider voltage measurement running
-			   "hv__katrin-hv_rep__7__5",  //K65 divider voltage reading
-			   "hv__katrin-hv_rep__7__6",  //K65 divider voltage timestamp
-			   "hv__katrin-hv_rep__7__7",  //K65 divider voltage measurement running
-			   "hv__katrin-hv_rep__7__8",  //JRL divider voltage reading KAL1, PS
-			   "hv__katrin-hv_rep__7__9",  //JRL divider voltage timestamp KAL1, PS
-			   "hv__katrin-hv_rep__7__10", //JRL divider voltage measurement running
-			   ),
-		     
-		     // Detector Valve and HV grounding interlock (index 31)
-		     array(
-			   "csms__ControlSystem_MS__436HV_Interlook__6",  //CRT-5221 or 522-VAO-1010 clearance, detector gate valve clearence 
-			   "csms__ControlSystem_MS__436HV_Interlook__24"  //MS HV grounding switch position, open or closed
-			   ),
-		     // PS Control System Condition (index 32)
-		     array(
-			   "csps__ControlSystem_PS__410System__0" //PS PCS7 control system condition
-			   ),
-		     // MS Control System Condition (index 33)
-		     array(
-			   "csms__ControlSystem_MS__430System__0"  //MS PCS7 control system condition
-			   ),
-		     // PS LAUDA Temperatures (index 34)
-		     array(
-			   "csps__ControlSystem_PS__415HZ_Oelheizung__0", //LAUDA Ist 5401
-			   "csps__ControlSystem_PS__415HZ_Oelheizung__3" //LAUDA Soll 5401
-			   ),
-		     // MS MoS HV distribution switches (index 35)
-		     array(
-			   "csms__ControlSystem_MS__436HV_Koppeln__0", // HV switch 1101 - MS to MoS line
-			   "csms__ControlSystem_MS__436HV_Koppeln__3", // HV switch 1102 - K65 connection
-			   "csms__ControlSystem_MS__436HV_Koppeln__6", // HV switch 1103 - K35 connection
-			   ), 
-		     // Beamline Instrumentation V4, Detector Valve, Splitring Electrodes (index 36)
-		     array(
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__0",  // 320-VAO-0004 clearance, V4 clearance from SDS 
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__3",  // 320-VAO-0004 position, V4 open or closed
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__60",  // 522-VAO-1010 position, detector gate valve open or closed
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__6",  // 418-EEL-2150 on off value 1 = on
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__9",  // 418-EEL-2150 actual value
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__12", // 418-EEL-2150 polatity 0 = pos
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__15", // 418-EEL-2150 set point value
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__18", // 418-EEL-4150 on off value 1 = on
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__21", // 418-EEL-4150 actual value
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__24", // 418-EEL-4150 polatity 0 = pos
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__27", // 418-EEL-4150 set point value
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__30", // 438-EEL-5150 on off value 1 = on
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__33", // 438-EEL-5150 actual value
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__36", // 438-EEL-5150 polatity 0 = pos
-			   "csbl__ControlSystem_BL__408Beamline_Elektroden__39"  // 438-EEL-5150 set point value
-			   ),
-		     // Precision magnetometer for SAP North Ring (index 37)
-		     array(
-			   "precmm0__PrecMagnet__SAP_NorthRing__0",	//precision sensor (SAP NorthRing, BW) B_x
-			   "precmm0__PrecMagnet__SAP_NorthRing__1",	//precision sensor (SAP NorthRing, BW) B_y
-			   "precmm0__PrecMagnet__SAP_NorthRing__2",	//precision sensor (SAP NorthRing, BW) B_z
-			   "precmm0__PrecMagnet__SAP_NorthRing__3",     //precision sensor (SAP NorthRing, TW) B_x
-			   "precmm0__PrecMagnet__SAP_NorthRing__4",	//precision sensor (SAP NorthRing, TW) B_y
-			   "precmm0__PrecMagnet__SAP_NorthRing__5",	//precision sensor (SAP NorthRing, TW) B_z
-			   "precmm0__PrecMagnet__SAP_NorthRing__6",	//precision sensor (SAP NorthRing, TE) B_x
-			   "precmm0__PrecMagnet__SAP_NorthRing__7",	//precision sensor (SAP NorthRing, TE) B_y
-			   "precmm0__PrecMagnet__SAP_NorthRing__8",	//precision sensor (SAP NorthRing, TE) B_z
-			   "precmm0__PrecMagnet__SAP_NorthRing__9",	//precision sensor (SAP NorthRing, BE) B_x
-			   "precmm0__PrecMagnet__SAP_NorthRing__10",	//precision sensor (SAP NorthRing, BE) B_y
-			   "precmm0__PrecMagnet__SAP_NorthRing__11",	//precision sensor (SAP NorthRing, BE) B_z
-			   "precmm0__PrecMagnet__SAP_NorthRing__12",	//precision sensor (SAP NorthRing, B) B_x
-			   "precmm0__PrecMagnet__SAP_NorthRing__13",	//precision sensor (SAP NorthRing, B) B_y
-			   "precmm0__PrecMagnet__SAP_NorthRing__14"	//precision sensor (SAP NorthRing, B) B_z
-			   ),
-		     // Precision magnetometer for SAP South Ring (index 38)
-		     array(
-			   "precmm0__PrecMagnet__SAP_SouthRing__0",	//precision sensor (SAP SouthRing, BW) B_x
-			   "precmm0__PrecMagnet__SAP_SouthRing__1",	//precision sensor (SAP SouthRing, BW) B_y
-			   "precmm0__PrecMagnet__SAP_SouthRing__2",	//precision sensor (SAP SouthRing, BW) B_z
-			   "precmm0__PrecMagnet__SAP_SouthRing__3",	//precision sensor (SAP SouthRing, TW) B_x
-			   "precmm0__PrecMagnet__SAP_SouthRing__4",	//precision sensor (SAP SouthRing, TW) B_y
-			   "precmm0__PrecMagnet__SAP_SouthRing__5",	//precision sensor (SAP SouthRing, TW) B_z
-			   "precmm0__PrecMagnet__SAP_SouthRing__6",	//precision sensor (SAP SouthRing, TE) B_x
-			   "precmm0__PrecMagnet__SAP_SouthRing__7",	//precision sensor (SAP SouthRing, TE) B_y
-			   "precmm0__PrecMagnet__SAP_SouthRing__8",	//precision sensor (SAP SouthRing, TE) B_z
-			   "precmm0__PrecMagnet__SAP_SouthRing__9",	//precision sensor (SAP SouthRing, BE) B_x
-			   "precmm0__PrecMagnet__SAP_SouthRing__10",	//precision sensor (SAP SouthRing, BE) B_y
-			   "precmm0__PrecMagnet__SAP_SouthRing__11"	//precision sensor (SAP SouthRing, BE) B_z
-			   ),
-		     // status of PS ion monitor (index 39)
-		     array(
-			   "cspsionen__PS_Ionen__Amperemeter1__0",	//418-REI-0-10-01 measured mean value of ion monitor current
-			   "cspsionen__PS_Ionen__Amperemeter1__5"	//418-REI-0-10-06 lock status of ion monitoring alarm (0=armed, 1=off)
-			   ),		     
-		     // B460 OPUS weather stations at PS (index 40)
-		     array(
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__0",	//415-RTY-0-9111-0001 PS weather station temperatuer in C
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__1",	//415-RTY-0-9111-0002 PS weather station temperature in F
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__2",	//415-RTY-0-9111-0003 PS weather station dew point in C
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__3",	//415-RTY-0-9111-0004 PS weather station dew point in F
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__4",	//415-RTY-0-9112-0001 PS weather station rel humidity in %
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__5",	//415-RTY-0-9112-0002 PS weather station rel humidity in g/m3
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__6",	//415-RTY-0-9113-0001 PS weather station abs pressure in hPa
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__7",	//415-RTY-0-9113-0002 PS weather station rel presuure in hPa
-			   "weather__Opus_WeatherStations__415OWS_PS_platform__8"	//415-RTY-0-9114-0001 PS weather station voltage in V
-			   ),	     
-		     // B460 OPUS weather stations at DET (index 41)
-		     array(
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__0",	//435-RTY-0-9121-0001 DET weather station temperatuer in C
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__1",	//435-RTY-0-9121-0002 DET weather station temperature in F
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__2",	//435-RTY-0-9121-0003 DET weather station dew point in C
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__3",	//435-RTY-0-9121-0004 DET weather station dew point in F
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__4",	//435-RTY-0-9122-0001 DET weather station rel humidity in %
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__5",	//435-RTY-0-9122-0002 DET weather station rel humidity in g/m3
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__6",	//435-RTY-0-9123-0001 DET weather station abs pressure in hPa
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__7",	//435-RTY-0-9123-0002 DET weather station rel presuure in hPa
-			   "weather__Opus_WeatherStations__435OWS_DET_platform__8"	//435-RTY-0-9124-0001 DET weather station voltage in V
-			   ),	     
-		     // B460 OPUS weather stations at HV cage (index 42)
-		     array(
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__0",	//435-RTY-0-9111-0001 HV weather station temperatuer in C
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__1",	//435-RTY-0-9111-0002 HV weather station temperature in F
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__2",	//435-RTY-0-9111-0003 HV weather station dew point in C
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__3",	//435-RTY-0-9111-0004 HV weather station dew point in F
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__4",	//435-RTY-0-9112-0001 HV weather station rel humidity in %
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__5",	//435-RTY-0-9112-0002 HV weather station rel humidity in g/m3
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__6",	//435-RTY-0-9113-0001 HV weather station abs pressure in hPa
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__7",	//435-RTY-0-9113-0002 HV weather station rel presuure in hPa
-			   "weather__Opus_WeatherStations__435OWS_HV_cage__8"	//435-RTY-0-9114-0001 HV weather station voltage in V
-			   ),	     
-		     // B460 OPUS weather stations at MS bottom (index 43)
-		     array(
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__0",	//435-RTY-0-9131-0001 MS_bottom weather station temperatuer in C
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__1",	//435-RTY-0-9131-0002 MS_bottom weather station temperature in F
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__2",	//435-RTY-0-9131-0003 MS_bottom weather station dew point in C
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__3",	//435-RTY-0-9131-0004 MS_bottom weather station dew point in F
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__4",	//435-RTY-0-9132-0001 MS_bottom weather station rel humidity in %
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__5",	//435-RTY-0-9132-0002 MS_bottom weather station rel humidity in g/m3
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__6",	//435-RTY-0-9133-0001 MS_bottom weather station abs pressure in hPa
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__7",	//435-RTY-0-9133-0002 MS_bottom weather station rel presuure in hPa
-			   "weather__Opus_WeatherStations__435OWS_MS_bottom__8"	        //435-RTY-0-9134-0001 MS_bottom weather station voltage in V
-			   ),	     
-		     // B460 OPUS weather stations at MS top (index 44)
-		     array(
-			   "weather__Opus_WeatherStations__435OWS_MS_top__0",	//435-RTY-0-9141-0001 MS_top weather station temperatuer in C
-			   "weather__Opus_WeatherStations__435OWS_MS_top__1",	//435-RTY-0-9141-0002 MS_top weather station temperature in F
-			   "weather__Opus_WeatherStations__435OWS_MS_top__2",	//435-RTY-0-9141-0003 MS_top weather station dew point in C
-			   "weather__Opus_WeatherStations__435OWS_MS_top__3",	//435-RTY-0-9141-0004 MS_top weather station dew point in F
-			   "weather__Opus_WeatherStations__435OWS_MS_top__4",	//435-RTY-0-9142-0001 MS_top weather station rel humidity in %
-			   "weather__Opus_WeatherStations__435OWS_MS_top__5",	//435-RTY-0-9142-0002 MS_top weather station rel humidity in g/m3
-			   "weather__Opus_WeatherStations__435OWS_MS_top__6",	//435-RTY-0-9143-0001 MS_top weather station abs pressure in hPa
-			   "weather__Opus_WeatherStations__435OWS_MS_top__7",	//435-RTY-0-9143-0002 MS_top weather station rel presuure in hPa
-			   "weather__Opus_WeatherStations__435OWS_MS_top__8"	//435-RTY-0-9144-0001 MS_top weather station voltage in V
-			   ),	     
-		     // B461 OPUS weather stations (index 45)
-		     array(
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__0",	//445-RTY-0-9111-0001 MoS_general weather station temperatuer in C
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__1",	//445-RTY-0-9111-0002 MoS_general weather station temperature in F
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__2",	//445-RTY-0-9111-0003 MoS_general weather station dew point in C
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__3",	//445-RTY-0-9111-0004 MoS_general weather station dew point in F
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__4",	//445-RTY-0-9112-0001 MoS_general weather station rel humidity in %
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__5",	//445-RTY-0-9112-0002 MoS_general weather station rel humidity in g/m3
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__6",	//445-RTY-0-9113-0001 MoS_general weather station abs pressure in hPa
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__7",	//445-RTY-0-9113-0002 MoS_general weather station rel presuure in hPa
-			   "weather__Opus_WeatherStations__445OWS_MoS_general__8"	//445-RTY-0-9114-0001 MoS_general weather station voltage in V
-			   )
-		     );
+    array( //EMCS+LFCS currents
+        "aircoils__aircoils_rep__0__2", //433-ELV-1-0101
+        "aircoils__aircoils_rep__0__3", //433-ELV-1-0201
+        "aircoils__aircoils_rep__0__4", //433-ELV-1-0301
+        "aircoils__aircoils_rep__0__5", //433-ELV-1-0401
+        "aircoils__aircoils_rep__0__6", //433-ELV-1-0501
+        "aircoils__aircoils_rep__0__7", //433-ELV-1-0601
+        "aircoils__aircoils_rep__0__8", //433-ELV-1-0701
+        "aircoils__aircoils_rep__0__9", //433-ELV-1-0801
+        "aircoils__aircoils_rep__0__10", //433-ELV-1-0901
+        "aircoils__aircoils_rep__0__11", //433-ELV-1-1001
+        "aircoils__aircoils_rep__0__12", //433-ELV-1-1101
+        "aircoils__aircoils_rep__0__13", //433-ELV-1-1201
+        "aircoils__aircoils_rep__0__14", //433-ELV-1-1301
+        "aircoils__aircoils_rep__0__15", //433-ELV-1-1401
+        "aircoils__aircoils_rep__0__16", //433-ELV-1-1501
+        "aircoils__aircoils_rep__0__17", //433-ELV-1-1601
+        "aircoils__aircoils_rep__0__18", //433-ELV-1-1701
+        "aircoils__aircoils_rep__0__19", //433-ELV-1-1801
+        "aircoils__aircoils_rep__0__20", //433-ELV-1-1901
+        "aircoils__aircoils_rep__0__21", //433-ELV-1-2001
+        "aircoils__aircoils_rep__0__22", //433-ELV-1-2101
+        "aircoils__aircoils_rep__0__23"
+        //433-ELV-1-2201
 
-?>
+    ) ,
+    array( //EMCS+LFCS Voltages
+        "aircoils__aircoils_rep__0__24", //433-ELV-1-0101
+        "aircoils__aircoils_rep__0__25", //433-ELV-1-0201
+        "aircoils__aircoils_rep__0__26", //433-ELV-1-0301
+        "aircoils__aircoils_rep__0__27", //433-ELV-1-0401
+        "aircoils__aircoils_rep__0__28", //433-ELV-1-0501
+        "aircoils__aircoils_rep__0__29", //433-ELV-1-0601
+        "aircoils__aircoils_rep__0__30", //433-ELV-1-0701
+        "aircoils__aircoils_rep__0__31", //433-ELV-1-0801
+        "aircoils__aircoils_rep__0__32", //433-ELV-1-0901
+        "aircoils__aircoils_rep__0__33", //433-ELV-1-1001
+        "aircoils__aircoils_rep__0__34", //433-ELV-1-1101
+        "aircoils__aircoils_rep__0__35", //433-ELV-1-1201
+        "aircoils__aircoils_rep__0__36", //433-ELV-1-1301
+        "aircoils__aircoils_rep__0__37", //433-ELV-1-1401
+        "aircoils__aircoils_rep__0__38", //433-ELV-1-1501
+        "aircoils__aircoils_rep__0__39", //433-ELV-1-1601
+        "aircoils__aircoils_rep__0__40", //433-ELV-1-1701
+        "aircoils__aircoils_rep__0__41", //433-ELV-1-1801
+        "aircoils__aircoils_rep__0__42", //433-ELV-1-1901
+        "aircoils__aircoils_rep__0__43", //433-ELV-1-2001
+        "aircoils__aircoils_rep__0__44", //433-ELV-1-2101
+        "aircoils__aircoils_rep__0__45"
+        //433-ELV-1-2201
+
+    ) ,
+    array( // LEM Status all coils
+        "aircoils__aircoils_rep__0__116", //433-ELV-1-0101
+        "aircoils__aircoils_rep__0__117", //433-ELV-1-0201
+        "aircoils__aircoils_rep__0__118", //433-ELV-1-0301
+        "aircoils__aircoils_rep__0__119", //433-ELV-1-0401
+        "aircoils__aircoils_rep__0__120", //433-ELV-1-0501
+        "aircoils__aircoils_rep__0__121", //433-ELV-1-0601
+        "aircoils__aircoils_rep__0__122", //433-ELV-1-0701
+        "aircoils__aircoils_rep__0__123", //433-ELV-1-0801
+        "aircoils__aircoils_rep__0__124", //433-ELV-1-0901
+        "aircoils__aircoils_rep__0__125", //433-ELV-1-1001
+        "aircoils__aircoils_rep__0__126", //433-ELV-1-1101
+        "aircoils__aircoils_rep__0__127", //433-ELV-1-1201
+        "aircoils__aircoils_rep__0__128", //433-ELV-1-1301
+        "aircoils__aircoils_rep__0__129", //433-ELV-1-1401
+        "aircoils__aircoils_rep__0__130", //433-ELV-1-1501
+        "aircoils__aircoils_rep__0__131", //433-ELV-1-1601
+        "aircoils__aircoils_rep__0__132", //433-ELV-1-1701
+        "aircoils__aircoils_rep__0__133", //433-ELV-1-1801
+        "aircoils__aircoils_rep__0__134", //433-ELV-1-1901
+        "aircoils__aircoils_rep__0__135", //433-ELV-1-2001
+        "aircoils__aircoils_rep__0__136", //433-ELV-1-2101
+        "aircoils__aircoils_rep__0__137", //433-ELV-1-2201
+        "aircoils__aircoils_rep__0__138"
+        // HV dipole trigger status
+
+    ) ,
+    array(
+        "aircoils__aircoils_rep__0__112", //PS1 + PS2 current
+        "aircoils__aircoils_rep__0__113",
+        "aircoils__aircoils_rep__0__114", //PS1 + PS2 Status
+        "aircoils__aircoils_rep__0__115"
+    ) ,
+    array(
+        "fpd__katrin_rep__0__153",
+        "fpd__katrin_rep__0__158"
+    ) ,
+    // Baffle vacuum  (index 5, former egun part)
+    array(
+        "csms__ControlSystem_MS__432VAK_Kryoleitung__9"
+    ) ,
+    array(
+        "fpd__katrin_rep__0__43",
+        "fpd__katrin_rep__0__66",
+        "fpd__katrin_rep__0__80",
+        "fpd__katrin_rep__0__99",
+        "fpd__katrin_rep__0__112",
+        "fpd__katrin_rep__0__113",
+        "fpd__katrin_rep__0__116",
+        "fpd__katrin_rep__0__117",
+        "fpd__katrin_rep__0__118",
+        "fpd__katrin_rep__0__60",
+        "fpd__katrin_rep__0__62",
+        "fpd__katrin_rep__0__114",
+        "fpd__katrin_rep__0__45"
+    ) ,
+    array(
+        "csms__ControlSystem_MS__432VAK_PumpPort2__33",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__6",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__12",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__18",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__57",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__60",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__63",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__36",
+        "csms__ControlSystem_MS__432VAK_PumpPort2__29"
+        // time stamp for RPH-2330 as general vacuum time stamp
+
+    ) ,
+    array(
+        "csms__ControlSystem_MS__432VAK_PumpPort3__24",
+        "csms__ControlSystem_MS__432VAK_PumpPort3__6",
+        "csms__ControlSystem_MS__432VAK_PumpPort3__12",
+        "csms__ControlSystem_MS__432VAK_PumpPort3__18",
+        "csms__ControlSystem_MS__432VAK_PumpPort3__42",
+        "csms__ControlSystem_MS__432VAK_PumpPort3__45",
+        "csms__ControlSystem_MS__432VAK_PumpPort3__48"
+    ) ,
+    array( // index 9, vacuum MS tank
+        "csms__ControlSystem_MS__432VAK_Tank__9", // RPM 0106
+        "csms__ControlSystem_MS__432VAK_Tank__12", // RPV 0220
+        "csms__ControlSystem_MS__432VAK_Tank__3", // RPI 0096
+        "csms__ControlSystem_MS__432VAK_Tank__15", // VAI 0105 Pos OK
+        "csms__ControlSystem_MS__432VAK_Tank__24", // VAO 0095
+        "csms__ControlSystem_MS__432VAK_Tank__27", // VAO 0101
+        "csms__ControlSystem_MS__432VAK_Tank__6", // RPI 0098
+        "csms__ControlSystem_MS__432VAK_Tank__21", // VAI 0105 Soll
+        "csms__ControlSystem_MS__432VAK_Tank__33", // PS-MS Flapper VMO 4110 AUF
+        "csms__ControlSystem_MS__432VAK_Tank__36"
+        // PS-MS Flapper VMO 4110 AUF
+
+    ) ,
+    array( //HV subsystem , index 10
+        "hv__katrin-hv_rep__0__39", // MS vessel U_IST
+        "hv__katrin-hv_rep__0__38", // MS vessel U_SOLL
+        "hv__katrin-hv_rep__0__87", // MS IE Common electrode IST
+        "hv__katrin-hv_rep__0__86", // MS IE Common electrode SOLL
+        "hv__katrin-hv_rep__0__71", // MS IE dipole west IST
+        "hv__katrin-hv_rep__0__70", // MS IE dipole west SOLL
+        "hv__katrin-hv_rep__0__79", // MS IE dipole east IST
+        "hv__katrin-hv_rep__0__78", // MS IE dipole east SOLL
+        "hv__katrin-hv_rep__0__63", // Anti Penning south U ist
+        "hv__katrin-hv_rep__0__62", // Anti Penning south U soll
+        "hv__katrin-hv_rep__0__55", // Anti Penning north U ist
+        "hv__katrin-hv_rep__0__54", // Anti Penning north U soll
+        "hv__katrin-hv_rep__0__132", // dipole relay status
+        "hv__katrin-hv_rep__0__131", // dipole relay status
+        "hv__katrin-hv_rep__0__95", // PS vessel IST
+        "hv__katrin-hv_rep__0__94", // PS vessel SOLL
+        "hv__katrin-hv_rep__0__103", // PS IE1 Ch1A IST
+        "hv__katrin-hv_rep__0__102", // PS IE1 Ch1A SOLL
+        "hv__katrin-hv_rep__0__111", // PS IE2 Ch1B IST
+        "hv__katrin-hv_rep__0__110", // PS IE2 Ch1B SOLL
+        "hv__katrin-hv_rep__0__119", // PS IE3 Ch2A IST
+        "hv__katrin-hv_rep__0__118", // PS IE3 Ch2A SOLL
+        "hv__katrin-hv_rep__0__127", // PS IE4 Ch2B IST
+        "hv__katrin-hv_rep__0__126", // PS IE4 Ch2B SOLL
+        "hv__katrin-hv_rep__0__47", // MS IE Precision Supply IST
+        "hv__katrin-hv_rep__0__46", // MS IE Precision Supply SOLL
+        "hv__katrin-hv_rep__0__134", // K35 regulated temperature actual value
+        "hv__katrin-hv_rep__0__140", // K65 regulated temperature actual value
+        "hv__katrin-hv_rep__0__41", // MS vessel I_IST  (#28)
+        "hv__katrin-hv_rep__0__165", // Post regulation PID running flag (#29)
+        "hv__katrin-hv_rep__0__164", // Post regulation PID set point (#30)
+        "hv__katrin-hv_rep__0__162"
+        // Post regulation triode current (#31)
+
+    ) ,
+    array(
+        "hv__katrin-hv_rep__1__3",
+        "hv__katrin-hv_rep__1__10",
+        "hv__katrin-hv_rep__1__17",
+        "hv__katrin-hv_rep__1__24",
+        "hv__katrin-hv_rep__1__31",
+        "hv__katrin-hv_rep__1__38",
+        "hv__katrin-hv_rep__1__45",
+        "hv__katrin-hv_rep__1__52",
+        "hv__katrin-hv_rep__1__59",
+        "hv__katrin-hv_rep__1__66",
+        "hv__katrin-hv_rep__1__73",
+        "hv__katrin-hv_rep__1__80",
+        "hv__katrin-hv_rep__1__87",
+        "hv__katrin-hv_rep__1__94",
+        "hv__katrin-hv_rep__1__101",
+        "hv__katrin-hv_rep__1__108",
+        "hv__katrin-hv_rep__1__115",
+        "hv__katrin-hv_rep__1__122",
+        "hv__katrin-hv_rep__1__129",
+        "hv__katrin-hv_rep__1__136",
+        "hv__katrin-hv_rep__1__143",
+        "hv__katrin-hv_rep__1__150",
+        "hv__katrin-hv_rep__1__157",
+        "hv__katrin-hv_rep__1__164"
+    ) ,
+    array(
+        "hv__katrin-hv_rep__1__2",
+        "hv__katrin-hv_rep__1__9",
+        "hv__katrin-hv_rep__1__16",
+        "hv__katrin-hv_rep__1__23",
+        "hv__katrin-hv_rep__1__30",
+        "hv__katrin-hv_rep__1__37",
+        "hv__katrin-hv_rep__1__44",
+        "hv__katrin-hv_rep__1__51",
+        "hv__katrin-hv_rep__1__58",
+        "hv__katrin-hv_rep__1__65",
+        "hv__katrin-hv_rep__1__72",
+        "hv__katrin-hv_rep__1__79",
+        "hv__katrin-hv_rep__1__86",
+        "hv__katrin-hv_rep__1__93",
+        "hv__katrin-hv_rep__1__100",
+        "hv__katrin-hv_rep__1__107",
+        "hv__katrin-hv_rep__1__114",
+        "hv__katrin-hv_rep__1__121",
+        "hv__katrin-hv_rep__1__128",
+        "hv__katrin-hv_rep__1__135",
+        "hv__katrin-hv_rep__1__142",
+        "hv__katrin-hv_rep__1__149",
+        "hv__katrin-hv_rep__1__156",
+        "hv__katrin-hv_rep__1__163"
+    ) ,
+    array(
+        "hv__katrin-hv_rep__2__3",
+        "hv__katrin-hv_rep__2__10",
+        "hv__katrin-hv_rep__2__17",
+        "hv__katrin-hv_rep__2__24",
+        "hv__katrin-hv_rep__2__31",
+        "hv__katrin-hv_rep__2__38",
+        "hv__katrin-hv_rep__2__45",
+        "hv__katrin-hv_rep__2__52",
+        "hv__katrin-hv_rep__2__59",
+        "hv__katrin-hv_rep__2__66",
+        "hv__katrin-hv_rep__2__73",
+        "hv__katrin-hv_rep__2__80",
+        "hv__katrin-hv_rep__2__87",
+        "hv__katrin-hv_rep__2__94",
+        "hv__katrin-hv_rep__2__101",
+        "hv__katrin-hv_rep__2__108",
+        "hv__katrin-hv_rep__2__115",
+        "hv__katrin-hv_rep__2__122",
+        "hv__katrin-hv_rep__2__129",
+        "hv__katrin-hv_rep__2__136",
+        "hv__katrin-hv_rep__2__143",
+        "hv__katrin-hv_rep__2__150",
+        "hv__katrin-hv_rep__2__157",
+        "hv__katrin-hv_rep__2__164"
+    ) ,
+    array(
+        "hv__katrin-hv_rep__2__2",
+        "hv__katrin-hv_rep__2__9",
+        "hv__katrin-hv_rep__2__16",
+        "hv__katrin-hv_rep__2__23",
+        "hv__katrin-hv_rep__2__30",
+        "hv__katrin-hv_rep__2__37",
+        "hv__katrin-hv_rep__2__44",
+        "hv__katrin-hv_rep__2__51",
+        "hv__katrin-hv_rep__2__58",
+        "hv__katrin-hv_rep__2__65",
+        "hv__katrin-hv_rep__2__72",
+        "hv__katrin-hv_rep__2__79",
+        "hv__katrin-hv_rep__2__86",
+        "hv__katrin-hv_rep__2__93",
+        "hv__katrin-hv_rep__2__100",
+        "hv__katrin-hv_rep__2__107",
+        "hv__katrin-hv_rep__2__114",
+        "hv__katrin-hv_rep__2__121",
+        "hv__katrin-hv_rep__2__128",
+        "hv__katrin-hv_rep__2__135",
+        "hv__katrin-hv_rep__2__142",
+        "hv__katrin-hv_rep__2__149",
+        "hv__katrin-hv_rep__2__156",
+        "hv__katrin-hv_rep__2__163"
+    ) ,
+    array(
+        "csms__ControlSystem_MS__430KRYO_Baffel__111", // RTP 1081
+        "csms__ControlSystem_MS__430KRYO_Baffel__123", // RTP 2081
+        "csms__ControlSystem_MS__430KRYO_Baffel__135", // RTP 3081
+        "csms__ControlSystem_MS__430KRYO_Baffel__147", // VAI 5411
+        "csms__ControlSystem_MS__430KRYO_Baffel__153", // VAI 5421
+        "csms__ControlSystem_MS__430KRYO_Baffel__159", // VAI 5431
+        "csms__ControlSystem_MS__430KRYO_Baffel__84", // LN2 Tank level, RLY 6102
+        "csms__ControlSystem_MS__430KRYO_Baffel__87", // LN2 Tank pressure, RLY 6101
+        "csms__ControlSystem_MS__430KRYO_Baffel__113"
+        // RTP1081 time stamp
+
+    ) ,
+    array(
+        "precmm0__PrecMagnet__NorthRing__0",
+        "precmm0__PrecMagnet__NorthRing__1",
+        "precmm0__PrecMagnet__NorthRing__2",
+        "precmm0__PrecMagnet__NorthRing__7",
+        "precmm0__PrecMagnet__NorthRing__8",
+        "precmm0__PrecMagnet__NorthRing__9",
+        "precmm0__PrecMagnet__NorthRing__14",
+        "precmm0__PrecMagnet__NorthRing__15",
+        "precmm0__PrecMagnet__NorthRing__16",
+        "precmm0__PrecMagnet__NorthRing__21",
+        "precmm0__PrecMagnet__NorthRing__22",
+        "precmm0__PrecMagnet__NorthRing__23"
+    ) ,
+    array(
+        "precmm0__PrecMagnet__MidRing__0",
+        "precmm0__PrecMagnet__MidRing__1",
+        "precmm0__PrecMagnet__MidRing__2",
+        "precmm0__PrecMagnet__MidRing__7",
+        "precmm0__PrecMagnet__MidRing__8",
+        "precmm0__PrecMagnet__MidRing__9",
+        "precmm0__PrecMagnet__MidRing__14",
+        "precmm0__PrecMagnet__MidRing__15",
+        "precmm0__PrecMagnet__MidRing__16",
+        "precmm0__PrecMagnet__MidRing__21",
+        "precmm0__PrecMagnet__MidRing__22",
+        "precmm0__PrecMagnet__MidRing__23",
+        "precmm0__PrecMagnet__MidRing__28",
+        "precmm0__PrecMagnet__MidRing__29",
+        "precmm0__PrecMagnet__MidRing__30",
+        "precmm0__PrecMagnet__MidRing__35",
+        "precmm0__PrecMagnet__MidRing__36",
+        "precmm0__PrecMagnet__MidRing__37"
+    ) ,
+    array(
+        "precmm0__PrecMagnet__SouthRing__0",
+        "precmm0__PrecMagnet__SouthRing__1",
+        "precmm0__PrecMagnet__SouthRing__2",
+        "precmm0__PrecMagnet__SouthRing__7",
+        "precmm0__PrecMagnet__SouthRing__8",
+        "precmm0__PrecMagnet__SouthRing__9",
+        "precmm0__PrecMagnet__SouthRing__21",
+        "precmm0__PrecMagnet__SouthRing__22",
+        "precmm0__PrecMagnet__SouthRing__23",
+        "precmm0__PrecMagnet__SouthRing__14",
+        "precmm0__PrecMagnet__SouthRing__15",
+        "precmm0__PrecMagnet__SouthRing__16"
+    ) ,
+    // FPD status values (index 19)
+    array(
+        "fpd__katrin_rep__0__198",
+        "fpd__katrin_rep__0__199",
+        "fpd__katrin_rep__0__200",
+        "fpd__katrin_rep__0__180"
+        // saphire window at port 0100 temperature
+
+    ) ,
+    array(
+        "csms__ControlSystem_MS__435HZ_Temperatur__27",
+        "csms__ControlSystem_MS__435HZ_Temperatur__33",
+        "csms__ControlSystem_MS__435HZ_Temperatur__42",
+        "csms__ControlSystem_MS__435HZ_Temperatur__45"
+    ) ,
+    array( // EMCS+LFCS current set points (index 21)
+        "aircoils__aircoils_rep__1__2", //433-ELV-1-0101
+        "aircoils__aircoils_rep__1__3", //433-ELV-1-0201
+        "aircoils__aircoils_rep__1__4", //433-ELV-1-0301
+        "aircoils__aircoils_rep__1__5", //433-ELV-1-0401
+        "aircoils__aircoils_rep__1__6", //433-ELV-1-0501
+        "aircoils__aircoils_rep__1__7", //433-ELV-1-0601
+        "aircoils__aircoils_rep__1__8", //433-ELV-1-0701
+        "aircoils__aircoils_rep__1__9", //433-ELV-1-0801
+        "aircoils__aircoils_rep__1__10", //433-ELV-1-0901
+        "aircoils__aircoils_rep__1__11", //433-ELV-1-1001
+        "aircoils__aircoils_rep__1__12", //433-ELV-1-1101
+        "aircoils__aircoils_rep__1__13", //433-ELV-1-1201
+        "aircoils__aircoils_rep__1__14", //433-ELV-1-1301
+        "aircoils__aircoils_rep__1__15", //433-ELV-1-1401
+        "aircoils__aircoils_rep__1__16", //433-ELV-1-1501
+        "aircoils__aircoils_rep__1__17", //433-ELV-1-1601
+        "aircoils__aircoils_rep__1__18", //433-ELV-1-1701
+        "aircoils__aircoils_rep__1__19", //433-ELV-1-1801
+        "aircoils__aircoils_rep__1__20", //433-ELV-1-1901
+        "aircoils__aircoils_rep__1__21", //433-ELV-1-2001
+        "aircoils__aircoils_rep__1__22", //433-ELV-1-2101
+        "aircoils__aircoils_rep__1__23", //433-ELV-1-2201
+
+    ) ,
+    array( // all flip box polarity set points
+        "aircoils__aircoils_rep__1__24", //433-ELV-1-0101
+        "aircoils__aircoils_rep__1__25", //433-ELV-1-0201
+        "aircoils__aircoils_rep__1__26", //433-ELV-1-0301
+        "aircoils__aircoils_rep__1__27", //433-ELV-1-0401
+        "aircoils__aircoils_rep__1__28", //433-ELV-1-0501
+        "aircoils__aircoils_rep__1__29", //433-ELV-1-0601
+        "aircoils__aircoils_rep__1__30", //433-ELV-1-0701
+        "aircoils__aircoils_rep__1__31", //433-ELV-1-0801
+        "aircoils__aircoils_rep__1__32", //433-ELV-1-0901
+        "aircoils__aircoils_rep__1__33", //433-ELV-1-1001
+        "aircoils__aircoils_rep__1__34", //433-ELV-1-1101
+        "aircoils__aircoils_rep__1__35", //433-ELV-1-1201
+        "aircoils__aircoils_rep__1__36", //433-ELV-1-1301
+        "aircoils__aircoils_rep__1__37", //433-ELV-1-1401
+        "aircoils__aircoils_rep__1__38", //433-ELV-1-1501
+        "aircoils__aircoils_rep__1__39", //433-ELV-1-1601
+        "aircoils__aircoils_rep__1__40", //433-ELV-1-1701
+        "aircoils__aircoils_rep__1__41", //433-ELV-1-1801
+        "aircoils__aircoils_rep__1__42", //433-ELV-1-1901
+        "aircoils__aircoils_rep__1__43", //433-ELV-1-2001
+        "aircoils__aircoils_rep__1__44", //433-ELV-1-2101
+        "aircoils__aircoils_rep__1__45", //433-ELV-1-2201
+
+    ) ,
+    array( // all flip boxes mask value (for pulsing)
+        "aircoils__aircoils_rep__1__55", //433-ELV-1-0101
+        "aircoils__aircoils_rep__1__56", //433-ELV-1-0201
+        "aircoils__aircoils_rep__1__57", //433-ELV-1-0301
+        "aircoils__aircoils_rep__1__58", //433-ELV-1-0401
+        "aircoils__aircoils_rep__1__59", //433-ELV-1-0501
+        "aircoils__aircoils_rep__1__60", //433-ELV-1-0601
+        "aircoils__aircoils_rep__1__61", //433-ELV-1-0701
+        "aircoils__aircoils_rep__1__62", //433-ELV-1-0801
+        "aircoils__aircoils_rep__1__63", //433-ELV-1-0901
+        "aircoils__aircoils_rep__1__64", //433-ELV-1-1001
+        "aircoils__aircoils_rep__1__65", //433-ELV-1-1101
+        "aircoils__aircoils_rep__1__66", //433-ELV-1-1201
+        "aircoils__aircoils_rep__1__67", //433-ELV-1-1301
+        "aircoils__aircoils_rep__1__68", //433-ELV-1-1401
+        "aircoils__aircoils_rep__1__69", //433-ELV-1-1501
+        "aircoils__aircoils_rep__1__70", //433-ELV-1-1601
+        "aircoils__aircoils_rep__1__71", //433-ELV-1-1701
+        "aircoils__aircoils_rep__1__72", //433-ELV-1-1801
+        "aircoils__aircoils_rep__1__73", //433-ELV-1-1901
+        "aircoils__aircoils_rep__1__74", //433-ELV-1-2001
+        "aircoils__aircoils_rep__1__75", //433-ELV-1-2101
+        "aircoils__aircoils_rep__1__76", //433-ELV-1-2201
+        "aircoils__aircoils_rep__1__50"
+        // 433-ECB-1-0061-0001 FB mode single/cycle (puls mode on/off)
+
+    ) ,
+    // CPS current (index 24)
+    array(
+        "cscps__ControlSystem_CPS__320_MAG_Stromzufuhr__0"
+    ) ,
+    // PP2 TMP temps (index 25)
+    array(
+        "csms__ControlSystem_MS__435HZ_PumpPort2__78",
+        "csms__ControlSystem_MS__435HZ_PumpPort2__81",
+        "csms__ControlSystem_MS__435HZ_PumpPort2__84"
+    ) ,
+    // PP3 TMP temps (index 26)
+    array(
+        "csms__ControlSystem_MS__435HZ_PumpPort3__60",
+        "csms__ControlSystem_MS__435HZ_PumpPort3__63",
+        "csms__ControlSystem_MS__435HZ_PumpPort3__66"
+    ) ,
+    // PS vacuum system (index 27)
+    array(
+        "csps__ControlSystem_PS__412VAK_PumpPort__30", // CC1232
+        "csps__ControlSystem_PS__412VAK_PumpPort__6", // TMP 1122 speed
+        "csps__ControlSystem_PS__412VAK_PumpPort__12", // TMP 1123 speed
+        "csps__ControlSystem_PS__412VAK_PumpPort__54", // VAO 1313 ZUST
+        "csps__ControlSystem_PS__412VAK_PumpPort__57", // VAO 1314 ZUST
+        "csps__ControlSystem_PS__412VAK_PumpPort__21", // Ex1221
+        "csps__ControlSystem_PS__412VAK_PumpPort__42", // Gas Inlet 1342 PosOK signal
+        "csps__ControlSystem_PS__412VAK_PumpPort__45", // Gas Inlet 1342 Pos setpoint
+
+    ) ,
+    // MS PP1 vacuum (index 28)
+    array(
+        "csms__ControlSystem_MS__432VAK_PumpPort1__0"
+    ) ,
+    // PS Temperatures (index 29)
+    array(
+        "csps__ControlSystem_PS__415HZ_Tank__132", //RTP4023
+        "csps__ControlSystem_PS__415HZ_Tank__138", //RTP4033
+        "csps__ControlSystem_PS__415HZ_Tank__144", //RTP4043
+        "csps__ControlSystem_PS__415HZ_Tank__150", // TLK wall
+        "csps__ControlSystem_PS__415HZ_Tank__24", // RTP3901
+        "csps__ControlSystem_PS__415HZ_Tank__66", // RTP3902/3900 NEG Pump Regelsensor
+        "csps__ControlSystem_PS__415HZ_Tank__69", // RTP3903 NEG Pump
+        "csps__ControlSystem_PS__415HZ_Tank__72", // RTP2904 NEG Pump
+        "csps__ControlSystem_PS__415HZ_Tank__30", // RTP3911/3910 NEG Pump Regelsensor
+        "csps__ControlSystem_PS__415HZ_Tank__75", // RTP3912 NEG Pump
+        "csps__ControlSystem_PS__415HZ_Tank__78", // RTP3913 NEG Pump
+        "csps__ControlSystem_PS__415HZ_Tank__81"
+        // RTP3914 NEG Pump
+
+    ) ,
+    // Voltage monitoring K35 etc. (index 30)
+    array(
+        "hv__katrin-hv_rep__7__2", //K35 divider voltage reading
+        "hv__katrin-hv_rep__7__3", //K35 divider voltage timestamp
+        "hv__katrin-hv_rep__7__4", //K35 divider voltage measurement running
+        "hv__katrin-hv_rep__7__5", //K65 divider voltage reading
+        "hv__katrin-hv_rep__7__6", //K65 divider voltage timestamp
+        "hv__katrin-hv_rep__7__7", //K65 divider voltage measurement running
+        "hv__katrin-hv_rep__7__8", //JRL divider voltage reading KAL1, PS
+        "hv__katrin-hv_rep__7__9", //JRL divider voltage timestamp KAL1, PS
+        "hv__katrin-hv_rep__7__10", //JRL divider voltage measurement running
+
+    ) ,
+
+    // Detector Valve and HV grounding interlock (index 31)
+    array(
+        "csms__ControlSystem_MS__436HV_Interlook__6", //CRT-5221 or 522-VAO-1010 clearance, detector gate valve clearence
+        "csms__ControlSystem_MS__436HV_Interlook__24"
+        //MS HV grounding switch position, open or closed
 
+    ) ,
+    // PS Control System Condition (index 32)
+    array(
+        "csps__ControlSystem_PS__410System__0"
+        //PS PCS7 control system condition
+
+    ) ,
+    // MS Control System Condition (index 33)
+    array(
+        "csms__ControlSystem_MS__430System__0"
+        //MS PCS7 control system condition
+
+    ) ,
+    // PS LAUDA Temperatures (index 34)
+    array(
+        "csps__ControlSystem_PS__415HZ_Oelheizung__0", //LAUDA Ist 5401
+        "csps__ControlSystem_PS__415HZ_Oelheizung__3"
+        //LAUDA Soll 5401
+
+    ) ,
+    // MS MoS HV distribution switches (index 35)
+    array(
+        "csms__ControlSystem_MS__436HV_Koppeln__0", // HV switch 1101 - MS to MoS line
+        "csms__ControlSystem_MS__436HV_Koppeln__3", // HV switch 1102 - K65 connection
+        "csms__ControlSystem_MS__436HV_Koppeln__6", // HV switch 1103 - K35 connection
+
+    ) ,
+    // Beamline Instrumentation V4, Detector Valve, Splitring Electrodes (index 36)
+    array(
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__0", // 320-VAO-0004 clearance, V4 clearance from SDS
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__3", // 320-VAO-0004 position, V4 open or closed
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__60", // 522-VAO-1010 position, detector gate valve open or closed
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__6", // 418-EEL-2150 on off value 1 = on
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__9", // 418-EEL-2150 actual value
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__12", // 418-EEL-2150 polatity 0 = pos
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__15", // 418-EEL-2150 set point value
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__18", // 418-EEL-4150 on off value 1 = on
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__21", // 418-EEL-4150 actual value
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__24", // 418-EEL-4150 polatity 0 = pos
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__27", // 418-EEL-4150 set point value
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__30", // 438-EEL-5150 on off value 1 = on
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__33", // 438-EEL-5150 actual value
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__36", // 438-EEL-5150 polatity 0 = pos
+        "csbl__ControlSystem_BL__408Beamline_Elektroden__39"
+        // 438-EEL-5150 set point value
+
+    ) ,
+    // Precision magnetometer for SAP North Ring (index 37)
+    array(
+        "precmm0__PrecMagnet__SAP_NorthRing__0", //precision sensor (SAP NorthRing, BW) B_x
+        "precmm0__PrecMagnet__SAP_NorthRing__1", //precision sensor (SAP NorthRing, BW) B_y
+        "precmm0__PrecMagnet__SAP_NorthRing__2", //precision sensor (SAP NorthRing, BW) B_z
+        "precmm0__PrecMagnet__SAP_NorthRing__3", //precision sensor (SAP NorthRing, TW) B_x
+        "precmm0__PrecMagnet__SAP_NorthRing__4", //precision sensor (SAP NorthRing, TW) B_y
+        "precmm0__PrecMagnet__SAP_NorthRing__5", //precision sensor (SAP NorthRing, TW) B_z
+        "precmm0__PrecMagnet__SAP_NorthRing__6", //precision sensor (SAP NorthRing, TE) B_x
+        "precmm0__PrecMagnet__SAP_NorthRing__7", //precision sensor (SAP NorthRing, TE) B_y
+        "precmm0__PrecMagnet__SAP_NorthRing__8", //precision sensor (SAP NorthRing, TE) B_z
+        "precmm0__PrecMagnet__SAP_NorthRing__9", //precision sensor (SAP NorthRing, BE) B_x
+        "precmm0__PrecMagnet__SAP_NorthRing__10", //precision sensor (SAP NorthRing, BE) B_y
+        "precmm0__PrecMagnet__SAP_NorthRing__11", //precision sensor (SAP NorthRing, BE) B_z
+        "precmm0__PrecMagnet__SAP_NorthRing__12", //precision sensor (SAP NorthRing, B) B_x
+        "precmm0__PrecMagnet__SAP_NorthRing__13", //precision sensor (SAP NorthRing, B) B_y
+        "precmm0__PrecMagnet__SAP_NorthRing__14"
+        //precision sensor (SAP NorthRing, B) B_z
+
+    ) ,
+    // Precision magnetometer for SAP South Ring (index 38)
+    array(
+        "precmm0__PrecMagnet__SAP_SouthRing__0", //precision sensor (SAP SouthRing, BW) B_x
+        "precmm0__PrecMagnet__SAP_SouthRing__1", //precision sensor (SAP SouthRing, BW) B_y
+        "precmm0__PrecMagnet__SAP_SouthRing__2", //precision sensor (SAP SouthRing, BW) B_z
+        "precmm0__PrecMagnet__SAP_SouthRing__3", //precision sensor (SAP SouthRing, TW) B_x
+        "precmm0__PrecMagnet__SAP_SouthRing__4", //precision sensor (SAP SouthRing, TW) B_y
+        "precmm0__PrecMagnet__SAP_SouthRing__5", //precision sensor (SAP SouthRing, TW) B_z
+        "precmm0__PrecMagnet__SAP_SouthRing__6", //precision sensor (SAP SouthRing, TE) B_x
+        "precmm0__PrecMagnet__SAP_SouthRing__7", //precision sensor (SAP SouthRing, TE) B_y
+        "precmm0__PrecMagnet__SAP_SouthRing__8", //precision sensor (SAP SouthRing, TE) B_z
+        "precmm0__PrecMagnet__SAP_SouthRing__9", //precision sensor (SAP SouthRing, BE) B_x
+        "precmm0__PrecMagnet__SAP_SouthRing__10", //precision sensor (SAP SouthRing, BE) B_y
+        "precmm0__PrecMagnet__SAP_SouthRing__11"
+        //precision sensor (SAP SouthRing, BE) B_z
+
+    ) ,
+    // status of PS ion monitor (index 39)
+    array(
+        "cspsionen__PS_Ionen__Amperemeter1__0", //418-REI-0-10-01 measured mean value of ion monitor current
+        "cspsionen__PS_Ionen__Amperemeter1__5"
+        //418-REI-0-10-06 lock status of ion monitoring alarm (0=armed, 1=off)
+
+    ) ,
+    // B460 OPUS weather stations at PS (index 40)
+    array(
+        "weather__Opus_WeatherStations__415OWS_PS_platform__0", //415-RTY-0-9111-0001 PS weather station temperatuer in C
+        "weather__Opus_WeatherStations__415OWS_PS_platform__1", //415-RTY-0-9111-0002 PS weather station temperature in F
+        "weather__Opus_WeatherStations__415OWS_PS_platform__2", //415-RTY-0-9111-0003 PS weather station dew point in C
+        "weather__Opus_WeatherStations__415OWS_PS_platform__3", //415-RTY-0-9111-0004 PS weather station dew point in F
+        "weather__Opus_WeatherStations__415OWS_PS_platform__4", //415-RTY-0-9112-0001 PS weather station rel humidity in %
+        "weather__Opus_WeatherStations__415OWS_PS_platform__5", //415-RTY-0-9112-0002 PS weather station rel humidity in g/m3
+        "weather__Opus_WeatherStations__415OWS_PS_platform__6", //415-RTY-0-9113-0001 PS weather station abs pressure in hPa
+        "weather__Opus_WeatherStations__415OWS_PS_platform__7", //415-RTY-0-9113-0002 PS weather station rel presuure in hPa
+        "weather__Opus_WeatherStations__415OWS_PS_platform__8"
+        //415-RTY-0-9114-0001 PS weather station voltage in V
+
+    ) ,
+    // B460 OPUS weather stations at DET (index 41)
+    array(
+        "weather__Opus_WeatherStations__435OWS_DET_platform__0", //435-RTY-0-9121-0001 DET weather station temperatuer in C
+        "weather__Opus_WeatherStations__435OWS_DET_platform__1", //435-RTY-0-9121-0002 DET weather station temperature in F
+        "weather__Opus_WeatherStations__435OWS_DET_platform__2", //435-RTY-0-9121-0003 DET weather station dew point in C
+        "weather__Opus_WeatherStations__435OWS_DET_platform__3", //435-RTY-0-9121-0004 DET weather station dew point in F
+        "weather__Opus_WeatherStations__435OWS_DET_platform__4", //435-RTY-0-9122-0001 DET weather station rel humidity in %
+        "weather__Opus_WeatherStations__435OWS_DET_platform__5", //435-RTY-0-9122-0002 DET weather station rel humidity in g/m3
+        "weather__Opus_WeatherStations__435OWS_DET_platform__6", //435-RTY-0-9123-0001 DET weather station abs pressure in hPa
+        "weather__Opus_WeatherStations__435OWS_DET_platform__7", //435-RTY-0-9123-0002 DET weather station rel presuure in hPa
+        "weather__Opus_WeatherStations__435OWS_DET_platform__8"
+        //435-RTY-0-9124-0001 DET weather station voltage in V
+
+    ) ,
+    // B460 OPUS weather stations at HV cage (index 42)
+    array(
+        "weather__Opus_WeatherStations__435OWS_HV_cage__0", //435-RTY-0-9111-0001 HV weather station temperatuer in C
+        "weather__Opus_WeatherStations__435OWS_HV_cage__1", //435-RTY-0-9111-0002 HV weather station temperature in F
+        "weather__Opus_WeatherStations__435OWS_HV_cage__2", //435-RTY-0-9111-0003 HV weather station dew point in C
+        "weather__Opus_WeatherStations__435OWS_HV_cage__3", //435-RTY-0-9111-0004 HV weather station dew point in F
+        "weather__Opus_WeatherStations__435OWS_HV_cage__4", //435-RTY-0-9112-0001 HV weather station rel humidity in %
+        "weather__Opus_WeatherStations__435OWS_HV_cage__5", //435-RTY-0-9112-0002 HV weather station rel humidity in g/m3
+        "weather__Opus_WeatherStations__435OWS_HV_cage__6", //435-RTY-0-9113-0001 HV weather station abs pressure in hPa
+        "weather__Opus_WeatherStations__435OWS_HV_cage__7", //435-RTY-0-9113-0002 HV weather station rel presuure in hPa
+        "weather__Opus_WeatherStations__435OWS_HV_cage__8"
+        //435-RTY-0-9114-0001 HV weather station voltage in V
+
+    ) ,
+    // B460 OPUS weather stations at MS bottom (index 43)
+    array(
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__0", //435-RTY-0-9131-0001 MS_bottom weather station temperatuer in C
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__1", //435-RTY-0-9131-0002 MS_bottom weather station temperature in F
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__2", //435-RTY-0-9131-0003 MS_bottom weather station dew point in C
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__3", //435-RTY-0-9131-0004 MS_bottom weather station dew point in F
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__4", //435-RTY-0-9132-0001 MS_bottom weather station rel humidity in %
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__5", //435-RTY-0-9132-0002 MS_bottom weather station rel humidity in g/m3
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__6", //435-RTY-0-9133-0001 MS_bottom weather station abs pressure in hPa
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__7", //435-RTY-0-9133-0002 MS_bottom weather station rel presuure in hPa
+        "weather__Opus_WeatherStations__435OWS_MS_bottom__8"
+        //435-RTY-0-9134-0001 MS_bottom weather station voltage in V
+
+    ) ,
+    // B460 OPUS weather stations at MS top (index 44)
+    array(
+        "weather__Opus_WeatherStations__435OWS_MS_top__0", //435-RTY-0-9141-0001 MS_top weather station temperatuer in C
+        "weather__Opus_WeatherStations__435OWS_MS_top__1", //435-RTY-0-9141-0002 MS_top weather station temperature in F
+        "weather__Opus_WeatherStations__435OWS_MS_top__2", //435-RTY-0-9141-0003 MS_top weather station dew point in C
+        "weather__Opus_WeatherStations__435OWS_MS_top__3", //435-RTY-0-9141-0004 MS_top weather station dew point in F
+        "weather__Opus_WeatherStations__435OWS_MS_top__4", //435-RTY-0-9142-0001 MS_top weather station rel humidity in %
+        "weather__Opus_WeatherStations__435OWS_MS_top__5", //435-RTY-0-9142-0002 MS_top weather station rel humidity in g/m3
+        "weather__Opus_WeatherStations__435OWS_MS_top__6", //435-RTY-0-9143-0001 MS_top weather station abs pressure in hPa
+        "weather__Opus_WeatherStations__435OWS_MS_top__7", //435-RTY-0-9143-0002 MS_top weather station rel presuure in hPa
+        "weather__Opus_WeatherStations__435OWS_MS_top__8"
+        //435-RTY-0-9144-0001 MS_top weather station voltage in V
+
+    ) ,
+    // B461 OPUS weather stations (index 45)
+    array(
+        "weather__Opus_WeatherStations__445OWS_MoS_general__0", //445-RTY-0-9111-0001 MoS_general weather station temperatuer in C
+        "weather__Opus_WeatherStations__445OWS_MoS_general__1", //445-RTY-0-9111-0002 MoS_general weather station temperature in F
+        "weather__Opus_WeatherStations__445OWS_MoS_general__2", //445-RTY-0-9111-0003 MoS_general weather station dew point in C
+        "weather__Opus_WeatherStations__445OWS_MoS_general__3", //445-RTY-0-9111-0004 MoS_general weather station dew point in F
+        "weather__Opus_WeatherStations__445OWS_MoS_general__4", //445-RTY-0-9112-0001 MoS_general weather station rel humidity in %
+        "weather__Opus_WeatherStations__445OWS_MoS_general__5", //445-RTY-0-9112-0002 MoS_general weather station rel humidity in g/m3
+        "weather__Opus_WeatherStations__445OWS_MoS_general__6", //445-RTY-0-9113-0001 MoS_general weather station abs pressure in hPa
+        "weather__Opus_WeatherStations__445OWS_MoS_general__7", //445-RTY-0-9113-0002 MoS_general weather station rel presuure in hPa
+        "weather__Opus_WeatherStations__445OWS_MoS_general__8"
+        //445-RTY-0-9114-0001 MoS_general weather station voltage in V
+
+    )
+);
+
+?>

+ 78 - 96
SDS_status_functions.php

@@ -1,100 +1,82 @@
-
 <?php
 
-	function placePic($posY, $posX, $pic, $size, $title)
-	{
-		echo '<div title="' . $title . '" style="position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<img src="pics/' . $pic . '" width="' . $size . '" height="' . $size . '">';
-		echo '</div>';
-	}
-	
-
-	function placePicXY($posY, $posX, $pic, $sizex, $sizey, $title)
-	{
-		echo '<div title="' . $title . '" style="position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<img src="pics/' . $pic . '" width="' . $sizex . '" height="' . $sizey . '">';
-		echo '</div>';
-	}
-
-
-	function placePicWithLink($posY, $posX, $pic, $size, $title, $link)
-	{
-		echo '<a href="https://adei-katrin.kaas.kit.edu/adei/#module=graph&db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&db_mask=all&experiment=-&window=86400&module=graph&virtual=srctree&srctree=' . $link . '" target="_blank">';
-		placePic($posY, $posX, $pic, $size, $title);
-		echo '</a>';
-	}
-
-	function placeText($posY, $posX, $text, $width, $size, $color)
-	{
-		echo '<div align="center" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<font size="' . $size . '" color="' . $color . '"><b>';
-		echo $text;
-		echo '</b></font></div>';
-	}
-
-	function placeTextWithLink($posY, $posX, $text, $width, $size, $color, $title, $link)
-	{
-		echo '<div title="' . $title . '" align="center" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<a href="https://adei-katrin.kaas.kit.edu/adei/#module=graph&db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&db_mask=all&experiment=-&window=86400&module=graph&virtual=srctree&srctree=' . $link . '" target="_blank">';
-		echo '<font size="' . $size . '" color="' . $color . '"><b>';
-		echo $text;
-		echo '</b></font></a></div>';
-	}
-
-	function placeTextLeftWithLink($posY, $posX, $text, $width, $size, $color, $title, $link)
-	{
-		echo '<div title="' . $title . '" align="left" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<a href="https://adei-katrin.kaas.kit.edu/adei/#module=graph&db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&db_mask=all&experiment=-&window=86400&module=graph&virtual=srctree&srctree=' . $link . '" target="_blank">';
-		echo '<font size="' . $size . '" color="' . $color . '"><b>';
-		echo $text;
-		echo '</b></font></a></div>';
-	}
-
-	function placeTextWithWebsiteLink($posY, $posX, $text, $width, $size, $color, $title, $link)
-	{
-		echo '<div title="' . $title . '" align="center" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<a href='.$link.' target="_blank">';
-		echo '<font size="' . $size . '" color="' . $color . '"><b>';
-		echo $text;
-		echo '</b></font></a></div>';
-	}
-		
-	function placeTextLeftWithWebsiteLink($posY, $posX, $text, $width, $size, $color, $title, $link)
-	{
-		echo '<div title="' . $title . '" align="left" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<a href='.$link.' target="_blank">';
-		echo '<font size="' . $size . '" color="' . $color . '"><b>';
-		echo $text;
-		echo '</b></font></a></div>';
-	}
-
-	function placeBox($posY, $posX, $text, $width, $size, $color)
-	{
-		echo '<div align="center" style="background-color:' . $color . '; border-style:solid; border-width:2px; border-color:#000000; width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<font size="' . $size . '" color=#000000><b>';
-		echo $text;
-		echo '</b></font></div>';
-	}
-
-	function placeBoxRight($posY, $posX, $text, $width, $size, $color)
-	{
-		echo '<div align="right" style="background-color:' . $color . '; border-style:solid; border-width:2px; border-color:#000000; width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
-		echo '<font size="' . $size . '" color=#000000><b>';
-		echo $text;
-		echo '</b></font></div>';
-	}
-
-
-	function getValveStatus($value)
-	{
-		$value = decbin($value);
-		$value = substr("00000000000", 0, 11 - strlen($value)) . $value;
-		if (substr($value, 3, 1) == 1) return 1;
-		else if (substr($value, 2, 1) == 1) return 0;
-		else return -1;
-	}
+    function placePic($posY, $posX, $pic, $size, $title) {
+        echo '<div title="' . $title . '" style="position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<img src="pics/' . $pic . '" width="' . $size . '" height="' . $size . '">';
+        echo '</div>';
+    }
+
+    function placePicXY($posY, $posX, $pic, $sizex, $sizey, $title) {
+        echo '<div title="' . $title . '" style="position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<img src="pics/' . $pic . '" width="' . $sizex . '" height="' . $sizey . '">';
+        echo '</div>';
+    }
+
+    function placePicWithLink($posY, $posX, $pic, $size, $title, $link) {
+        echo '<a href="https://adei-katrin.kaas.kit.edu/adei/#module=graph&db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&db_mask=all&experiment=-&window=86400&module=graph&virtual=srctree&srctree=' . $link . '" target="_blank">';
+        placePic($posY, $posX, $pic, $size, $title);
+        echo '</a>';
+    }
+
+    function placeText($posY, $posX, $text, $width, $size, $color) {
+        echo '<div align="center" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<font size="' . $size . '" color="' . $color . '"><b>';
+        echo $text;
+        echo '</b></font></div>';
+    }
+
+    function placeTextWithLink($posY, $posX, $text, $width, $size, $color, $title, $link) {
+        echo '<div title="' . $title . '" align="center" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<a href="https://adei-katrin.kaas.kit.edu/adei/#module=graph&db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&db_mask=all&experiment=-&window=86400&module=graph&virtual=srctree&srctree=' . $link . '" target="_blank">';
+        echo '<font size="' . $size . '" color="' . $color . '"><b>';
+        echo $text;
+        echo '</b></font></a></div>';
+    }
+
+    function placeTextLeftWithLink($posY, $posX, $text, $width, $size, $color, $title, $link) {
+        echo '<div title="' . $title . '" align="left" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<a href="https://adei-katrin.kaas.kit.edu/adei/#module=graph&db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&db_mask=all&experiment=-&window=86400&module=graph&virtual=srctree&srctree=' . $link . '" target="_blank">';
+        echo '<font size="' . $size . '" color="' . $color . '"><b>';
+        echo $text;
+        echo '</b></font></a></div>';
+    }
+
+    function placeTextWithWebsiteLink($posY, $posX, $text, $width, $size, $color, $title, $link) {
+        echo '<div title="' . $title . '" align="center" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<a href=' . $link . ' target="_blank">';
+        echo '<font size="' . $size . '" color="' . $color . '"><b>';
+        echo $text;
+        echo '</b></font></a></div>';
+    }
+
+    function placeTextLeftWithWebsiteLink($posY, $posX, $text, $width, $size, $color, $title, $link) {
+        echo '<div title="' . $title . '" align="left" style="width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<a href=' . $link . ' target="_blank">';
+        echo '<font size="' . $size . '" color="' . $color . '"><b>';
+        echo $text;
+        echo '</b></font></a></div>';
+    }
+
+    function placeBox($posY, $posX, $text, $width, $size, $color) {
+        echo '<div align="center" style="background-color:' . $color . '; border-style:solid; border-width:2px; border-color:#000000; width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<font size="' . $size . '" color=#000000><b>';
+        echo $text;
+        echo '</b></font></div>';
+    }
+
+    function placeBoxRight($posY, $posX, $text, $width, $size, $color) {
+        echo '<div align="right" style="background-color:' . $color . '; border-style:solid; border-width:2px; border-color:#000000; width:' . $width . 'px; position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
+        echo '<font size="' . $size . '" color=#000000><b>';
+        echo $text;
+        echo '</b></font></div>';
+    }
+
+    function getValveStatus($value) {
+        $value = decbin($value);
+        $value = substr("00000000000", 0, 11 - strlen($value)) . $value;
+        if (substr($value, 3, 1) == 1) return 1;
+        else if (substr($value, 2, 1) == 1) return 0;
+        else return -1;
+    }
 
 ?>
-
-
-

+ 2036 - 1633
SDS_status_main.php

@@ -1,1711 +1,2114 @@
 <?php
 
-// display network localization
-if ($onsite) placeBox(-135, 1190, "Inside KIT CN network", 250, 2, "#DDDDDD");
-if (substr($ip, 0, 7) == "134.107") placeBox(25, 10, "MPP Munich network", 250, 2, "#FFFFFF");
-if (substr($ip, 0, 7) == "128.176") placeBox(25, 10, "WWU Muenster network", 250, 2, "#FFFFFF");
+    // display network localization
+    if ($onsite) placeBox(-135, 1190, "Inside KIT CN network", 250, 2, "#DDDDDD");
+    if (substr($ip, 0, 7) == "134.107") placeBox(25, 10, "MPP Munich network", 250, 2, "#FFFFFF");
+    if (substr($ip, 0, 7) == "128.176") placeBox(25, 10, "WWU Muenster network", 250, 2, "#FFFFFF");
 
-// #####  global variable for PS and MS operation mode
-$PSmode = $adeiValue[32][0];
-$MSmode = $adeiValue[33][0];
+    // #####  global variable for PS and MS operation mode
+    $PSmode = $adeiValue[32][0];
+    $MSmode = $adeiValue[33][0];
 
-$tol = 0.5;
+    $tol = 0.5;
 
-$local = false;
-if (substr($ip, 0, 13) == "141.52.12.52")
-	{
-      placeBox(-60, 1190,  "local dev computer", 250, 2, "#FFFFFF");
-      $local = true;
-      $MSmode = 5;
+    $local = false;
+    if (substr($ip, 0, 13) == "141.52.12.52")
+    {
+        placeBox(-60, 1190, "local dev computer", 250, 2, "#FFFFFF");
+        $local = true;
+        $MSmode = 5;
     }
- 
-
-
-      // ########## PS PCS7 operation mode ##########
 
+    // ########## PS PCS7 operation mode ##########
     $OpModeText = "PS mode: ";
     $color = "#FFFFFF";
-    if ($PSmode == 0) { $OpModeText = $OpModeText." commissioning"; $color="#FFA0A0"; }
-    else if ($PSmode == 1) $OpModeText = $OpModeText.$PSmode." pump down";
-    else if ($PSmode == 2) $OpModeText = $OpModeText.$PSmode." venting";
-    else if ($PSmode == 3) $OpModeText = $OpModeText.$PSmode." pumping";
-    else if ($PSmode == 4) $OpModeText = $OpModeText.$PSmode." baking";
-    else if ($PSmode == 5) { $OpModeText = $OpModeText.$PSmode." high voltage"; $color="#B0FFB0"; }
+    if ($PSmode == 0)
+    {
+        $OpModeText = $OpModeText . " commissioning";
+        $color = "#FFA0A0";
+    }
+    else if ($PSmode == 1) $OpModeText = $OpModeText . $PSmode . " pump down";
+    else if ($PSmode == 2) $OpModeText = $OpModeText . $PSmode . " venting";
+    else if ($PSmode == 3) $OpModeText = $OpModeText . $PSmode . " pumping";
+    else if ($PSmode == 4) $OpModeText = $OpModeText . $PSmode . " baking";
+    else if ($PSmode == 5)
+    {
+        $OpModeText = $OpModeText . $PSmode . " high voltage";
+        $color = "#B0FFB0";
+    }
     placeBox(-110, 1190, $OpModeText, 250, 2, $color);
 
-
-       // ########## PS PCS7 operation mode ##########
-
+    // ########## PS PCS7 operation mode ##########
     $OpModeText = "MS mode: ";
     $color = "#FFFFFF";
-    if ($MSmode == 0) { $OpModeText = $OpModeText." commissioning"; $color="#FFA0A0"; }
-    else if ($MSmode == 1) $OpModeText = $OpModeText.$PSmode." pump down";
-    else if ($MSmode == 2) $OpModeText = $OpModeText.$PSmode." venting";
-    else if ($MSmode == 3) $OpModeText = $OpModeText.$PSmode." pumping";
-    else if ($MSmode == 4) $OpModeText = $OpModeText.$PSmode." baking";
-    else if ($MSmode == 5) { $OpModeText = $OpModeText.$PSmode." high voltage"; $color="#B0FFB0"; }
+    if ($MSmode == 0)
+    {
+        $OpModeText = $OpModeText . " commissioning";
+        $color = "#FFA0A0";
+    }
+    else if ($MSmode == 1) $OpModeText = $OpModeText . $PSmode . " pump down";
+    else if ($MSmode == 2) $OpModeText = $OpModeText . $PSmode . " venting";
+    else if ($MSmode == 3) $OpModeText = $OpModeText . $PSmode . " pumping";
+    else if ($MSmode == 4) $OpModeText = $OpModeText . $PSmode . " baking";
+    else if ($MSmode == 5)
+    {
+        $OpModeText = $OpModeText . $PSmode . " high voltage";
+        $color = "#B0FFB0";
+    }
     placeBox(-85, 1190, $OpModeText, 250, 2, $color);
 
-
-	// ########## VALVES ##########
-
-	// V4
-	$value = $adeiValue[36][1];
-	$clearance = $adeiValue[36][0];
-	$pic = "valve";
+    // ########## VALVES ##########
+    // V4
+    $value = $adeiValue[36][1];
+    $clearance = $adeiValue[36][0];
+    $pic = "valve";
     $V4_open = false;
-	if (($value == 1) && ($clearance == 1)) {$pic = $pic . "On"; $V4_open = true;}
-	else if (($value == 0) && ($clearance == 0)) $pic = $pic . "Off";
-	else if (($value == 0) && ($clearance == 1)) $pic = $pic . "FREE";
-	else if (($value == 1) && ($clearance == 0)) $pic = $pic . "Error";
-	placePicWithLink(303, 60, $pic . ".png", 30, "status CPS-PS gate vlave V4 &#10;purple: clearance to open, red: no clearance, grey: undefined", $adeiChannel[36][0].",".$adeiChannel[36][1]);
-		
-	// PS-MS flapper valve VMO 4110
+    if (($value == 1) && ($clearance == 1))
+    {
+        $pic = $pic . "On";
+        $V4_open = true;
+    }
+    else if (($value == 0) && ($clearance == 0)) $pic = $pic . "Off";
+    else if (($value == 0) && ($clearance == 1)) $pic = $pic . "FREE";
+    else if (($value == 1) && ($clearance == 0)) $pic = $pic . "Error";
+    placePicWithLink(303, 60, $pic . ".png", 30, "status CPS-PS gate vlave V4 &#10;purple: clearance to open, red: no clearance, grey: undefined", $adeiChannel[36][0] . "," . $adeiChannel[36][1]);
+
+    // PS-MS flapper valve VMO 4110
     $value_open = $adeiValue[9][8];
     $value_closed = $adeiValue[9][9];
-	$pic = "valve";
+    $pic = "valve";
     if (($value_open == 1) && ($value_closed == 0)) $pic = $pic . "On";
-	else if (($value_open == 0) && ($value_closed == 1)) $pic = $pic . "Off";
-	placePicWithLink(303, 283, $pic . ".png", 30, "status PS-MS beam-line gate valve VMO-4110 &#10;green: open, red: closed, grey: undefined", $adeiChannel[9][8].",".$adeiChannel[9][9]);
+    else if (($value_open == 0) && ($value_closed == 1)) $pic = $pic . "Off";
+    placePicWithLink(303, 283, $pic . ".png", 30, "status PS-MS beam-line gate valve VMO-4110 &#10;green: open, red: closed, grey: undefined", $adeiChannel[9][8] . "," . $adeiChannel[9][9]);
 
     // FPD gate valve
-	$value = $adeiValue[36][2];
-	$clearance = $adeiValue[31][0];
-	$pic = "valve";
-	if (($value == 1) && ($clearance == 1)) $pic = $pic . "On";
-	else if (($value == 0) && ($clearance == 0)) $pic = $pic . "Off";
-	else if (($value == 0) && ($clearance == 1)) $pic = $pic . "FREE";
-	else if (($value == 1) && ($clearance == 0)) $pic = $pic . "Error";
-	placePicWithLink(303, 1466, $pic . ".png", 30, "status FPD beam-line gate valve&#10;green: open, red: closed, grey: undefined", $adeiChannel[36][2].",".$adeiChannel[31][0]);
+    $value = $adeiValue[36][2];
+    $clearance = $adeiValue[31][0];
+    $pic = "valve";
+    if (($value == 1) && ($clearance == 1)) $pic = $pic . "On";
+    else if (($value == 0) && ($clearance == 0)) $pic = $pic . "Off";
+    else if (($value == 0) && ($clearance == 1)) $pic = $pic . "FREE";
+    else if (($value == 1) && ($clearance == 0)) $pic = $pic . "Error";
+    placePicWithLink(303, 1466, $pic . ".png", 30, "status FPD beam-line gate valve&#10;green: open, red: closed, grey: undefined", $adeiChannel[36][2] . "," . $adeiChannel[31][0]);
+
+    // ########## MAGNETS ##########
+    // CPS
+    $NlCPS = 20550 / 0.9133;
+    $BfieldCPS = 1.26e-6 * $adeiValue[24][0] * $NlCPS; // mu0 * I * N/l
+    if ($BfieldCPS < 0.1)
+    {
+        $value = "OFF";
+        $color = "#FF0000";
+    }
+    else
+    {
+        $value = sprintf('%.1F T', $BfieldCPS);
+        $color = "#000000";
+    }
+    placeTextWithLink(240, 2, $value, 60, 5, $color, "field of CPS behind separation wall derived from current", $adeiChannel[24][0]);
+    placeText(265, 2, "CPS", 60, 2, "#000000");
+
+    // PS1
+    if ($adeiValue[3][3] == 0)
+    {
+        $value = "LEM";
+        $color = "#FF0000";
+    }
+    else
+    {
+        $value = sprintf('%.1F T', $adeiValue[3][1] / 157.0 * 4.5);
+        $color = "#000000";
+    }
+    placeTextWithLink(240, 66, $value, 70, 5, $color, "stand-alone center field PS1 magnet", $adeiChannel[3][1]);
+    placeText(265, 66, "PS1", 70, 2, "#000000");
 
+    // PS2
+    if ($adeiValue[3][2] == 0)
+    {
+        $value = "LEM";
+        $color = "#FF0000";
+    }
+    else
+    {
+        $value = sprintf('%.1F T', $adeiValue[3][0] / 157.0 * 4.5);
+        $color = "#000000";
+    }
+    placeTextWithLink(240, 274, $value, 70, 5, $color, "stand-alone center field PS2 magnet", $adeiChannel[3][0]);
+    placeText(265, 274, "PS2", 70, 2, "#000000");
+
+    // Pinch
+    placeTextWithLink(240, 1420, sprintf('%.1F', $adeiValue[4][0] / 86.98 * 6.0) . " T", 70, 5, "#000000", "stand-alone center field PCH magnet", $adeiChannel[4][0]);
+    placeText(265, 1420, "PCH", 70, 2, "#000000");
+
+    // Detector
+    placeTextWithLink(240, 1495, sprintf('%.1F', $adeiValue[4][1] / 93.59 * 6.0) . " T", 70, 5, "#000000", "stand-alone center field DET magnet", $adeiChannel[4][1]);
+    placeText(265, 1495, "DET", 70, 2, "#000000");
+
+    // ########## PAE ##########
+    placeTextWithLink(303, 1553, sprintf('%.1F', $adeiValue[6][2]) . " kV", 90, 5, "#000000", "PAE potential", $adeiChannel[6][2]);
+    placeText(328, 1553, "PAE", 90, 2, "#000000");
+
+    // ########## PUMP PORTS ##########
+    placeText(416, 1623, "PP2", 50, 2, "#000000");
+    placeText(466, 1623, "PP1", 50, 2, "#000000");
+    placeText(516, 1623, "PP3", 50, 2, "#000000");
+
+    // ########## BAFFLE ##########
+    $max = array(
+        90,
+        94,
+        88
+    );
+
+    $time_conversion_factor = 621355968000000000; // conversion for PCS7 .NET value;
+    $timestamp = ($adeiValue[15][8] - $time_conversion_factor) / 10000000;
+    echo '<br><font size="4" color="#000000">&nbsp;Baffle timestamp: ' . date("r", $timestamp) . ' </font><br>';
+
+    //placeText(560, 1395, "LN<sub>2</sub> Tank", 130, 5, "#000000");
+    $link = $adeiChannel[15][6] . "," . $adeiChannel[15][7];
+    //placePicWithLink(563,1367, "LN2tank.png", 45, "LN2 tank", $link);
+    $value = $adeiValue[15][6] * 0.77 + 0.83;
+    $link = $adeiChannel[15][6];
+    $text = sprintf('%.0F', $value) . " %";
+    //placeTextWithLink(590, 1395, $text, 70, 4, "#000000", "LN2 tank level", $link);
+    $value = $adeiValue[15][7] - 1.86;
+    $link = $adeiChannel[15][7];
+    $text = sprintf('%.1F', $value) . " bar";
+    //placeTextWithLink(590, 1450, $text, 70, 4, "#000000", "LN2 tank pressure", $link);
+    for ($id = 0;$id < 3;$id++)
+    {
+        $value = $adeiValue[15][$id];
+        $pic = "ice.png";
+        $text = "---";
+
+        if ($value < 800)
+        {
+            $text = sprintf('%.0F', $value) . " K";
+            if ($value > $max[$id]) $pic = "iceOff.png";
+            else
+            {
+                $value = $adeiValue[15][$id + 3];
+                if ($value > 0.1 && $value < 100.0) $pic = "iceOn.png";
+                else $pic = "iceBlink.gif";
+            }
+        }
+
+        $pos = $id;
+        if ($id == 0) $pos = 1;
+        else if ($id == 1) $pos = 0;
+
+        $link = $adeiChannel[15][$id] . "," . $adeiChannel[15][$id + 3];
+        placePicWithLink(410 + $pos * 50, 1375, $pic, 30, "status baffle PP" . ($id + 1) . "&#10;blue: cooled, red: warmed, blinking: warming, grey: undefined", $link);
+        placeTextWithLink(437 + $pos * 50, 1355, $text, 70, 4, "#000000", "temperature baffle PP" . ($id + 1) , $link);
+    }
 
+    // ########## PRESSURES ##########
+    // CC2320
+    $value = $adeiValue[7][0];
+    $pic = "cc";
+    $text = "---";
+    if ($value > 1E+2)
+    {
+        $pic = $pic;
+        $text = "OFF";
+    }
+    else if ($value > 2E-5)
+    {
+        $pic = $pic . "Off";
+        $text = "high";
+    }
+    else if ($value <= 1E-4 && $value >= 1.334E-11)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    else if ($value < 1.334E-11)
+    {
+        $text = "LOW";
+    }
+    placePicWithLink(410, 1435, $pic . ".png", 30, "status cold cathode gauge CC2320&#10;green: on, red: off, grey: undefined", $adeiChannel[7][0]);
+    placeTextWithLink(439, 1415, $text, 70, 4, "#000000", "pressure [mbar] cold cathode gauge CC2320", $adeiChannel[7][0]);
+
+    $time_conversion_factor = 621355968000000000; // conversion for PCS7 .NET value;
+    $timestamp = ($adeiValue[7][8] - $time_conversion_factor) / 10000000;
+    echo '<font size="4" color="#000000">&nbsp;Vacuum timestamp: ' . date("r", $timestamp) . ' </font><br>';
+
+    // CC2345
+    $value = $adeiValue[7][7];
+    $pic = "cc";
+    $text = "---";
+    if ($value > 1E-4)
+    {
+        $pic = $pic . "Off";
+        $text = "OFF";
+    }
+    else if ($value <= 1E-4 && $value >= 1.334E-11)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    else if ($value < 1.334E-11)
+    {
+        $text = "LOW";
+    }
+    placePicWithLink(427, 1482, $pic . ".png", 30, "status cold cathode gauge CC2345&#10;green: on, red: off, grey: undefined", $adeiChannel[7][7]);
+    placeTextWithLink(406, 1462, $text, 70, 4, "#000000", "pressure [mbar] cold cathode gauge CC2345", $adeiChannel[7][7]);
 
-	// ########## MAGNETS ##########
+    // Ex3110
+    $value = $adeiValue[8][0];
+    $pic = "ex";
+    $text = "---";
+    if ($value > 2E-5)
+    {
+        $text = "OFF";
+        {
+            if ($MSmode < 5) $pic = $pic . "Off";
+            else $pic = $pic;
+        }
+    }
+    else if ($value <= 2E-5 && $value > 1E-12)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    placePicWithLink(510, 1435, $pic . ".png", 30, "status extractor ion gauge Ex3110&#10;green: on, red: off, grey: undefined", $adeiChannel[8][0]);
+    placeTextWithLink(539, 1415, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge Ex3110", $adeiChannel[8][0]);
 
-	// CPS
-	$NlCPS = 20550 / 0.9133;
-	$BfieldCPS = 1.26e-6 * $adeiValue[24][0] * $NlCPS;	// mu0 * I * N/l
-	if ($BfieldCPS < 0.1) { $value = "OFF"; $color = "#FF0000"; }
-	else { $value = sprintf('%.1F T', $BfieldCPS); $color = "#000000"; }
-	placeTextWithLink(240, 2, $value, 60, 5, $color, "field of CPS behind separation wall derived from current", $adeiChannel[24][0]);
-	placeText(265, 2, "CPS", 60, 2, "#000000");
+    // Ex1110
+    $value = $adeiValue[28][0];
+    $link = $adeiChannel[28][0];
+    $pic = "ex";
+    $text = "---";
+    if ($value > 2E-5)
+    {
+        $text = "OFF";
+        {
+            if ($MSmode < 5) $pic = $pic . "Off";
+            else $pic = $pic;
+        }
+    }
+    else if ($value <= 2E-5 && $value > 1E-12)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    placePicWithLink(460, 1435, $pic . ".png", 30, "status extractor ion gauge Ex1110&#10;green: off, blinking: on, grey: undefined", $link);
+    placeTextWithLink(489, 1415, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge Ex1110", $link);
 
-		
-	// PS1
-	if ($adeiValue[3][3] == 0) { $value = "LEM"; $color = "#FF0000"; }
-	else { $value = sprintf('%.1F T', $adeiValue[3][1] / 157.0 * 4.5); $color = "#000000"; }
-	placeTextWithLink(240, 66, $value, 70, 5, $color, "stand-alone center field PS1 magnet", $adeiChannel[3][1]);
-	placeText(265, 66, "PS1", 70, 2, "#000000");
+    // Ex0096
+    $value = $adeiValue[9][2];
+    $link = $adeiChannel[9][2];
+    $pic = "ex";
+    $text = "---";
+    if ($value > 1E+2)
+    {
+        $text = "OFF";
+        {
+            if ($MSmode < 5) $pic = $pic . "Off";
+            else $pic = $pic;
+        }
+    }
+    else if ($value > 2E-5)
+    {
+        $pic = $pic . "Off";
+        $text = "OFF";
+    }
+    else if ($value <= 2E-5 && $value > 1E-12)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    placePicWithLink(230, 1220, $pic . ".png", 30, "status extractor ion gauge 0096&#10;green: off, blinking: on, grey: undefined", $link);
+    placeTextWithLink(259, 1200, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge 0096", $link);
+
+    // CC FPD
+    $value = $adeiValue[6][1];
+    $pic = "cc";
+    $text = "---";
+    if ($value > 1E-4)
+    {
+        $pic = $pic . "Off";
+        $text = "OFF";
+    }
+    if ($value < 1E-11)
+    {
+        $pic = $pic . "Off";
+        $text = "OFF";
+    }
+    else if ($value <= 1E-4 && $value > 1E-12)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    placePicWithLink(188, 1475, $pic . ".png", 30, "status FPD cold cathode gauge&#10;green: on, red: off, grey: undefined", $adeiChannel[6][1]);
+    placeTextWithLink(217, 1455, $text, 70, 4, "#000000", "pressure [mbar] FPD cold cathode gauge", $adeiChannel[6][1]);
+
+    // Gauge Baffle
+    $value = $adeiValue[5][0];
+    $link = $adeiChannel[5][0];
+    $color = "#000000";
+    $pic = "gauge";
+    $text = "---";
+    if ($value > 1E-4)
+    {
+        $pic = $pic . "Off";
+        $text = "OFF";
+    }
+    // standard cold blue "#0026FF"  ,  ice cold blue "#107BC7"
+    if ($value < 2E-6 && $value > 1E-9)
+    {
+        $pic = "gaugeOn";
+        $color = "#107BC7";
+        $text = sprintf('%.1E', $value);
+    }
+    else if ($value >= 1E-6 && $value < 1e-1)
+    {
+        $pic = "gaugeOff";
+        $color = "FF0000";
+        $text = sprintf('%.1E', $value);
+    }
 
-	// PS2
-	if ($adeiValue[3][2] == 0) { $value = "LEM"; $color = "#FF0000"; }
-	else { $value = sprintf('%.1F T', $adeiValue[3][0] / 157.0 * 4.5); $color = "#000000"; }
-	placeTextWithLink(240, 274, $value, 70, 5, $color, "stand-alone center field PS2 magnet", $adeiChannel[3][0]);
-	placeText(265, 274, "PS2", 70, 2, "#000000");
+    placePicWithLink(460, 1315, $pic . ".png", 30, "status baffle insulation vacuum gauge&#10;gray: off, green: on, red: too high&#10Should be < 5e-6 mbar for HV operation!!!", $link);
+    placeTextWithLink(460 + 29, 1295, $text, 70, 4, $color, "pressure [mbar] baffle insulation vacuum gauge", $link);
 
-	// Pinch
-	placeTextWithLink(240, 1420, sprintf('%.1F', $adeiValue[4][0] / 86.98 * 6.0) . " T", 70, 5, "#000000", "stand-alone center field PCH magnet", $adeiChannel[4][0]);
-	placeText(265, 1420, "PCH", 70, 2, "#000000");
+    // PS CC1232
+    $value = $adeiValue[27][0];
+    $link = $adeiChannel[27][0];
+    $pic = "cc";
+    $text = "---";
+    if ($value >= 9.9E-5)
+    {
+        $pic = $pic . "Off";
+        $text = "OFF";
+    }
+    else if ($value < 1E-4 && $value > 1.2E-11)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    placePicWithLink(370, 240, $pic . ".png", 30, "status cold cathode gauge CC1232&#10;green: on, red: off, grey: undefined", $link);
+    placeTextWithLink(399, 220, $text, 70, 4, "#000000", "pressure [mbar] cold cathode gauge CC1232", $link);
 
-	// Detector
-	placeTextWithLink(240, 1495, sprintf('%.1F', $adeiValue[4][1] / 93.59 * 6.0) . " T", 70, 5, "#000000", "stand-alone center field DET magnet", $adeiChannel[4][1]);
-	placeText(265, 1495, "DET", 70, 2, "#000000");
-
-
-
-	// ########## PAE ##########
-
-	placeTextWithLink(303, 1553, sprintf('%.1F', $adeiValue[6][2]) . " kV", 90, 5, "#000000", "PAE potential", $adeiChannel[6][2]);
-	placeText(328, 1553, "PAE", 90, 2, "#000000");
-
-
-
-	// ########## PUMP PORTS ##########
-
-	placeText(416, 1623, "PP2", 50, 2, "#000000");
-	placeText(466, 1623, "PP1", 50, 2, "#000000");
-	placeText(516, 1623, "PP3", 50, 2, "#000000");
-
-
-
-	// ########## BAFFLE ##########
-
-	$max = array( 90, 94, 88 );
-
-        $time_conversion_factor = 621355968000000000; // conversion for PCS7 .NET value;
-        $timestamp = ($adeiValue[15][8] - $time_conversion_factor) / 10000000;
-        echo '<br><font size="4" color="#000000">&nbsp;Baffle timestamp: ' . date("r", $timestamp ) . ' </font><br>';
-
-        //placeText(560, 1395, "LN<sub>2</sub> Tank", 130, 5, "#000000");
-        $link = $adeiChannel[15][6] . "," . $adeiChannel[15][7];
-        //placePicWithLink(563,1367, "LN2tank.png", 45, "LN2 tank", $link);
-
-        $value = $adeiValue[15][6]*0.77+0.83;
-        $link = $adeiChannel[15][6];
-        $text = sprintf('%.0F', $value) . " %";
-        //placeTextWithLink(590, 1395, $text, 70, 4, "#000000", "LN2 tank level", $link);	
- 
-        $value = $adeiValue[15][7]-1.86;
-        $link = $adeiChannel[15][7];
-        $text = sprintf('%.1F', $value) . " bar";
-        //placeTextWithLink(590, 1450, $text, 70, 4, "#000000", "LN2 tank pressure", $link);	
-
-	for ($id = 0; $id < 3; $id++)
-	{
-		$value = $adeiValue[15][$id];
-		$pic = "ice.png";
-		$text = "---";
-
-		if ($value < 800)
-		{
-			$text = sprintf('%.0F', $value) . " K";
-			if ($value > $max[$id]) $pic = "iceOff.png";
-			else
-			{
-				$value = $adeiValue[15][$id + 3];
-				if ($value > 0.1 && $value < 100.0) $pic = "iceOn.png";
-				else $pic = "iceBlink.gif";
-			}
-		}
-
-		$pos = $id;
-		if ($id == 0) $pos = 1;
-		else if ($id == 1) $pos = 0;
-
-		$link = $adeiChannel[15][$id] . "," . $adeiChannel[15][$id + 3];
-		placePicWithLink(410 + $pos * 50, 1375, $pic, 30, "status baffle PP" . ($id + 1) . "&#10;blue: cooled, red: warmed, blinking: warming, grey: undefined", $link);
-		placeTextWithLink(437 + $pos * 50, 1355, $text, 70, 4, "#000000", "temperature baffle PP" . ($id + 1), $link);	
-	}
+    // PS Ex1221
+    $value = $adeiValue[27][5];
+    $link = $adeiChannel[27][5];
+    $pic = "ex";
+    $text = "---";
+    if ($value >= 9.9E-5)
+    {
+        $text = "OFF";
+        {
+            if ($PSmode < 5) $pic = $pic . "Off";
+            else $pic = $pic;
+        }
+    }
+    else if ($value < 1E-4 && $value > 7E-13)
+    {
+        $pic = $pic . "On";
+        $text = sprintf('%.1E', $value);
+    }
+    placePicWithLink(188, 141, $pic . ".png", 30, "status extractor ion gauge Ex1221&#10;green: on, red: off, grey: undefined", $link);
+    placeTextWithLink(217, 121, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge Ex1221", $link);
+
+    // ########## VACUUM PUMPS ##########
+    // MS TMP Temperatures
+    //T<sub>max</sub>
+    $value = max($adeiValue[25][0], $adeiValue[25][1], $adeiValue[25][2]);
+    $link = $adeiChannel[25][0] . "," . $adeiChannel[25][1] . "," . $adeiChannel[25][2];
+    $color = "#000000";
+    if ($value < 10) $color = "#0026FF";
+    else if ($value > 50) $color = "#FF0000";
+    placeTextWithLink(435, 1625, sprintf('%.1F &#176;C', $value) , 70, 3, $color, "TMP max temperature PP2", $link);
+
+    $value = max($adeiValue[26][0], $adeiValue[26][1], $adeiValue[26][2]);
+    $link = $adeiChannel[26][0] . "," . $adeiChannel[26][1] . "," . $adeiChannel[26][2];
+    $color = "#000000";
+    if ($value < 10) $color = "#0026FF";
+    else if ($value > 50) $color = "#FF0000";
+    placeTextWithLink(535, 1625, sprintf('%.1F &#176;C', $value) , 70, 3, $color, "TMP max temperature PP3", $link);
+
+    // TMPs (PP2 + PP3)
+    for ($pp = 0;$pp < 2;$pp++)
+    {
+        for ($id = 0;$id < 3;$id++)
+        {
+            $value = $adeiValue[$pp + 7][$id + 1];
+            $pic = "tmp";
+            $text = "---";
+
+            if ($value < 50)
+            {
+                if ($MSmode < 5) $pic = $pic . "Off";
+            }
+            else if ($value >= 50 && $value < 500)
+            {
+                $text = sprintf('%.0F', $value);
+                if ($value > 450)
+                {
+                    $value = $adeiValue[$pp + 7][$id + 4];
+                    //$pic = $pic . "On";
+                    if ($value == 1) $pic = $pic . "On";
+                    else if ($value == 0) $pic = $pic . "Closed";
+                }
+                else if ($value > 240)
+                {
+                    $value = $adeiValue[$pp + 7][$id + 4];
+                    //$pic = $pic . "On";
+                    if ($value == 1) $pic = $pic . "Standby";
+                    else if ($value == 0) $pic = $pic . "Standby";
+                }
+            }
+
+            placePicWithLink(410 + $pp * 100, 1528 + $id * 35, $pic . ".png", 30, "status turbo-molecular pump TMP" . ($pp + 2) . ($id + 4) . "20&#10;green: on, yellow: on but isolated, red: off, grey: undefined", $adeiChannel[$pp + 7][$id + 1]);
+            placeTextWithLink(439 + $pp * 100, 1518 + $id * 35, $text, 50, 4, "#000000", "rotational speed [Hz] turbo-molecular pump TMP" . ($pp + 2) . ($id + 4) . "20", $adeiChannel[$pp + 7][$id + 1]);
+        }
+    }
 
+    // PS TMPs
+    for ($id = 0;$id < 2;$id++)
+    {
+        $value = $adeiValue[27][$id + 1];
+        $link = $adeiChannel[27][$id + 1];
+        $pic = "tmp";
+        $text = "---";
+
+        if ($value < 50)
+        {
+            if ($PSmode < 5) $pic = $pic . "Off";
+        }
+        else if ($value >= 50 && $value < 700)
+        {
+            $text = sprintf('%.0F', $value);
+            if ($value > 570)
+            {
+                $value = $adeiValue[27][$id + 3];
+                //$pic = $pic . "On";
+                if ($value == 1) $pic = $pic . "On";
+                else if ($value == 0) $pic = $pic . "Standby";
+            }
+        }
+
+        placePicWithLink(370, 157 + $id * 35, $pic . ".png", 30, "status turbo-molecular pump TMP" . (1123 - $id) . "&#10;green: on, yellow: on but isolated, red: off, grey: undefined", $link);
+        placeTextWithLink(399, 148 + $id * 35, $text, 50, 4, "#000000", "rotational speed [Hz] turbo-molecular pump TMP" . (1123 - $id) , $link);
+    }
 
+    // FPD CP
+    $value = $adeiValue[6][3];
+    $pic = "cp";
+    $text = "---";
 
-	// ########## PRESSURES ##########
-
-	// CC2320
-        $value = $adeiValue[7][0];
-	$pic = "cc";
-	$text = "---";
-	if ($value > 1E+2) { $pic = $pic; $text = "OFF"; }
-	else if ($value > 2E-5) { $pic = $pic . "Off"; $text = "high"; }
-	else if ($value <= 1E-4 && $value >= 1.334E-11) { $pic = $pic . "On"; $text = sprintf('%.1E', $value); }
-	else if ($value < 1.334E-11) { $text = "LOW"; }
-	placePicWithLink(410, 1435, $pic . ".png", 30, "status cold cathode gauge CC2320&#10;green: on, red: off, grey: undefined", $adeiChannel[7][0]);
-	placeTextWithLink(439, 1415, $text, 70, 4, "#000000", "pressure [mbar] cold cathode gauge CC2320", $adeiChannel[7][0]);
-
-        $time_conversion_factor = 621355968000000000; // conversion for PCS7 .NET value;
-        $timestamp = ($adeiValue[7][8] - $time_conversion_factor) / 10000000;
-        echo '<font size="4" color="#000000">&nbsp;Vacuum timestamp: ' . date("r", $timestamp ) . ' </font><br>';
+    if ($value > 20)
+    {
+        $pic = $pic . "Off";
+    }
+    else if ($value <= 20 && $value > 5)
+    {
+        $text = sprintf('%.0F K', $value);
+        $value = $adeiValue[6][12];
+        if ($value == 1)
+        {
+            $pic = $pic . "On";
+        }
+        else if ($value == 0)
+        {
+            $pic = $pic . "Standby";
+        }
+    }
 
-	// CC2345
-	$value = $adeiValue[7][7];
-	$pic = "cc";
-	$text = "---";
-	if ($value > 1E-4) { $pic = $pic . "Off"; $text = "OFF"; }
-	else if ($value <= 1E-4 && $value >= 1.334E-11) { $pic = $pic . "On"; $text = sprintf('%.1E', $value); }
-	else if ($value < 1.334E-11) { $text = "LOW"; }
-	placePicWithLink(427, 1482, $pic . ".png", 30, "status cold cathode gauge CC2345&#10;green: on, red: off, grey: undefined", $adeiChannel[7][7]);
-	placeTextWithLink(406, 1462, $text, 70, 4, "#000000", "pressure [mbar] cold cathode gauge CC2345", $adeiChannel[7][7]);
+    placePicWithLink(368 - 30, 1475, $pic . ".png", 30, "status FPD UHV cryo pump&#10;green: on, yellow: on but isolated, red: off, grey: undefined", $adeiChannel[6][3]);
+    placeTextWithLink(368, 1455, $text, 70, 3, "#000000", "temperature FPD UHV cryo pump", $adeiChannel[6][3]);
+
+    // ########## FPD SOURCES ##########
+    $pic = "source";
+    $text = "---";
+    if ($adeiValue[6][9] == 1 && $adeiValue[6][10] == 1)
+    {
+        $pic = $pic . "On";
+        $text = "OUT";
+    }
+    else if ($adeiValue[6][9] == 1 && $adeiValue[6][10] == 0)
+    {
+        $pic = $pic . "EIn";
+        $text = "IN";
+    }
+    else if ($adeiValue[6][9] == 0 && $adeiValue[6][10] == 1)
+    {
+        $pic = $pic . "GIn";
+        $text = "IN";
+    }
+    else if ($adeiValue[6][9] == 0 && $adeiValue[6][10] == 0)
+    {
+        $pic = $pic . "Off";
+        $text = "IN";
+    }
+    $link = $adeiChannel[6][9] . "," . $adeiChannel[6][10];
+    placePicWithLink(368 - 30, 1510, $pic . ".png", 30, "status FPD sources (electron and gamma source)&#10;green: retracted (out), red: inserted (in), grey: undefined", $link);
+    placeTextWithLink(368, 1490, $text, 70, 3, "#000000", "status FPD sources (electron and gamma source)", $link);
+
+    // ########## AIR COILS ##########
+
+
+    // LFCS
+    $tol = 0.3;
+    $text = "Unkn";
+    $color = "#FFD800";
+    $lfcs_array_offset = 2;
+
+    $lfcs_config = - 1; // store config for emcs later in loop
+    for ($pp = 0;$pp < sizeof($aircoil_settings);$pp++)
+    {
+        for ($id = 0;$id < 22;$id++) // still old air coil number
+
+        {
+            $tol = abs($tol);
+            if ($id == 20)
+            {
+                $lfcs_array_offset = - 19;
+            }
+            if ($id == 21)
+            {
+                $lfcs_array_offset = - 21;
+            }
+            if (abs($adeiValue[0][$id + $lfcs_array_offset] - $aircoil_settings[$pp][$id + 1]) < $tol)
+            {
+                if ($id == 19)
+                {
+                    $text = $aircoil_settings[$pp][0];
+                    $lfcs_config = $pp;
+                    $color = "#FF9300";
+                }
+                if ($id == 21)
+                {
+                    $color = "#4CFF00";
+                }
+            }
+            else break;
+        }
+        if ($lfcs_config > - 1) break;
+    }
+    if ($text == "All Off")
+    {
+        $text = "OFF";
+        $color = "#FF0000";
+    }
+
+    $mace_setting["LFCS"] = $text;
+    placeText(-15, 232, "LFCS", 85, 5, "#000000");
+    placeBox(10, 230, $text, 85, 3, $color);
+
+    // EMCS
+    $tol = 0.2;
+    $text = "???";
+    $color = "#FFD800";
+    $EMCShor = $aircoil_settings[$lfcs_config][21];
+    $EMCSver = $aircoil_settings[$lfcs_config][22];
+
+    if ($adeiValue[0][0] > $EMCSver - $tol && $adeiValue[0][0] < $EMCSver + $tol && $adeiValue[0][1] > $EMCShor - $tol && $adeiValue[0][1] < $EMCShor + $tol)
+    {
+        $text = "On OK";
+        $color = "#4CFF00";
+    }
+    else if ($adeiValue[0][0] > $tol || $adeiValue[0][1] > $tol)
+    {
+        $text = "Unkn";
+        $color = "#FFD800";
+    }
+    else
+    {
+        $text = "ERR " . $lfcs[$lfcs_config][16];
+        $color = "#FF0000";
+    }
+    if ($adeiValue[0][0] < $tol && $adeiValue[0][1] < $tol && $adeiValue[0][0] > - $tol && $adeiValue[0][1] > - $tol)
+    {
+        $text = "OFF";
+        $color = "#FF0000";
+    }
+
+    $mace_setting["EMCS"] = $text;
+    placeText(50, 232, "EMCS", 85, 5, "#000000");
+    placeBox(75, 230, $text, 85, 3, $color);
+
+    // print current values
+    $tol = 0.5;
+    for ($coil = 0;$coil < 22;$coil++)
+    {
+        $current = $adeiValue[0][$coil];
+        $voltage = $adeiValue[1][$coil];
+
+        $voltage = sprintf('%.1F', $voltage);
 
-	// Ex3110 
-	$value = $adeiValue[8][0];
-	$pic = "ex";
-	$text = "---";
-	if ($value > 2E-5) {$text = "OFF"; {if ($MSmode < 5) $pic = $pic . "Off"; else $pic = $pic;}}
-	else if ($value <= 2E-5 && $value > 1E-12) { $pic = $pic . "On"; $text = sprintf('%.1E', $value); }
-	placePicWithLink(510, 1435, $pic . ".png", 30, "status extractor ion gauge Ex3110&#10;green: on, red: off, grey: undefined", $adeiChannel[8][0]);
-	placeTextWithLink(539, 1415, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge Ex3110", $adeiChannel[8][0]);
-
-	// Ex1110
-	$value = $adeiValue[28][0];
-    $link = $adeiChannel[28][0];
-    $pic = "ex";
-	$text = "---";
-	if ($value > 2E-5) {$text = "OFF"; {if ($MSmode < 5) $pic = $pic . "Off"; else $pic = $pic;}}
-	else if ($value <= 2E-5 && $value > 1E-12) { $pic = $pic . "On"; $text = sprintf('%.1E', $value);}
-	placePicWithLink(460, 1435, $pic.".png", 30, "status extractor ion gauge Ex1110&#10;green: off, blinking: on, grey: undefined", $link);
-	placeTextWithLink(489, 1415, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge Ex1110", $link);
-
-	// Ex0096
-	$value = $adeiValue[9][2];
-    $link = $adeiChannel[9][2];
-	$pic = "ex";
-	$text = "---";
-    if ($value > 1E+2) {$text = "OFF"; {if ($MSmode < 5) $pic = $pic . "Off"; else $pic = $pic;}}
-    else if ($value > 2E-5) { $pic = $pic . "Off"; $text = "OFF"; }
-	else if ($value <= 2E-5 && $value > 1E-12) { $pic = $pic . "On"; $text = sprintf('%.1E', $value);}
-    placePicWithLink(230, 1220, $pic.".png", 30, "status extractor ion gauge 0096&#10;green: off, blinking: on, grey: undefined", $link);
-	placeTextWithLink(259, 1200, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge 0096", $link);
-
-	// CC FPD
-	$value = $adeiValue[6][1];
-	$pic = "cc";
-	$text = "---";
-	if ($value > 1E-4) { $pic = $pic . "Off"; $text = "OFF"; }
-	if ($value < 1E-11) { $pic = $pic . "Off"; $text = "OFF"; }
-	else if ($value <= 1E-4 && $value > 1E-12) { $pic = $pic . "On"; $text = sprintf('%.1E', $value); }
-	placePicWithLink(188, 1475, $pic . ".png", 30, "status FPD cold cathode gauge&#10;green: on, red: off, grey: undefined", $adeiChannel[6][1]);
-	placeTextWithLink(217, 1455, $text, 70, 4, "#000000", "pressure [mbar] FPD cold cathode gauge", $adeiChannel[6][1]);
-
-	// Gauge Baffle
-	$value = $adeiValue[5][0];
-        $link = $adeiChannel[5][0];
         $color = "#000000";
-        $pic = "gauge";
-	$text = "---";
-	if ($value > 1E-4) { $pic = $pic . "Off"; $text = "OFF"; }
-        // standard cold blue "#0026FF"  ,  ice cold blue "#107BC7"
-        if ($value < 2E-6 && $value > 1E-9) { $pic ="gaugeOn"; $color ="#107BC7"; $text = sprintf('%.1E', $value); }
-	else if ($value >= 1E-6 && $value < 1e-1) { $pic = "gaugeOff"; $color = "FF0000"; $text = sprintf('%.1E', $value); }
-
-	placePicWithLink(460, 1315, $pic . ".png", 30, "status baffle insulation vacuum gauge&#10;gray: off, green: on, red: too high&#10Should be < 5e-6 mbar for HV operation!!!", $link);
-	placeTextWithLink(460+29, 1295, $text, 70, 4, $color, "pressure [mbar] baffle insulation vacuum gauge", $link);
-
-	// PS CC1232
-	$value = $adeiValue[27][0];
-        $link = $adeiChannel[27][0];
-	$pic = "cc";
-	$text = "---";
-	if ($value >= 9.9E-5) { $pic = $pic . "Off"; $text = "OFF"; }
-	else if ($value < 1E-4 && $value > 1.2E-11) { $pic = $pic . "On"; $text = sprintf('%.1E', $value); }
-        placePicWithLink(370, 240, $pic . ".png", 30, "status cold cathode gauge CC1232&#10;green: on, red: off, grey: undefined", $link);
-	placeTextWithLink(399, 220, $text, 70, 4, "#000000", "pressure [mbar] cold cathode gauge CC1232", $link);
-
-	// PS Ex1221 
-	$value = $adeiValue[27][5];
-        $link = $adeiChannel[27][5];
-	$pic = "ex";
-	$text = "---";
-        if ($value >= 9.9E-5) {$text = "OFF"; {if ($PSmode < 5) $pic = $pic . "Off"; else $pic = $pic;}}
-	else if ($value < 1E-4 && $value > 7E-13) { $pic = $pic . "On"; $text = sprintf('%.1E', $value); }
-	placePicWithLink(188, 141, $pic . ".png", 30, "status extractor ion gauge Ex1221&#10;green: on, red: off, grey: undefined", $link);
-	placeTextWithLink(217, 121, $text, 70, 4, "#000000", "pressure [mbar] extractor ion gauge Ex1221", $link);
-
-
-
-
-	// ########## VACUUM PUMPS ##########
-
-       // MS TMP Temperatures
-
-        //T<sub>max</sub> 
-	$value = max($adeiValue[25][0], $adeiValue[25][1], $adeiValue[25][2]);
-        $link = $adeiChannel[25][0] . "," . $adeiChannel[25][1] . "," . $adeiChannel[25][2];
-	$color = "#000000";
-	if ($value < 10) $color = "#0026FF";
-	else if ($value > 50) $color = "#FF0000";
-	placeTextWithLink(435, 1625, sprintf('%.1F &#176;C', $value), 70, 3, $color, "TMP max temperature PP2", $link);
-
-	$value = max($adeiValue[26][0], $adeiValue[26][1], $adeiValue[26][2]);
-        $link = $adeiChannel[26][0] . "," . $adeiChannel[26][1] . "," . $adeiChannel[26][2];
-	$color = "#000000";
-	if ($value < 10) $color = "#0026FF";
-	else if ($value > 50) $color = "#FF0000";
-	placeTextWithLink(535, 1625, sprintf('%.1F &#176;C', $value), 70, 3, $color, "TMP max temperature PP3", $link);
-
-
-
-	// TMPs (PP2 + PP3)
-
-	for ($pp = 0; $pp < 2; $pp++)
-	{
-		for ($id = 0; $id < 3; $id++)
-		{
-			$value = $adeiValue[$pp + 7][$id + 1];
-			$pic = "tmp";
-			$text = "---";
-
-			if ($value < 50)
-			{
-			  If ($MSmode < 5) $pic = $pic . "Off";
-			}
-			else if ($value >= 50 && $value < 500)
-			{
-				$text = sprintf('%.0F', $value);
-				if ($value > 450)
-				{
-					$value = $adeiValue[$pp + 7][$id + 4];
-                                        //$pic = $pic . "On";
-                                        if ($value == 1) $pic = $pic . "On";
-					else if ($value == 0) $pic = $pic . "Closed";
-				}
-				else if ($value > 240)
-				{
-					$value = $adeiValue[$pp + 7][$id + 4];
-                                        //$pic = $pic . "On";
-                                        if ($value == 1) $pic = $pic . "Standby";
-					else if ($value == 0) $pic = $pic . "Standby";
-				}
-			}
-
-			placePicWithLink(410 + $pp * 100, 1528 + $id * 35, $pic . ".png", 30, "status turbo-molecular pump TMP" . ($pp + 2) . ($id + 4) . "20&#10;green: on, yellow: on but isolated, red: off, grey: undefined", $adeiChannel[$pp + 7][$id + 1]);
-			placeTextWithLink(439 + $pp * 100, 1518 + $id * 35, $text, 50, 4, "#000000", "rotational speed [Hz] turbo-molecular pump TMP" . ($pp + 2) . ($id + 4) . "20", $adeiChannel[$pp + 7][$id + 1]);
-		}
-	}
-
-       // PS TMPs
-
-	for ($id = 0; $id < 2; $id++)
-	{
-                $value = $adeiValue[27][$id + 1];
-                $link = $adeiChannel[27][$id + 1];
-		$pic = "tmp";
-		$text = "---";
-
-		if ($value < 50)
-		{
-		  If ($PSmode < 5) $pic = $pic . "Off";
-		}
-		else if ($value >= 50 && $value < 700)
-		{
-			$text = sprintf('%.0F', $value);
-			if ($value > 570)
-			{
-				$value = $adeiValue[27][$id + 3];
-                                //$pic = $pic . "On";
-                                if ($value == 1) $pic = $pic . "On";
-				else if ($value == 0) $pic = $pic . "Standby";
-			}
-		}
-
-		placePicWithLink(370, 157 + $id * 35, $pic . ".png", 30, "status turbo-molecular pump TMP" . (1123 - $id) . "&#10;green: on, yellow: on but isolated, red: off, grey: undefined", $link);
-		placeTextWithLink(399, 148 + $id * 35, $text, 50, 4, "#000000", "rotational speed [Hz] turbo-molecular pump TMP" . (1123 - $id), $link);
-	}
-
-
-	// FPD CP
-
-	$value = $adeiValue[6][3];
-	$pic = "cp";
-	$text = "---";
-
-	if ($value > 20)
-	{
-		$pic = $pic . "Off";
-	}
-	else if ($value <= 20 && $value > 5)
-	{
-		$text = sprintf('%.0F K', $value);
-		$value = $adeiValue[6][12];
-		if ($value == 1) { $pic = $pic . "On"; }
-		else if ($value == 0) { $pic = $pic . "Standby"; }
-	}
-
-	placePicWithLink(368-30, 1475, $pic . ".png", 30, "status FPD UHV cryo pump&#10;green: on, yellow: on but isolated, red: off, grey: undefined", $adeiChannel[6][3]);
-	placeTextWithLink(368, 1455, $text, 70, 3, "#000000", "temperature FPD UHV cryo pump", $adeiChannel[6][3]);
-
-
-
-	// ########## FPD SOURCES ##########
-
-	$pic = "source";
-	$text = "---";
-	if ($adeiValue[6][9] == 1 && $adeiValue[6][10] == 1) { $pic = $pic . "On"; $text = "OUT"; }
-	else if ($adeiValue[6][9] == 1 && $adeiValue[6][10] == 0) { $pic = $pic . "EIn"; $text = "IN"; }
-	else if ($adeiValue[6][9] == 0 && $adeiValue[6][10] == 1) { $pic = $pic . "GIn"; $text = "IN"; }
-	else if ($adeiValue[6][9] == 0 && $adeiValue[6][10] == 0) { $pic = $pic . "Off"; $text = "IN"; }
-	$link = $adeiChannel[6][9] . "," . $adeiChannel[6][10];
-	placePicWithLink(368-30, 1510, $pic . ".png", 30, "status FPD sources (electron and gamma source)&#10;green: retracted (out), red: inserted (in), grey: undefined", $link);
-	placeTextWithLink(368, 1490, $text, 70, 3, "#000000", "status FPD sources (electron and gamma source)", $link);
-
-
-
-
-	// ########## AIR COILS ##########
-
-
-	// LFCS
-
-	$tol = 0.3;
-	$text = "Unkn";
-	$color = "#FFD800";
-        $lfcs_array_offset = 2;
-     
-        $lfcs_config = -1;  // store config for emcs later in loop
-	for ($pp = 0; $pp < sizeof($aircoil_settings); $pp++)
-	{
-		for ($id = 0; $id < 22; $id++) // still old air coil number
-		{
-                        $tol = abs($tol);
-			if ($id == 20) {$lfcs_array_offset = -19; }
-			if ($id == 21) {$lfcs_array_offset = -21; }
-			if (abs($adeiValue[0][$id + $lfcs_array_offset] - $aircoil_settings[$pp][$id + 1]) < $tol)
-			{
-			  if ($id == 19) { $text = $aircoil_settings[$pp][0]; $lfcs_config = $pp; $color = "#FF9300"; }
-			  if ($id == 21) { $color = "#4CFF00"; }			}
-			else break;
-		}
-		if ($lfcs_config > -1) break;
-	}
-	if ($text == "All Off") { $text = "OFF"; $color = "#FF0000"; }
-
-        $mace_setting["LFCS"]=$text; 
-        placeText(-15, 232, "LFCS", 85, 5, "#000000");
-        placeBox(10, 230, $text, 85, 3, $color);
-
-        // EMCS
-
-	$tol = 0.2;
-	$text = "???";
-	$color = "#FFD800";
-        $EMCShor = $aircoil_settings[$lfcs_config][21];
-        $EMCSver = $aircoil_settings[$lfcs_config][22];
-
-	if ($adeiValue[0][0] > $EMCSver - $tol && $adeiValue[0][0] < $EMCSver + $tol && $adeiValue[0][1] > $EMCShor - $tol && $adeiValue[0][1] < $EMCShor + $tol) { $text = "On OK"; $color = "#4CFF00"; }
-	else if ($adeiValue[0][0] > $tol || $adeiValue[0][1] > $tol) { $text = "Unkn"; $color = "#FFD800"; }
-        else { $text = "ERR ".$lfcs[$lfcs_config][16]; $color = "#FF0000"; }
-	if ($adeiValue[0][0] < $tol && $adeiValue[0][1] < $tol && $adeiValue[0][0] > -$tol && $adeiValue[0][1] > -$tol) { $text = "OFF"; $color = "#FF0000"; }
-
-        $mace_setting["EMCS"]=$text; 
- 	placeText(50, 232, "EMCS", 85, 5, "#000000");
-        placeBox(75, 230, $text, 85, 3, $color);
-
-
-        // print current values 
-	$tol = 0.5;
-	for ($coil = 0; $coil < 22; $coil++)
-	{
-		$current = $adeiValue[0][$coil];
-		$voltage = $adeiValue[1][$coil];
-
-		$voltage = sprintf('%.1F', $voltage);
-		
-		$color = "#000000";
-		if (abs($current) < $adeiValue[21][$coil] - $tol || abs($current) > $adeiValue[21][$coil] + $tol) $color = "#FF0000";
-		if ($current < -$tol && $adeiValue[22][$coil] != 1) $color = "#FF0000";
-		if ($current > $tol && $adeiValue[22][$coil] != 0) $color = "#FF0000";
-
-		$current = sprintf('%.1F', $current);
-		if ($current <= -100 || $current >= 100) $current = sprintf('%.0F', $current);
-		if ($current >= -0.1 && $current <= 0.1) $current = sprintf('%.1F', 0.0); 
-		
-		$vpos = -26;
-		$pos = 609 + ($coil - 4) * 42.9;
-		if ($coil == 0) {$pos = 320; $vpos = 56;}      // pos for EMCS VER
-		else if ($coil == 1) {$pos = 378; $vpos = 56;} // pos for EMCS HOR
-		else if ($coil == 21) {$pos = $pos + 4;}       // for coil 21
-
-		$lem = $adeiValue[2][$coil];
-		$color = "#006400";
-		if ($lem == 1) $current = "LEM";
-
-		$label = ($coil - 1);
-		if ($coil == 0) $label = "VER";
-		else if ($coil == 1) $label = "HOR";
-
-		// add value label
-		//if ($coil == 2) {
-		//  placeText($vpos+2, $pos-30, "I [A] =", 50, 2, "#888888");
-		//  placeText($vpos+17, $pos-30, "U [V]  =", 47, 1, "#888888");
-		//}
-		
-		// add air coil numbers here
-		placeText($vpos+32, $pos, $label, 70, 2, "#000000");
-
-		// print voltage value of air coil
-		placeTextWithLink($vpos+18, $pos, $voltage, 70, 1, $color, "air-coil voltage [V]", $adeiChannel[1][$coil]);
-		
-		// print current value of air coil
-		placeTextWithLink($vpos, $pos, $current, 70, 4, $color, "air-coil current [A]&#10;LEM: DCCT offline", $adeiChannel[0][$coil]);
-	}
-
-
-
-
-// ######### HV Divider Temp Monitoring
-	
-  if ($MSmode == 5)
-      { // only display in MS operation mode High-Voltage
+        if (abs($current) < $adeiValue[21][$coil] - $tol || abs($current) > $adeiValue[21][$coil] + $tol) $color = "#FF0000";
+        if ($current < - $tol && $adeiValue[22][$coil] != 1) $color = "#FF0000";
+        if ($current > $tol && $adeiValue[22][$coil] != 0) $color = "#FF0000";
+
+        $current = sprintf('%.1F', $current);
+        if ($current <= - 100 || $current >= 100) $current = sprintf('%.0F', $current);
+        if ($current >= - 0.1 && $current <= 0.1) $current = sprintf('%.1F', 0.0);
+
+        $vpos = - 26;
+        $pos = 609 + ($coil - 4) * 42.9;
+        if ($coil == 0)
+        {
+            $pos = 320;
+            $vpos = 56;
+        } // pos for EMCS VER
+        else if ($coil == 1)
+        {
+            $pos = 378;
+            $vpos = 56;
+        } // pos for EMCS HOR
+        else if ($coil == 21)
+        {
+            $pos = $pos + 4;
+        } // for coil 21
+        $lem = $adeiValue[2][$coil];
+        $color = "#006400";
+        if ($lem == 1) $current = "LEM";
+
+        $label = ($coil - 1);
+        if ($coil == 0) $label = "VER";
+        else if ($coil == 1) $label = "HOR";
+
+        // add value label
+        //if ($coil == 2) {
+        //  placeText($vpos+2, $pos-30, "I [A] =", 50, 2, "#888888");
+        //  placeText($vpos+17, $pos-30, "U [V]  =", 47, 1, "#888888");
+        //}
+        // add air coil numbers here
+        placeText($vpos + 32, $pos, $label, 70, 2, "#000000");
+
+        // print voltage value of air coil
+        placeTextWithLink($vpos + 18, $pos, $voltage, 70, 1, $color, "air-coil voltage [V]", $adeiChannel[1][$coil]);
+
+        // print current value of air coil
+        placeTextWithLink($vpos, $pos, $current, 70, 4, $color, "air-coil current [A]&#10;LEM: DCCT offline", $adeiChannel[0][$coil]);
+    }
 
+    // ######### HV Divider Temp Monitoring
+    if ($MSmode == 5)
+    { // only display in MS operation mode High-Voltage
         $K35_temp = $adeiValue[10][26];
         $K35_link = $adeiChannel[10][26];
         $K65_temp = $adeiValue[10][27];
         $K65_link = $adeiChannel[10][27];
-	$divider_temp_spec = 25.0;
-	$tol_div = 0.2;
-
-	$color = "#FFFFFF";
-	if (abs($K35_temp - $divider_temp_spec) > $tol_div) $color = "#FF0000";
-	placeBox(586, 322,sprintf('%.1F &#176;C', $K35_temp), 50, 2, $color);
-
-	placePicWithLink(536,324, "K35_drawing.png", 50, "K35 temperature status", $K35_link);
-	
-	$color = "#FFFFFF";
-	if (abs($K65_temp - $divider_temp_spec) > $tol_div) $color = "#FF0000";
-	placeBox(586, 378,sprintf('%.1F &#176;C', $K65_temp), 50, 2, $color);
-
-	placePicWithLink(536,379, "K65_drawing.png", 50, "K65 temperature status", $K65_link);
-      }
-
-// ########## HIGH VOLTAGE ##########
-
-if (($MSmode == 5) or ($MSmode == 4))
-  { // only display in MS operation mode High-Voltage or baking
-
-    // #####  path to patch panel configuration file
-    if (file_exists("patchpanel/data/activeIEconfig.txt"))
-      {$path_to_patchpanel = "patchpanel/data/activeIEconfig.txt"; }// only for KAAS server
-    else {$path_to_patchpanel = "patchpanel/ringstoadei.txt"; }   // for IKP dev server
-   
-   // load patch-panel configuration
-    $handle = fopen($path_to_patchpanel, "r");
-    
-    $ringsToAdei = array();
-    if ($handle)
-      {
-	while (($buffer = fgets($handle, 4096)) !== false)
-	  {
-	    $buffer = trim($buffer);
-	    $ringsToAdei[count($ringsToAdei)] = $buffer;
-	  }
-	fclose($handle);
-      }
-    
-    // labels
-    
-    $posY = 8; // offset between labels and voltages (13)
-    $posX = 10; // down/bottom (7)
+        $divider_temp_spec = 25.0;
+        $tol_div = 0.2;
 
-    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 = DVM at IE Common voltage for SuperKrypton 2021
-        $Kal1_value = $adeiValue[30][6];
-        $Kal1_link = $adeiChannel[30][6];
-        $Kal1_TS = $adeiValue[30][7];
-        $Kal1_RunFlag = $adeiValue[30][8];
-	$Kal1_text = "DVM @ IE Common";
-	
-	$time_conversion_factor = 2082844800;
-        $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 = "K65 @ MS Tank + IE";
-	
-	// voltage monitoring readout K35
-	$color = "#000000";
-	$factor_m = 1818.108;
-	$factor_m_rel_error = 1.0e-6;
-	$offset = 3.67e-6;
-	$offset_error = 1.6e-7;
-	$gain = 0.99999956;
-	$gain_error = 6.5e-8;
-	$value = ($K35_value - $offset) * $gain * $factor_m;
-	$voltage_error = abs($value * $factor_m_rel_error * 1e3); // in mV
-	if ($voltage_error*100 < 1) { $voltage_error = 0.2; }
-	
-	// voltage display K35
-	$link = $K35_link;
-	$text = "K35 divider readout 436-REU-0-0201-0001, but connected to K65 in KNM6 at 436-REU-0-0101-0001, precision voltage value";
-
-	if ($K35_RunFlag > 0) 
-	  {
-	    placeText(342, 811, $K35_text, 140, 2, $color); // K35 voltage reading
-	    placeTextWithLink(320, 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
-	  }
-	
-	// HV switch for K65
-	$hv_switch1102_k65 = $adeiValue[35][1];
-	//$K65_text = "K65 @ MS Tank + IE";
-	$K65_text = "K35 @ MS Tank + IE";
-	//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 = 1818.108;
-	//$factor_m_rel_error = 0.02/$factor_m;
-	//$offset = -4.1e-6;
-	//$gain = 1.00000136;
-        
-	$factor_m = 1972.462;
-	$factor_m_rel_error = 1.0e-6; // including calibration, gain and offset error
-	$offset = 3.67e-6;
-	$offset_error = 3.5e-7;
-	$gain = 0.999999277;
-	$gain_error = 9.9e-8;
-	$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 = $K65_link;
-	$text = "K65 divider channel 436-REU-0-0301-0001, precision voltage value, KNM5 calibration, in 2021 connected to K35 at 436-REU-0-0201-0001";
-	//$text = "K65 divider channel 436-REU-0-0301-0001, precision voltage value, KNM5 calibration, in 2021 used for 436-REU-0-0201-0001 as long as K35 is down.";
-	
-	if ($K65_RunFlag > 0) 
-	  {
-	    if (($value < -19724.6) & ($value > -19724.7)) placeText(340, 796, "calibration in progress", 170, 2, "green"); // calibration ongoing
-	    placeTextWithLink(358, 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
-	// in 2021 used for IE Common monitoring
-	$color = "#000000";
-	//$factor_m = 5000.1021;
-	//$offset = 4.529e-6;
-	//$gain = 0.999997525656185;
-	$factor_m = 1.0;
-	$offset = 0.0;
-	$gain = 1.0;
-	$value = ($Kal1_value - $offset) * $gain * $factor_m;
-	//        $voltage_error = abs($value * 2e-3);
-	$voltage_error = abs($value * 20 * 10e-6);
-	//if ($voltage_error*100 < 1) { $voltage_error = 0.2; }
-	if ($voltage_error*100 < 0.002) { $voltage_error = 0.002; }
-	
-	// voltage display K35
-	$link = $Kal1_link;
-	//	$text = "JRL divider at Kal1 monitoring input 436-REU-0-0501-0001, precision voltage value";
-	$text = "DVM at IE Common, 436-REU-0-0301-001, precision voltage value";
-
-	if ($Kal1_RunFlag > 0)
-	{
-	  placeText(304, 815, $Kal1_text, 130, 2, $color); // Kal1 voltage reading
-	  if (abs($value) > 36000) placeText(490, 116, "calibration in progress", 170, 2, "green"); // calibration ongoing
-	  placeTextWithLink(284, 765, "U<sub>IE</sub> = ".sprintf('%.3F', $value ) . "(" . sprintf('%.0F', $voltage_error*100 ) .") V" , 230, 4, $color, $text, $link);
-	}
-
-	
-	// Post Regulation Current Monitor
-
-	$U_ist = abs($adeiValue[10][0]);
-	$I_ist = abs($adeiValue[10][28]);
-	$PID_setpoint = abs($adeiValue[10][30]);
-	$PR_hw_current = abs($adeiValue[10][31]);
-	$hv_switch1102_k65 = $adeiValue[35][1];
-	$hv_switch1103_k35 = $adeiValue[35][2];
-	$R_K65 = 54.5e6;
-	$R_K35 = 58.65e6;
-	if ($hv_switch1103_k35+$hv_switch1102_k65 = 2) $R_ges = 33.057e6;  // manual entry of R_ges with K65 and K35 connected 
-	else $R_ges = (1-$hv_switch1103_k35)*$R_K35+(1-$hv_switch1102_k65)*$R_K65;  // choose just one divider
-
-	
-	$I_noPR = $U_ist / $R_ges * 1000.0;
-	$I_PR = $I_ist - $I_noPR;
-	$APR_on = abs($adeiValue[10][29]);
-
-	$verbose = false;  // switch for status outputs, dev mode
-	
-	// 28W limit, 33 kV mit 0,7 mA ist Maximum für stabilen Betrieb
-	$P_PR = 0.0;
-	If ($I_PR > 0.01) {  $P_PR = $U_ist * $I_PR/1000; }
-	else $I_PR = 0.0;
-
-	$pic = "postreg";
-	
-	if ($verbose) echo '<br><br><br>';
-	if ($I_PR < 0.1) {  if ($verbose) echo 'PR off<br>';  $pic = $pic."Off";}
-	else {  if ($I_PR < 0.46) {   if ($verbose) echo 'PR_current low';    $pic = $pic."Warn";}
-	  else if (($I_PR >= 0.46) && ($I_PR <= 0.8)) {   if ($verbose) echo 'PR_current OK'; $pic = $pic."On";}
-	  else if ($I_PR > 0.8) {  if ($verbose) echo 'PR_current overload';   $pic = $pic."Alarm";}
-
-	  if ($verbose) {
-	    echo '<br>';			    
-	    if ($P_PR < 23) echo "    PR_wattage in range";
-	    else if ($P_PR < 28) echo "    PR_wattage high";
-	    else if ($P_PR > 28) echo "    PR_wattage CRITICAL";
-	    echo '<br>';
-	  }
-	}
-
-	if ($verbose) {
-	  echo '<br>';			    
-	  
-	  echo 'R_Divider = '.$U_ist/($I_ist*1000).' MOhm, ';
-	  echo 'I_ist = '.$I_ist.' mA,  ';
-	  echo 'I_noPR = '.$I_noPR.' mA, ';	
-	  echo 'I_PR = '.$I_PR.' mA, ';
-	  echo 'P_PR = '.$P_PR.' W<br>';
-	}
-	
-	$color = "#000000";
-	placePic(435,339, $pic.".png", 30, "Estimated status of HV post regulation &#010green  = normal operation &#010gray    = off &#010red      = current too high &#010orange = current too low");
-
-	if ($I_PR < 0.1)
-	  {
-	    placeText(466,324, "OFF", 60, 2, $color, "HV post regulation offline.");
-	  }
-	else
-	  {
-	    placeTextWithLink(466,325, sprintf('%.2F mA', $I_PR), 60, 2, $color, "Estimated current through post regulation triode shunt. 0.46-0.8 mA for optimal performance.", $adeiChannel[10][28]);
-	    placeTextWithLink(480,325, sprintf('%2.0F W', $P_PR), 60, 2, $color, "Estimated power consumption of post regulation triode shunt. Must be < 28 W.", $adeiChannel[10][28]);
-
-	    if ($APR_on) placeTextWithLink(492,335, "APR ON", 40, 0, "#40AA40", "Advanced Post Regulation (APR) status.", $adeiChannel[10][29]);
-	  
-	    if ($PID_setpoint > 9.0) placeTextWithLink(501,285, "APR setpoint limit", 140, 0, "#FF0000", "APR setpoint at 90% of limit.", $adeiChannel[10][30]);
-
-	    if (abs($I_PR - $PR_hw_current) > 0.1) placeTextWithLink(510,285, "PR current mismatch", 140, 0, "#FF0000", "Estimated and actual current of post regulation don't match.", $adeiChannel[10][31]);
-	  }
-  }  // 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
-    placeText(265, 815, "MS IE COMMON", 130, 2, "#000000"); // mainspec IE Common
-    
-    // MS Tank from Precision HCP Supply or Standard HCN
-    $text = "MS TANK";
-    $ms_hcp_soll = $adeiValue[10][1];  //flipped 2021-02-16 for new HCP device
-    $ms_hcn_soll = $adeiValue[10][25];
-
-    $HCP = true;
-    if  ($ms_hcn_soll == 0) {
-      if ($ms_hcp_soll == 0) { $text = $text . " OFF";}
-      else { $text = $text . " HCP"; $HCP = true; }
-    } else { $text = $text . " HCN"; $HCP = false; }
-    placeText(70, 830, $text, 100, 2, "#000000"); // mainspec tank
-    // switch values here between HCN and HCP in Value and Channel Array !!!
-    //if ($HCP) { $adeiValue[10][0] = -$adeiValue[10][24]; $adeiValue[10][1] = $adeiValue[10][25]; $adeiChannel[10][0] = $adeiChannel[10][24]; $adeiChannel[10][1] = $adeiChannel[10][25]; }
-
-    if ($HCP) { $adeiValue[10][0] = -$adeiValue[10][0];}
-      
-    placeText(110-$posY, 845, "W7-11", 70, 2, "#000000"); // w7-11
-    placeText(503+$posY+$posX, 845, "E7-11", 70, 2, "#000000"); // e7-11
-    
-    placeText(126-$posY, 600, "W6", 70, 2, "#000000"); // w6
-    placeText(487+$posY+$posX, 600, "E6", 70, 2, "#000000"); // e6
-    placeText(126-$posY, 1090, "W12", 70, 2, "#000000"); // w12
-    placeText(487+$posY+$posX, 1090, "E12", 70, 2, "#000000"); // e12
-    
-    placeText(161-$posY, 516, "W5", 70, 2, "#000000"); // w5
-    placeText(452+$posY+$posX, 516, "E5", 70, 2, "#000000"); // e5
-    placeText(161-$posY, 1174, "W13", 70, 2, "#000000"); // w13
-    placeText(452+$posY+$posX, 1174, "E13", 70, 2, "#000000"); // e13
-    
-    placeText(194-$posY, 434, "W4", 70, 2, "#000000"); // w4
-    placeText(419+$posY+$posX, 434, "E4", 70, 2, "#000000"); // e4
-    placeText(194-$posY, 1256, "W14", 70, 2, "#000000"); // w14
-    placeText(419+$posY+$posX, 1256, "E14", 70, 2, "#000000"); // e14
-    
-    placeText(225-$posY, 385, "W3", 70, 2, "#000000"); // w3
-    placeText(388+$posY+$posX, 385, "E3", 70, 2, "#000000"); // e3
-    placeText(225-$posY, 1305, "W15", 70, 2, "#000000"); // w15
-    placeText(388+$posY+$posX, 1305, "E15", 70, 2, "#000000"); // e15
-    
-    placeText(273-$posY, 352, "W2", 70, 2, "#000000"); // w2
-    placeText(340+$posY+$posX, 352, "E2", 70, 2, "#000000"); // e2
-    placeText(273-$posY, 1338, "W16", 70, 2, "#000000"); // w16
-    placeText(340+$posY+$posX, 1338, "E16", 70, 2, "#000000"); // e16
-    
-    if ($adeiValue[10][8] > 10.0) placeText(309, 359, "APE", 70, 2, "#000000"); // ape south
-    if ($adeiValue[10][10] > 10.0) placeText(309, 1331, "APE", 70, 2, "#000000"); // ape north
-    
-    // offset voltages
-    
-    $posY = 16; // offset between outer and inner voltages
-    $ringsPosY = array( 275, 275+$posY, 227, 227+$posY, 196, 196+$posY, 163, 163+$posY, 128, 128+$posY, 112, 112+$posY, 128, 128+$posY, 163, 163+$posY, 196, 196+$posY, 227, 227+$posY, 275, 275+$posY, 342, 342-$posY, 390, 390-$posY, 421, 421-$posY, 454, 454-$posY, 489, 489-$posY, 505, 505-$posY, 489, 489-$posY, 454, 454-$posY, 421, 421-$posY, 390, 390-$posY, 342, 342-$posY );
-    $ringsPosX = array( 352, 352, 385, 385, 434, 434, 516, 516, 600, 600, 845, 845, 1090, 1090, 1174, 1174, 1256, 1256, 1305, 1305, 1338, 1338, 352, 352, 385, 385, 434, 434, 516, 516, 600, 600, 845, 845, 1090, 1090, 1174, 1174, 1256, 1256, 1305, 1305, 1338, 1338 );
-    $tol = 0.2;
+        $color = "#FFFFFF";
+        if (abs($K35_temp - $divider_temp_spec) > $tol_div) $color = "#FF0000";
+        placeBox(586, 322, sprintf('%.1F &#176;C', $K35_temp) , 50, 2, $color);
+
+        placePicWithLink(536, 324, "K35_drawing.png", 50, "K35 temperature status", $K35_link);
+
+        $color = "#FFFFFF";
+        if (abs($K65_temp - $divider_temp_spec) > $tol_div) $color = "#FF0000";
+        placeBox(586, 378, sprintf('%.1F &#176;C', $K65_temp) , 50, 2, $color);
+
+        placePicWithLink(536, 379, "K65_drawing.png", 50, "K65 temperature status", $K65_link);
+    }
 
-    $ringNames = array( "W2", "W2i", "W3", "W3i",  "W4", "W4i", "W5", "W5i", "W6", "W6i", "W7-11", "W7-11i", "W12", "W12i", "W13", "W13i", "W14", "W14i", "W15", "W15i", "W16", "W16i", "E2", "E2i", "E3", "E3i",  "E4", "E4i", "E5", "E5i", "E6", "E6i", "E7-11", "E7-11i", "E12", "E12i", "E13", "E13i", "E14", "E14i", "E15", "E15i", "E16", "E16i");
-    
-    for ($pp = 0; $pp < 2; $pp++) // west (0), east (1)
-      {
-	for ($id = 0; $id < 22; $id++) // rings: o, i, o, i, ...
-	  {
-	    // show voltage if not shorted to IE
-	    if ($ringsToAdei[$id + 22*$pp] != "IE" && $ringsToAdei[$id + 22*$pp] != "")
-	      {
-		// color
-		if ( ($adeiValue[11 + 2*$pp][$ringsToAdei[$id + 22*$pp]] > $adeiValue[12 + 2*$pp][$ringsToAdei[$id + 22*$pp]] - $tol) && ($adeiValue[11 + 2*$pp][$ringsToAdei[$id + 22*$pp]] < $adeiValue[12 + 2*$pp][$ringsToAdei[$id + 22*$pp]] + $tol) )
-		  $color = "#000000";
-		else
-		  $color = "#FF0000";
-
-			
-		// show voltage
-		if ( ($id % 2 == 0) || ($id % 2 == 1 && $ringsToAdei[$id + 22*$pp] != $ringsToAdei[$id + 22*$pp - 1]) )
-		  {
-		    $value = $adeiValue[11 + 2*$pp][$ringsToAdei[$id + 22*$pp]];
-	            $mace_setting[$ringNames[$id + 22*$pp]]=$value; 
-		    placeTextWithLink($ringsPosY[$id + 22*$pp], $ringsPosX[$id + 22*$pp], "+" . sprintf('%.1F', $value), 70, 4, $color, "relative voltage offset", $adeiChannel[11 + 2*$pp][$ringsToAdei[$id + 22*$pp]]);
-		  }
-	      }
-	  }
-      }
-    
-    // tank, ie, dipole, ape
-    
-    $ringsPosY = array( 52, 247, 155, 425, 306, 306, 0, 240, 300, 285, 300, 315 );
-    $ringsPosX = array( 805, 805, 805, 805, 319, 1371, 0, 150, 160, 190, 220, 190 );
-    $tolA = array ( 15, 2, 1, 1, 1, 1, 0, 250, 2, 2, 2, 2);
-    
-    // MS voltages
-    
-    for ($pp = 0; $pp < 6; $pp++) // tank (0), ie (1), ie west (2), ie east (3), ape south (4), ape north (5)
-      {
-	// color
-	if ( ($adeiValue[10][2*$pp] > $adeiValue[10][2*$pp + 1] - $tolA[$pp]) && ($adeiValue[10][2*$pp] < $adeiValue[10][2*$pp + 1] + $tolA[$pp]) )
-	  $color = "#000000";
-	else
-	  $color = "#FF0000";
-	
-	// show voltage
-	
-	$value = $adeiValue[10][2*$pp];
-	$link = $adeiChannel[10][2*$pp];
-	
-	$dipolestatus = $adeiValue[2][16];
-	$dipolelink = $adeiChannel[2][16];
-	
-	if ($pp == 0) { $text = "absolute tank potential HCN:436-EHV-0-1001-0002 HCP:436-EHV-0-1002-0002"; }
-	else if ($pp == 1) { $text = "IE common offset potential, 436-EHV-0-1003-0002"; }
-	else if ($pp == 2) { $text = "relative voltage potential west IE"; }
-	else if ($pp == 3) { $text = "relative voltage potential east IE"; }
-	else if ($pp == 4) { $text = "relative voltage potential south APE"; }
-	else if ($pp == 5) { $text = "relative voltage potential north APE"; }
-	
-	if ($pp == 2 || $pp == 3)
-	  {
-	    if ($dipolestatus == 1) // dipole enabled
-	      {
-		$color = "#990000";
-		$value = $adeiValue[10][2*$pp];
-		if ($pp == 2)
-		  {
-		    placeText($ringsPosY[$pp] + 40, $ringsPosX[$pp], "DIPOLE", 150, 4, "#CC0000" );
-                    
-		  }
-		else if ($pp == 3)
-		  {
-		    placeText($ringsPosY[$pp] + 40, $ringsPosX[$pp], "DIPOLE", 150, 4, "#CC0000");
-                    
-		  }
-	      }
-	    else
-	      {
-		$value = $adeiValue[10][2*$pp]; // dipole disabled
-		$color = "#909090";
-	      }
-	    
-	    if ($pp == 2) placeText(180, 825, "MS WEST IE", 110, 2, $color); // west IE
-	    else if ($pp == 3) placeText(450, 825, "MS EAST IE", 110, 2, $color); // east IE
-	    
-	    $link = $adeiChannel[10][2*$pp+1] . "," . $adeiChannel[10][2*$pp] . "," . $dipolelink;
-	  }
-	
-	// tank potential
-	if ($pp == 0) placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F V', -$value), 150, 4, $color, $text, $link);
-	
-	// IE common
-	else if ($pp == 1)
-	  {
-	    if ($Kal1_RunFlag == 0) $digits = '%.2F V'; else $digits = '%.1F V';
-	    placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf($digits, -$value), 150, 4, $color, $text, $link);
-	    $mace_setting["IECommon"]=-$value;
-	    $digits = '';
-	  }
-	
-	// IE dipoles
-	else if ($pp == 2 || $pp == 3) placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.2F V', $value), 150, 5, $color, $text, $link);
-	
-	
-	// APE
-	else if ($pp == 4 || $pp == 5)
-	  {
-	    if ($adeiValue[10][2*$pp] > 10.0) { placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp] , sprintf('%.1F', $value), 70, 4, $color, $text, $link); }
-	  }
-      }
-  }
-
-
-// PS voltages (add $pp < 10 for PS IE )
-if ($PSmode == 5)
-  { // only display in PS operation mode High-Voltage
-    
-    
-    placeText(265, 190, "PS TANK", 70, 2, "#000000"); // prespec tank
-    placeText(330, 160, "PS IE", 120, 2, "#505050"); // prespec IE
-    
-    
-    for ($pp = 7; $pp < 12; $pp++) // PS tank (channel 7 = array entry 14 + 15), IE west (8), IE east (9)
-      {
-	// color and text
-	if ($pp == 7) { $text = "Primary PS tank potential of 416EHV1001"; $color = "#000000";}
-	else if ($pp == 8) { $text = "relative voltage potential PS IE1 Ch1A of 416EHV1002"; $color = "#505050";}
-	else if ($pp == 9) { $text = "relative voltage potential PS IE2 Ch1B of 416EHV1002"; $color = "#505050";}
-	else if ($pp == 10) { $text = "relative voltage potential PS IE3 Ch2A of 416EHV1003"; $color = "#505050";}
-	else if ($pp == 11) { $text = "relative voltage potential PS IE4 Ch2B of 416EHV1003"; $color = "#A0A0A0";}
-	
-	// setpoint mismatch color
-	if ( ($adeiValue[10][2*$pp] > $adeiValue[10][2*$pp + 1] - $tolA[$pp]) && ($adeiValue[10][2*$pp] < $adeiValue[10][2*$pp + 1] + $tolA[$pp]) )
-	  $color = $color;
-	else
-	  $color = "#FF0000";
-	
-	// show voltage
-	
-	$value = $adeiValue[10][2*$pp];
-	$link = $adeiChannel[10][2*$pp];
-	
-	if ($pp == 7) placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F V', -$value), 150, 5, $color, $text, $link);
-	else placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F V', -$value), 60, 2, $color, $text, $link);
-      }
-  }
-
-
-       // ########## Split Ring Electrodes ##########
-
-        $srPosX = array( 59, 284, 1420 );
-        $srPosY = array( 402, 402, 370 );
-        $srKATRINNumber = array( "418-EEL-3-2150", "418-EEL-3-4150", "438-EEL-3-5150" );
-
-	// CPS-PS electrode 418-EEL-2150
-
-        // $sr: 0 = cps-ps ; 1 = PS-MS ; 2 = MS-FPD
-        for ($sr = 0; $sr < 3; $sr++)
-	{ 
-        $splitringON = $adeiValue[36][4*$sr + 3];
-	    $pic = "splitring";
+    // ########## HIGH VOLTAGE ##########
+    if (($MSmode == 5) or ($MSmode == 4))
+    { // only display in MS operation mode High-Voltage or baking
+        // #####  path to patch panel configuration file
+        if (file_exists("patchpanel/data/activeIEconfig.txt"))
+        {
+            $path_to_patchpanel = "patchpanel/data/activeIEconfig.txt";
+        } // only for KAAS server
+        else
+        {
+            $path_to_patchpanel = "patchpanel/ringstoadei.txt";
+        } // for IKP dev server
+        // load patch-panel configuration
+        $handle = fopen($path_to_patchpanel, "r");
+
+        $ringsToAdei = array();
+        if ($handle)
+        {
+            while (($buffer = fgets($handle, 4096)) !== false)
+            {
+                $buffer = trim($buffer);
+                $ringsToAdei[count($ringsToAdei) ] = $buffer;
+            }
+            fclose($handle);
+        }
+
+        // labels
+        $posY = 8; // offset between labels and voltages (13)
+        $posX = 10; // down/bottom (7)
+        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 = DVM at IE Common voltage for SuperKrypton 2021
+            $Kal1_value = $adeiValue[30][6];
+            $Kal1_link = $adeiChannel[30][6];
+            $Kal1_TS = $adeiValue[30][7];
+            $Kal1_RunFlag = $adeiValue[30][8];
+            $Kal1_text = "DVM @ IE Common";
+
+            $time_conversion_factor = 2082844800;
+            $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 = "K65 @ MS Tank + IE";
+
+            // voltage monitoring readout K35
+            $color = "#000000";
+            $factor_m = 1818.108;
+            $factor_m_rel_error = 1.0e-6;
+            $offset = 3.67e-6;
+            $offset_error = 1.6e-7;
+            $gain = 0.99999956;
+            $gain_error = 6.5e-8;
+            $value = ($K35_value - $offset) * $gain * $factor_m;
+            $voltage_error = abs($value * $factor_m_rel_error * 1e3); // in mV
+            if ($voltage_error * 100 < 1)
+            {
+                $voltage_error = 0.2;
+            }
+
+            // voltage display K35
+            $link = $K35_link;
+            $text = "K35 divider readout 436-REU-0-0201-0001, but connected to K65 in KNM6 at 436-REU-0-0101-0001, precision voltage value";
+
+            if ($K35_RunFlag > 0)
+            {
+                placeText(342, 811, $K35_text, 140, 2, $color); // K35 voltage reading
+                placeTextWithLink(320, 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
+
+            }
+
+            // HV switch for K65
+            $hv_switch1102_k65 = $adeiValue[35][1];
+            //$K65_text = "K65 @ MS Tank + IE";
+            $K65_text = "K35 @ MS Tank + IE";
+            //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 = 1818.108;
+            //$factor_m_rel_error = 0.02/$factor_m;
+            //$offset = -4.1e-6;
+            //$gain = 1.00000136;
+            $factor_m = 1972.462;
+            $factor_m_rel_error = 1.0e-6; // including calibration, gain and offset error
+            $offset = 3.67e-6;
+            $offset_error = 3.5e-7;
+            $gain = 0.999999277;
+            $gain_error = 9.9e-8;
+            $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 = $K65_link;
+            $text = "K65 divider channel 436-REU-0-0301-0001, precision voltage value, KNM5 calibration, in 2021 connected to K35 at 436-REU-0-0201-0001";
+            //$text = "K65 divider channel 436-REU-0-0301-0001, precision voltage value, KNM5 calibration, in 2021 used for 436-REU-0-0201-0001 as long as K35 is down.";
+            if ($K65_RunFlag > 0)
+            {
+                if (($value < - 19724.6) & ($value > - 19724.7)) placeText(340, 796, "calibration in progress", 170, 2, "green"); // calibration ongoing
+                placeTextWithLink(358, 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
+            // in 2021 used for IE Common monitoring
+            $color = "#000000";
+            //$factor_m = 5000.1021;
+            //$offset = 4.529e-6;
+            //$gain = 0.999997525656185;
+            $factor_m = 1.0;
+            $offset = 0.0;
+            $gain = 1.0;
+            $value = ($Kal1_value - $offset) * $gain * $factor_m;
+            //        $voltage_error = abs($value * 2e-3);
+            $voltage_error = abs($value * 20 * 10e-6);
+            //if ($voltage_error*100 < 1) { $voltage_error = 0.2; }
+            if ($voltage_error * 100 < 0.002)
+            {
+                $voltage_error = 0.002;
+            }
+
+            // voltage display K35
+            $link = $Kal1_link;
+            //	$text = "JRL divider at Kal1 monitoring input 436-REU-0-0501-0001, precision voltage value";
+            $text = "DVM at IE Common, 436-REU-0-0301-001, precision voltage value";
+
+            if ($Kal1_RunFlag > 0)
+            {
+                placeText(304, 815, $Kal1_text, 130, 2, $color); // Kal1 voltage reading
+                if (abs($value) > 36000) placeText(490, 116, "calibration in progress", 170, 2, "green"); // calibration ongoing
+                placeTextWithLink(284, 765, "U<sub>IE</sub> = " . sprintf('%.3F', $value) . "(" . sprintf('%.0F', $voltage_error * 100) . ") V", 230, 4, $color, $text, $link);
+            }
+
+            // Post Regulation Current Monitor
+            $U_ist = abs($adeiValue[10][0]);
+            $I_ist = abs($adeiValue[10][28]);
+            $PID_setpoint = abs($adeiValue[10][30]);
+            $PR_hw_current = abs($adeiValue[10][31]);
+            $hv_switch1102_k65 = $adeiValue[35][1];
+            $hv_switch1103_k35 = $adeiValue[35][2];
+            $R_K65 = 54.5e6;
+            $R_K35 = 58.65e6;
+            if ($hv_switch1103_k35 + $hv_switch1102_k65 = 2) $R_ges = 33.057e6; // manual entry of R_ges with K65 and K35 connected
+            else $R_ges = (1 - $hv_switch1103_k35) * $R_K35 + (1 - $hv_switch1102_k65) * $R_K65; // choose just one divider
+
+
+            $I_noPR = $U_ist / $R_ges * 1000.0;
+            $I_PR = $I_ist - $I_noPR;
+            $APR_on = abs($adeiValue[10][29]);
+
+            $verbose = false; // switch for status outputs, dev mode
+            // 28W limit, 33 kV mit 0,7 mA ist Maximum für stabilen Betrieb
+            $P_PR = 0.0;
+            if ($I_PR > 0.01)
+            {
+                $P_PR = $U_ist * $I_PR / 1000;
+            }
+            else $I_PR = 0.0;
+
+            $pic = "postreg";
+
+            if ($verbose) echo '<br><br><br>';
+            if ($I_PR < 0.1)
+            {
+                if ($verbose) echo 'PR off<br>';
+                $pic = $pic . "Off";
+            }
+            else
+            {
+                if ($I_PR < 0.46)
+                {
+                    if ($verbose) echo 'PR_current low';
+                    $pic = $pic . "Warn";
+                }
+                else if (($I_PR >= 0.46) && ($I_PR <= 0.8))
+                {
+                    if ($verbose) echo 'PR_current OK';
+                    $pic = $pic . "On";
+                }
+                else if ($I_PR > 0.8)
+                {
+                    if ($verbose) echo 'PR_current overload';
+                    $pic = $pic . "Alarm";
+                }
+
+                if ($verbose)
+                {
+                    echo '<br>';
+                    if ($P_PR < 23) echo "    PR_wattage in range";
+                    else if ($P_PR < 28) echo "    PR_wattage high";
+                    else if ($P_PR > 28) echo "    PR_wattage CRITICAL";
+                    echo '<br>';
+                }
+            }
+
+            if ($verbose)
+            {
+                echo '<br>';
+
+                echo 'R_Divider = ' . $U_ist / ($I_ist * 1000) . ' MOhm, ';
+                echo 'I_ist = ' . $I_ist . ' mA,  ';
+                echo 'I_noPR = ' . $I_noPR . ' mA, ';
+                echo 'I_PR = ' . $I_PR . ' mA, ';
+                echo 'P_PR = ' . $P_PR . ' W<br>';
+            }
+
+            $color = "#000000";
+            placePic(435, 339, $pic . ".png", 30, "Estimated status of HV post regulation &#010green  = normal operation &#010gray    = off &#010red      = current too high &#010orange = current too low");
+
+            if ($I_PR < 0.1)
+            {
+                placeText(466, 324, "OFF", 60, 2, $color, "HV post regulation offline.");
+            }
+            else
+            {
+                placeTextWithLink(466, 325, sprintf('%.2F mA', $I_PR) , 60, 2, $color, "Estimated current through post regulation triode shunt. 0.46-0.8 mA for optimal performance.", $adeiChannel[10][28]);
+                placeTextWithLink(480, 325, sprintf('%2.0F W', $P_PR) , 60, 2, $color, "Estimated power consumption of post regulation triode shunt. Must be < 28 W.", $adeiChannel[10][28]);
+
+                if ($APR_on) placeTextWithLink(492, 335, "APR ON", 40, 0, "#40AA40", "Advanced Post Regulation (APR) status.", $adeiChannel[10][29]);
+
+                if ($PID_setpoint > 9.0) placeTextWithLink(501, 285, "APR setpoint limit", 140, 0, "#FF0000", "APR setpoint at 90% of limit.", $adeiChannel[10][30]);
+
+                if (abs($I_PR - $PR_hw_current) > 0.1) placeTextWithLink(510, 285, "PR current mismatch", 140, 0, "#FF0000", "Estimated and actual current of post regulation don't match.", $adeiChannel[10][31]);
+            }
+        } // 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
+        placeText(265, 815, "MS IE COMMON", 130, 2, "#000000"); // mainspec IE Common
+        // MS Tank from Precision HCP Supply or Standard HCN
+        $text = "MS TANK";
+        $ms_hcp_soll = $adeiValue[10][1]; //flipped 2021-02-16 for new HCP device
+        $ms_hcn_soll = $adeiValue[10][25];
+
+        $HCP = true;
+        if ($ms_hcn_soll == 0)
+        {
+            if ($ms_hcp_soll == 0)
+            {
+                $text = $text . " OFF";
+            }
+            else
+            {
+                $text = $text . " HCP";
+                $HCP = true;
+            }
+        }
+        else
+        {
+            $text = $text . " HCN";
+            $HCP = false;
+        }
+        placeText(70, 830, $text, 100, 2, "#000000"); // mainspec tank
+        // switch values here between HCN and HCP in Value and Channel Array !!!
+        //if ($HCP) { $adeiValue[10][0] = -$adeiValue[10][24]; $adeiValue[10][1] = $adeiValue[10][25]; $adeiChannel[10][0] = $adeiChannel[10][24]; $adeiChannel[10][1] = $adeiChannel[10][25]; }
+        if ($HCP)
+        {
+            $adeiValue[10][0] = - $adeiValue[10][0];
+        }
+
+        placeText(110 - $posY, 845, "W7-11", 70, 2, "#000000"); // w7-11
+        placeText(503 + $posY + $posX, 845, "E7-11", 70, 2, "#000000"); // e7-11
+        placeText(126 - $posY, 600, "W6", 70, 2, "#000000"); // w6
+        placeText(487 + $posY + $posX, 600, "E6", 70, 2, "#000000"); // e6
+        placeText(126 - $posY, 1090, "W12", 70, 2, "#000000"); // w12
+        placeText(487 + $posY + $posX, 1090, "E12", 70, 2, "#000000"); // e12
+        placeText(161 - $posY, 516, "W5", 70, 2, "#000000"); // w5
+        placeText(452 + $posY + $posX, 516, "E5", 70, 2, "#000000"); // e5
+        placeText(161 - $posY, 1174, "W13", 70, 2, "#000000"); // w13
+        placeText(452 + $posY + $posX, 1174, "E13", 70, 2, "#000000"); // e13
+        placeText(194 - $posY, 434, "W4", 70, 2, "#000000"); // w4
+        placeText(419 + $posY + $posX, 434, "E4", 70, 2, "#000000"); // e4
+        placeText(194 - $posY, 1256, "W14", 70, 2, "#000000"); // w14
+        placeText(419 + $posY + $posX, 1256, "E14", 70, 2, "#000000"); // e14
+        placeText(225 - $posY, 385, "W3", 70, 2, "#000000"); // w3
+        placeText(388 + $posY + $posX, 385, "E3", 70, 2, "#000000"); // e3
+        placeText(225 - $posY, 1305, "W15", 70, 2, "#000000"); // w15
+        placeText(388 + $posY + $posX, 1305, "E15", 70, 2, "#000000"); // e15
+        placeText(273 - $posY, 352, "W2", 70, 2, "#000000"); // w2
+        placeText(340 + $posY + $posX, 352, "E2", 70, 2, "#000000"); // e2
+        placeText(273 - $posY, 1338, "W16", 70, 2, "#000000"); // w16
+        placeText(340 + $posY + $posX, 1338, "E16", 70, 2, "#000000"); // e16
+        if ($adeiValue[10][8] > 10.0) placeText(309, 359, "APE", 70, 2, "#000000"); // ape south
+        if ($adeiValue[10][10] > 10.0) placeText(309, 1331, "APE", 70, 2, "#000000"); // ape north
+        // offset voltages
+        $posY = 16; // offset between outer and inner voltages
+        $ringsPosY = array(
+            275,
+            275 + $posY,
+            227,
+            227 + $posY,
+            196,
+            196 + $posY,
+            163,
+            163 + $posY,
+            128,
+            128 + $posY,
+            112,
+            112 + $posY,
+            128,
+            128 + $posY,
+            163,
+            163 + $posY,
+            196,
+            196 + $posY,
+            227,
+            227 + $posY,
+            275,
+            275 + $posY,
+            342,
+            342 - $posY,
+            390,
+            390 - $posY,
+            421,
+            421 - $posY,
+            454,
+            454 - $posY,
+            489,
+            489 - $posY,
+            505,
+            505 - $posY,
+            489,
+            489 - $posY,
+            454,
+            454 - $posY,
+            421,
+            421 - $posY,
+            390,
+            390 - $posY,
+            342,
+            342 - $posY
+        );
+        $ringsPosX = array(
+            352,
+            352,
+            385,
+            385,
+            434,
+            434,
+            516,
+            516,
+            600,
+            600,
+            845,
+            845,
+            1090,
+            1090,
+            1174,
+            1174,
+            1256,
+            1256,
+            1305,
+            1305,
+            1338,
+            1338,
+            352,
+            352,
+            385,
+            385,
+            434,
+            434,
+            516,
+            516,
+            600,
+            600,
+            845,
+            845,
+            1090,
+            1090,
+            1174,
+            1174,
+            1256,
+            1256,
+            1305,
+            1305,
+            1338,
+            1338
+        );
+        $tol = 0.2;
+
+        $ringNames = array(
+            "W2",
+            "W2i",
+            "W3",
+            "W3i",
+            "W4",
+            "W4i",
+            "W5",
+            "W5i",
+            "W6",
+            "W6i",
+            "W7-11",
+            "W7-11i",
+            "W12",
+            "W12i",
+            "W13",
+            "W13i",
+            "W14",
+            "W14i",
+            "W15",
+            "W15i",
+            "W16",
+            "W16i",
+            "E2",
+            "E2i",
+            "E3",
+            "E3i",
+            "E4",
+            "E4i",
+            "E5",
+            "E5i",
+            "E6",
+            "E6i",
+            "E7-11",
+            "E7-11i",
+            "E12",
+            "E12i",
+            "E13",
+            "E13i",
+            "E14",
+            "E14i",
+            "E15",
+            "E15i",
+            "E16",
+            "E16i"
+        );
+
+        for ($pp = 0;$pp < 2;$pp++) // west (0), east (1)
+
+        {
+            for ($id = 0;$id < 22;$id++) // rings: o, i, o, i, ...
+
+            {
+                // show voltage if not shorted to IE
+                if ($ringsToAdei[$id + 22 * $pp] != "IE" && $ringsToAdei[$id + 22 * $pp] != "")
+                {
+                    // color
+                    if (($adeiValue[11 + 2 * $pp][$ringsToAdei[$id + 22 * $pp]] > $adeiValue[12 + 2 * $pp][$ringsToAdei[$id + 22 * $pp]] - $tol) && ($adeiValue[11 + 2 * $pp][$ringsToAdei[$id + 22 * $pp]] < $adeiValue[12 + 2 * $pp][$ringsToAdei[$id + 22 * $pp]] + $tol)) $color = "#000000";
+                    else $color = "#FF0000";
+
+                    // show voltage
+                    if (($id % 2 == 0) || ($id % 2 == 1 && $ringsToAdei[$id + 22 * $pp] != $ringsToAdei[$id + 22 * $pp - 1]))
+                    {
+                        $value = $adeiValue[11 + 2 * $pp][$ringsToAdei[$id + 22 * $pp]];
+                        $mace_setting[$ringNames[$id + 22 * $pp]] = $value;
+                        placeTextWithLink($ringsPosY[$id + 22 * $pp], $ringsPosX[$id + 22 * $pp], "+" . sprintf('%.1F', $value) , 70, 4, $color, "relative voltage offset", $adeiChannel[11 + 2 * $pp][$ringsToAdei[$id + 22 * $pp]]);
+                    }
+                }
+            }
+        }
+
+        // tank, ie, dipole, ape
+        $ringsPosY = array(
+            52,
+            247,
+            155,
+            425,
+            306,
+            306,
+            0,
+            240,
+            300,
+            285,
+            300,
+            315
+        );
+        $ringsPosX = array(
+            805,
+            805,
+            805,
+            805,
+            319,
+            1371,
+            0,
+            150,
+            160,
+            190,
+            220,
+            190
+        );
+        $tolA = array(
+            15,
+            2,
+            1,
+            1,
+            1,
+            1,
+            0,
+            250,
+            2,
+            2,
+            2,
+            2
+        );
+
+        // MS voltages
+        for ($pp = 0;$pp < 6;$pp++) // tank (0), ie (1), ie west (2), ie east (3), ape south (4), ape north (5)
+
+        {
+            // color
+            if (($adeiValue[10][2 * $pp] > $adeiValue[10][2 * $pp + 1] - $tolA[$pp]) && ($adeiValue[10][2 * $pp] < $adeiValue[10][2 * $pp + 1] + $tolA[$pp])) $color = "#000000";
+            else $color = "#FF0000";
+
+            // show voltage
+            $value = $adeiValue[10][2 * $pp];
+            $link = $adeiChannel[10][2 * $pp];
+
+            $dipolestatus = $adeiValue[2][16];
+            $dipolelink = $adeiChannel[2][16];
+
+            if ($pp == 0)
+            {
+                $text = "absolute tank potential HCN:436-EHV-0-1001-0002 HCP:436-EHV-0-1002-0002";
+            }
+            else if ($pp == 1)
+            {
+                $text = "IE common offset potential, 436-EHV-0-1003-0002";
+            }
+            else if ($pp == 2)
+            {
+                $text = "relative voltage potential west IE";
+            }
+            else if ($pp == 3)
+            {
+                $text = "relative voltage potential east IE";
+            }
+            else if ($pp == 4)
+            {
+                $text = "relative voltage potential south APE";
+            }
+            else if ($pp == 5)
+            {
+                $text = "relative voltage potential north APE";
+            }
+
+            if ($pp == 2 || $pp == 3)
+            {
+                if ($dipolestatus == 1) // dipole enabled
+
+                {
+                    $color = "#990000";
+                    $value = $adeiValue[10][2 * $pp];
+                    if ($pp == 2)
+                    {
+                        placeText($ringsPosY[$pp] + 40, $ringsPosX[$pp], "DIPOLE", 150, 4, "#CC0000");
+
+                    }
+                    else if ($pp == 3)
+                    {
+                        placeText($ringsPosY[$pp] + 40, $ringsPosX[$pp], "DIPOLE", 150, 4, "#CC0000");
+
+                    }
+                }
+                else
+                {
+                    $value = $adeiValue[10][2 * $pp]; // dipole disabled
+                    $color = "#909090";
+                }
+
+                if ($pp == 2) placeText(180, 825, "MS WEST IE", 110, 2, $color); // west IE
+                else if ($pp == 3) placeText(450, 825, "MS EAST IE", 110, 2, $color); // east IE
+                $link = $adeiChannel[10][2 * $pp + 1] . "," . $adeiChannel[10][2 * $pp] . "," . $dipolelink;
+            }
+
+            // tank potential
+            if ($pp == 0) placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F V', -$value) , 150, 4, $color, $text, $link);
+
+            // IE common
+            else if ($pp == 1)
+            {
+                if ($Kal1_RunFlag == 0) $digits = '%.2F V';
+                else $digits = '%.1F V';
+                placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf($digits, -$value) , 150, 4, $color, $text, $link);
+                $mace_setting["IECommon"] = - $value;
+                $digits = '';
+            }
+
+            // IE dipoles
+            else if ($pp == 2 || $pp == 3) placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.2F V', $value) , 150, 5, $color, $text, $link);
+
+            // APE
+            else if ($pp == 4 || $pp == 5)
+            {
+                if ($adeiValue[10][2 * $pp] > 10.0)
+                {
+                    placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F', $value) , 70, 4, $color, $text, $link);
+                }
+            }
+        }
+    }
+
+    // PS voltages (add $pp < 10 for PS IE )
+    if ($PSmode == 5)
+    { // only display in PS operation mode High-Voltage
+
+
+        placeText(265, 190, "PS TANK", 70, 2, "#000000"); // prespec tank
+        placeText(330, 160, "PS IE", 120, 2, "#505050"); // prespec IE
+
+
+        for ($pp = 7;$pp < 12;$pp++) // PS tank (channel 7 = array entry 14 + 15), IE west (8), IE east (9)
+
+        {
+            // color and text
+            if ($pp == 7)
+            {
+                $text = "Primary PS tank potential of 416EHV1001";
+                $color = "#000000";
+            }
+            else if ($pp == 8)
+            {
+                $text = "relative voltage potential PS IE1 Ch1A of 416EHV1002";
+                $color = "#505050";
+            }
+            else if ($pp == 9)
+            {
+                $text = "relative voltage potential PS IE2 Ch1B of 416EHV1002";
+                $color = "#505050";
+            }
+            else if ($pp == 10)
+            {
+                $text = "relative voltage potential PS IE3 Ch2A of 416EHV1003";
+                $color = "#505050";
+            }
+            else if ($pp == 11)
+            {
+                $text = "relative voltage potential PS IE4 Ch2B of 416EHV1003";
+                $color = "#A0A0A0";
+            }
+
+            // setpoint mismatch color
+            if (($adeiValue[10][2 * $pp] > $adeiValue[10][2 * $pp + 1] - $tolA[$pp]) && ($adeiValue[10][2 * $pp] < $adeiValue[10][2 * $pp + 1] + $tolA[$pp])) $color = $color;
+            else $color = "#FF0000";
+
+            // show voltage
+            $value = $adeiValue[10][2 * $pp];
+            $link = $adeiChannel[10][2 * $pp];
+
+            if ($pp == 7) placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F V', -$value) , 150, 5, $color, $text, $link);
+            else placeTextWithLink($ringsPosY[$pp], $ringsPosX[$pp], sprintf('%.1F V', -$value) , 60, 2, $color, $text, $link);
+        }
+    }
+
+    // ########## Split Ring Electrodes ##########
+    $srPosX = array(
+        59,
+        284,
+        1420
+    );
+    $srPosY = array(
+        402,
+        402,
+        370
+    );
+    $srKATRINNumber = array(
+        "418-EEL-3-2150",
+        "418-EEL-3-4150",
+        "438-EEL-3-5150"
+    );
+
+    // CPS-PS electrode 418-EEL-2150
+    // $sr: 0 = cps-ps ; 1 = PS-MS ; 2 = MS-FPD
+    for ($sr = 0;$sr < 3;$sr++)
+    {
+        $splitringON = $adeiValue[36][4 * $sr + 3];
+        $pic = "splitring";
         if ($splitringON = 1)
-	  {
-	    $color = "#000000";
-	    $splitringVal = $adeiValue[36][4*$sr + 4];
-	    $splitringPOL = $adeiValue[36][4*$sr + 5];
-	    $splitringSet = $adeiValue[36][4*$sr + 6];
-	    $link = $adeiChannel[36][$sr*4 + 4];
-
-	    if (abs($splitringVal) < 25) { $color="#FF0000"; $pic = $pic."Alarm"; $sign = "";}
-	    else {
-	      if ($splitringPOL == 0) {$sign = "+"; $pic = $pic."On";}
-	      if ($splitringPOL == 1) {$sign = ""; $pic = $pic."Warn";}
-	    }
-	    
-	    placePicWithLink($srPosY[$sr]-32,$srPosX[$sr]+16, $pic.".png", 30, "status of split ring electrode (green = polarity pos and OK, gray = off, red = low voltage alarm, orange = polarity neg warning", $link);
-	    placeTextWithLink($srPosY[$sr],$srPosX[$sr], $sign.sprintf('%.0F V', $splitringVal), 60, 2, $color, "Voltage on split ring electrode ".$srKATRINNumber[$sr], $link);
-	  }
-	    else placePicWithLink($srPosY[$sr]-32,$srPosX[$sr]+16, $pic."Off.png", 30, "status of split ring electrode", $link);
-	}
-
-
-	// ########## DETECTOR ##########
-
-	// detector powered
-
-	$lowVoltage = array( 12, 8, 6, 6, 120 );
-	$link = "";
-	$pic = "fpdOn";
-	$text = "ON";
-	for ($id = 0; $id < 5; $id++)
-	{
-		$value = $adeiValue[6][4 + $id];
-		if (!($value < $lowVoltage[$id] + 0.2 && $value > $lowVoltage[$id] - 0.2))
-		{
-			$pic = "fpdOff";
-			$text = "OFF";
-		}
-		$link = $link . $adeiChannel[6][4 + $id] . ",";
-	}
-	$link = substr($link, 0, strlen($link) - 1);
-	placePicWithLink(200, 1600, $pic . ".png", 30, "status FPD power&#10;green: on, red: off, grey: undefined", $link);
-	placeTextWithLink(227, 1580, $text, 70, 4, "#000000", "status FPD power", $link);
-
-	// carousel
-
-	$value = $adeiValue[6][11];
-	$color = "#000000";
-
-	if ($value < -95) $value = "---";
-	else $value = sprintf('%.0F', $adeiValue[6][11]) . " &#176;C";
-
-	placeTextWithLink(255, 1565, $value, 100, 4, $color, "temperature FPD carousel/electronics", $adeiChannel[6][11]);
-	placeText(275, 1565, "carousel", 100, 2, "#000000");
-
-
-
-	// ########## MAGNETOMETERS ##########
-
-	$mag = array(4, 6, 3);  // removed 4th entry of south ring, due to disconnection
- 
-	for ($pp = 0; $pp < 3; $pp++)
-	{
-		$bx = 0;
-		$by = 0;
-		$bz = 0;
-		$link = "";
-
-		for ($id = 0; $id < $mag[$pp]; $id++)
-		{
-			$bx = $bx + $adeiValue[16 + $pp][3 * $id];
-			$by = $by + $adeiValue[16 + $pp][3 * $id + 1];
-			$bz = $bz + $adeiValue[16 + $pp][3 * $id + 2];
-                        $link = $link . $adeiChannel[16 + $pp][3 * $id + 2] . ",";
-//echo $bx . "  " . $by . "  " . $bz . "<br>";
-		}
-
-		$bx = $bx / $mag[$pp];
-		$by = $by / $mag[$pp];
-		$bz = $bz / $mag[$pp];
-		$link = substr($link, 0, strlen($link) - 1);
-
-		$value = sqrt($bx * $bx + $by * $by + $bz * $bz);
-		
-		$text = "averaged field precise magnetometers ";
-		if ($pp == 0) $text = $text . "north ";
-		else if ($pp == 1) $text = $text . "middle ";
-		else if ($pp == 2) $text = $text . "south ";
-		$text = $text . "ring";
-
-		placeTextWithLink(553, 1015 - 170 * $pp, sprintf('%.1F G', $value), 80, 5, "#000000", $text, $link);
-	}
-
-
-	// ########## SAP MAGNETOMETERS ##########
-
-	$mag = array(5, 4,); // 5 SAP North Ring, 4 SAP South Ring magnetometers
-
-	for ($pp = 0; $pp < 2; $pp++)
-	{
-		$bx = 0;
-		$by = 0;
-		$bz = 0;
-		$link = "";
-
-		for ($id = 0; $id < $mag[$pp]; $id++)
-		{
-			$bx = $bx + $adeiValue[37 + $pp][3 * $id];
-			$by = $by + $adeiValue[37 + $pp][3 * $id + 1];
-			$bz = $bz + $adeiValue[37 + $pp][3 * $id + 2];
-                        $link = $link . $adeiChannel[37 + $pp][37 * $id + 2] . ",";
-			//echo $bx . "  " . $by . "  " . $bz . "<br>";
-		}
-
-		$bx = $bx / $mag[$pp];
-		$by = $by / $mag[$pp];
-		$bz = $bz / $mag[$pp];
-		$link = substr($link, 0, strlen($link) - 1);
-
-		// radings in muT, therfore factor 100 for Gauss display
-		$value = 0.01*sqrt($bx * $bx + $by * $by + $bz * $bz);
-		
-		$text = "averaged field precise magnetometers SAP ";
-		if ($pp == 0) $text = $text . "north ";
-		else if ($pp == 1) $text = $text . "south ";
-		$text = $text . "ring";
-
-		placeTextWithLink(553, 1240 - 110 * $pp, sprintf('%.1F G', $value), 80, 5, "#000000", $text, $link);
-	}
-
-
-
-	// dipole
-
-//	$pic = "status";
-//	if ($pulserId[0] == "dipole" && $daqElapsed[0] > 30)
-//	{
-//		if ($pulserCounts[0] > 0) $pic = $pic . "On";
-//		else if ($pulserCounts[0] == 0) $pic = $pic . "Off";
-//	}
-	//placePic($posY + 34 + 25, $posX + 80, $pic . ".png", 17, "status dipole sync pulser&#10;green: on, red: off, grey: undefined");
-
-	// egun
-
-//	$pic = "status";
-//	if ($pulserId[1] == "egun" && $daqElapsed[0] > 30)
-//	{
-//		if ($pulserCounts[1] > 0) $pic = $pic . "On";
-//		else if ($pulserCounts[1] == 0) $pic = $pic . "Off";
-//	}
-	//placePic($posY + 34 + 50, $posX + 80, $pic . ".png", 17, "status egun sync pulser&#10;green: on, red: off, grey: undefined");
-
-	// muon
-
-//	$pic = "status";
-//	if ($pulserId[3] == "muon" && $daqElapsed[0] > 30)
-//	{
-//		if ($pulserCounts[3] > 0) $pic = $pic . "On";
-//		else if ($pulserCounts[3] == 0) $pic = $pic . "Off";
-//	}
-//	placePic($posY + 34 + 75, $posX + 80, $pic . ".png", 17, "status muon sync pulser&#10;green: on, red: off, grey: undefined");
-
-
-
-	// ########## HIGH PRESSURE MS ##########
-
-        $value = $adeiValue[9][3];
-        if ($value > 1.0)
-	{
-	  if ($value < 20.0) $pic = "bottleBlinking.gif";
-	  else $pic = "bottleOn.png";
-	  $text = "ON";
-	  $color = "#000000";
-	  if ($adeiValue[9][4] != 64) $color = "#FF0000";
-	  placeTextWithLink(135, 1387, sprintf('%.1F &#037;', $adeiValue[9][3]), 70, 4, $color, "gas flow leak valve", $adeiChannel[9][5]);
-	  placeTextWithLink(160, 1387, sprintf('%.1E', $adeiValue[9][0]), 70, 4, $color, "pressure [mbar] MKS Baratron", $adeiChannel[9][3]);
-	}
-	else
-	{
-	  $pic = "bottle.png";
-	  $text = "OFF";
-	}
-       
-	$link = $adeiChannel[9][3] . "," . $adeiChannel[9][0];
-	placePicWithLink(135, 1358, $pic, 48, "status gas injection system&#10;gray: off, blinking: low, green: on&#10Should be off for nominal pressure measurements!!!", $link);
-	placeTextWithLink(180, 1347, $text, 70, 4, "#000000", "status gas injection system", $link);
-
-
-	// ########## HIGH PRESSURE PS ##########
-
-        $value = $adeiValue[27][7];
-        $posOK = $adeiValue[27][6];
-        $link = $adeiChannel[27][6].",".$adeiChannel[27][7];
-        if ($value < 1) 
-	{
-	  $pic = "bottle.png";
-	  $text = "OFF";
-	  $color = "#909090";
-	}
-	else if (($value >= 1) && ($value < 15))
-	{
-          $pic = "bottleBlinking.gif";
-	  $text = "ON";
-	  $color = "#000000";
-	}
-	else if ($value >= 15)
-	{
-	  $pic = "bottleOn.png";
-	  $text = sprintf('%.1F', $value)." %";
-	  $color = "#000000";
-          if ($posOK == 1) placeBox(418, 107, "Pos OK", 40, 2, "#00FF00");
-	  else placeBox(418, 107, "PosErr", 40, 2, "#FF0000");
-	}
-	placePicWithLink(370, 113 , $pic, 30, "status PS gas injection system&#10;gray: off, blinking: low, green: on&#10Should be off for nominal pressure measurements!!!", $link);
-	placeTextWithLink(402, 99, $text, 60, 2, $color, "status gas injection system", $link);
-
-
-
-	// ########## TLK Wall and LAUDA TEMPERATURE ##########
-
-
-
-if ($PSmode == 5) 
-    { // only display if PS operation mode is HV
+        {
+            $color = "#000000";
+            $splitringVal = $adeiValue[36][4 * $sr + 4];
+            $splitringPOL = $adeiValue[36][4 * $sr + 5];
+            $splitringSet = $adeiValue[36][4 * $sr + 6];
+            $link = $adeiChannel[36][$sr * 4 + 4];
+
+            if (abs($splitringVal) < 25)
+            {
+                $color = "#FF0000";
+                $pic = $pic . "Alarm";
+                $sign = "";
+            }
+            else
+            {
+                if ($splitringPOL == 0)
+                {
+                    $sign = "+";
+                    $pic = $pic . "On";
+                }
+                if ($splitringPOL == 1)
+                {
+                    $sign = "";
+                    $pic = $pic . "Warn";
+                }
+            }
+
+            placePicWithLink($srPosY[$sr] - 32, $srPosX[$sr] + 16, $pic . ".png", 30, "status of split ring electrode (green = polarity pos and OK, gray = off, red = low voltage alarm, orange = polarity neg warning", $link);
+            placeTextWithLink($srPosY[$sr], $srPosX[$sr], $sign . sprintf('%.0F V', $splitringVal) , 60, 2, $color, "Voltage on split ring electrode " . $srKATRINNumber[$sr], $link);
+        }
+        else placePicWithLink($srPosY[$sr] - 32, $srPosX[$sr] + 16, $pic . "Off.png", 30, "status of split ring electrode", $link);
+    }
 
-	// mean of 4023, 4033, 4043
-        $link = $adeiChannel[29][0] . "," . $adeiChannel[29][1] . "," . $adeiChannel[29][2];
-	$value = ($adeiValue[29][0] + $adeiValue[29][1] + $adeiValue[29][2])/3.0;
-	$color = "#000000";
-	if ($value < 4000) placeTextWithLink(440, 145,  "T<sub>PS</sub> = " . sprintf('%.1F &#176;C', $value), 120, 4, $color, "PS mean temperature of 4023..33..43", $link);
+    // ########## DETECTOR ##########
+    // detector powered
+    $lowVoltage = array(
+        12,
+        8,
+        6,
+        6,
+        120
+    );
+    $link = "";
+    $pic = "fpdOn";
+    $text = "ON";
+    for ($id = 0;$id < 5;$id++)
+    {
+        $value = $adeiValue[6][4 + $id];
+        if (!($value < $lowVoltage[$id] + 0.2 && $value > $lowVoltage[$id] - 0.2))
+        {
+            $pic = "fpdOff";
+            $text = "OFF";
+        }
+        $link = $link . $adeiChannel[6][4 + $id] . ",";
+    }
+    $link = substr($link, 0, strlen($link) - 1);
+    placePicWithLink(200, 1600, $pic . ".png", 30, "status FPD power&#10;green: on, red: off, grey: undefined", $link);
+    placeTextWithLink(227, 1580, $text, 70, 4, "#000000", "status FPD power", $link);
+
+    // carousel
+    $value = $adeiValue[6][11];
+    $color = "#000000";
+
+    if ($value < - 95) $value = "---";
+    else $value = sprintf('%.0F', $adeiValue[6][11]) . " &#176;C";
+
+    placeTextWithLink(255, 1565, $value, 100, 4, $color, "temperature FPD carousel/electronics", $adeiChannel[6][11]);
+    placeText(275, 1565, "carousel", 100, 2, "#000000");
+
+    // ########## MAGNETOMETERS ##########
+    $mag = array(
+        4,
+        6,
+        3
+    ); // removed 4th entry of south ring, due to disconnection
+    for ($pp = 0;$pp < 3;$pp++)
+    {
+        $bx = 0;
+        $by = 0;
+        $bz = 0;
+        $link = "";
+
+        for ($id = 0;$id < $mag[$pp];$id++)
+        {
+            $bx = $bx + $adeiValue[16 + $pp][3 * $id];
+            $by = $by + $adeiValue[16 + $pp][3 * $id + 1];
+            $bz = $bz + $adeiValue[16 + $pp][3 * $id + 2];
+            $link = $link . $adeiChannel[16 + $pp][3 * $id + 2] . ",";
+            //echo $bx . "  " . $by . "  " . $bz . "<br>";
+
+        }
+
+        $bx = $bx / $mag[$pp];
+        $by = $by / $mag[$pp];
+        $bz = $bz / $mag[$pp];
+        $link = substr($link, 0, strlen($link) - 1);
+
+        $value = sqrt($bx * $bx + $by * $by + $bz * $bz);
+
+        $text = "averaged field precise magnetometers ";
+        if ($pp == 0) $text = $text . "north ";
+        else if ($pp == 1) $text = $text . "middle ";
+        else if ($pp == 2) $text = $text . "south ";
+        $text = $text . "ring";
+
+        placeTextWithLink(553, 1015 - 170 * $pp, sprintf('%.1F G', $value) , 80, 5, "#000000", $text, $link);
     }
 
-if ($PSmode != 5) 
-    { // only display if PS operation mode is Baking
+    // ########## SAP MAGNETOMETERS ##########
+    $mag = array(
+        5,
+        4,
+    ); // 5 SAP North Ring, 4 SAP South Ring magnetometers
+    for ($pp = 0;$pp < 2;$pp++)
+    {
+        $bx = 0;
+        $by = 0;
+        $bz = 0;
+        $link = "";
+
+        for ($id = 0;$id < $mag[$pp];$id++)
+        {
+            $bx = $bx + $adeiValue[37 + $pp][3 * $id];
+            $by = $by + $adeiValue[37 + $pp][3 * $id + 1];
+            $bz = $bz + $adeiValue[37 + $pp][3 * $id + 2];
+            $link = $link . $adeiChannel[37 + $pp][37 * $id + 2] . ",";
+            //echo $bx . "  " . $by . "  " . $bz . "<br>";
+
+        }
+
+        $bx = $bx / $mag[$pp];
+        $by = $by / $mag[$pp];
+        $bz = $bz / $mag[$pp];
+        $link = substr($link, 0, strlen($link) - 1);
+
+        // radings in muT, therfore factor 100 for Gauss display
+        $value = 0.01 * sqrt($bx * $bx + $by * $by + $bz * $bz);
+
+        $text = "averaged field precise magnetometers SAP ";
+        if ($pp == 0) $text = $text . "north ";
+        else if ($pp == 1) $text = $text . "south ";
+        $text = $text . "ring";
+
+        placeTextWithLink(553, 1240 - 110 * $pp, sprintf('%.1F G', $value) , 80, 5, "#000000", $text, $link);
+    }
 
-	$min = 18;
-	$max = 30;
+    // dipole
+    //	$pic = "status";
+    //	if ($pulserId[0] == "dipole" && $daqElapsed[0] > 30)
+    //	{
+    //		if ($pulserCounts[0] > 0) $pic = $pic . "On";
+    //		else if ($pulserCounts[0] == 0) $pic = $pic . "Off";
+    //	}
+    //placePic($posY + 34 + 25, $posX + 80, $pic . ".png", 17, "status dipole sync pulser&#10;green: on, red: off, grey: undefined");
+    // egun
+    //	$pic = "status";
+    //	if ($pulserId[1] == "egun" && $daqElapsed[0] > 30)
+    //	{
+    //		if ($pulserCounts[1] > 0) $pic = $pic . "On";
+    //		else if ($pulserCounts[1] == 0) $pic = $pic . "Off";
+    //	}
+    //placePic($posY + 34 + 50, $posX + 80, $pic . ".png", 17, "status egun sync pulser&#10;green: on, red: off, grey: undefined");
+    // muon
+    //	$pic = "status";
+    //	if ($pulserId[3] == "muon" && $daqElapsed[0] > 30)
+    //	{
+    //		if ($pulserCounts[3] > 0) $pic = $pic . "On";
+    //		else if ($pulserCounts[3] == 0) $pic = $pic . "Off";
+    //	}
+    //	placePic($posY + 34 + 75, $posX + 80, $pic . ".png", 17, "status muon sync pulser&#10;green: on, red: off, grey: undefined");
+
+
+    // ########## HIGH PRESSURE MS ##########
+    $value = $adeiValue[9][3];
+    if ($value > 1.0)
+    {
+        if ($value < 20.0) $pic = "bottleBlinking.gif";
+        else $pic = "bottleOn.png";
+        $text = "ON";
+        $color = "#000000";
+        if ($adeiValue[9][4] != 64) $color = "#FF0000";
+        placeTextWithLink(135, 1387, sprintf('%.1F &#037;', $adeiValue[9][3]) , 70, 4, $color, "gas flow leak valve", $adeiChannel[9][5]);
+        placeTextWithLink(160, 1387, sprintf('%.1E', $adeiValue[9][0]) , 70, 4, $color, "pressure [mbar] MKS Baratron", $adeiChannel[9][3]);
+    }
+    else
+    {
+        $pic = "bottle.png";
+        $text = "OFF";
+    }
 
-	// sensor 4100 ID [29][3]
-        $link = $adeiChannel[29][3];
-	$value = $adeiValue[29][3];
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if ($value < 400) placeTextLeftWithLink(445, 5, "T<sub>wall</sub> = " . sprintf('%.1F &#176;C', $value), 180, 4, $color, "TLK separation wall temperature of RTP4100", $link);
+    $link = $adeiChannel[9][3] . "," . $adeiChannel[9][0];
+    placePicWithLink(135, 1358, $pic, 48, "status gas injection system&#10;gray: off, blinking: low, green: on&#10Should be off for nominal pressure measurements!!!", $link);
+    placeTextWithLink(180, 1347, $text, 70, 4, "#000000", "status gas injection system", $link);
 
-	$min = 15;
-	// LAUDA System 5401 [34][0..1]
-        $link = $adeiChannel[34][0].",".$adeiChannel[34][1];
-	$value = $adeiValue[34][0];
-	$max = $adeiValue[34][1]+1;
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if ($value < 400) placeTextLeftWithLink(475, 5, "T<sub>LAUDA</sub> = " . sprintf('%.1F &#176;C', $value), 180, 4, $color, "LAUDA System actual temperature value", $link);
+    // ########## HIGH PRESSURE PS ##########
+    $value = $adeiValue[27][7];
+    $posOK = $adeiValue[27][6];
+    $link = $adeiChannel[27][6] . "," . $adeiChannel[27][7];
+    if ($value < 1)
+    {
+        $pic = "bottle.png";
+        $text = "OFF";
+        $color = "#909090";
+    }
+    else if (($value >= 1) && ($value < 15))
+    {
+        $pic = "bottleBlinking.gif";
+        $text = "ON";
+        $color = "#000000";
+    }
+    else if ($value >= 15)
+    {
+        $pic = "bottleOn.png";
+        $text = sprintf('%.1F', $value) . " %";
+        $color = "#000000";
+        if ($posOK == 1) placeBox(418, 107, "Pos OK", 40, 2, "#00FF00");
+        else placeBox(418, 107, "PosErr", 40, 2, "#FF0000");
+    }
+    placePicWithLink(370, 113, $pic, 30, "status PS gas injection system&#10;gray: off, blinking: low, green: on&#10Should be off for nominal pressure measurements!!!", $link);
+    placeTextWithLink(402, 99, $text, 60, 2, $color, "status gas injection system", $link);
 
+    // ########## TLK Wall and LAUDA TEMPERATURE ##########
 
 
-	// ########## PS VESSEL TEMPERATURES ##########
+    if ($PSmode == 5)
+    { // only display if PS operation mode is HV
+        // mean of 4023, 4033, 4043
+        $link = $adeiChannel[29][0] . "," . $adeiChannel[29][1] . "," . $adeiChannel[29][2];
+        $value = ($adeiValue[29][0] + $adeiValue[29][1] + $adeiValue[29][2]) / 3.0;
+        $color = "#000000";
+        if ($value < 4000) placeTextWithLink(440, 145, "T<sub>PS</sub> = " . sprintf('%.1F &#176;C', $value) , 120, 4, $color, "PS mean temperature of 4023..33..43", $link);
+    }
 
-	$min = 18;
-	$max = 65;
+    if ($PSmode != 5)
+    { // only display if PS operation mode is Baking
+        $min = 18;
+        $max = 30;
 
-	// mean of 4023, 4033, 4043
+        // sensor 4100 ID [29][3]
+        $link = $adeiChannel[29][3];
+        $value = $adeiValue[29][3];
+        $color = "#000000";
+        if ($value < $min) $color = "#0026FF";
+        else if ($value > $max) $color = "#FF0000";
+        if ($value < 400) placeTextLeftWithLink(445, 5, "T<sub>wall</sub> = " . sprintf('%.1F &#176;C', $value) , 180, 4, $color, "TLK separation wall temperature of RTP4100", $link);
+
+        $min = 15;
+        // LAUDA System 5401 [34][0..1]
+        $link = $adeiChannel[34][0] . "," . $adeiChannel[34][1];
+        $value = $adeiValue[34][0];
+        $max = $adeiValue[34][1] + 1;
+        $color = "#000000";
+        if ($value < $min) $color = "#0026FF";
+        else if ($value > $max) $color = "#FF0000";
+        if ($value < 400) placeTextLeftWithLink(475, 5, "T<sub>LAUDA</sub> = " . sprintf('%.1F &#176;C', $value) , 180, 4, $color, "LAUDA System actual temperature value", $link);
+
+        // ########## PS VESSEL TEMPERATURES ##########
+        $min = 18;
+        $max = 65;
+
+        // mean of 4023, 4033, 4043
         $link = $adeiChannel[29][0] . "," . $adeiChannel[29][1] . "," . $adeiChannel[29][2];
-	$value = ($adeiValue[29][0] + $adeiValue[29][1] + $adeiValue[29][2])/3.0;
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if ($value < 4000) placeTextWithLink(305, 185, sprintf('%.1F &#176;C', $value), 90, 4, $color, "PS mean temperature of 4023..33..43", $link);
+        $value = ($adeiValue[29][0] + $adeiValue[29][1] + $adeiValue[29][2]) / 3.0;
+        $color = "#000000";
+        if ($value < $min) $color = "#0026FF";
+        else if ($value > $max) $color = "#FF0000";
+        if ($value < 4000) placeTextWithLink(305, 185, sprintf('%.1F &#176;C', $value) , 90, 4, $color, "PS mean temperature of 4023..33..43", $link);
 
-	// mean of 3901, 3902, 3903, 3904
+        // mean of 3901, 3902, 3903, 3904
         $link = $adeiChannel[29][4] . "," . $adeiChannel[29][5] . "," . $adeiChannel[29][6] . "," . $adeiChannel[29][7];
-	$value = ($adeiValue[29][4] + $adeiValue[29][5] + $adeiValue[29][6] + $adeiValue[29][7])/4.0;
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if ($value < 4000) placeTextWithLink(295, 110, sprintf('%.1F &#176;C', $value), 90, 4, $color, "PS mean temperature of 3902..03..04 upper NEG port", $link);
+        $value = ($adeiValue[29][4] + $adeiValue[29][5] + $adeiValue[29][6] + $adeiValue[29][7]) / 4.0;
+        $color = "#000000";
+        if ($value < $min) $color = "#0026FF";
+        else if ($value > $max) $color = "#FF0000";
+        if ($value < 4000) placeTextWithLink(295, 110, sprintf('%.1F &#176;C', $value) , 90, 4, $color, "PS mean temperature of 3902..03..04 upper NEG port", $link);
 
-	// mean of 3912, 3913, (3914 failed)
+        // mean of 3912, 3913, (3914 failed)
         $link = $adeiChannel[29][8] . "," . $adeiChannel[29][9] . "," . $adeiChannel[29][10] . "," . $adeiChannel[29][11];
-	//	$value = ($adeiValue[29][8] + $adeiValue[29][9] + $adeiValue[29][10] + $adeiValue[29][11])/4.0;
-	$value = ($adeiValue[29][8] + $adeiValue[29][9] + $adeiValue[29][10])/3.0;
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if ($value < 4000) placeTextWithLink(315, 110, sprintf('%.1F &#176;C', $value), 90, 4, $color, "PS mean temperature of 3912..13..14 side NEG port", $link);
-
+        //	$value = ($adeiValue[29][8] + $adeiValue[29][9] + $adeiValue[29][10] + $adeiValue[29][11])/4.0;
+        $value = ($adeiValue[29][8] + $adeiValue[29][9] + $adeiValue[29][10]) / 3.0;
+        $color = "#000000";
+        if ($value < $min) $color = "#0026FF";
+        else if ($value > $max) $color = "#FF0000";
+        if ($value < 4000) placeTextWithLink(315, 110, sprintf('%.1F &#176;C', $value) , 90, 4, $color, "PS mean temperature of 3912..13..14 side NEG port", $link);
 
     }
 
+    // ########## MS VESSEL TEMPERATURES ##########
+    $min = 14;
+    $max = 24;
+
+    // 0066
+    $value = $adeiValue[20][0];
+    $color = "#000000";
+    if ($value < $min) $color = "#0026FF";
+    else if ($value > $max) $color = "#FF0000";
+    if (($value < 400) & ($value > 0)) placeTextWithLink(110, 933, "T<sub>IE0066</sub> = " . sprintf('%.1F &#176;C', $value) , 170, 4, $color, "IE temperature 0066", $adeiChannel[20][0]);
+
+    // 0076
+    $value = $adeiValue[20][1];
+    $color = "#000000";
+    if ($value < $min) $color = "#0026FF";
+    else if ($value > $max) $color = "#FF0000";
+    if (($value < 400) & ($value > 0)) placeTextWithLink(110 + 20, 933, "T<sub>IE0076</sub> = " . sprintf('%.1F &#176;C', $value) , 170, 4, $color, "IE temperature 0076", $adeiChannel[20][1]);
+
+    // 0270
+    $value = $adeiValue[20][2];
+    $color = "#000000";
+    if ($value < $min) $color = "#0026FF";
+    else if ($value > $max) $color = "#FF0000";
+    if (($MSmode != 5) & ($value < 400) & ($value > 0)) placeTextWithLink(307, 805, "T<sub>0270</sub> = " . sprintf('%.1F &#176;C', $value) , 160, 4, $color, "tank temperature 0270", $adeiChannel[20][2]);
+    if (($MSmode == 5) & ($value < 400) & ($value > 0)) placeTextWithLink(110, 677, "T<sub>0270</sub> = " . sprintf('%.1F &#176;C', $value) , 160, 4, $color, "tank temperature 0270", $adeiChannel[20][2]);
+
+    // define global tank temperature
+    $global_MS_temperature = $adeiValue[20][2];
+
+    // 0283
+    $value = $adeiValue[20][3];
+    $color = "#000000";
+    if ($value < $min) $color = "#0026FF";
+    else if ($value > $max) $color = "#FF0000";
+    if (($MSmode != 5) & ($value < 400) & ($value > 0)) placeTextWithLink(307, 963, "T<sub>0283</sub> = " . sprintf('%.1F &#176;C', $value) , 160, 4, $color, "tank temperature 0283", $adeiChannel[20][3]);
+    if (($MSmode == 5) & ($value < 400) & ($value > 0)) placeTextWithLink(130, 677, "T<sub>0283</sub> = " . sprintf('%.1F &#176;C', $value) , 160, 4, $color, "tank temperature 0283", $adeiChannel[20][3]);
+
+    // port 0100 saphire window
+    $value = $adeiValue[19][3];
+    $color = "#000000";
+    if ($value > 30) placeTextLeftWithLink(105, 1275, "T<sub>saphire</sub> = " . sprintf('%.1F &#176;C', $value) , 160, 4, $color, "port 0100 saphire window temperature", $adeiChannel[19][3]);
 
-	// ########## MS VESSEL TEMPERATURES ##########
+    $color = "#000000";
+    // ########## STS ##########
+    placeTextLeftWithWebsiteLink(370, 1, "&larr;STS", 60, 5, $color, "Link to STS Status Overview", "https://katrin.kit.edu/status-sts/");
 
-	$min = 14;
-	$max = 24;
+    // ########## WebTrium Link ##########
+    placeTextLeftWithWebsiteLink(20, 1450, "&rarr; WebTrium", 155, 4, $color, "Link to WebTrium Overview", "https://webtrium.mpp.mpg.de");
 
-	// 0066
-	$value = $adeiValue[20][0];
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if (($value < 400) & ($value > 0)) placeTextWithLink(110, 933, "T<sub>IE0066</sub> = " . sprintf('%.1F &#176;C', $value), 170, 4, $color, "IE temperature 0066", $adeiChannel[20][0]);
+    // ########## FPD Status ##########
+    placeTextLeftWithWebsiteLink(50, 1450, "&rarr; FPD Status", 155, 4, $color, "Link to FPD Status Overview", "https://ikp-katrin-fpd.ikp.kit.edu/fpdstatus/");
 
-	// 0076
-	$value = $adeiValue[20][1];
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if (($value < 400) & ($value > 0)) placeTextWithLink(110+20, 933, "T<sub>IE0076</sub> = " . sprintf('%.1F &#176;C', $value), 170, 4, $color, "IE temperature 0076", $adeiChannel[20][1]);
+    // ########## Sanshiro Katana Page ##########
+    placeTextLeftWithWebsiteLink(80, 1450, "&rarr; Brew Kaffee Beans and Idle", 275, 4, $color, "Link to Brew Kaffee Beans and Idle page at UW/Seattle", "http://katana.npl.washington.edu/~sanshiro/");
 
-	// 0270
-	$value = $adeiValue[20][2];
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-    if (($MSmode != 5) & ($value < 400) & ($value > 0)) placeTextWithLink(307, 805, "T<sub>0270</sub> = " . sprintf('%.1F &#176;C', $value), 160, 4, $color, "tank temperature 0270", $adeiChannel[20][2]);
-    if (($MSmode == 5) & ($value < 400) & ($value > 0)) placeTextWithLink(110, 677, "T<sub>0270</sub> = " . sprintf('%.1F &#176;C', $value), 160, 4, $color, "tank temperature 0270", $adeiChannel[20][2]);
+    // ########## MoS und HV Status ##########
+    placeTextLeftWithWebsiteLink(110, 1450, "&rarr; MoS and HV Status", 240, 4, $color, "Link to Monitor Spectrometer and High Voltage Status Overview", "https://katrin.kit.edu/bora-mos");
 
-        // define global tank temperature
-        $global_MS_temperature = $adeiValue[20][2];
+    // ########## Magnet Overview ##########
+    placeTextLeftWithWebsiteLink(140, 1450, "&rarr; Magnet Control System", 270, 4, $color, "Link to Magnet Control System Status Page", "https://katrin.kit.edu/bora-mcs");
+    // ########## PS ##########
+    //	placeText(100, 170, "PS", 60, 30, $color);
 
-	// 0283
-	$value = $adeiValue[20][3];
-	$color = "#000000";
-	if ($value < $min) $color = "#0026FF";
-	else if ($value > $max) $color = "#FF0000";
-	if (($MSmode != 5) & ($value < 400) & ($value > 0)) placeTextWithLink(307, 963, "T<sub>0283</sub> = " . sprintf('%.1F &#176;C', $value), 160, 4, $color, "tank temperature 0283", $adeiChannel[20][3]);
-	if (($MSmode == 5) & ($value < 400) & ($value > 0)) placeTextWithLink(130, 677, "T<sub>0283</sub> = " . sprintf('%.1F &#176;C', $value), 160, 4, $color, "tank temperature 0283", $adeiChannel[20][3]);
 
-    // port 0100 saphire window
-	$value = $adeiValue[19][3];
-	$color = "#000000";
-    if ($value > 30) placeTextLeftWithLink(105, 1275, "T<sub>saphire</sub> = " . sprintf('%.1F &#176;C', $value), 160, 4, $color, "port 0100 saphire window temperature", $adeiChannel[19][3]);
+    // ########## MAC-E filter configuration display ##########
+    $tol = 0.2;
+    $tol = abs($tol);
+    $color = "#FFD800"; //base color: US school bus yellow
+    for ($pp = 0;$pp < sizeof($mace_configurations);$pp++) // loop over all predefined configurations
 
+    {
+        for ($id = 1;$id < sizeof($mace_configurations[$pp]);$id++) // loop thru all parameters, but not name in $id=0
+
+        {
+            if (($id < 3) & (array_values($mace_configurations[$pp]) [$id] != array_values($mace_setting) [$id])) break;
+            if (abs(array_values($mace_configurations[$pp]) [$id] - array_values($mace_setting) [$id]) < $tol)
+            {
+                if ($id == 25)
+                {
+                    $mace_setting["Config"] = $mace_configurations[$pp]["Config"];
+                    $color = "#4CFF00"; // success color: harlequin green
+
+                }
+                else
+                {
+                    $color = "#FF9300"; // failure color: dark orange
+
+                }
+            }
+            else break;
+        }
+        if ($color == "#4CFF00") break;
+    }
+    if (($mace_setting["Config"] == "unkn") or ($mace_setting["Config"] == "other"))
+    {
+        $color = "#FFD800"; //unknown config color: US school bus yellow
 
-	$color = "#000000";
-	// ########## STS ##########
-	placeTextLeftWithWebsiteLink(370, 1, "&larr;STS", 60, 5, $color, "Link to STS Status Overview", "https://katrin.kit.edu/status-sts/");
+    }
 
-    // ########## WebTrium Link ##########
-	placeTextLeftWithWebsiteLink(20, 1450, "&rarr; WebTrium", 155, 4, $color, "Link to WebTrium Overview", "https://webtrium.mpp.mpg.de");
+    placeText(115, 232, "MAC-E", 85, 5, "#000000");
+    placeBox(140, 230, $mace_setting["Config"], 85, 3, $color);
+
+    if ($V4_open)
+    {
 
-	// ########## FPD Status ##########
-	placeTextLeftWithWebsiteLink(50, 1450, "&rarr; FPD Status", 155, 4, $color, "Link to FPD Status Overview", "https://ikp-katrin-fpd.ikp.kit.edu/fpdstatus/");
-
-	// ########## Sanshiro Katana Page ##########
-	placeTextLeftWithWebsiteLink(80, 1450, "&rarr; Brew Kaffee Beans and Idle", 275, 4, $color, "Link to Brew Kaffee Beans and Idle page at UW/Seattle", "http://katana.npl.washington.edu/~sanshiro/");
-
-	// ########## MoS und HV Status ##########
-	placeTextLeftWithWebsiteLink(110, 1450, "&rarr; MoS and HV Status", 240, 4, $color, "Link to Monitor Spectrometer and High Voltage Status Overview", "https://katrin.kit.edu/bora-mos");
-
-	// ########## Magnet Overview ##########
-	placeTextLeftWithWebsiteLink(140, 1450, "&rarr; Magnet Control System", 270, 4, $color, "Link to Magnet Control System Status Page", "https://katrin.kit.edu/bora-mcs");
-        // ########## PS ##########
-//	placeText(100, 170, "PS", 60, 30, $color);
-
-
-
-// ########## MAC-E filter configuration display ##########
-$tol = 0.2;
-$tol = abs($tol);
-$color = "#FFD800";  //base color: US school bus yellow 
-
-for ($pp = 0; $pp < sizeof($mace_configurations); $pp++)  // loop over all predefined configurations
-  {
-    for ($id = 1; $id < sizeof($mace_configurations[$pp]); $id++) // loop thru all parameters, but not name in $id=0
-      {
-	if (($id < 3) & (array_values($mace_configurations[$pp])[$id] != array_values($mace_setting)[$id])) break; 
-	if (abs(array_values($mace_configurations[$pp])[$id] - array_values($mace_setting)[$id]) < $tol)
-	  {
-	    if ($id == 25) {
-	      $mace_setting["Config"] = $mace_configurations[$pp]["Config"];
-	      $color = "#4CFF00"; // success color: harlequin green
-	    }
-	    else 
-        { 
-          $color = "#FF9300"; // failure color: dark orange
-        }  	
-      }
-	else break; 
-      }
-    if ($color == "#4CFF00") break;
-  }
-if (($mace_setting["Config"] == "unkn") or ($mace_setting["Config"] == "other")) 
-	{
-      $color = "#FFD800"; //unknown config color: US school bus yellow 
-    }
-
-placeText(115, 232, "MAC-E", 85, 5, "#000000");
-placeBox(140, 230, $mace_setting["Config"] , 85, 3, $color);
-
-
-if ($V4_open) {
-	
-  // ########## PS Ion Monitor status display ##########
-  if ($adeiValue[39][1] < 0.5)
-    {
-      $ion_mon_stat = "active";
-      $color = "#4CFF00";
-    }
-  else
-    {
-      $ion_mon_stat = "bypassed";
-      $color = "#FF0000";
-      placePicWithLink(130, 33, "alarm_flash.gif", 50, "Ion alarm not armed!", $adeiChannel[39][1]);
-    }
-
-  placeText(115+65, 4, "Ion Mon", 105, 5, "#000000");
-  placeBox(140+65, 2, $ion_mon_stat , 105, 3, $color);
-  
-}
-
-
-// ########## HIGH VOLTAGE SWITCH ##########
-$value = $adeiValue[31][1];
-$pic = "switch";
-if ($value == 1) $pic = $pic . "Open";
-else if ($value	== 0) $pic = $pic . "Closed";
-placePicWithLink(474, 440, $pic . ".png", 80, "status high-voltage grounding switch", $adeiChannel[31][1]);
-
-
-
-// ########## MONITOR SPECTROMETR COUPLING STATUS ##########
-$hv_switch1101_mos = $adeiValue[35][0];
-$mos = "beamline_mos.png";
-placePicXY(525, 120, $mos, 190, 60, "status monitor spectrometer connection");
-if ($hv_switch1101_mos == 1)
-  {
-    $color = "#4CFF00"; // green
-    placeBox(586, 120, "MoS coupled", 190, 2, $color);
-  }
-else
-  {
-    $color = "#CFCFCF"; // light gray
-    placeBox(586, 120, "MoS separated", 190, 2, $color);
-  }
-
-
-// ########## define global dewpoint max value ###########
-$global_max_dewpoint = -273.0;
-
-// ########## PS Opus weather station ##########
-$data_index = 40;
-$Opus_tempC = $adeiValue[$data_index][0];
-$Opus_tempF = $adeiValue[$data_index][1];
-$Opus_dewpointC = $adeiValue[$data_index][2];
-$Opus_dewpointF = $adeiValue[$data_index][3];
-$Opus_relH_percent = $adeiValue[$data_index][4];
-$Opus_relH_gramm = $adeiValue[$data_index][5];
-$Opus_absPressure_hPa = $adeiValue[$data_index][6];
-$Opus_relPressure_hPa = $adeiValue[$data_index][7];
-$Opus_voltage = $adeiValue[$data_index][8];
-
-$Opus_tempC_channel = $adeiChannel[$data_index][0];
-$Opus_tempF_channel = $adeiChannel[$data_index][1];
-$Opus_dewpointC_channel = $adeiChannel[$data_index][2];
-$Opus_dewpointF_channel = $adeiChannel[$data_index][3];
-$Opus_relH_percent_channel = $adeiChannel[$data_index][4];
-$Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
-$Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
-$Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
-$Opus_voltage_channel = $adeiChannel[$data_index][8];
-
-// update dewpoint max value
-if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
-
-$location_text = "pre spectrometer";
-$draw_x = 0;
-$draw_y = -15;
-
-placePicWithLink($draw_y, $draw_x+5, "newTemperature.png", 23, "temperature at ".$location_text, $Opus_tempC_channel);
-placeTextWithLink($draw_y, $draw_x+30, sprintf('%.1F &#176;C', $Opus_tempC), 90, 4, "#000000", "temperature at ".$location_text, $Opus_tempC_channel);
-
-placePicWithLink($draw_y+25, $draw_x+5, "newPressure.png", 23, "atmospheric pressure at ".$location_text, $Opus_absPressure_hPa_channel);
-placeTextWithLink($draw_y+25, $draw_x+30, sprintf('%.0F hPa', $Opus_absPressure_hPa), 90, 4, "#000000", "atmospheric pressure at ".$location_text, $Opus_absPressure_hPa_channel);
-
-placePicWithLink($draw_y+50, $draw_x+5, "newHumidity.png", 23, "relative humidity at ".$location_text, $Opus_relH_percent_channel);
-placeTextWithLink($draw_y+50, $draw_x+30, sprintf('%.1F &#037;', $Opus_relH_percent), 90, 4, "#000000", "relative humidity at ".$location_text , $Opus_relH_percent_channel);
-
-placePicWithLink($draw_y+75, $draw_x+5, "newDewpoint.png", 23, "dewpoint at ".$location_text, $Opus_dewpointC_channel);
-placeTextWithLink($draw_y+75, $draw_x+30, sprintf('%.1F &#176;C', $Opus_dewpointC), 90, 4, "#000000", "dewpoint at ".$location_text , $Opus_dewpointC_channel);
-
-
-// ########## DET Opus weather station ##########
-$data_index = 41;
-$Opus_tempC = $adeiValue[$data_index][0];
-$Opus_tempF = $adeiValue[$data_index][1];
-$Opus_dewpointC = $adeiValue[$data_index][2];
-$Opus_dewpointF = $adeiValue[$data_index][3];
-$Opus_relH_percent = $adeiValue[$data_index][4];
-$Opus_relH_gramm = $adeiValue[$data_index][5];
-$Opus_absPressure_hPa = $adeiValue[$data_index][6];
-$Opus_relPressure_hPa = $adeiValue[$data_index][7];
-$Opus_voltage = $adeiValue[$data_index][8];
-
-$Opus_tempC_channel = $adeiChannel[$data_index][0];
-$Opus_tempF_channel = $adeiChannel[$data_index][1];
-$Opus_dewpointC_channel = $adeiChannel[$data_index][2];
-$Opus_dewpointF_channel = $adeiChannel[$data_index][3];
-$Opus_relH_percent_channel = $adeiChannel[$data_index][4];
-$Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
-$Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
-$Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
-$Opus_voltage_channel = $adeiChannel[$data_index][8];
-
-// update dewpoint max value
-if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
-
-$location_text = "detector platform";
-$draw_x = 1600;
-$draw_y = -15;
-
-placePicWithLink($draw_y, $draw_x+5, "newTemperature.png", 23, "temperature at ".$location_text, $Opus_tempC_channel);
-placeTextWithLink($draw_y, $draw_x+30, sprintf('%.1F &#176;C', $Opus_tempC), 90, 4, "#000000", "temperature at ".$location_text, $Opus_tempC_channel);
-
-placePicWithLink($draw_y+25, $draw_x+5, "newPressure.png", 23, "atmospheric pressure at ".$location_text, $Opus_absPressure_hPa_channel);
-placeTextWithLink($draw_y+25, $draw_x+30, sprintf('%.0F hPa', $Opus_absPressure_hPa), 90, 4, "#000000", "atmospheric pressure at ".$location_text, $Opus_absPressure_hPa_channel);
-
-placePicWithLink($draw_y+50, $draw_x+5, "newHumidity.png", 23, "relative humidity at ".$location_text, $Opus_relH_percent_channel);
-placeTextWithLink($draw_y+50, $draw_x+30, sprintf('%.1F &#037;', $Opus_relH_percent), 90, 4, "#000000", "relative humidity at ".$location_text , $Opus_relH_percent_channel);
-
-
-// ########## Detector Platform OLD ##########
-
-//placePicWithLink(-135, 1605, "newTemperature.png", 23, "temperature in KATRIN hall", $adeiChannel[19][1]);
-//placeTextWithLink(-135, 1630, sprintf('%.1F &#176;C', $adeiValue[19][1]), 90, 4, "#000000", "temperature in KATRIN hall", $adeiChannel[19][1]);
-
-//placePicWithLink(-110, 1605, "newPressure.png", 23, "atmospheric pressure in KATRIN hall", $adeiChannel[19][0]);
-//placeTextWithLink(-110, 1630, sprintf('%.0F hPa', $adeiValue[19][0] * 0.0689475729 * 1000.0), 90, 4, "#000000", "atmospheric pressure in KATRIN hall", $adeiChannel[19][0]);
-
-//placePicWithLink(-85, 1605, "newHumidity.png", 23, "relative humidity in KATRIN hall", $adeiChannel[19][2]);
-//placeTextWithLink(-85, 1630, sprintf('%.1F &#037;', $adeiValue[19][2]), 90, 4, "#000000", "relative humidity in KATRIN hall", $adeiChannel[19][2]);
-
-
-
-// ########## HV Opus weather station ##########
-$data_index = 42;
-$Opus_tempC = $adeiValue[$data_index][0];
-$Opus_tempF = $adeiValue[$data_index][1];
-$Opus_dewpointC = $adeiValue[$data_index][2];
-$Opus_dewpointF = $adeiValue[$data_index][3];
-$Opus_relH_percent = $adeiValue[$data_index][4];
-$Opus_relH_gramm = $adeiValue[$data_index][5];
-$Opus_absPressure_hPa = $adeiValue[$data_index][6];
-$Opus_relPressure_hPa = $adeiValue[$data_index][7];
-$Opus_voltage = $adeiValue[$data_index][8];
-
-$Opus_tempC_channel = $adeiChannel[$data_index][0];
-$Opus_tempF_channel = $adeiChannel[$data_index][1];
-$Opus_dewpointC_channel = $adeiChannel[$data_index][2];
-$Opus_dewpointF_channel = $adeiChannel[$data_index][3];
-$Opus_relH_percent_channel = $adeiChannel[$data_index][4];
-$Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
-$Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
-$Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
-$Opus_voltage_channel = $adeiChannel[$data_index][8];
-
-// update dewpoint max value
-if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
-
-$location_text = "high-voltage cage";
-$draw_x = 434;
-$draw_y = 586;
-
-if (($Opus_tempC > 0) && (($Opus_tempC < 99)) && ($Opus_absPressure_hPa > 0))
-  {
-    placeBoxRight($draw_y, $draw_x,sprintf('%.1F &#176;C', $Opus_tempC), 65, 2, $color);
-    placePicWithLink($draw_y+2, $draw_x+5, "newTemperature.png", 15, "temperature at ".$location_text.", and &#010rel. humidity is H = ".sprintf('%.1F &#037;', $Opus_relH_percent).",&#010dewpoint Td = ".sprintf('%.1F &#176;C', $Opus_dewpointC).",&#010atm. pressure is p = ".sprintf('%.0F hPa', $Opus_absPressure_hPa).".", $Opus_tempC_channel);
-  }
-
-// ########## MS bottom Opus weather station ##########
-$data_index = 43;
-$Opus_tempC = $adeiValue[$data_index][0];
-$Opus_tempF = $adeiValue[$data_index][1];
-$Opus_dewpointC = $adeiValue[$data_index][2];
-$Opus_dewpointF = $adeiValue[$data_index][3];
-$Opus_relH_percent = $adeiValue[$data_index][4];
-$Opus_relH_gramm = $adeiValue[$data_index][5];
-$Opus_absPressure_hPa = $adeiValue[$data_index][6];
-$Opus_relPressure_hPa = $adeiValue[$data_index][7];
-$Opus_voltage = $adeiValue[$data_index][8];
-
-$Opus_tempC_channel = $adeiChannel[$data_index][0];
-$Opus_tempF_channel = $adeiChannel[$data_index][1];
-$Opus_dewpointC_channel = $adeiChannel[$data_index][2];
-$Opus_dewpointF_channel = $adeiChannel[$data_index][3];
-$Opus_relH_percent_channel = $adeiChannel[$data_index][4];
-$Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
-$Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
-$Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
-$Opus_voltage_channel = $adeiChannel[$data_index][8];
-
-// update dewpoint max value
-if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
-
-$location_text = "main spectrometer basement";
-$draw_x = 845;
-$draw_y = 586;
-
-$color = "#CCCCCC";
-
-if (($Opus_tempC > 0) && (($Opus_tempC < 99)) && ($Opus_absPressure_hPa > 0))
-  {
-    placeBoxRight($draw_y, $draw_x,sprintf('%.1F &#176;C', $Opus_tempC), 65, 2, $color);
-    placePicWithLink($draw_y+2, $draw_x+5, "newTemperature.png", 15, "temperature at ".$location_text.", and &#010rel. humidity is H = ".sprintf('%.1F &#037;', $Opus_relH_percent).",&#010dewpoint Td = ".sprintf('%.1F &#176;C', $Opus_dewpointC).",&#010atm. pressure is p = ".sprintf('%.0F hPa', $Opus_absPressure_hPa).".", $Opus_tempC_channel);
-
-  }
-
-// ########## MS top Opus weather station ##########
-$data_index = 44;
-$Opus_tempC = $adeiValue[$data_index][0];
-$Opus_tempF = $adeiValue[$data_index][1];
-$Opus_dewpointC = $adeiValue[$data_index][2];
-$Opus_dewpointF = $adeiValue[$data_index][3];
-$Opus_relH_percent = $adeiValue[$data_index][4];
-$Opus_relH_gramm = $adeiValue[$data_index][5];
-$Opus_absPressure_hPa = $adeiValue[$data_index][6];
-$Opus_relPressure_hPa = $adeiValue[$data_index][7];
-$Opus_voltage = $adeiValue[$data_index][8];
-
-$Opus_tempC_channel = $adeiChannel[$data_index][0];
-$Opus_tempF_channel = $adeiChannel[$data_index][1];
-$Opus_dewpointC_channel = $adeiChannel[$data_index][2];
-$Opus_dewpointF_channel = $adeiChannel[$data_index][3];
-$Opus_relH_percent_channel = $adeiChannel[$data_index][4];
-$Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
-$Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
-$Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
-$Opus_voltage_channel = $adeiChannel[$data_index][8];
-
-// update dewpoint max value
-if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
-
-$location_text = "main spectrometer under the roof";
-$draw_x = 845;
-$draw_y = 31;
-
-
-if (($Opus_tempC > 0) && (($Opus_tempC < 99)) && ($Opus_absPressure_hPa > 0))
-  {
-    placeBoxRight($draw_y, $draw_x,sprintf('%.1F &#176;C', $Opus_tempC), 65, 2, $color);
-    placePicWithLink($draw_y+2, $draw_x+5, "newTemperature.png", 15, "temperature at ".$location_text.", and &#010rel. humidity is H = ".sprintf('%.1F &#037;', $Opus_relH_percent).",&#010dewpoint Td = ".sprintf('%.1F &#176;C', $Opus_dewpointC).",&#010atm. pressure is p = ".sprintf('%.0F hPa', $Opus_absPressure_hPa).".", $Opus_tempC_channel);
-  }
-
-// ########## MoS general Opus weather station ##########
-$data_index = 45;
-$Opus_tempC = $adeiValue[$data_index][0];
-$Opus_tempF = $adeiValue[$data_index][1];
-$Opus_dewpointC = $adeiValue[$data_index][2];
-$Opus_dewpointF = $adeiValue[$data_index][3];
-$Opus_relH_percent = $adeiValue[$data_index][4];
-$Opus_relH_gramm = $adeiValue[$data_index][5];
-$Opus_absPressure_hPa = $adeiValue[$data_index][6];
-$Opus_relPressure_hPa = $adeiValue[$data_index][7];
-$Opus_voltage = $adeiValue[$data_index][8];
-
-$Opus_tempC_channel = $adeiChannel[$data_index][0];
-$Opus_tempF_channel = $adeiChannel[$data_index][1];
-$Opus_dewpointC_channel = $adeiChannel[$data_index][2];
-$Opus_dewpointF_channel = $adeiChannel[$data_index][3];
-$Opus_relH_percent_channel = $adeiChannel[$data_index][4];
-$Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
-$Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
-$Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
-$Opus_voltage_channel = $adeiChannel[$data_index][8];
-
-$location_text = "monitor spectrometer building";
-$draw_x = 0;
-$draw_y = 536;
-
-placePicWithLink($draw_y, $draw_x+5, "newTemperature.png", 23, "temperature at ".$location_text, $Opus_tempC_channel);
-placeTextWithLink($draw_y, $draw_x+30, sprintf('%.1F &#176;C', $Opus_tempC), 90, 4, "#000000", "temperature at ".$location_text, $Opus_tempC_channel);
-
-placePicWithLink($draw_y+25, $draw_x+5, "newPressure.png", 23, "atmospheric pressure at ".$location_text, $Opus_absPressure_hPa_channel);
-placeTextWithLink($draw_y+25, $draw_x+30, sprintf('%.0F hPa', $Opus_absPressure_hPa), 90, 4, "#000000", "atmospheric pressure at ".$location_text, $Opus_absPressure_hPa_channel);
-
-placePicWithLink($draw_y+50, $draw_x+5, "newHumidity.png", 23, "relative humidity at ".$location_text, $Opus_relH_percent_channel);
-placeTextWithLink($draw_y+50, $draw_x+30, sprintf('%.1F &#037;', $Opus_relH_percent), 90, 4, "#000000", "relative humidity at ".$location_text , $Opus_relH_percent_channel);
-
-
-
-// ########## MS condensation alert during HV operation ##########
-
-if ($MSmode == 5) {
-  if ($global_max_dewpoint - $global_MS_temperature > -1)  // check dewpoint 1 °C below tank temperature
-    {
-      placePic(-130+12, 857, "alarm_flash.gif", 50, "Condensation alert, don't operate high voltage!");
-      $color = "#FFD800"; // yellow 
-      placeBox(-130+60, 805, "CONDENSATION ALERT" , 150, 3, $color);
-    }  
-}
+        // ########## PS Ion Monitor status display ##########
+        if ($adeiValue[39][1] < 0.5)
+        {
+            $ion_mon_stat = "active";
+            $color = "#4CFF00";
+        }
+        else
+        {
+            $ion_mon_stat = "bypassed";
+            $color = "#FF0000";
+            placePicWithLink(130, 33, "alarm_flash.gif", 50, "Ion alarm not armed!", $adeiChannel[39][1]);
+        }
+
+        placeText(115 + 65, 4, "Ion Mon", 105, 5, "#000000");
+        placeBox(140 + 65, 2, $ion_mon_stat, 105, 3, $color);
 
+    }
 
+    // ########## HIGH VOLTAGE SWITCH ##########
+    $value = $adeiValue[31][1];
+    $pic = "switch";
+    if ($value == 1) $pic = $pic . "Open";
+    else if ($value == 0) $pic = $pic . "Closed";
+    placePicWithLink(474, 440, $pic . ".png", 80, "status high-voltage grounding switch", $adeiChannel[31][1]);
+
+    // ########## MONITOR SPECTROMETR COUPLING STATUS ##########
+    $hv_switch1101_mos = $adeiValue[35][0];
+    $mos = "beamline_mos.png";
+    placePicXY(525, 120, $mos, 190, 60, "status monitor spectrometer connection");
+    if ($hv_switch1101_mos == 1)
+    {
+        $color = "#4CFF00"; // green
+        placeBox(586, 120, "MoS coupled", 190, 2, $color);
+    }
+    else
+    {
+        $color = "#CFCFCF"; // light gray
+        placeBox(586, 120, "MoS separated", 190, 2, $color);
+    }
+
+    // ########## define global dewpoint max value ###########
+    $global_max_dewpoint = - 273.0;
+
+    // ########## PS Opus weather station ##########
+    $data_index = 40;
+    $Opus_tempC = $adeiValue[$data_index][0];
+    $Opus_tempF = $adeiValue[$data_index][1];
+    $Opus_dewpointC = $adeiValue[$data_index][2];
+    $Opus_dewpointF = $adeiValue[$data_index][3];
+    $Opus_relH_percent = $adeiValue[$data_index][4];
+    $Opus_relH_gramm = $adeiValue[$data_index][5];
+    $Opus_absPressure_hPa = $adeiValue[$data_index][6];
+    $Opus_relPressure_hPa = $adeiValue[$data_index][7];
+    $Opus_voltage = $adeiValue[$data_index][8];
+
+    $Opus_tempC_channel = $adeiChannel[$data_index][0];
+    $Opus_tempF_channel = $adeiChannel[$data_index][1];
+    $Opus_dewpointC_channel = $adeiChannel[$data_index][2];
+    $Opus_dewpointF_channel = $adeiChannel[$data_index][3];
+    $Opus_relH_percent_channel = $adeiChannel[$data_index][4];
+    $Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
+    $Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
+    $Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
+    $Opus_voltage_channel = $adeiChannel[$data_index][8];
+
+    // update dewpoint max value
+    if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
+
+    $location_text = "pre spectrometer";
+    $draw_x = 0;
+    $draw_y = - 15;
+
+    placePicWithLink($draw_y, $draw_x + 5, "newTemperature.png", 23, "temperature at " . $location_text, $Opus_tempC_channel);
+    placeTextWithLink($draw_y, $draw_x + 30, sprintf('%.1F &#176;C', $Opus_tempC) , 90, 4, "#000000", "temperature at " . $location_text, $Opus_tempC_channel);
+
+    placePicWithLink($draw_y + 25, $draw_x + 5, "newPressure.png", 23, "atmospheric pressure at " . $location_text, $Opus_absPressure_hPa_channel);
+    placeTextWithLink($draw_y + 25, $draw_x + 30, sprintf('%.0F hPa', $Opus_absPressure_hPa) , 90, 4, "#000000", "atmospheric pressure at " . $location_text, $Opus_absPressure_hPa_channel);
+
+    placePicWithLink($draw_y + 50, $draw_x + 5, "newHumidity.png", 23, "relative humidity at " . $location_text, $Opus_relH_percent_channel);
+    placeTextWithLink($draw_y + 50, $draw_x + 30, sprintf('%.1F &#037;', $Opus_relH_percent) , 90, 4, "#000000", "relative humidity at " . $location_text, $Opus_relH_percent_channel);
+
+    placePicWithLink($draw_y + 75, $draw_x + 5, "newDewpoint.png", 23, "dewpoint at " . $location_text, $Opus_dewpointC_channel);
+    placeTextWithLink($draw_y + 75, $draw_x + 30, sprintf('%.1F &#176;C', $Opus_dewpointC) , 90, 4, "#000000", "dewpoint at " . $location_text, $Opus_dewpointC_channel);
+
+    // ########## DET Opus weather station ##########
+    $data_index = 41;
+    $Opus_tempC = $adeiValue[$data_index][0];
+    $Opus_tempF = $adeiValue[$data_index][1];
+    $Opus_dewpointC = $adeiValue[$data_index][2];
+    $Opus_dewpointF = $adeiValue[$data_index][3];
+    $Opus_relH_percent = $adeiValue[$data_index][4];
+    $Opus_relH_gramm = $adeiValue[$data_index][5];
+    $Opus_absPressure_hPa = $adeiValue[$data_index][6];
+    $Opus_relPressure_hPa = $adeiValue[$data_index][7];
+    $Opus_voltage = $adeiValue[$data_index][8];
+
+    $Opus_tempC_channel = $adeiChannel[$data_index][0];
+    $Opus_tempF_channel = $adeiChannel[$data_index][1];
+    $Opus_dewpointC_channel = $adeiChannel[$data_index][2];
+    $Opus_dewpointF_channel = $adeiChannel[$data_index][3];
+    $Opus_relH_percent_channel = $adeiChannel[$data_index][4];
+    $Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
+    $Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
+    $Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
+    $Opus_voltage_channel = $adeiChannel[$data_index][8];
+
+    // update dewpoint max value
+    if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
+
+    $location_text = "detector platform";
+    $draw_x = 1600;
+    $draw_y = - 15;
+
+    placePicWithLink($draw_y, $draw_x + 5, "newTemperature.png", 23, "temperature at " . $location_text, $Opus_tempC_channel);
+    placeTextWithLink($draw_y, $draw_x + 30, sprintf('%.1F &#176;C', $Opus_tempC) , 90, 4, "#000000", "temperature at " . $location_text, $Opus_tempC_channel);
+
+    placePicWithLink($draw_y + 25, $draw_x + 5, "newPressure.png", 23, "atmospheric pressure at " . $location_text, $Opus_absPressure_hPa_channel);
+    placeTextWithLink($draw_y + 25, $draw_x + 30, sprintf('%.0F hPa', $Opus_absPressure_hPa) , 90, 4, "#000000", "atmospheric pressure at " . $location_text, $Opus_absPressure_hPa_channel);
+
+    placePicWithLink($draw_y + 50, $draw_x + 5, "newHumidity.png", 23, "relative humidity at " . $location_text, $Opus_relH_percent_channel);
+    placeTextWithLink($draw_y + 50, $draw_x + 30, sprintf('%.1F &#037;', $Opus_relH_percent) , 90, 4, "#000000", "relative humidity at " . $location_text, $Opus_relH_percent_channel);
+
+    // ########## Detector Platform OLD ##########
+    //placePicWithLink(-135, 1605, "newTemperature.png", 23, "temperature in KATRIN hall", $adeiChannel[19][1]);
+    //placeTextWithLink(-135, 1630, sprintf('%.1F &#176;C', $adeiValue[19][1]), 90, 4, "#000000", "temperature in KATRIN hall", $adeiChannel[19][1]);
+    //placePicWithLink(-110, 1605, "newPressure.png", 23, "atmospheric pressure in KATRIN hall", $adeiChannel[19][0]);
+    //placeTextWithLink(-110, 1630, sprintf('%.0F hPa', $adeiValue[19][0] * 0.0689475729 * 1000.0), 90, 4, "#000000", "atmospheric pressure in KATRIN hall", $adeiChannel[19][0]);
+    //placePicWithLink(-85, 1605, "newHumidity.png", 23, "relative humidity in KATRIN hall", $adeiChannel[19][2]);
+    //placeTextWithLink(-85, 1630, sprintf('%.1F &#037;', $adeiValue[19][2]), 90, 4, "#000000", "relative humidity in KATRIN hall", $adeiChannel[19][2]);
+
+
+    // ########## HV Opus weather station ##########
+    $data_index = 42;
+    $Opus_tempC = $adeiValue[$data_index][0];
+    $Opus_tempF = $adeiValue[$data_index][1];
+    $Opus_dewpointC = $adeiValue[$data_index][2];
+    $Opus_dewpointF = $adeiValue[$data_index][3];
+    $Opus_relH_percent = $adeiValue[$data_index][4];
+    $Opus_relH_gramm = $adeiValue[$data_index][5];
+    $Opus_absPressure_hPa = $adeiValue[$data_index][6];
+    $Opus_relPressure_hPa = $adeiValue[$data_index][7];
+    $Opus_voltage = $adeiValue[$data_index][8];
+
+    $Opus_tempC_channel = $adeiChannel[$data_index][0];
+    $Opus_tempF_channel = $adeiChannel[$data_index][1];
+    $Opus_dewpointC_channel = $adeiChannel[$data_index][2];
+    $Opus_dewpointF_channel = $adeiChannel[$data_index][3];
+    $Opus_relH_percent_channel = $adeiChannel[$data_index][4];
+    $Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
+    $Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
+    $Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
+    $Opus_voltage_channel = $adeiChannel[$data_index][8];
+
+    // update dewpoint max value
+    if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
+
+    $location_text = "high-voltage cage";
+    $draw_x = 434;
+    $draw_y = 586;
+
+    if (($Opus_tempC > 0) && (($Opus_tempC < 99)) && ($Opus_absPressure_hPa > 0))
+    {
+        placeBoxRight($draw_y, $draw_x, sprintf('%.1F &#176;C', $Opus_tempC) , 65, 2, $color);
+        placePicWithLink($draw_y + 2, $draw_x + 5, "newTemperature.png", 15, "temperature at " . $location_text . ", and &#010rel. humidity is H = " . sprintf('%.1F &#037;', $Opus_relH_percent) . ",&#010dewpoint Td = " . sprintf('%.1F &#176;C', $Opus_dewpointC) . ",&#010atm. pressure is p = " . sprintf('%.0F hPa', $Opus_absPressure_hPa) . ".", $Opus_tempC_channel);
+    }
+
+    // ########## MS bottom Opus weather station ##########
+    $data_index = 43;
+    $Opus_tempC = $adeiValue[$data_index][0];
+    $Opus_tempF = $adeiValue[$data_index][1];
+    $Opus_dewpointC = $adeiValue[$data_index][2];
+    $Opus_dewpointF = $adeiValue[$data_index][3];
+    $Opus_relH_percent = $adeiValue[$data_index][4];
+    $Opus_relH_gramm = $adeiValue[$data_index][5];
+    $Opus_absPressure_hPa = $adeiValue[$data_index][6];
+    $Opus_relPressure_hPa = $adeiValue[$data_index][7];
+    $Opus_voltage = $adeiValue[$data_index][8];
+
+    $Opus_tempC_channel = $adeiChannel[$data_index][0];
+    $Opus_tempF_channel = $adeiChannel[$data_index][1];
+    $Opus_dewpointC_channel = $adeiChannel[$data_index][2];
+    $Opus_dewpointF_channel = $adeiChannel[$data_index][3];
+    $Opus_relH_percent_channel = $adeiChannel[$data_index][4];
+    $Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
+    $Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
+    $Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
+    $Opus_voltage_channel = $adeiChannel[$data_index][8];
+
+    // update dewpoint max value
+    if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
+
+    $location_text = "main spectrometer basement";
+    $draw_x = 845;
+    $draw_y = 586;
+
+    $color = "#CCCCCC";
+
+    if (($Opus_tempC > 0) && (($Opus_tempC < 99)) && ($Opus_absPressure_hPa > 0))
+    {
+        placeBoxRight($draw_y, $draw_x, sprintf('%.1F &#176;C', $Opus_tempC) , 65, 2, $color);
+        placePicWithLink($draw_y + 2, $draw_x + 5, "newTemperature.png", 15, "temperature at " . $location_text . ", and &#010rel. humidity is H = " . sprintf('%.1F &#037;', $Opus_relH_percent) . ",&#010dewpoint Td = " . sprintf('%.1F &#176;C', $Opus_dewpointC) . ",&#010atm. pressure is p = " . sprintf('%.0F hPa', $Opus_absPressure_hPa) . ".", $Opus_tempC_channel);
+
+    }
+
+    // ########## MS top Opus weather station ##########
+    $data_index = 44;
+    $Opus_tempC = $adeiValue[$data_index][0];
+    $Opus_tempF = $adeiValue[$data_index][1];
+    $Opus_dewpointC = $adeiValue[$data_index][2];
+    $Opus_dewpointF = $adeiValue[$data_index][3];
+    $Opus_relH_percent = $adeiValue[$data_index][4];
+    $Opus_relH_gramm = $adeiValue[$data_index][5];
+    $Opus_absPressure_hPa = $adeiValue[$data_index][6];
+    $Opus_relPressure_hPa = $adeiValue[$data_index][7];
+    $Opus_voltage = $adeiValue[$data_index][8];
+
+    $Opus_tempC_channel = $adeiChannel[$data_index][0];
+    $Opus_tempF_channel = $adeiChannel[$data_index][1];
+    $Opus_dewpointC_channel = $adeiChannel[$data_index][2];
+    $Opus_dewpointF_channel = $adeiChannel[$data_index][3];
+    $Opus_relH_percent_channel = $adeiChannel[$data_index][4];
+    $Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
+    $Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
+    $Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
+    $Opus_voltage_channel = $adeiChannel[$data_index][8];
+
+    // update dewpoint max value
+    if ($Opus_dewpointC > $global_max_dewpoint) $global_max_dewpoint = $Opus_dewpointC;
+
+    $location_text = "main spectrometer under the roof";
+    $draw_x = 845;
+    $draw_y = 31;
+
+    if (($Opus_tempC > 0) && (($Opus_tempC < 99)) && ($Opus_absPressure_hPa > 0))
+    {
+        placeBoxRight($draw_y, $draw_x, sprintf('%.1F &#176;C', $Opus_tempC) , 65, 2, $color);
+        placePicWithLink($draw_y + 2, $draw_x + 5, "newTemperature.png", 15, "temperature at " . $location_text . ", and &#010rel. humidity is H = " . sprintf('%.1F &#037;', $Opus_relH_percent) . ",&#010dewpoint Td = " . sprintf('%.1F &#176;C', $Opus_dewpointC) . ",&#010atm. pressure is p = " . sprintf('%.0F hPa', $Opus_absPressure_hPa) . ".", $Opus_tempC_channel);
+    }
+
+    // ########## MoS general Opus weather station ##########
+    $data_index = 45;
+    $Opus_tempC = $adeiValue[$data_index][0];
+    $Opus_tempF = $adeiValue[$data_index][1];
+    $Opus_dewpointC = $adeiValue[$data_index][2];
+    $Opus_dewpointF = $adeiValue[$data_index][3];
+    $Opus_relH_percent = $adeiValue[$data_index][4];
+    $Opus_relH_gramm = $adeiValue[$data_index][5];
+    $Opus_absPressure_hPa = $adeiValue[$data_index][6];
+    $Opus_relPressure_hPa = $adeiValue[$data_index][7];
+    $Opus_voltage = $adeiValue[$data_index][8];
+
+    $Opus_tempC_channel = $adeiChannel[$data_index][0];
+    $Opus_tempF_channel = $adeiChannel[$data_index][1];
+    $Opus_dewpointC_channel = $adeiChannel[$data_index][2];
+    $Opus_dewpointF_channel = $adeiChannel[$data_index][3];
+    $Opus_relH_percent_channel = $adeiChannel[$data_index][4];
+    $Opus_relH_gramm_channel = $adeiChannel[$data_index][5];
+    $Opus_absPressure_hPa_channel = $adeiChannel[$data_index][6];
+    $Opus_relPressure_hPa_channel = $adeiChannel[$data_index][7];
+    $Opus_voltage_channel = $adeiChannel[$data_index][8];
+
+    $location_text = "monitor spectrometer building";
+    $draw_x = 0;
+    $draw_y = 536;
+
+    placePicWithLink($draw_y, $draw_x + 5, "newTemperature.png", 23, "temperature at " . $location_text, $Opus_tempC_channel);
+    placeTextWithLink($draw_y, $draw_x + 30, sprintf('%.1F &#176;C', $Opus_tempC) , 90, 4, "#000000", "temperature at " . $location_text, $Opus_tempC_channel);
+
+    placePicWithLink($draw_y + 25, $draw_x + 5, "newPressure.png", 23, "atmospheric pressure at " . $location_text, $Opus_absPressure_hPa_channel);
+    placeTextWithLink($draw_y + 25, $draw_x + 30, sprintf('%.0F hPa', $Opus_absPressure_hPa) , 90, 4, "#000000", "atmospheric pressure at " . $location_text, $Opus_absPressure_hPa_channel);
+
+    placePicWithLink($draw_y + 50, $draw_x + 5, "newHumidity.png", 23, "relative humidity at " . $location_text, $Opus_relH_percent_channel);
+    placeTextWithLink($draw_y + 50, $draw_x + 30, sprintf('%.1F &#037;', $Opus_relH_percent) , 90, 4, "#000000", "relative humidity at " . $location_text, $Opus_relH_percent_channel);
+
+    // ########## MS condensation alert during HV operation ##########
+    if ($MSmode == 5)
+    {
+        if ($global_max_dewpoint - $global_MS_temperature > - 1) // check dewpoint 1 °C below tank temperature
+
+        {
+            placePic(-130 + 12, 857, "alarm_flash.gif", 50, "Condensation alert, don't operate high voltage!");
+            $color = "#FFD800"; // yellow
+            placeBox(-130 + 60, 805, "CONDENSATION ALERT", 150, 3, $color);
+        }
+    }
 
 ?>

+ 453 - 471
aircoils_settings.php

@@ -1,475 +1,457 @@
 <?php
 
-$aircoil_settings = array (
-  0 => 
-  array (
-    0 => 'All Off',
-    1 => 0.0,
-    2 => 0.0,
-    3 => 0.0,
-    4 => 0.0,
-    5 => 0.0,
-    6 => 0.0,
-    7 => 0.0,
-    8 => 0.0,
-    9 => 0.0,
-    10 => 0.0,
-    11 => 0.0,
-    12 => 0.0,
-    13 => 0.0,
-    14 => 0.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0,
-    22 => 0.0,
-  ),
-  1 => 
-  array (
-    0 => 'ZERO 70%',
-    1 => 0.0,
-    2 => 0.0,
-    3 => 0.0,
-    4 => 0.0,
-    5 => 0.0,
-    6 => 0.0,
-    7 => 0.0,
-    8 => 0.0,
-    9 => 0.0,
-    10 => 0.0,
-    11 => 0.0,
-    12 => 0.0,
-    13 => 0.0,
-    14 => 0.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 7.24,
-    22 => 46.47,
-  ),
-  2 =>
-  array (
-    0 => 'KNM1max',
-    1 => 95.0,
-    2 => 95.0,
-    3 => 120.0,
-    4 => 120.0,
-    5 => 120.0,
-    6 => 120.0,
-    7 => 120.0,
-    8 => 120.0,
-    9 => 120.0,
-    10 => 120.0,
-    11 => 120.0,
-    12 => 95.0,
-    13 => 95.0,
-    14 => 0.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 1.8,
-    22 => 60.9,
-  ),
-  3 => 
-  array (
-    0 => 'e1G',
-    1 => -24.4,
-    2 => 0.0,
-    3 => -25.0,
-    4 => -13.7,
-    5 => -4.8,
-    6 => -1.0,
-    7 => 3.4,
-    8 => 15.0,
-    9 => 7.0,
-    10 => 6.0,
-    11 => 3.7,
-    12 => 2.5,
-    13 => -17.0,
-    14 => -60.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0,
-    22 => 45.0,
-  ),
-  4 => 
-  array (
-    0 => '2.0G 70%',
-    1 => -11.9,
-    2 => -9.0,
-    3 => 5.8,
-    4 => -6.6,
-    5 => 15.3,
-    6 => 0.8,
-    7 => 34.1,
-    8 => 44.6,
-    9 => 5.5,
-    10 => 5.4,
-    11 => -8.6,
-    12 => 13.0,
-    13 => -10.0,
-    14 => 19.4,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 7.42,
-    22 => 46.48,
-  ),
-  5 => 
-  array (
-    0 => 'e2.7G',
-    1 => 0.0,
-    2 => 0.0,
-    3 => 5.0,
-    4 => 0.0,
-    5 => 0.0,
-    6 => 5.7,
-    7 => 9.7,
-    8 => 27.0,
-    9 => 30.0,
-    10 => 3.0,
-    11 => 9.0,
-    12 => 5.3,
-    13 => 10.7,
-    14 => -22.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0,
-    22 => 45.0,
-  ),
-  6 => 
-  array (
-    0 => '7.0G \'19',
-    1 => 30.0,
-    2 => 30.0,
-    3 => 40.0,
-    4 => 50.0,
-    5 => 80.0,
-    6 => 87.0,
-    7 => 102.0,
-    8 => 102.0,
-    9 => 87.0,
-    10 => 80.0,
-    11 => 40.0,
-    12 => 40.0,
-    13 => 10.0,
-    14 => 0.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 13.9,
-    22 => 60.5,
-  ),
-  7 => 
-  array (
-    0 => '3.8G \'19',
-    1 => 21.6,
-    2 => 21.3,
-    3 => 33.2,
-    4 => 7.4,
-    5 => 55.9,
-    6 => 32.0,
-    7 => 61.0,
-    8 => 56.8,
-    9 => 35.8,
-    10 => 36.0,
-    11 => 42.3,
-    12 => 33.9,
-    13 => 15.8,
-    14 => 45.2,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 4.6,
-    22 => 53.0,
-  ),
-  8 => 
-  array (
-    0 => '9.7G \'19',
-    1 => 28.4,
-    2 => 98.7,
-    3 => 93.0,
-    4 => 76.8,
-    5 => 95.6,
-    6 => 132.6,
-    7 => 103.4,
-    8 => 98.5,
-    9 => 149.1,
-    10 => 66.8,
-    11 => 84.4,
-    12 => 94.6,
-    13 => 95.0,
-    14 => 25.7,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 2.3,
-    22 => 59.4,
-  ),
-  9 => 
-  array (
-    0 => '8.0G \'19',
-    1 => 30.0,
-    2 => 50.0,
-    3 => 60.0,
-    4 => 80.0,
-    5 => 83.0,
-    6 => 94.0,
-    7 => 112.0,
-    8 => 112.0,
-    9 => 94.0,
-    10 => 83.0,
-    11 => 60.0,
-    12 => 50.0,
-    13 => 30.0,
-    14 => 0.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 2.9,
-    22 => 57.7,
-  ),
-  10 => 
-  array (
-    0 => 'e4G \'20',
-    1 => 0.0,
-    2 => 0.0,
-    3 => 5.0,
-    4 => 15.0,
-    5 => 18.0,
-    6 => 21.0,
-    7 => 25.0,
-    8 => 28.0,
-    9 => 28.0,
-    10 => 26.0,
-    11 => 18.0,
-    12 => 16.0,
-    13 => 13.0,
-    14 => 0.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
-  11 => 
-  array (
-    0 => 'SDS BG',
-    1 => 48.2,
-    2 => 0.0,
-    3 => 49.5,
-    4 => 90.0,
-    5 => 52.3,
-    6 => 52.0,
-    7 => 27.8,
-    8 => 91.8,
-    9 => 64.7,
-    10 => 63.0,
-    11 => 13.4,
-    12 => 60.5,
-    13 => 94.1,
-    14 => 10.1,
-    15 => 0.0,
-    16 => 1.1,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 7.8,
-    22 => 46.5,
-  ),
-  12 =>
-  array (
-    0 => 'MAX',
-    1 => 120.0,
-    2 => 120.0,
-    3 => 120.0,
-    4 => 120.0,
-    5 => 110.0,
-    6 => 110.0,
-    7 => 110.0,
-    8 => 110.0,
-    9 => 110.0,
-    10 => 110.0,
-    11 => 110.0,
-    12 => 110.0,
-    13 => 120.0,
-    14 => 120.0,
-    15 => 120.0,
-    16 => 120.0,
-    17 => 120.0,
-    18 => 120.0,
-    19 => 120.0,
-    20 => 120.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
-  13 => 
-  array (
-    0 => 'KNM2',
-    1 => 50.8,
-    2 => 0.0,
-    3 => 44.6,
-    4 => 79.5,
-    5 => 43.0,
-    6 => 64.8,
-    7 => 25.7,
-    8 => 52.8,
-    9 => 34.9,
-    10 => 38.6,
-    11 => 9.2,
-    12 => 35.9,
-    13 => 92.7,
-    14 => 13.2,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
-  14 => 
-  array (
-    0 => 'SAP',
-    1 => 120.0,
-    2 => 0.0,
-    3 => 120.0,
-    4 => 120.0,
-    5 => 120.0,
-    6 => 120.0,
-    7 => 120.0,
-    8 => 110.0,
-    9 => 110.0,
-    10 => 110.0,
-    11 => -60.0,
-    12 => -30.0,
-    13 => 60.0,
-    14 => 0.0,
-    15 => 120.0,
-    16 => 120.0,
-    17 => -120.0,
-    18 => -120.0,
-    19 => -120.0,
-    20 => -120.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
-  15 => 
-  array (
-    0 => 'KrT2-19',
-    1 => 0.0,
-    2 => 0.0,
-    3 => 5.0,
-    4 => 0.0,
-    5 => 0.0,
-    6 => 10.0,
-    7 => 17.0,
-    8 => 27.0,
-    9 => 30.0,
-    10 => 3.0,
-    11 => 9.0,
-    12 => 5.3,
-    13 => 10.7,
-    14 => -22.0,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
-  16 => 
-  array (
-    0 => 'eKNM2',
-    1 => 50.8,
-    2 => 0.0,
-    3 => 44.6,
-    4 => 45.4,
-    5 => 24.6,
-    6 => 37.0,
-    7 => 14.7,
-    8 => 52.8,
-    9 => 34.9,
-    10 => 38.7,
-    11 => 9.2,
-    12 => 35.9,
-    13 => 92.7,
-    14 => 13.2,
-    15 => 0.0,
-    16 => 0.0,
-    17 => 0.0,
-    18 => 0.0,
-    19 => 0.0,
-    20 => 0.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
-  17 => 
-  array (
-    0 => 'eSAP',
-    1 => 120.0,
-    2 => -4.0,
-    3 => 116.0,
-    4 => 70.0,
-    5 => 70.0,
-    6 => 70.0,
-    7 => 70.0,
-    8 => 110.0,
-    9 => 110.0,
-    10 => 110.0,
-    11 => -60.0,
-    12 => -28.0,
-    13 => 58.0,
-    14 => 5.0,
-    15 => 120.0,
-    16 => 120.0,
-    17 => -120.0,
-    18 => -119.0,
-    19 => -120.0,
-    20 => -120.0,
-    21 => 0.0, 
-    22 => 45.0,
-  ),
+$aircoil_settings = array(
+    0 => array(
+        0 => 'All Off',
+        1 => 0.0,
+        2 => 0.0,
+        3 => 0.0,
+        4 => 0.0,
+        5 => 0.0,
+        6 => 0.0,
+        7 => 0.0,
+        8 => 0.0,
+        9 => 0.0,
+        10 => 0.0,
+        11 => 0.0,
+        12 => 0.0,
+        13 => 0.0,
+        14 => 0.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 0.0,
+    ) ,
+    1 => array(
+        0 => 'ZERO 70%',
+        1 => 0.0,
+        2 => 0.0,
+        3 => 0.0,
+        4 => 0.0,
+        5 => 0.0,
+        6 => 0.0,
+        7 => 0.0,
+        8 => 0.0,
+        9 => 0.0,
+        10 => 0.0,
+        11 => 0.0,
+        12 => 0.0,
+        13 => 0.0,
+        14 => 0.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 7.24,
+        22 => 46.47,
+    ) ,
+    2 => array(
+        0 => 'KNM1max',
+        1 => 95.0,
+        2 => 95.0,
+        3 => 120.0,
+        4 => 120.0,
+        5 => 120.0,
+        6 => 120.0,
+        7 => 120.0,
+        8 => 120.0,
+        9 => 120.0,
+        10 => 120.0,
+        11 => 120.0,
+        12 => 95.0,
+        13 => 95.0,
+        14 => 0.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 1.8,
+        22 => 60.9,
+    ) ,
+    3 => array(
+        0 => 'e1G',
+        1 => - 24.4,
+        2 => 0.0,
+        3 => - 25.0,
+        4 => - 13.7,
+        5 => - 4.8,
+        6 => - 1.0,
+        7 => 3.4,
+        8 => 15.0,
+        9 => 7.0,
+        10 => 6.0,
+        11 => 3.7,
+        12 => 2.5,
+        13 => - 17.0,
+        14 => - 60.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    4 => array(
+        0 => '2.0G 70%',
+        1 => - 11.9,
+        2 => - 9.0,
+        3 => 5.8,
+        4 => - 6.6,
+        5 => 15.3,
+        6 => 0.8,
+        7 => 34.1,
+        8 => 44.6,
+        9 => 5.5,
+        10 => 5.4,
+        11 => - 8.6,
+        12 => 13.0,
+        13 => - 10.0,
+        14 => 19.4,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 7.42,
+        22 => 46.48,
+    ) ,
+    5 => array(
+        0 => 'e2.7G',
+        1 => 0.0,
+        2 => 0.0,
+        3 => 5.0,
+        4 => 0.0,
+        5 => 0.0,
+        6 => 5.7,
+        7 => 9.7,
+        8 => 27.0,
+        9 => 30.0,
+        10 => 3.0,
+        11 => 9.0,
+        12 => 5.3,
+        13 => 10.7,
+        14 => - 22.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    6 => array(
+        0 => '7.0G \'19',
+        1 => 30.0,
+        2 => 30.0,
+        3 => 40.0,
+        4 => 50.0,
+        5 => 80.0,
+        6 => 87.0,
+        7 => 102.0,
+        8 => 102.0,
+        9 => 87.0,
+        10 => 80.0,
+        11 => 40.0,
+        12 => 40.0,
+        13 => 10.0,
+        14 => 0.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 13.9,
+        22 => 60.5,
+    ) ,
+    7 => array(
+        0 => '3.8G \'19',
+        1 => 21.6,
+        2 => 21.3,
+        3 => 33.2,
+        4 => 7.4,
+        5 => 55.9,
+        6 => 32.0,
+        7 => 61.0,
+        8 => 56.8,
+        9 => 35.8,
+        10 => 36.0,
+        11 => 42.3,
+        12 => 33.9,
+        13 => 15.8,
+        14 => 45.2,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 4.6,
+        22 => 53.0,
+    ) ,
+    8 => array(
+        0 => '9.7G \'19',
+        1 => 28.4,
+        2 => 98.7,
+        3 => 93.0,
+        4 => 76.8,
+        5 => 95.6,
+        6 => 132.6,
+        7 => 103.4,
+        8 => 98.5,
+        9 => 149.1,
+        10 => 66.8,
+        11 => 84.4,
+        12 => 94.6,
+        13 => 95.0,
+        14 => 25.7,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 2.3,
+        22 => 59.4,
+    ) ,
+    9 => array(
+        0 => '8.0G \'19',
+        1 => 30.0,
+        2 => 50.0,
+        3 => 60.0,
+        4 => 80.0,
+        5 => 83.0,
+        6 => 94.0,
+        7 => 112.0,
+        8 => 112.0,
+        9 => 94.0,
+        10 => 83.0,
+        11 => 60.0,
+        12 => 50.0,
+        13 => 30.0,
+        14 => 0.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 2.9,
+        22 => 57.7,
+    ) ,
+    10 => array(
+        0 => 'e4G \'20',
+        1 => 0.0,
+        2 => 0.0,
+        3 => 5.0,
+        4 => 15.0,
+        5 => 18.0,
+        6 => 21.0,
+        7 => 25.0,
+        8 => 28.0,
+        9 => 28.0,
+        10 => 26.0,
+        11 => 18.0,
+        12 => 16.0,
+        13 => 13.0,
+        14 => 0.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    11 => array(
+        0 => 'SDS BG',
+        1 => 48.2,
+        2 => 0.0,
+        3 => 49.5,
+        4 => 90.0,
+        5 => 52.3,
+        6 => 52.0,
+        7 => 27.8,
+        8 => 91.8,
+        9 => 64.7,
+        10 => 63.0,
+        11 => 13.4,
+        12 => 60.5,
+        13 => 94.1,
+        14 => 10.1,
+        15 => 0.0,
+        16 => 1.1,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 7.8,
+        22 => 46.5,
+    ) ,
+    12 => array(
+        0 => 'MAX',
+        1 => 120.0,
+        2 => 120.0,
+        3 => 120.0,
+        4 => 120.0,
+        5 => 110.0,
+        6 => 110.0,
+        7 => 110.0,
+        8 => 110.0,
+        9 => 110.0,
+        10 => 110.0,
+        11 => 110.0,
+        12 => 110.0,
+        13 => 120.0,
+        14 => 120.0,
+        15 => 120.0,
+        16 => 120.0,
+        17 => 120.0,
+        18 => 120.0,
+        19 => 120.0,
+        20 => 120.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    13 => array(
+        0 => 'KNM2',
+        1 => 50.8,
+        2 => 0.0,
+        3 => 44.6,
+        4 => 79.5,
+        5 => 43.0,
+        6 => 64.8,
+        7 => 25.7,
+        8 => 52.8,
+        9 => 34.9,
+        10 => 38.6,
+        11 => 9.2,
+        12 => 35.9,
+        13 => 92.7,
+        14 => 13.2,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    14 => array(
+        0 => 'SAP',
+        1 => 120.0,
+        2 => 0.0,
+        3 => 120.0,
+        4 => 120.0,
+        5 => 120.0,
+        6 => 120.0,
+        7 => 120.0,
+        8 => 110.0,
+        9 => 110.0,
+        10 => 110.0,
+        11 => - 60.0,
+        12 => - 30.0,
+        13 => 60.0,
+        14 => 0.0,
+        15 => 120.0,
+        16 => 120.0,
+        17 => - 120.0,
+        18 => - 120.0,
+        19 => - 120.0,
+        20 => - 120.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    15 => array(
+        0 => 'KrT2-19',
+        1 => 0.0,
+        2 => 0.0,
+        3 => 5.0,
+        4 => 0.0,
+        5 => 0.0,
+        6 => 10.0,
+        7 => 17.0,
+        8 => 27.0,
+        9 => 30.0,
+        10 => 3.0,
+        11 => 9.0,
+        12 => 5.3,
+        13 => 10.7,
+        14 => - 22.0,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    16 => array(
+        0 => 'eKNM2',
+        1 => 50.8,
+        2 => 0.0,
+        3 => 44.6,
+        4 => 45.4,
+        5 => 24.6,
+        6 => 37.0,
+        7 => 14.7,
+        8 => 52.8,
+        9 => 34.9,
+        10 => 38.7,
+        11 => 9.2,
+        12 => 35.9,
+        13 => 92.7,
+        14 => 13.2,
+        15 => 0.0,
+        16 => 0.0,
+        17 => 0.0,
+        18 => 0.0,
+        19 => 0.0,
+        20 => 0.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
+    17 => array(
+        0 => 'eSAP',
+        1 => 120.0,
+        2 => - 4.0,
+        3 => 116.0,
+        4 => 70.0,
+        5 => 70.0,
+        6 => 70.0,
+        7 => 70.0,
+        8 => 110.0,
+        9 => 110.0,
+        10 => 110.0,
+        11 => - 60.0,
+        12 => - 28.0,
+        13 => 58.0,
+        14 => 5.0,
+        15 => 120.0,
+        16 => 120.0,
+        17 => - 120.0,
+        18 => - 119.0,
+        19 => - 120.0,
+        20 => - 120.0,
+        21 => 0.0,
+        22 => 45.0,
+    ) ,
 
-); 
+);
 
-?>
+?>

+ 94 - 77
index.php

@@ -4,48 +4,63 @@
 <title>KATRIN Spectrometer and Detector System Status Overview </title>
 
 <style type="text/css">
-	body      { font-family:Calibri,Arial; }
-	a:link    { text-decoration:none; }
-	a:visited { text-decoration:none; }
-	a:hover   { text-decoration:none; }
-	a:active  { text-decoration:none; }
-	a:focus   { text-decoration:none; }
+    body      { font-family:Calibri,Arial; }
+    a:link    { text-decoration:none; }
+    a:visited { text-decoration:none; }
+    a:hover   { text-decoration:none; }
+    a:active  { text-decoration:none; }
+    a:focus   { text-decoration:none; }
 </style>
 
 <head>
-  <link rel="stylesheet" href="pics/beamline_noMoS.png" />
-  <link rel="stylesheet" href="pics/spectrometer2019.png" />
-  <link rel="stylesheet" href="pics/katrin_logo.jpg" />
-  <link rel="stylesheet" href="pics/newEmail.png" />
+    <link rel="stylesheet" href="pics/beamline_noMoS.png" />
+    <link rel="stylesheet" href="pics/spectrometer2019.png" />
+    <link rel="stylesheet" href="pics/katrin_logo.jpg" />
+    <link rel="stylesheet" href="pics/newEmail.png" />
 
 <!--
-  <style>
-  body {
-    background-image: url("pics/bg.png");
-    background-repeat: no-repeat;
-  }
-  </style>
+    <style>
+    body {
+        background-image: url("pics/bg.png");
+        background-repeat: no-repeat;
+    }
+    </style>
 -->
 </head>
 
 <?php
-  // get client ip adress to check whether computer is on-site or not
-
-  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
-      $ip = $_SERVER['HTTP_CLIENT_IP'];
-      } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-          $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
-          } else { $ip = $_SERVER['REMOTE_ADDR']; }
-
-$onsite = false;
-$slowrefresh = false;
-
-if (substr($ip, 0, 6) == "141.52")
-     { if (substr($ip, 0, 9) == "141.52.16")
-         { echo '<meta http-equiv="refresh" content="10">'; $onsite = true; }
-       else echo '<meta http-equiv="refresh" content="30">'; $onsite = true; }
-else { echo '<meta http-equiv="refresh" content="120">'; $slowrefresh= true; }
-
+    // get client ip adress to check whether computer is on-site or not
+    if (!empty($_SERVER['HTTP_CLIENT_IP']))
+    {
+        $ip = $_SERVER['HTTP_CLIENT_IP'];
+    }
+    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
+    {
+        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+    }
+    else
+    {
+        $ip = $_SERVER['REMOTE_ADDR'];
+    }
+
+    $onsite = false;
+    $slowrefresh = false;
+
+    if (substr($ip, 0, 6) == "141.52")
+    {
+        if (substr($ip, 0, 9) == "141.52.16")
+        {
+            echo '<meta http-equiv="refresh" content="10">';
+            $onsite = true;
+        }
+        else echo '<meta http-equiv="refresh" content="30">';
+        $onsite = true;
+    }
+    else
+    {
+        echo '<meta http-equiv="refresh" content="120">';
+        $slowrefresh = true;
+    }
 ?>
 
 </head>
@@ -53,57 +68,59 @@ else { echo '<meta http-equiv="refresh" content="120">'; $slowrefresh= true; }
 
 
 <?php
-      // set time zone to local German time
-      date_default_timezone_set('Europe/Berlin');
-
-      // include helper functions
-      include "SDS_status_functions.php";
-
-      // include channel list
-      include "SDS_status_channels.php";
-
-      // include aircoil settings
-      include "aircoils_settings.php";
-  
-      // include mac-e filter settings
-      include "mace_settings.php";
-
-      // include HV data
-      if ((include "ADEI_HV_readings.php") == 0)
-      { usleep(400000); include "ADEI_HV_readings.php"; };
-
-      // read cached ADEI data
-      $valuesincluded = 0;
-      $loop = 0;
-      $includeflag = 0;
-      do {
-        $includeflag = include 'ADEIvalues.php'; 
+    // set time zone to local German time
+    date_default_timezone_set('Europe/Berlin');
+
+    // include helper functions
+    include "SDS_status_functions.php";
+
+    // include channel list
+    include "SDS_status_channels.php";
+
+    // include aircoil settings
+    include "aircoils_settings.php";
+
+    // include mac-e filter settings
+    include "mace_settings.php";
+
+    // include HV data
+    if ((include "ADEI_HV_readings.php") == 0)
+    {
+        usleep(400000);
+        include "ADEI_HV_readings.php";
+    };
+
+    // read cached ADEI data
+    $valuesincluded = 0;
+    $loop = 0;
+    $includeflag = 0;
+    do
+    {
+        $includeflag = include 'ADEIvalues.php';
         $loop++;
         if ($valuesincluded == 0) usleep(100000);
-        }
-      while (($loop < 21) && ($includeflag+$valuesincluded < 2));
-      if ($valuesincluded == 0) $extraction_time = "Request timed out!".PHP_EOL;
-      //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;
-      
-
-	// ########## TIME STAMP ##########
-
-	echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector System Status Overview</b></font><br>';
-	echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC850) . '</font><br>';
-	echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
-	echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
-	echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Uptime:' . @file_get_contents( "/proc/uptime") . ' </font><br>';
-
-  
-//('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
-        if ($errorcount >0) echo "<br> <br> <br> <br>".$errormessage;
+    }
+    while (($loop < 21) && ($includeflag + $valuesincluded < 2));
+    if ($valuesincluded == 0) $extraction_time = "Request timed out!" . PHP_EOL;
+    //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;
+
+
+    // ########## TIME STAMP ##########
+    echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector System Status Overview</b></font><br>';
+    echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC850) . '</font><br>';
+    echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
+    echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
+    echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Uptime:' . @file_get_contents("/proc/uptime") . ' </font><br>';
+
+    //('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
+    if ($errorcount > 0) echo "<br> <br> <br> <br>" . $errormessage;
 ?>
 
 <!--
 <div style="position:absolute; top:0px; left:0px">
 <img src="pics/bg.png">
 -->
-  
+
 <div style="position:absolute; top:150px; left:2px">
 <img src="pics/beamline_noMoS.png">
 
@@ -134,5 +151,5 @@ else { echo '<meta http-equiv="refresh" content="120">'; $slowrefresh= true; }
 ?>
 
 
-</body> 
+</body>
 </html>

+ 87 - 69
index_beta.php

@@ -4,98 +4,116 @@
 <title>KATRIN Spectrometer and Detector Section Status Overview</title>
 
 <style type="text/css">
-	body      { font-family:Calibri,Arial; }
-	a:link    { text-decoration:none; }
-	a:visited { text-decoration:none; }
-	a:hover   { text-decoration:none; }
-	a:active  { text-decoration:none; }
-	a:focus   { text-decoration:none; }
+    body      { font-family:Calibri,Arial; }
+    a:link    { text-decoration:none; }
+    a:visited { text-decoration:none; }
+    a:hover   { text-decoration:none; }
+    a:active  { text-decoration:none; }
+    a:focus   { text-decoration:none; }
 </style>
 
 <head>
-  <link rel="stylesheet" href="pics/beamline_noMoS.png" />
-  <link rel="stylesheet" href="pics/spectrometer.png" />
-  <link rel="stylesheet" href="pics/katrin_logo.jpg" />
-  <link rel="stylesheet" href="pics/newEmail.png" />
-
-  <style>
-  body {
-    background-image: url("pics/bg.png");
-    background-repeat: no-repeat;
-  }
-  </style>
+    <link rel="stylesheet" href="pics/beamline_noMoS.png" />
+    <link rel="stylesheet" href="pics/spectrometer.png" />
+    <link rel="stylesheet" href="pics/katrin_logo.jpg" />
+    <link rel="stylesheet" href="pics/newEmail.png" />
+
+    <style>
+    body {
+        background-image: url("pics/bg.png");
+        background-repeat: no-repeat;
+    }
+    </style>
 </head>
 
 <?php
-  // get client ip adress to check whether computer is on-site or not
-
-  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
-      $ip = $_SERVER['HTTP_CLIENT_IP'];
-      } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-          $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
-          } else { $ip = $_SERVER['REMOTE_ADDR']; }
-
-$onsite = false;
-$slowrefresh = false;
-
-if (substr($ip, 0, 6) == "141.52")
-     { if (substr($ip, 0, 9) == "141.52.16")
-         { echo '<meta http-equiv="refresh" content="10">'; $onsite = true; }
-       else echo '<meta http-equiv="refresh" content="30">'; $onsite = true; }
-else { echo '<meta http-equiv="refresh" content="120">'; $slowrefresh= true; }
-
+    // get client ip adress to check whether computer is on-site or not
+    if (!empty($_SERVER['HTTP_CLIENT_IP']))
+    {
+        $ip = $_SERVER['HTTP_CLIENT_IP'];
+    }
+    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
+    {
+        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+    }
+    else
+    {
+        $ip = $_SERVER['REMOTE_ADDR'];
+    }
+
+    $onsite = false;
+    $slowrefresh = false;
+
+    if (substr($ip, 0, 6) == "141.52")
+    {
+        if (substr($ip, 0, 9) == "141.52.16")
+        {
+            echo '<meta http-equiv="refresh" content="10">';
+            $onsite = true;
+        }
+        else echo '<meta http-equiv="refresh" content="30">';
+        $onsite = true;
+    }
+    else
+    {
+        echo '<meta http-equiv="refresh" content="120">';
+        $slowrefresh = true;
+    }
 ?>
 
 </head>
 <body style="background-color:black;">
 
 <?php
-      // set time zone to local German time
-      date_default_timezone_set('Europe/Berlin');
-
-      // include helper functions
-      include "SDS_status_functions.php";
-
-      // include channel list
-      include "SDS_status_channels.php";
-
-      // include aircoil settings
-      include "aircoils_settings.php";
-
-      // include HV data
-      if ((include "ADEI_HV_readings.php") == 0)
-      { usleep(400000); include "ADEI_HV_readings.php"; };
-
-      // read cached ADEI data
-      $valuesincluded = 0;
-      $loop = 0;
-      $includeflag = 0;
-      do {
-        $includeflag = include 'ADEIvalues.php'; 
+    // set time zone to local German time
+    date_default_timezone_set('Europe/Berlin');
+
+    // include helper functions
+    include "SDS_status_functions.php";
+
+    // include channel list
+    include "SDS_status_channels.php";
+
+    // include aircoil settings
+    include "aircoils_settings.php";
+
+    // include HV data
+    if ((include "ADEI_HV_readings.php") == 0)
+    {
+        usleep(400000);
+        include "ADEI_HV_readings.php";
+    };
+
+    // read cached ADEI data
+    $valuesincluded = 0;
+    $loop = 0;
+    $includeflag = 0;
+    do
+    {
+        $includeflag = include 'ADEIvalues.php';
         $loop++;
         if ($valuesincluded == 0) usleep(100000);
-        }
-      while (($loop < 21) && ($includeflag+$valuesincluded < 2));
-      if ($valuesincluded == 0) $extraction_time = "Request timed out!".PHP_EOL;
-      //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;
-      
+    }
+    while (($loop < 21) && ($includeflag + $valuesincluded < 2));
+    if ($valuesincluded == 0) $extraction_time = "Request timed out!" . PHP_EOL;
+    //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;
 
-	// ########## TIME STAMP ##########
 
-	echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector Section Status Overview</b></font><br>';
-	echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC850) . '</font><br>';
-	echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
-	echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
+    // ########## TIME STAMP ##########
+    echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector Section Status Overview</b></font><br>';
+    echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC850) . '</font><br>';
+    echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
+    echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
 
-//('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
-        if ($errorcount >0) echo "<br> <br> <br> <br>".$errormessage;
+    //('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
+    if ($errorcount > 0) echo "<br> <br> <br> <br>" . $errormessage;
 ?>
 
 <!--
 <div style="position:absolute; top:0px; left:0px">
 <img src="pics/bg.png">
 -->
-  
+
 <div style="position:absolute; top:150px; left:0px">
 <img src="pics/beamline_noMoS.png">
 

+ 43 - 47
list.php

@@ -4,59 +4,55 @@
 <title>KATRIN Spectrometer and Detector Section Status Value List</title>
 
 <style type="text/css">
-	body      { font-family:Calibri,Arial; }
-	a:link    { text-decoration:none; }
-	a:visited { text-decoration:none; }
-	a:hover   { text-decoration:none; }
-	a:active  { text-decoration:none; }
-	a:focus   { text-decoration:none; }
+    body      { font-family:Calibri,Arial; }
+    a:link    { text-decoration:none; }
+    a:visited { text-decoration:none; }
+    a:hover   { text-decoration:none; }
+    a:active  { text-decoration:none; }
+    a:focus   { text-decoration:none; }
 </style>
 
 <head>
 </head>
 
 <?php
-
-$onsite = false;
-$slowrefresh = false;
-
+    $onsite = false;
+    $slowrefresh = false;
 ?>
 
 </head>
 <body>
 
 <?php
+    // include helper functions
+    include "SDS_status_functions.php";
 
-      // include helper functions
-      include "SDS_status_functions.php";
-
-      // include channel list
-      include "SDS_status_channels.php";
-
+    // include channel list
+    include "SDS_status_channels.php";
 
-      // read cached ADEI data
-      $valuesincluded = 0;
-      $loop = 0;
-      $includeflag = 0;
-      do {
-        $includeflag = include 'ADEIvalues.php'; 
+    // read cached ADEI data
+    $valuesincluded = 0;
+    $loop = 0;
+    $includeflag = 0;
+    do
+    {
+        $includeflag = include 'ADEIvalues.php';
         $loop++;
         if ($valuesincluded == 0) usleep(100000);
-         }
-      while (($loop < 21) && ($includeflag+$valuesincluded < 2));
-      if ($valuesincluded == 0) $extraction_time = "Request timed out!".PHP_EOL;
-      //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;
-      
+    }
+    while (($loop < 21) && ($includeflag + $valuesincluded < 2));
+    if ($valuesincluded == 0) $extraction_time = "Request timed out!" . PHP_EOL;
+    //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;
 
-	// ########## TIME STAMP ##########
 
-	echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector Section Value List</b></font><br>';
-	echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC822) . '</font><br>';
-	echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
-	echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
+    // ########## TIME STAMP ##########
+    echo '<font size="6" color="#000000"><b>KATRIN Spectrometer and Detector Section Value List</b></font><br>';
+    echo '<font size="4" color="#000000">Page refreshed:&emsp;' . date(DATE_RFC822) . '</font><br>';
+    echo '<font size="4" color="#000000">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;' . $extraction_time . ' </font><br>';
+    echo '<font size="4" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
 
-//('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
-        if ($errorcount >0) echo "<br> <br> <br> <br>".$errormessage;
+    //('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';
+    if ($errorcount > 0) echo "<br> <br> <br> <br>" . $errormessage;
 ?>
 
 
@@ -68,21 +64,21 @@ $slowrefresh = false;
 </a>
 
 <?php
-  // include values
-
-  if ($valuesincluded == 0) echo "Failed to load values! Stopped!".PHP_EOL;
-  else {
-    echo "All values successfully loaded!<br>".PHP_EOL;
-
-   for ($id = 0; $id < sizeof($adeiChannel); $id++)
+    // include values
+    if ($valuesincluded == 0) echo "Failed to load values! Stopped!" . PHP_EOL;
+    else
     {
-      echo "<br>".PHP_EOL;
-      for ($ch = 0; $ch < sizeof($adeiChannel[$id]); $ch++)
-      {
-        echo $id." ".$ch." ".$adeiChannel[$id][$ch]." ".$adeiValue[$id][$ch]."<br>".PHP_EOL;
-      }
+        echo "All values successfully loaded!<br>" . PHP_EOL;
+
+        for ($id = 0;$id < sizeof($adeiChannel);$id++)
+        {
+            echo "<br>" . PHP_EOL;
+            for ($ch = 0;$ch < sizeof($adeiChannel[$id]);$ch++)
+            {
+                echo $id . " " . $ch . " " . $adeiChannel[$id][$ch] . " " . $adeiValue[$id][$ch] . "<br>" . PHP_EOL;
+            }
+        }
     }
-  }
 ?>
 
 

+ 254 - 263
mace_settings.php

@@ -1,268 +1,259 @@
 <?php
 
-$mace_setting = array  (
-		       "Config" => "unkn",
-		       "EMCS" => "off",
-		       "LFCS" => "off",
-		       "IECommon" => 0.0,
-		       "W2" => 0.0,
-		       "W3" => 0.0,
-		       "W4" => 0.0,
-		       "W5" => 0.0,
-		       "W6" => 0.0,
-		       "W7-11" => 0.0,
-		       "W12" => 0.0,
-		       "W13" => 0.0,
-		       "W14" => 0.0,
-		       "W15" => 0.0,
-		       "W16" => 0.0,
-		       "E2" => 0.0,
-		       "E3" => 0.0,
-		       "E4" => 0.0,
-		       "E5" => 0.0,
-		       "E6" => 0.0,
-		       "E7-11" => 0.0,
-		       "E12" => 0.0,
-		       "E13" => 0.0,
-		       "E14" => 0.0,
-		       "E15" => 0.0,
-		       "E16" => 0.0
-		       );
+$mace_setting = array(
+    "Config" => "unkn",
+    "EMCS" => "off",
+    "LFCS" => "off",
+    "IECommon" => 0.0,
+    "W2" => 0.0,
+    "W3" => 0.0,
+    "W4" => 0.0,
+    "W5" => 0.0,
+    "W6" => 0.0,
+    "W7-11" => 0.0,
+    "W12" => 0.0,
+    "W13" => 0.0,
+    "W14" => 0.0,
+    "W15" => 0.0,
+    "W16" => 0.0,
+    "E2" => 0.0,
+    "E3" => 0.0,
+    "E4" => 0.0,
+    "E5" => 0.0,
+    "E6" => 0.0,
+    "E7-11" => 0.0,
+    "E12" => 0.0,
+    "E13" => 0.0,
+    "E14" => 0.0,
+    "E15" => 0.0,
+    "E16" => 0.0
+);
 
-
-$mace_configurations = array (
-			      0 => 
-			      array (
-				     "Config" => "STD",
-				     "EMCS" => "On OK",
-				     "LFCS" => "eKNM2",
-				     "IECommon" => -200.0,
-				     "W2" => 40.0,
-				     "W3" => 40.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 40.0,
-				     "W16" => 40.0,
-				     "E2" => 40.0,
-				     "E3" => 40.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 40.0,
-				     "E16" => 40.0,
-				     ),
-			      1 => 
-			      array (
-				     "Config" => "SAP",
-				     "EMCS" => "On OK",
-				     "LFCS" => "eSAP",
-				     "IECommon" => -205.0,
-				     "W2" => 125.0,
-				     "W3" => 125.0,
-				     "W4" => 25.0,
-				     "W5" => 25.0,
-				     "W6" => 25.0,
-				     "W7-11" => 10.0,
-				     "W12" => 2.0,
-				     "W13" => 0.0,
-				     "W14" => 2.0,
-				     "W15" => 45.0,
-				     "W16" => 105.0,
-				     "E2" => 125.0,
-				     "E3" => 125.0,
-				     "E4" => 25.0,
-				     "E5" => 25.0,
-				     "E6" => 25.0,
-				     "E7-11" => 10.0,
-				     "E12" => 2.0,
-				     "E13" => 0.0,
-				     "E14" => 2.0,
-				     "E15" => 45.0,
-				     "E16" => 105.0,
-				     ),
-			      2 => 
-			      array (
-				     "Config" => "Kr",
-				     "EMCS" => "On OK",
-				     "LFCS" => "eKNM2",
-				     "IECommon" => -200.0,
-				     "W2" => 130.0,
-				     "W3" => 130.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 130.0,
-				     "W16" => 130.0,
-				     "E2" => 130.0,
-				     "E3" => 130.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 130.0,
-				     "E16" => 130.0,
-				     ),
-			      3 => 
-			      array (
-				     "Config" => "Kr 4G",
-				     "EMCS" => "On OK",
-				     "LFCS" => "e4G '20",
-				     "IECommon" => -200.0,
-				     "W2" => 130.0,
-				     "W3" => 130.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 130.0,
-				     "W16" => 130.0,
-				     "E2" => 130.0,
-				     "E3" => 130.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 130.0,
-				     "E16" => 130.0,
-				     ),
-			      4 => 
-			      array (
-				     "Config" => "HighRes",
-				     "EMCS" => "On OK",
-				     "LFCS" => "e1G",
-				     "IECommon" => -200.0,
-				     "W2" => 40.0,
-				     "W3" => 40.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 40.0,
-				     "W16" => 40.0,
-				     "E2" => 40.0,
-				     "E3" => 40.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 40.0,
-				     "E16" => 40.0,
-				     ),
-			      5 => 
-			      array (
-				     "Config" => "other",
-				     "EMCS" => "On OK",
-				     "LFCS" => "eKNM2",
-				     "IECommon" => -200.0,
-				     "W2" => 0.0,
-				     "W3" => 0.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 0.0,
-				     "W16" => 0.0,
-				     "E2" => 0.0,
-				     "E3" => 0.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 0.0,
-				     "E16" => 0.0,
-				     ),
-  6 => 
-			      array (
-				     "Config" => "maxSTD",
-				     "EMCS" => "On OK",
-				     "LFCS" => "MAX",
-				     "IECommon" => -200.0,
-				     "W2" => 40.0,
-				     "W3" => 40.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 40.0,
-				     "W16" => 40.0,
-				     "E2" => 40.0,
-				     "E3" => 40.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 40.0,
-				     "E16" => 40.0,
-				     ),
-  7 => 
-			      array (
-				     "Config" => "Kr 2.7G",
-				     "EMCS" => "On OK",
-				     "LFCS" => "e2.7G",
-				     "IECommon" => -200.0,
-				     "W2" => 130.0,
-				     "W3" => 130.0,
-				     "W4" => 0.0,
-				     "W5" => 0.0,
-				     "W6" => 0.0,
-				     "W7-11" => 0.0,
-				     "W12" => 0.0,
-				     "W13" => 0.0,
-				     "W14" => 0.0,
-				     "W15" => 130.0,
-				     "W16" => 130.0,
-				     "E2" => 130.0,
-				     "E3" => 130.0,
-				     "E4" => 0.0,
-				     "E5" => 0.0,
-				     "E6" => 0.0,
-				     "E7-11" => 0.0,
-				     "E12" => 0.0,
-				     "E13" => 0.0,
-				     "E14" => 0.0,
-				     "E15" => 130.0,
-				     "E16" => 130.0,
-				     ),
-			      ); 
+$mace_configurations = array(
+    0 => array(
+        "Config" => "STD",
+        "EMCS" => "On OK",
+        "LFCS" => "eKNM2",
+        "IECommon" => - 200.0,
+        "W2" => 40.0,
+        "W3" => 40.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 40.0,
+        "W16" => 40.0,
+        "E2" => 40.0,
+        "E3" => 40.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 40.0,
+        "E16" => 40.0,
+    ) ,
+    1 => array(
+        "Config" => "SAP",
+        "EMCS" => "On OK",
+        "LFCS" => "eSAP",
+        "IECommon" => - 205.0,
+        "W2" => 125.0,
+        "W3" => 125.0,
+        "W4" => 25.0,
+        "W5" => 25.0,
+        "W6" => 25.0,
+        "W7-11" => 10.0,
+        "W12" => 2.0,
+        "W13" => 0.0,
+        "W14" => 2.0,
+        "W15" => 45.0,
+        "W16" => 105.0,
+        "E2" => 125.0,
+        "E3" => 125.0,
+        "E4" => 25.0,
+        "E5" => 25.0,
+        "E6" => 25.0,
+        "E7-11" => 10.0,
+        "E12" => 2.0,
+        "E13" => 0.0,
+        "E14" => 2.0,
+        "E15" => 45.0,
+        "E16" => 105.0,
+    ) ,
+    2 => array(
+        "Config" => "Kr",
+        "EMCS" => "On OK",
+        "LFCS" => "eKNM2",
+        "IECommon" => - 200.0,
+        "W2" => 130.0,
+        "W3" => 130.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 130.0,
+        "W16" => 130.0,
+        "E2" => 130.0,
+        "E3" => 130.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 130.0,
+        "E16" => 130.0,
+    ) ,
+    3 => array(
+        "Config" => "Kr 4G",
+        "EMCS" => "On OK",
+        "LFCS" => "e4G '20",
+        "IECommon" => - 200.0,
+        "W2" => 130.0,
+        "W3" => 130.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 130.0,
+        "W16" => 130.0,
+        "E2" => 130.0,
+        "E3" => 130.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 130.0,
+        "E16" => 130.0,
+    ) ,
+    4 => array(
+        "Config" => "HighRes",
+        "EMCS" => "On OK",
+        "LFCS" => "e1G",
+        "IECommon" => - 200.0,
+        "W2" => 40.0,
+        "W3" => 40.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 40.0,
+        "W16" => 40.0,
+        "E2" => 40.0,
+        "E3" => 40.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 40.0,
+        "E16" => 40.0,
+    ) ,
+    5 => array(
+        "Config" => "other",
+        "EMCS" => "On OK",
+        "LFCS" => "eKNM2",
+        "IECommon" => - 200.0,
+        "W2" => 0.0,
+        "W3" => 0.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 0.0,
+        "W16" => 0.0,
+        "E2" => 0.0,
+        "E3" => 0.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 0.0,
+        "E16" => 0.0,
+    ) ,
+    6 => array(
+        "Config" => "maxSTD",
+        "EMCS" => "On OK",
+        "LFCS" => "MAX",
+        "IECommon" => - 200.0,
+        "W2" => 40.0,
+        "W3" => 40.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 40.0,
+        "W16" => 40.0,
+        "E2" => 40.0,
+        "E3" => 40.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 40.0,
+        "E16" => 40.0,
+    ) ,
+    7 => array(
+        "Config" => "Kr 2.7G",
+        "EMCS" => "On OK",
+        "LFCS" => "e2.7G",
+        "IECommon" => - 200.0,
+        "W2" => 130.0,
+        "W3" => 130.0,
+        "W4" => 0.0,
+        "W5" => 0.0,
+        "W6" => 0.0,
+        "W7-11" => 0.0,
+        "W12" => 0.0,
+        "W13" => 0.0,
+        "W14" => 0.0,
+        "W15" => 130.0,
+        "W16" => 130.0,
+        "E2" => 130.0,
+        "E3" => 130.0,
+        "E4" => 0.0,
+        "E5" => 0.0,
+        "E6" => 0.0,
+        "E7-11" => 0.0,
+        "E12" => 0.0,
+        "E13" => 0.0,
+        "E14" => 0.0,
+        "E15" => 130.0,
+        "E16" => 130.0,
+    ) ,
+);
 
 ?>

+ 0 - 0
aircoils_convert_csv_to_array.php → oldfiles/aircoils_convert_csv_to_array.php


+ 0 - 0
getADEIData.php → oldfiles/getADEIData.php


+ 0 - 0
getDAQData.php → oldfiles/getDAQData.php


+ 0 - 0
getFluxTube.php → oldfiles/getFluxTube.php


+ 215 - 221
poll_HV_data.php

@@ -1,226 +1,220 @@
 <?php
+    // include channel list
+    $adeiChannel = array(
+        // Voltage monitoring K35 etc. (index 30)
+        array(
+            "hv__katrin-hv_rep__7__2", //K35 divided voltage reading
+            "hv__katrin-hv_rep__7__5", //K65 divided voltage reading
+            "hv__katrin-hv_rep__7__3", //K35 divided voltage timestamp
+            "hv__katrin-hv_rep__7__6", //K65 divided voltage timestamp
+
+        )
+    );
+
+    // include previous values
+    //include "ADEI_HV_readings.php";
+    $username = getenv('PHP_ADEI_USERNAME');
+    $password = getenv('PHP_ADEI_PASSWORD');
+    $context = stream_context_create(array(
+        'http' => array(
+            'header' => "Authorization: Basic " . base64_encode("$username:$password") ,
+            "Connection: close\r\n"
+        )
+    ));
+
+    // set time zone to local German time
+    date_default_timezone_set('Europe/Berlin');
+
+    sleep(2);
+
+    $counter = 0;
+    $calltime = time();
+    $errorcount = 0;
+    $errormessage = '<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>';
+
+    $starttime = $calltime;
+    $n = 0;
+    //echo "started ".date("r", $starttime).PHP_EOL;
+    do {
+        $n++;
+        $currenttime = time();
+        $delaytime = 10 - ($currenttime % 10);
+        sleep($delaytime);
+
+        //  echo "start polling ".time().PHP_EOL;
+        //echo "Polling ADEI data.".PHP_EOL;
+        for ($id = 0;$id < sizeof($adeiChannel);$id++) {
+            $adeiChannels = "";
+            for ($id2 = 0;$id2 < sizeof($adeiChannel[$id]);$id2++) {
+                $adeiChannels = $adeiChannels . $adeiChannel[$id][$id2] . ",";
+            }
+            $adeiChannels = substr($adeiChannels, 0, strlen($adeiChannels) - 1);
+
+            // new adei-katrin.kaas.kit.edu added and optimized readout parameters
+            $fileip = file_get_contents("https://adei-katrin.kaas.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&rt=full&window=400&format=csv", false, $context);
+            sleep(1);
+
+            //echo $fileip.PHP_EOL;
+            $adeiArray = explode("\n", $fileip);
+
+            //convert ADEI response into array with all values
+            $oldTS1 = 0;
+            $oldTS2 = 0;
+            $readings1 = array();
+            $readings2 = array();
+            foreach ($adeiArray as $key => $element) {
+                $adeiLine = explode(",", $element);
+                //echo $key." ".sizeof($adeiLine).PHP_EOL;
+                if (sizeof($adeiLine) == 5) {
+                    $voltage = floatval($adeiLine[1]);
+                    $voltageTS = floatval($adeiLine[3]);
+                    if (($voltageTS > 0) && ($voltageTS > $oldTS1)) {
+                        $readings1[] = array(
+                            $voltageTS,
+                            $voltage
+                        );
+                        $oldTS1 = $voltageTS;
+                    }
+                    $voltage = floatval($adeiLine[2]);
+                    $voltageTS = floatval($adeiLine[4]);
+                    if (($voltageTS > 0) && ($voltageTS > $oldTS2)) {
+                        $readings2[] = array(
+                            $voltageTS,
+                            $voltage
+                        );
+                        $oldTS2 = $voltageTS;
+                    }
+                }
+            }
+            unset($element);
+
+            // filter and extract FlukeA values and calculate mean and deviations for a set of entries
+            $index = array(-10, -30, -150
+            );
+            foreach ($index as $slice) {
+                if (sizeof($readings1) > abs($slice)) {
+                    $arrayslice = array_slice($readings1, $slice);
+                    $entries = count($arrayslice);
+                    if ($entries > 2) {
+                        $voltages = array_column($arrayslice, 1);
+                        $mean = array_sum($voltages) / $entries;
+                        $carry = 0.0;
+                        foreach ($voltages as $val) {
+                            $d = ((double)$val) - $mean;
+                            $carry += $d * $d;
+                        }
+                    }
+                    $mean1 = $mean;
+                    $stddev1 = sqrt($carry / $entries);
+                    $stddev1_rel = $stddev1 / abs($mean1);
+                    $endTS = $arrayslice[sizeof($arrayslice) - 1][0];
+                    $span = round($endTS - $arrayslice[0][0]);
+
+                    $time_conversion_factor = 2082844800;
+
+                    //echo "Number of aquired elements: ".sizeof($arrayslice).PHP_EOL;
+                    //echo "Mean Value:                 ".sprintf('%.6F', $mean1).PHP_EOL;
+                    //echo "Standard Deviation:         ".sprintf('%.2E', $stddev1).PHP_EOL;
+                    //echo "Rel. Standard Deviation:    ".sprintf('%.2E', $stddev1_rel).PHP_EOL;
+                    //echo "TS at end:                  ".date("r", $endTS-$time_conversion_factor).PHP_EOL;
+                    //echo "Timespan:                   ".$span.PHP_EOL;
+                    //echo PHP_EOL;
+                    $results1[] = array(
+                        "number" => sizeof($arrayslice) ,
+                        "timespan" => $span,
+                        "timestamp" => $endTS - $time_conversion_factor,
+                        "humantime" => date("r", $endTS - $time_conversion_factor) ,
+                        "mean" => $mean1,
+                        "stddev" => $stddev1,
+                        "ppmdev" => $stddev1_rel
+                    );
+
+                }
+            }
+
+            // filter and extract FlukeE values and calculate mean and deviations for a set of entries
+            $index = array(-5, -10, -30, -150
+            );
+            foreach ($index as $slice) {
+                if (sizeof($readings2) > abs($slice)) {
+                    $arrayslice = array_slice($readings2, $slice);
+                    $entries = count($arrayslice);
+                    if ($entries > 2) {
+                        $voltages = array_column($arrayslice, 1);
+                        $mean = array_sum($voltages) / $entries;
+                        $carry = 0.0;
+                        foreach ($voltages as $val) {
+                            $d = ((double)$val) - $mean;
+                            $carry += $d * $d;
+                        }
+                    }
+                    $mean2 = $mean;
+                    $stddev2 = sqrt($carry / $entries);
+                    $stddev2_rel = $stddev2 / abs($mean2);
+                    $endTS = $arrayslice[sizeof($arrayslice) - 1][0];
+                    $span = round($endTS - $arrayslice[0][0]);
+
+                    $time_conversion_factor = 2082844800;
+
+                    //echo "Number of aquired elements: ".sizeof($arrayslice).PHP_EOL;
+                    //echo "Mean Value:                 ".sprintf('%.6F', $mean2).PHP_EOL;
+                    //echo "Standard Deviation:         ".sprintf('%.2E', $stddev2).PHP_EOL;
+                    //echo "Rel. Standard Deviation:    ".sprintf('%.2E', $stddev2_rel).PHP_EOL;
+                    //echo "TS at end:                  ".date("r", $endTS-$time_conversion_factor).PHP_EOL;
+                    //echo "Timespan:                   ".$span.PHP_EOL;
+                    //echo PHP_EOL;
+                    $results2[] = array(
+                        "number" => sizeof($arrayslice) ,
+                        "timespan" => $span,
+                        "timestamp" => $endTS - $time_conversion_factor,
+                        "humantime" => date("r", $endTS - $time_conversion_factor) ,
+                        "mean" => $mean2,
+                        "stddev" => $stddev2,
+                        "ppmdev" => $stddev2_rel
+                    );
+
+                }
+            }
+
+            //var_dump( $results2 );
+            //var_dump( $results1 );
+            // error handling
+            if (substr($fileip, 0, 5) == "ERROR") {
+                $errorcount++;
+                $errormessage = $errormessage . "Error loading ADEI channel " . $id . "<br>";
+            }
+
+            for ($id2 = sizeof($adeiChannel[$id]) - 1;$id2 > - 1;$id2--) {
+                $pos = strrpos($fileip, ",");
+                $adeiValue[$id][$id2] = floatval(substr($fileip, $pos + 2));
+                $fileip = substr($fileip, 0, $pos);
+                //echo $id . " " . $id2 . " " . $adeiValue[$id][$id2] . PHP_EOL;
+
+            }
+        }
+
+        if ($errorcount > 0) echo $errormessage;
+
+        //echo "Writing data into formatted string.".PHP_EOL;
+        $strFileContent = "<" . "?php" . PHP_EOL . PHP_EOL . "$" . "flukeA = " . var_export($results1, true) . ";" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "flukeE = " . var_export($results2, true) . ";" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "extraction_time_HV = '" . date(DATE_RFC850) . "';" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "?" . ">" . PHP_EOL;
+
+        // write ADEI data to file
+        //echo "Writing data to file.".PHP_EOL;
+        $file_w = fopen('ADEI_HV_readings.php', 'w+');
+        sleep(1);
+        fwrite($file_w, $strFileContent);
+        fclose($file_w);
+
+        //echo $strFileContent.PHP_EOL;
+        //echo $n." ".time().PHP_EOL;
 
-// include channel list
-$adeiChannel = array(
-		     // Voltage monitoring K35 etc. (index 30)
-		     array(
-			   "hv__katrin-hv_rep__7__2",  //K35 divided voltage reading
-			   "hv__katrin-hv_rep__7__5",  //K65 divided voltage reading
-			   "hv__katrin-hv_rep__7__3",  //K35 divided voltage timestamp
-			   "hv__katrin-hv_rep__7__6",  //K65 divided voltage timestamp
-			   )
-		     );
-
-// include previous values
-//include "ADEI_HV_readings.php";
-
-$username = getenv('PHP_ADEI_USERNAME');
-$password = getenv('PHP_ADEI_PASSWORD');
-$context = stream_context_create(array(
-		'http' => array(
-			'header'  => "Authorization: Basic " . base64_encode("$username:$password"), "Connection: close\r\n"
-		)
-	));
-
-// set time zone to local German time
-date_default_timezone_set('Europe/Berlin');
-
-sleep(2);
-
-$counter = 0;
-$calltime = time();
-$errorcount = 0;
-$errormessage = '<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>';
-
-$starttime = $calltime;
-$n = 0;
-//echo "started ".date("r", $starttime).PHP_EOL;
-do {
-  $n++;
-  $currenttime = time();
-  $delaytime = 10 - ($currenttime % 10);
-  sleep($delaytime);
-
-  //  echo "start polling ".time().PHP_EOL;
-  
-  //echo "Polling ADEI data.".PHP_EOL;
-  
-  for ($id = 0; $id < sizeof($adeiChannel); $id++)
-    {
-      $adeiChannels = "";
-      for ($id2 = 0; $id2 < sizeof($adeiChannel[$id]); $id2++)
-	{
-	  $adeiChannels = $adeiChannels . $adeiChannel[$id][$id2] . ",";
-	}
-      $adeiChannels = substr($adeiChannels, 0, strlen($adeiChannels) - 1);
-      
-      
-      // new adei-katrin.kaas.kit.edu added and optimized readout parameters
-      $fileip = file_get_contents("https://adei-katrin.kaas.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&rt=full&window=400&format=csv", false, $context);
-      sleep(1);
-      
-      //echo $fileip.PHP_EOL;
-      $adeiArray = explode("\n", $fileip);
-      
-      //convert ADEI response into array with all values
-      $oldTS1 = 0; 
-      $oldTS2 = 0; 
-      $readings1 = array();
-      $readings2 = array();
-      foreach ($adeiArray as $key => $element)
-	{
-	  $adeiLine = explode(",",$element);
-	  //echo $key." ".sizeof($adeiLine).PHP_EOL;
-	  if (sizeof($adeiLine) == 5)
-	    {
-	      $voltage = floatval($adeiLine[1]);
-	      $voltageTS = floatval($adeiLine[3]);
-	      if (($voltageTS > 0) && ($voltageTS > $oldTS1)) { $readings1[] = array($voltageTS, $voltage); $oldTS1 = $voltageTS; }
-	      $voltage = floatval($adeiLine[2]);
-	      $voltageTS = floatval($adeiLine[4]);
-	      if (($voltageTS > 0) && ($voltageTS > $oldTS2)) { $readings2[] = array($voltageTS, $voltage); $oldTS2 = $voltageTS; }
-	    }
-	}
-      unset($element);
-      
-      // filter and extract FlukeA values and calculate mean and deviations for a set of entries
-      $index = array(-10,-30,-150);
-      foreach ($index as $slice)
-	{
-	  if (sizeof($readings1) > abs($slice))
-	    {
-	      $arrayslice = array_slice($readings1,$slice);
-	      $entries = count($arrayslice);
-	      if ($entries > 2)
-		{
-		  $voltages = array_column($arrayslice,1);
-		  $mean = array_sum($voltages) / $entries;
-		  $carry = 0.0;
-		  foreach ($voltages as $val)
-		  {
-		    $d = ((double) $val) - $mean;
-		    $carry += $d * $d;
-		  }
-	      }
-	      $mean1 = $mean;
-	      $stddev1 = sqrt($carry / $entries);
-	      $stddev1_rel = $stddev1 / abs($mean1);
-	      $endTS = $arrayslice[sizeof($arrayslice)-1][0];
-	      $span = round($endTS-$arrayslice[0][0]);
-	      
-	      $time_conversion_factor = 2082844800;
-	      
-	      //echo "Number of aquired elements: ".sizeof($arrayslice).PHP_EOL;
-	      //echo "Mean Value:                 ".sprintf('%.6F', $mean1).PHP_EOL;
-	      //echo "Standard Deviation:         ".sprintf('%.2E', $stddev1).PHP_EOL;
-	      //echo "Rel. Standard Deviation:    ".sprintf('%.2E', $stddev1_rel).PHP_EOL;
-	      //echo "TS at end:                  ".date("r", $endTS-$time_conversion_factor).PHP_EOL;
-	      //echo "Timespan:                   ".$span.PHP_EOL;
-	      //echo PHP_EOL;
-	      
-	      $results1[] = array(
-				  "number" => sizeof($arrayslice),
-				  "timespan" => $span,
-				  "timestamp" =>  $endTS-$time_conversion_factor,
-				  "humantime" =>  date("r", $endTS-$time_conversion_factor),
-				  "mean" => $mean1,
-				  "stddev" => $stddev1,
-				  "ppmdev" => $stddev1_rel
-				  );
-	      
-	      
-	    }
-	}
-      
-      // filter and extract FlukeE values and calculate mean and deviations for a set of entries 
-      $index = array(-5,-10,-30,-150);
-      foreach ($index as $slice)
-	{
-	  if (sizeof($readings2) > abs($slice))
-	    {
-	      $arrayslice = array_slice($readings2,$slice);
-	    $entries = count($arrayslice);
-	    if ($entries > 2)
-	      {
-		$voltages = array_column($arrayslice,1);
-		$mean = array_sum($voltages) / $entries;
-		$carry = 0.0;
-		foreach ($voltages as $val)
-		  {
-		    $d = ((double) $val) - $mean;
-		    $carry += $d * $d;
-		  }
-	      }
-	    $mean2 = $mean;
-	    $stddev2 = sqrt($carry / $entries);
-	    $stddev2_rel = $stddev2 / abs($mean2);
-	    $endTS = $arrayslice[sizeof($arrayslice)-1][0];
-	    $span = round($endTS-$arrayslice[0][0]);
-	    
-	    $time_conversion_factor = 2082844800;
-	    
-	    //echo "Number of aquired elements: ".sizeof($arrayslice).PHP_EOL;
-	    //echo "Mean Value:                 ".sprintf('%.6F', $mean2).PHP_EOL;
-	    //echo "Standard Deviation:         ".sprintf('%.2E', $stddev2).PHP_EOL;
-	    //echo "Rel. Standard Deviation:    ".sprintf('%.2E', $stddev2_rel).PHP_EOL;
-	    //echo "TS at end:                  ".date("r", $endTS-$time_conversion_factor).PHP_EOL;
-	    //echo "Timespan:                   ".$span.PHP_EOL;
-	    //echo PHP_EOL;
-	    
-	    $results2[] = array(
-				"number" => sizeof($arrayslice),
-				"timespan" => $span,
-				"timestamp" =>  $endTS-$time_conversion_factor,
-				"humantime" =>  date("r", $endTS-$time_conversion_factor),
-				"mean" => $mean2,
-				"stddev" => $stddev2,
-				"ppmdev" => $stddev2_rel
-				);
-	    
-	    }
-	}
-      
-      //var_dump( $results2 );
-      
-      //var_dump( $results1 );
-      
-      // error handling
-      if (substr($fileip,0,5) == "ERROR")
-	{$errorcount++; $errormessage = $errormessage . "Error loading ADEI channel " . $id . "<br>";}
-      
-      for ($id2 = sizeof($adeiChannel[$id]) - 1 ; $id2 > -1; $id2--)
-	{
-	  $pos = strrpos($fileip, ",");
-	  $adeiValue[$id][$id2] = floatval(substr($fileip, $pos + 2));
-	  $fileip = substr($fileip, 0, $pos);
-	  //echo $id . " " . $id2 . " " . $adeiValue[$id][$id2] . PHP_EOL;
-	}
     }
-  
-  
-  
-  if ($errorcount >0) echo $errormessage;
-  
-  //echo "Writing data into formatted string.".PHP_EOL;
-  $strFileContent = "<"."?php".PHP_EOL.PHP_EOL."$"."flukeA = ".var_export($results1, true).";".PHP_EOL.PHP_EOL;
-  $strFileContent .= "$"."flukeE = ".var_export($results2, true).";".PHP_EOL.PHP_EOL;
-  $strFileContent .= "$"."extraction_time_HV = '". date(DATE_RFC850) ."';".PHP_EOL.PHP_EOL;
-  $strFileContent .= "?".">".PHP_EOL;
-  
-  // write ADEI data to file 
-  //echo "Writing data to file.".PHP_EOL;
-  $file_w = fopen('ADEI_HV_readings.php', 'w+');
-  sleep(1);
-  fwrite($file_w, $strFileContent);
-  fclose($file_w);
-
-  //echo $strFileContent.PHP_EOL;
-  //echo $n." ".time().PHP_EOL;
-
-} while (time() < $starttime+50);
-
-//echo "stopped".date("r", time()).PHP_EOL;
-
-//echo "Data extraction done.".PHP_EOL;
+    while (time() < $starttime + 50);
+
+    //echo "stopped".date("r", time()).PHP_EOL;
+    //echo "Data extraction done.".PHP_EOL;
 
 ?>

+ 105 - 108
poll_adei_data.php

@@ -1,153 +1,150 @@
 <?php
 
+    function show_status($done, $total, $size = 30) {
 
-function show_status($done, $total, $size=30) {
+        static $start_time;
 
-    static $start_time;
+        // if we go over our bound, just ignore it
+        if ($done > $total) return;
 
-    // if we go over our bound, just ignore it
-    if($done > $total) return;
+        if (empty($start_time)) $start_time = time();
+        $now = time();
 
-    if(empty($start_time)) $start_time=time();
-    $now = time();
+        $perc = (double)($done / $total);
 
-    $perc=(double)($done/$total);
+        $bar = floor($perc * $size);
 
-    $bar=floor($perc*$size);
+        $status_bar = "\r[";
+        $status_bar .= str_repeat("=", $bar);
+        if ($bar < $size) {
+            $status_bar .= ">";
+            $status_bar .= str_repeat(" ", $size - $bar);
+        }
+        else {
+            $status_bar .= "=";
+        }
 
-    $status_bar="\r[";
-    $status_bar.=str_repeat("=", $bar);
-    if($bar<$size){
-        $status_bar.=">";
-        $status_bar.=str_repeat(" ", $size-$bar);
-    } else {
-        $status_bar.="=";
-    }
+        $disp = number_format($perc * 100, 0);
 
-    $disp=number_format($perc*100, 0);
+        $status_bar .= "] $disp%  $done/$total";
 
-    $status_bar.="] $disp%  $done/$total";
+        $rate = ($now - $start_time) / $done;
+        $left = $total - $done;
+        $eta = round($rate * $left, 2);
 
-    $rate = ($now-$start_time)/$done;
-    $left = $total - $done;
-    $eta = round($rate * $left, 2);
+        $elapsed = $now - $start_time;
 
-    $elapsed = $now - $start_time;
+        $status_bar .= " remaining: " . number_format($eta) . " sec.  elapsed: " . number_format($elapsed) . " sec.";
 
-    $status_bar.= " remaining: ".number_format($eta)." sec.  elapsed: ".number_format($elapsed)." sec.";
+        echo "$status_bar  ";
 
-    echo "$status_bar  ";
+        flush();
 
-    flush();
+        // when done, send a newline
+        if ($done == $total) {
+            echo "\n";
+        }
 
-    // when done, send a newline
-    if($done == $total) {
-        echo "\n";
     }
 
-}
-
-// include channel list
-include "SDS_status_channels.php";
-
-$username = getenv('PHP_ADEI_USERNAME');
-$password = getenv('PHP_ADEI_PASSWORD');
-$context = stream_context_create(array(
-		'http' => array(
-			'header'  => "Authorization: Basic " . base64_encode("$username:$password"), "Connection: close\r\n"
-		)
-	));
+    // include channel list
+    include "SDS_status_channels.php";
 
+    $username = getenv('PHP_ADEI_USERNAME');
+    $password = getenv('PHP_ADEI_PASSWORD');
+    $context = stream_context_create(array(
+        'http' => array(
+            'header' => "Authorization: Basic " . base64_encode("$username:$password") ,
+            "Connection: close\r\n"
+        )
+    ));
 
-// set time zone to local German time
-date_default_timezone_set('Europe/Berlin');
+    // set time zone to local German time
+    date_default_timezone_set('Europe/Berlin');
 
-$counter = 0;
-$calltime = time();
-do {
+    $counter = 0;
+    $calltime = time();
+    do {
         $errorcount = 0;
         $errormessage = '<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>';
 
-	$starttime = time();
-	
-        //echo "Polling ADEI data.".PHP_EOL;
+        $starttime = time();
 
-	for ($id = 0; $id < sizeof($adeiChannel); $id++)
-	{
-		$adeiChannels = "";
-		for ($id2 = 0; $id2 < sizeof($adeiChannel[$id]); $id2++)
-		{
-			$adeiChannels = $adeiChannels . $adeiChannel[$id][$id2] . ",";
-		}
-		$adeiChannels = substr($adeiChannels, 0, strlen($adeiChannels) - 1);
-
-      		//$fileip = file_get_contents("http://katrin.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=50&format=csv", false, $context);
-      		//$fileip = file_get_contents("http://ipekatrinbackupserv1.ipe.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=60&format=csv", false, $context);
-		
-		//                $fileip = file_get_contents("http://katrin.kit.edu/adei-katrin/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=50&format=csv", false, $context);
-
-		// new adei-katrin.kaas.kit.edu added
-                //$fileip = file_get_contents("http://adei-katrin.kaas.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=50&format=csv", false, $context);
-
-		// new adei-katrin.kaas.kit.edu added and optimized readout parameters
-		$fileip = file_get_contents("https://adei-katrin.kaas.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&rt=full&window=3600,-1&format=csv", false, $context);
-		
-                //show_status($id+1,sizeof($adeiChannel));
-
-                if (substr($fileip,0,5) == "ERROR")
-                {$errorcount++; $errormessage = $errormessage . "Error loading ADEI channel " . $id . "<br>";}
-
-		for ($id2 = sizeof($adeiChannel[$id]) - 1 ; $id2 > -1; $id2--)
-		{
-			$pos = strrpos($fileip, ",");
-			$adeiValue[$id][$id2] = floatval(substr($fileip, $pos + 2));
-			$fileip = substr($fileip, 0, $pos);
-			//echo $id . " " . $id2 . " " . $adeiValue[$id][$id2] . PHP_EOL;
-		}
-	}
-
-        if ($errorcount >0) echo $errormessage;
+        //echo "Polling ADEI data.".PHP_EOL;
+        for ($id = 0;$id < sizeof($adeiChannel);$id++) {
+            $adeiChannels = "";
+            for ($id2 = 0;$id2 < sizeof($adeiChannel[$id]);$id2++) {
+                $adeiChannels = $adeiChannels . $adeiChannel[$id][$id2] . ",";
+            }
+            $adeiChannels = substr($adeiChannels, 0, strlen($adeiChannels) - 1);
+
+            //$fileip = file_get_contents("http://katrin.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=50&format=csv", false, $context);
+            //$fileip = file_get_contents("http://ipekatrinbackupserv1.ipe.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=60&format=csv", false, $context);
+            //                $fileip = file_get_contents("http://katrin.kit.edu/adei-katrin/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=50&format=csv", false, $context);
+            // new adei-katrin.kaas.kit.edu added
+            //$fileip = file_get_contents("http://adei-katrin.kaas.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&window=50&format=csv", false, $context);
+            // new adei-katrin.kaas.kit.edu added and optimized readout parameters
+            $fileip = file_get_contents("https://adei-katrin.kaas.kit.edu/adei/services/getdata.php?db_server=virtual&db_name=srctree&db_group=-3&control_group=-3&virtual=srctree&srctree=" . $adeiChannels . "&rt=full&window=3600,-1&format=csv", false, $context);
+
+            //show_status($id+1,sizeof($adeiChannel));
+            if (substr($fileip, 0, 5) == "ERROR") {
+                $errorcount++;
+                $errormessage = $errormessage . "Error loading ADEI channel " . $id . "<br>";
+            }
+
+            for ($id2 = sizeof($adeiChannel[$id]) - 1;$id2 > - 1;$id2--) {
+                $pos = strrpos($fileip, ",");
+                $adeiValue[$id][$id2] = floatval(substr($fileip, $pos + 2));
+                $fileip = substr($fileip, 0, $pos);
+                //echo $id . " " . $id2 . " " . $adeiValue[$id][$id2] . PHP_EOL;
+
+            }
+        }
+
+        if ($errorcount > 0) echo $errormessage;
 
         // increse loop counter
-	$counter ++;
-	$stoptime = time();
-	$wait_till = $starttime + 11;
+        $counter++;
+        $stoptime = time();
+        $wait_till = $starttime + 11;
 
-	if ($stoptime-$starttime > 10) {$errormessage .= "ERROR: delayed readout ".($stoptime-$starttime)." s "; $errorcount++;}
-	
-        //echo "Writing ADEI data to file.".PHP_EOL;
-
-        $strFileContent = "<"."?php".PHP_EOL."$"."adeiValue = ".var_export($adeiValue, true).";".PHP_EOL.PHP_EOL;
-        $strFileContent .= "$"."extraction_time = '". date(DATE_RFC850) ."';".PHP_EOL.PHP_EOL;
-	$strFileContent .= "$"."extraction_timestamp = ". time() .";".PHP_EOL.PHP_EOL;
-        $strFileContent .= "$"."errorcount = ". $errorcount .";".PHP_EOL.PHP_EOL;
-        $strFileContent .= "$"."errormessage = '". $errormessage ."';".PHP_EOL.PHP_EOL;
-        $strFileContent .= "$"."valuesincluded = 1;".PHP_EOL.PHP_EOL;
-        $strFileContent .= "?".">".PHP_EOL;
+        if ($stoptime - $starttime > 10) {
+            $errormessage .= "ERROR: delayed readout " . ($stoptime - $starttime) . " s ";
+            $errorcount++;
+        }
 
-	// write ADEI data to file
+        //echo "Writing ADEI data to file.".PHP_EOL;
+        $strFileContent = "<" . "?php" . PHP_EOL . "$" . "adeiValue = " . var_export($adeiValue, true) . ";" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "extraction_time = '" . date(DATE_RFC850) . "';" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "extraction_timestamp = " . time() . ";" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "errorcount = " . $errorcount . ";" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "errormessage = '" . $errormessage . "';" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "$" . "valuesincluded = 1;" . PHP_EOL . PHP_EOL;
+        $strFileContent .= "?" . ">" . PHP_EOL;
+
+        // write ADEI data to file
         $file_w = fopen('ADEIvalues.php', 'w+');
         //sleep(5);
         fwrite($file_w, $strFileContent);
         fclose($file_w);
-	
-	// write log file
-	$log_message = "";
-	$log_message = date(DATE_RFC850).": ADEI data polled: loop ".$counter;
-	$log_message .= ", poll time ".($stoptime-$starttime)." s";
-	if ($stoptime-$starttime > 10) $log_message .= ", delayed readout";
+
+        // write log file
+        $log_message = "";
+        $log_message = date(DATE_RFC850) . ": ADEI data polled: loop " . $counter;
+        $log_message .= ", poll time " . ($stoptime - $starttime) . " s";
+        if ($stoptime - $starttime > 10) $log_message .= ", delayed readout";
         $log_message .= PHP_EOL;
         $file_log = fopen('logs/poll_adei_data.log', 'a');
         fwrite($file_log, $log_message);
         fclose($file_log);
-        
-	//echo "Loop ".$counter." done.".PHP_EOL;
 
+        //echo "Loop ".$counter." done.".PHP_EOL;
         if ($wait_till <= $stoptime) sleep(3);
         else time_sleep_until($wait_till);
 
-} while (($counter < 10) && (time() < $calltime + 51));
+    }
+    while (($counter < 10) && (time() < $calltime + 51));
 
-//echo "All loops done.".PHP_EOL;
+    //echo "All loops done.".PHP_EOL;
 
 ?>