STS_channels.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. // ########## SLOW CONTROL CHANNELS ##########
  3. $adeiChannel = array(
  4. // DPS Magnets
  5. array(//0
  6. /*"cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__15", //"311-RBY-1-1051",
  7. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__18", //"311-RBY-1-1052",
  8. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__21", //"311-RBY-1-2051",
  9. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__24", //"311-RBY-1-2052",
  10. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__27", //"311-RBY-1-3051",
  11. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__30", //"311-RBY-1-3052",
  12. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__33", //"311-RBY-1-4051",
  13. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__36", //"311-RBY-1-4052",
  14. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__39", //"311-RBY-1-5051",
  15. "cscryo__ControlSystem_DPS__310_MAG_Magnetbetrieb__42" //"311-RBY-1-5052" // hall probes */
  16. "cstmagnet__ControlSystem_Magnet__800_MAG_MAG_Control__69", //"311-E23-1-1100",
  17. "cstmagnet__ControlSystem_Magnet__800_MAG_MAG_Control__84", //"311-E23-1-2100",
  18. "cstmagnet__ControlSystem_Magnet__800_MAG_MAG_Control__99", //"311-E23-1-3100",
  19. "cstmagnet__ControlSystem_Magnet__800_MAG_MAG_Control__114", //"311-E23-1-4100",
  20. "cstmagnet__ControlSystem_Magnet__800_MAG_MAG_Control__129" //"311-E23-1-5100" // current
  21. ),
  22. // CPS Magnets
  23. array(//1
  24. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__0",
  25. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__3",
  26. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__6",
  27. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__9",
  28. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__12",
  29. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__15",
  30. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__18",
  31. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__21",
  32. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__24",
  33. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__27",
  34. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__30",
  35. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__33",
  36. "cscps__ControlSystem_CPS__320_MAG_Magnetfeld__36"
  37. ),
  38. // CPS Current
  39. array(//2
  40. "cscps__ControlSystem_CPS__320_MAG_Stromzufuhr__0"
  41. ),
  42. // WGTS currents
  43. array(//3
  44. "cswgts__ControlSystem_WGTS_Magnet__200_MAG_Stromzufuhr_M1_M4_M5__0"
  45. ),
  46. array(//4
  47. "cswgts__ControlSystem_WGTS_Magnet__200_MAG_Stromzufuhr_M2_M3__0"
  48. ),
  49. array(//5
  50. "cswgts__ControlSystem_WGTS_Magnet__200_MAG_Stromzufuhr_M6_M7__0"
  51. ),
  52. // throughput
  53. array(//6
  54. "cstloops__ControlSystem_Loop_ISS__610InnerLoop_CircIn__12" // 610-RFY-8-0206
  55. )
  56. );
  57. $username = getenv('PHP_ADEI_USERNAME');
  58. $password = getenv('PHP_ADEI_PASSWORD');
  59. $context = stream_context_create(array(
  60. 'http' => array(
  61. 'header' => "Authorization: Basic " . base64_encode("$username:$password"), "Connection: close\r\n"
  62. )
  63. ));
  64. for ($id = 0; $id < sizeof($adeiChannel); $id++)
  65. {
  66. $adeiChannels = "";
  67. for ($id2 = 0; $id2 < sizeof($adeiChannel[$id]); $id2++)
  68. {
  69. $adeiChannels = $adeiChannels . $adeiChannel[$id][$id2] . ",";
  70. }
  71. $adeiChannels = substr($adeiChannels, 0, strlen($adeiChannels) - 1);
  72. // adei address changed
  73. $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=60,-1&format=csv", false, $context);
  74. // old adei
  75. //$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=60&format=csv", false, $context);
  76. // backup server
  77. //$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);
  78. //echo $fileip . "<br>";
  79. for ($id2 = sizeof($adeiChannel[$id]) - 1 ; $id2 > -1; $id2--)
  80. {
  81. $pos = strrpos($fileip, ",");
  82. $adeiValue[$id][$id2] = floatval(substr($fileip, $pos + 2));
  83. $fileip = substr($fileip, 0, $pos);
  84. //echo $id . "," . $id2 . "," . $adeiValue[$id][$id2] . "<br>";
  85. }
  86. }
  87. // corresponding KATRIN numbers of sensors
  88. $KatrinNumber = array(
  89. // DPS Magnets
  90. array(//0
  91. /*"311-RBY-1-1051",
  92. "311-RBY-1-1052",
  93. "311-RBY-1-2051",
  94. "311-RBY-1-2052",
  95. "311-RBY-1-3051",
  96. "311-RBY-1-3052",
  97. "311-RBY-1-4051",
  98. "311-RBY-1-4052",
  99. "311-RBY-1-5051",
  100. "311-RBY-1-5052" */ //those were the hall probe numbers
  101. "311-E23-1-1100",
  102. "311-E23-1-2100",
  103. "311-E23-1-3100",
  104. "311-E23-1-4100",
  105. "311-E23-1-5100" // current
  106. ),
  107. // CPS Magnets
  108. array(//1
  109. "320-RBI-1-1101",
  110. "320-RBI-1-1102",
  111. "320-RBI-1-2101",
  112. "320-RBI-1-2102",
  113. "320-RBI-1-3101",
  114. "320-RBI-1-3102",
  115. "320-RBI-1-4101",
  116. "320-RBI-1-4102",
  117. "320-RBI-1-5101",
  118. //"320-RBI-1-5102", // corrupted, not in ADEI anymore
  119. "320-RBI-1-6101",
  120. "320-RBI-1-6102",
  121. "320-RBI-1-7101",
  122. "320-RBI-1-7102"
  123. ),
  124. // CPS Current
  125. array(//2
  126. "320-REI-1-5103"
  127. ),
  128. // WGTS currents
  129. array(//3
  130. "200-REI-5-3111" // M5_M4_M1
  131. ),
  132. array(//4
  133. "200-REI-5-3211" // M2_M3
  134. ),
  135. array(//5
  136. "200-REI-5-3311" // M7_M6
  137. ),
  138. // throughput
  139. array(//6
  140. "610-RFY-8-0206" // 610-RFY-8-0206
  141. )
  142. );
  143. ?>