";
function getPolyHp($dataArray,$inParam)
{
unset($resVal);unset($tbArray);
for($i=0; $i1)
{
$polynomial = new zc_math_polynomial($tbArray);
$polynomial->calculate_coefficients();
$resVal = $polynomial->get_y($inParam);
}
else
$resVal=0;
return round($resVal,2);
}
function getPolyPe($dataArray,$inParam)
{
unset($resVal);unset($tbArray);
for($i=0; $i1)
{
$polynomial = new zc_math_polynomial($tbArray);
$polynomial->calculate_coefficients();
$resVal = $polynomial->get_y($inParam);
}
else
$resVal=0;
return round($resVal,2);
}
unset($wellArray);
$wellArray = sqlGetResAsArray("select * from a_power_data_everyday_20 where STAT is null limit 100");
for ($i=0; $i0 && strlen($wellExch[0]['WLE_ENG_NO'])>0)
{
$testIDArray = sqlGetResAsArray("select max(TST_ID) TST_ID from tst_tests where TST_PUP_SN_NO='".$wellExch[0]['WLE_PUMP_NO']."' and TST_ENG_SN_NO='".$wellExch[0]['WLE_ENG_NO']."' and TST_AUDIT_CD<='".$wellExch[0]['WLE_DATE_FROM']."'");
}
unset($probaArray);
unset($mocSP);
if ($testIDArray[0]['TST_ID']>0)
{
$wynik = mysql_query("select TSD_VAL_04,TSD_VAL_08,TSD_VAL_14 from tst_tests left join tst_test_details on TSD_TST_ID=TST_ID where TST_ID=".$testIDArray[0]['TST_ID']." order by TSD_MSR_STEP");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$probaArray[] = array(
'q' => (float) $r["TSD_VAL_04"],
'h' => (float) $r["TSD_VAL_08"],
'p' => (float) $r["TSD_VAL_14"]
);
}
$mocSP = (float) getPolyPe($probaArray,$wellArray[$i]['RHD_Q_VAL']);
//
if ($mocSP>0)
{
mysql_query("UPDATE rep_his_data_everyday SET RHD_PE_VAL='".$mocSP."' WHERE RHD_ID=".$wellArray[$i]['ID']);
echo("UPDATE rep_his_data_everyday SET RHD_PE_VAL='".$mocSP."' WHERE RHD_ID=".$wellArray[$i]['ID']);
echo'
';
}
}
mysql_query("UPDATE a_power_data_everyday_20 SET STAT='1' WHERE ID=".$wellArray[$i]['ID']);
echo("UPDATE a_power_data_everyday_20 SET STAT='1' WHERE ID=".$wellArray[$i]['ID']);
echo'
';
echo'
';
}
echo"STOP: ".date('Y-m-d H:i:m')."
";
mysql_close($polacz);