123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <html>
- <head>
- <title>STS 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; }
- </style>
- <meta http-equiv="refresh" content="60">
- </head>
- <body>
- <?php
- function placePic($posY, $posX, $pic, $size, $title)
- {
- echo '<div title="' . $title . '" style="position:absolute; top:' . $posY . 'px; left:' . $posX . 'px">';
- echo '<img src="pictures/' . $pic . '" width="' . $size . '" height="' . $size . '">';
- echo '</div>';
- }
- function placePicWithLink($posY, $posX, $pic, $size, $title, $link)
- {
- echo '<a href="https://katrin.kit.edu/adei-katrin/#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://katrin.kit.edu/adei-katrin/#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 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 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;
- }
- ?>
- <?php
- // ########## SLOW CONTROL CHANNELS ##########
- $adeiChannel = array(
- array(
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__15",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__18",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__21",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__24",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__27",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__30",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__33",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__36",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__39",
- "cscryo__ControlSystem_Cryo__310DPS_Magnetsteuerung__42"
- )
- );
- $username = 'katrin';
- $password = 'neutrino';
- $context = stream_context_create(array(
- 'http' => array(
- 'header' => "Authorization: Basic " . base64_encode("$username:$password"), "Connection: close\r\n"
- )
- ));
-
- 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=60&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);
- //echo $fileip . "<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] . "<br>";
- }
- }
- ?>
- <?php
- // ########## TITLE and DATE ##########
- echo '<font size="6" color="#000000"><b>STS Status Overview</b></font><br>';
- echo '<font size="4" color="#000000">' . date(DATE_RFC822) . '</font><br>';
- ?>
- <!-- beamline picture (center) -->
- <div style="position:absolute; top:300px; left:0px">
- <img src="pictures/Beamline_STS_side_1410.png">
- <!-- KATRIN logo (upper left) -->
- <a href="http://katrin.kit.edu" target="_blank">
- <div style="position:absolute; top:-285px; left:300px">
- <img src="pictures/katrin_logo.jpg" width="100" height="100">
- </div>
- <!-- email link (upper left)-->
- <a href="mailto:Florian.Heizmann@kit.edu">
- <div title="send email to Florian Heizmann" style="position:absolute; top:-220px; left:8px">
- <img src="pictures/newEmail.png" width="23" height="23">
- </div>
- </a>
- <?php
- $color = "#000000";
- // ########## Rearsection ##########
- placeText(-100, 100, "Rear Section", 70, 30, $color);
- placeText(100, 240, "RSCM", 30, 5, $color);
- // ########## WGTS ##########
- placeText(-100, 670, "WGTS", 70, 30, $color);
- placeText(100, 340, "M5", 30, 5, $color);
- placeText(100, 410, "M4", 30, 5, $color);
- placeText(100, 550, "M1", 30, 5, $color);
- placeText(50, 730, "M2", 30, 5, $color);
- placeText(100, 900, "M3", 30, 5, $color);
- placeText(100, 1040, "M7", 30, 5, $color);
- placeText(100, 1115, "M6", 30, 5, $color);
-
- // ########## DPS ##########
- placeText(-100, 1330, "DPS", 70, 30, $color);
- $thres = 0.4; // magnet B in T
- $tol = 180; // hall sensor B in mT 55
- $cali = array( 800, -800, 800, -800, 800, -800, 808, -769, 736, -778 );
- for ($pp = 1; $pp < 6; $pp++)
- {
- $pic = "coilA";
- if ($pp == 2) $pic = "coilB";
- else if ($pp == 4) $pic = "coilC";
- if ($pp == 1 || $pp == 5) $posY = 230+3;
- else if ($pp == 2 || $pp == 4) $posY = 224+3;
- else if ($pp == 3) $posY = 220+3;
- $posX = 1220 + 70*($pp-1);
- $link = $adeiChannel[0][0 + 2*($pp-1)] . "," . $adeiChannel[0][1 + 2*($pp-1)];
- $value = ( (5.5 * $adeiValue[0][2*($pp-1)] / $cali[2*($pp-1)]) + (5.5 * $adeiValue[0][1 + 2*($pp-1)] / $cali[1 + 2*($pp-1)]) ) / 2.0 ;
- if ($value > $thres && $adeiValue[0][2*($pp-1)] + $adeiValue[0][1 + 2*($pp-1)] < $tol && $adeiValue[0][2*($pp-1)] + $adeiValue[0][1 + 2*($pp-1)] > -$tol)
- {
- $posOffset = 0;
- if ($pp == 2) $posOffset = 1;
- else if ($pp == 4) $posOffset = -1;
- $text = "magnetic field [T] DPS magnet " . $pp;
- placeTextWithLink($posY + 13, $posX - 5 + $posOffset, sprintf('%.1F', $value), 30, 2, "#FF0000", $text, $link);
- $pic = $pic . "On";
- $color = "#FF0000";
- }
- $text = "status DPS magnet " . $pp . " red: ramped, white: off";
- placePicWithLink($posY, $posX, $pic . ".png", 20, $text, $link);
- placeText(100, $posX, "M" . $pp, 20, 5, $color);
- }
-
- // ########## CPS ##########
- placeText(-100, 1650, "CPS", 70, 30, $color);
- for ($index = 1; $index < 8; $index++)
- {
- placeText(0, 1570+50*($index-1), "M" . $index, 30, 5, $color);
- }
- ?>
- </div>
- </body>
- </html>
|