示例#1
0
    $days_ago = $c_max_graph_days;
}
$uts_now = time();
$uts_onedayago = $uts_now - $days_ago * 60 * 60 * 24;
db_connect();
$query = "SELECT * FROM records WHERE uts >= {$uts_onedayago} AND uts <= {$uts_now} ORDER BY uts ASC";
$result = mysql_query($query) or die("Failed");
db_disconnect();
$arr_temp = array();
$arr_ctemp = array();
$arr_xticks = array();
while ($row = mysql_fetch_array($result)) {
    $l = $row['light2'];
    $p = $row['pressure'];
    array_push($arr_xticks, $row['uts']);
    $ctemp = eureqa($c_eureqa_alg, $l, $p);
    array_push($arr_ctemp, $ctemp);
    array_push($arr_temp, $row['temp2']);
}
function doAlg($l, $p)
{
    return 2.45487E-6 * $l * $p + 11.7187 * $p - 4.1119E-9 * $l * $l - 0.00207619 * $l - 0.00578456 * $p * $p - 5920.69;
}
function doAlg2($l, $p)
{
    //24-04-10
    return 4.71319 * log(93.0361 + 0.0153703 * $l) + 0.192581 / ($l - 171.138) - 7.96062;
}
// Create the graph. These two calls are always required
$graph = new Graph(800, 600, "auto");
// SCALE
示例#2
0
    printf(" / %01.1f", $row['light'] / 255 * 100);
    ?>
</td></tr>

	<tr>
	<td style="background-color:#CCFFCC;">Temperature (&#176;C)</td>
        <td id="ajaxtemp" style="background-color:#<?php 
    if ($row['temp'] > 80 || $row['temp='] == 0) {
        echo "FF3D3D";
    } else {
        echo "CCFFCC";
    }
    ?>
;"><?php 
    printf("%01.1f", $row['temp']);
    $pred_temp = eureqa($c_eureqa_alg, $row['light2'], $row['pressure']);
    echo " <small>(Predicted: " . $pred_temp;
    //echo " - Error: " . calcPercentageError($pred_temp, $row['temp2'])."%";
    echo ")</small>";
    ?>
</td>
	</tr>

	<tr>
        <td style="background-color:#CCFFCC;">Sheltered Temperature (&#176;C)</td> 
        <td id="ajaxtemp2" style="background-color:#<?php 
    if ($row['temp2'] > 80) {
        echo "FF3D3D";
    } else {
        echo "CCFFCC";
    }