123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- require_once('/var/www/stsstatus/phplot.php');
-
- // ADEI channels of sensors
- $adeiChannel = array(
- // temperature sensors on top of beamtube
- array(//0
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__75", // RTP-3-5102, starting at front side
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__87", // RTP-3-5106
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__93", // RTP-3-5108
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__99", // RTP-3-5110
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__105", // RTP-3-5112
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__111", // RTP-3-5114
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__117", // RTP-3-5116
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__123", // RTP-3-5118
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__129", // RTP-3-5120
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__141" // RTP-3-5124
- ),
- // temperature sensors on bottom of beamtube
- array(//1
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__72", // RTP-3-5101, starting at front side
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__84", // RTP-3-5105
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__90", // RTP-3-5107
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__96", // RTP-3-5109
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__102", // RTP-3-5111
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__108", // RTP-3-5113
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__114", // RTP-3-5115
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__120", // RTP-3-5117
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__126", // RTP-3-5119
- "cswgts__ControlSystem_WGTS_Strahlrohr__200_STR_WGTS__138" // RTP-3-5123
- )
- );
-
- $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("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 . "&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)); // values of sensors
- $fileip = substr($fileip, 0, $pos);
- //echo $id . "," . $id2 . "," . $adeiValue[$id][$id2] . "<br>";
- }
- }
-
- // positions of sensors
- // z-positions of top/bottom sensors
- $position = file('data/SensorPositionsTopBottom.txt');
-
- $data = array();
- for ($ii=0; $ii<sizeof($position); $ii++) {
- $tempTop = $adeiValue[0][$ii]; $tempBottom = $adeiValue[1][$ii];
- $tempError = 1.5;
- if ($ii==1 || $ii==5) $tempTop="";
- if ($ii==3 || $ii==5) $tempBottom="";
- $data[] = array( '', $position[$ii]/1000, $tempTop, $tempError, $tempError, $tempBottom, $tempError, $tempError );
- //echo $data[$ii][1];
- }
-
- $plot = new PHPlot(1500, 250);
- $plot->SetImageBorderType('plain');
- $plot->SetFont('title', 5); $plot->SetFont('x_title', 4); $plot->SetFont('y_title', 4);
- $plot->SetFont('x_label', 2); $plot->SetFont('y_label', 2);
- $plot->SetDataType('data-data-error');
- $plot->SetDataValues($data);
- # Main plot title:
- $plot->SetTitle('source temperature profile');
- $plot->SetPlotType('linepoints');
- $plot->SetLineStyles(array('solid', 'dashed') );
- $plot->SetLineWidths( 2.5 );
- $colors = array('red', 'blue');
- $plot->SetDataColors( $colors );
- $plot->SetErrorBarColors( $colors );
- $plot->SetPointShapes( array('delta', 'dot') );
- $plot->SetXLabel( 'longitudinal position (m)' );
- $plot->SetYLabel( 'temperature (K)' );
- $plot->SetLegend( array('top', 'bottom') );
- $plot->SetLegendUseShapes(true);
- $plot->SetLegendPosition(1, 0, 'plot', 1, 0, 12, -23);
- # Make sure Y axis starts at 0:
- //$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);
- $plot->DrawGraph();
-
- ?>
|