Files
controls-web/OLD/OLD Trends/trends/boilersteam.php
2026-02-17 12:44:37 -06:00

129 lines
3.5 KiB
PHP

<?php
// content="text/plain; charset=utf-8"
require_once ('src/jpgraph.php');
require_once ('src/jpgraph_line.php');
// FOR DB CONNECTION
$link = mysql_connect('192.168.0.14', 'corey', '41945549')
or die('Could not connect: ' . mysql_error());
mysql_select_db('controls') or die('Could not select database');
$dataArray=array();
//get data from database
$sql="SELECT date, exhaustpr, ttlsteamflow, livestmpr, exststmflow1, exststmflow2 FROM trending where trending.id mod 7 = 0 GROUP BY date DESC LIMIT 96";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$datay[] = $row["date"];
$datax1[] = $row["exhaustpr"];
$datax2[] = $row["ttlsteamflow"];
$datax3[] = $row["livestmpr"];
$datax4[] = $row["exststmflow1"];
$datax5[] = $row["exststmflow2"];
}
}
$n = 5;
for($i=0; $i < $n; ++$i ) {
$targ1[$i] = "#$i";
$targ2[$i] = "#$i";
$targ3[$i] = "#$i";
$targ4[$i] = "#$i";
$targ5[$i] = "#$i";
$alts1[$i] = "Exhaust Pressure=%d PSI";
$alts2[$i] = "Total Steam Flow=%d KPPH";
$alts3[$i] = "Live Steam Pressure=%d PSI";
$alts4[$i] = "Exhaust Steam Flow 1=%d KPPH";
$alts5[$i] = "Exhaust Steam Flow 2=%d KPPH";
}
// Setup the graph
$graph = new Graph(1600,520);
$graph->SetScale('intlin',0,800);
$graph->SetYScale(0,'int',0,25);
$graph->SetYScale(1,'int',0,85);
$theme_class=new UniversalTheme;
$graph->img->SetMargin(70,100,30,100); // Sets the margin. L, R, T, B
$graph->SetMarginColor('whiite');
$graph->title->Set('Boiler Steam Values');
$graph->subtitle->Set('(15 Minute Intervals)');
$graph->xaxis->title->Set(1);
$graph->yaxis->title->Set('%');
$graph->SetBox(false);
//$graph->footer->right->Set('Timer (ms): ');
//$graph->footer->SetTimer($timer);
//$graph->legend->SetPos($aX,$aY,$aHAlign='right',$aVAlign='top');
$graph->img->SetAntiAliasing();
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->yaxis->title->Set(0);
$graph->yaxis->SetTitleMargin(50);
$graph->xgrid->Show(true,true);
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels($datay);
//$graph->xaxis->SetTickDensity(TICKD_DENSE);
$graph->xaxis->SetLabelAngle(65);
$graph->xgrid->SetColor('#E2E2E2');
// Create line 1
$p1=new LinePlot($datax1);
$p1->SetCSIMTargets($targ1,$alts1);
$p1->mark->SetType(MARK_CIRCLE);
$graph->AddY(0,$p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Exhaust Pressure - PSI');
$graph->ynaxis[0]->SetColor('#6495ED');
// Create line 2
$p2=new LinePlot($datax2);
$p2->SetCSIMTargets($targ2,$alts2);
$p2->mark->SetType(MARK_CIRCLE);
$graph->Add($p2);
$p2->SetColor("#B22222");
$p2->SetLegend('Total Steam Flow - KPPH');
// Create line 3
$p3=new LinePlot($datax3);
$p3->SetCSIMTargets($targ3,$alts3);
$p3->mark->SetType(MARK_CIRCLE);
$graph->Add($p3);
$p3->SetColor("orange");
$p3->SetLegend('Live Steam Pressure - PSI');
// Create line 4
$p4=new LinePlot($datax4);
$p4->SetCSIMTargets($targ4,$alts4);
$p4->mark->SetType(MARK_CIRCLE);
$graph->AddY(1,$p4);
$p4->SetColor("darkgreen");
$p4->SetLegend('Exhaust Steam Flow 1 - KPPH');
// Create line 5
$p5=new LinePlot($datax5);
$p5->SetCSIMTargets($targ5,$alts5);
$p5->mark->SetType(MARK_CIRCLE);
$graph->AddY(1,$p5);
$p5->SetColor("green");
$p5->SetLegend('Exhaust Steam Flow 2 - KPPH');
$graph->ynaxis[1]->SetColor("green");
$graph->ynaxis[1]->title->Set(1);
$graph->legend->SetFrameWeight(1);
// Output line
$graph->StrokeCSIM('../trends/boilersteam.php');
?>