Files
2026-09-03 11:24:19 +02:00

827 lines
36 KiB
PHP

<?php
if (!empty($_SESSION['site401']))
{
?>
<?php
if (!empty($_GET['direct']) && $_GET['direct']=='site301inf')
{
delSearchSessionData();
}
//warunek na przekazywanie nazw obiektów (G54)
if (empty($_GET['dev']) && !empty($_GET['obj']))
{
delSearchSessionData();
$_GET['dev'] = sqlStringValue("select DRS_ID from seg_dev_resources,seg_wells where DRS_DEV_ID=WLL_ID and DRS_DEV_TYPE=12 and WLL_NAME='".$_GET['obj']."'", "DRS_ID");
if ($_GET['dev']>0) $_GET['dev']=$_GET['dev'];
else {
$tmp = explode('=', $_SERVER['REQUEST_URI']);
$lastVal = count($tmp)-1;
$_GET['dev'] = sqlStringValue("select DRS_ID from seg_dev_resources,seg_wells where DRS_DEV_ID=WLL_ID and DRS_DEV_TYPE=12 and WLL_NAME='".$tmp[$lastVal]."'", "DRS_ID");
unset($tmp);
}
}
//załączaie wylączanie pompy
if (!empty($_GET['pa']) && $_GET['dev']>0 && $_POST['inEncrypted']==md5($_GET['dev']) && $_POST['subWellParamSave']==$lab_ButtonName_Next)
{
$onOffDate = $_POST['inOnOffDate'].' '.$_POST['inOnOffTimeH'].':'.$_POST['inOnOffTimeM'].':00';
if ($_GET['pa']=='on')
{
mysql_query("INSERT INTO seg_dev_resources_det SET DRD_DRS_ID=".$_GET['dev'].",DRD_RESOURCES_DETAIL=507,DRD_VALUE='ON',DRD_AUDIT_USR='".$_SESSION['user']."',DRD_AUDIT_DATE='".$onOffDate."'");
mysql_query("INSERT INTO seg_wells_manual_work SET WMS_WLL_ID=".$_SESSION['well_details']['wellID'].",WMS_DRS_ID=".$_GET['dev'].",WMS_NAME='".$_SESSION['well_details']['wellName']."',WMS_WORK_STATUS='ON',WMS_DATETIME='".$onOffDate."'");
}
elseif ($_GET['pa']=='off')
{
mysql_query("INSERT INTO seg_dev_resources_det SET DRD_DRS_ID=".$_GET['dev'].",DRD_RESOURCES_DETAIL=507,DRD_VALUE='OFF',DRD_DESCRIPTION='".$_POST['inOnOffReason']."',DRD_AUDIT_USR='".$_SESSION['user']."',DRD_AUDIT_DATE='".$onOffDate."'");
mysql_query("INSERT INTO seg_wells_manual_work SET WMS_WLL_ID=".$_SESSION['well_details']['wellID'].",WMS_DRS_ID=".$_GET['dev'].",WMS_NAME='".$_SESSION['well_details']['wellName']."',WMS_WORK_STATUS='OFF',WMS_DATETIME='".$onOffDate."'");
}
elseif ($_GET['pa']=='reson')
{
$drdID = sqlValue("select max(DRD_ID) from seg_dev_resources_det where DRD_RESOURCES_DETAIL=507 and DRD_DRS_ID=".$_GET['dev']." and DRD_AUDIT_DATE=(select max(DRD_AUDIT_DATE) from seg_dev_resources_det where DRD_RESOURCES_DETAIL=507 and DRD_DRS_ID=".$_GET['dev'].")");
mysql_query("UPDATE seg_dev_resources_det SET DRD_DESCRIPTION='".$_POST['inOnOffReason']."' WHERE DRD_ID=".$drdID);
}
}
// kasuje zmianne sesyjne dla historii ocen
unset($_SESSION['site401mhis_working_params']);
unset($_SESSION['site401mhis_inDate']);
unset($_SESSION['site401mhis_sel_data']);
require_once('./polynomial/PolynomialRegression.php' );
//wpisuje do tablicy podstawowe informacje o studni
if (empty($_SESSION['well_details']))
{
//$wynik = mysql_query("select DRS_ID,WLL_ID,WLL_NAME,PUP_ID,WLE_PUMP_NAME,WLE_PUMP_NO,ENG_ID,WLE_ENG_NAME,WLE_ENG_NO,WLE_PUMP_Q_N from rep_object_departments where DRS_ID=".$_GET['dev']);
$wynik = mysql_query("select DRS_ID,WLL_ID,WLL_NAME,WLL_CAT_DIC_ID,(select PUP_ID from seg_dev_resources left join seg_pumps on PUP_ID=DRS_DEV_ID and DRS_DEV_TYPE=10 where DRS_ID=RWL_PUP_DRS_ID limit 1) PUP_ID,(select PUP_NAME from seg_dev_resources left join seg_pumps on PUP_ID=DRS_DEV_ID and DRS_DEV_TYPE=10 where DRS_ID=RWL_PUP_DRS_ID limit 1) WLE_PUMP_NAME,(select PUP_Q_N from seg_dev_resources left join seg_pumps on PUP_ID=DRS_DEV_ID and DRS_DEV_TYPE=10 where DRS_ID=RWL_PUP_DRS_ID limit 1) WLE_PUMP_Q_N,(select DRS_SN_NUMBER from seg_dev_resources where DRS_ID=RWL_PUP_DRS_ID limit 1) WLE_PUMP_NO,(select ENG_ID from seg_dev_resources left join seg_engines on ENG_ID=DRS_DEV_ID and DRS_DEV_TYPE=11 where DRS_ID=RWL_ENG_DRS_ID limit 1) ENG_ID,(select ENG_NAME from seg_dev_resources left join seg_engines on ENG_ID=DRS_DEV_ID and DRS_DEV_TYPE=11 where DRS_ID=RWL_ENG_DRS_ID limit 1) WLE_ENG_NAME,(select DRS_SN_NUMBER from seg_dev_resources where DRS_ID=RWL_ENG_DRS_ID limit 1) WLE_ENG_NO from seg_wells left join seg_dev_resources on DRS_DEV_ID=WLL_ID and DRS_DEV_TYPE=12 left join seg_well_pump_eng_rel on RWL_WLL_ID=WLL_ID where DRS_ID=".$_GET['dev']);
if($wynik)while ($r = mysql_fetch_array($wynik))
{
//$tstID = sqlValue("select TST_ID from tst_tests where TST_PUP_ID=".$r["PUP_ID"]." and TST_PUP_SN_NO='".$r["WLE_PUMP_NO"]."' and TST_ENG_ID=".$r["ENG_ID"]." and TST_ENG_SN_NO='".$r["WLE_ENG_NO"]."'");
$tstID = sqlValue("select TST_ID from tst_tests where TST_PUP_ID=".$r["PUP_ID"]." and TST_PUP_SN_NO='".$r["WLE_PUMP_NO"]."' and TST_ENG_SN_NO='".$r["WLE_ENG_NO"]."'");
if (empty($tstID)) $tstID = sqlValue("select TST_ID from tst_tests where TST_PUP_ID=".$r["PUP_ID"]." and TST_PUP_SN_NO='".$r["WLE_PUMP_NO"]."'");
$_SESSION['well_details']=array(
'devID' => $r["DRS_ID"],
'wellID' => $r["WLL_ID"],
'wellName' => $r["WLL_NAME"],
'wellTypeID'=> $r["WLL_CAT_DIC_ID"],
'pumpID' => $r["PUP_ID"],
'pumpName' => $r["WLE_PUMP_NAME"],
'pumpSN' => $r["WLE_PUMP_NO"],
'engID' => $r["ENG_ID"],
'engName' => $r["WLE_ENG_NAME"],
'engSN' => $r["WLE_ENG_NO"],
'QnVal' => $r["WLE_PUMP_Q_N"],
'LpVal' => (float) getLastValueFromDevResourceDetail('WELL_PARAMETERS','LPM',$r["DRS_ID"]),
'DrVal' => (float) getLastValueFromDevResourceDetail('WELL_PARAMETERS','DR',$r["DRS_ID"])/1000,
'testID' => $tstID
);
}
}
//2016-09-10
// pobiera informacje do tablicy o wiarygodności danych z SYNDIS
unset($qualDataArray);
if ($_SESSION['well_details']['wellTypeID']!=20)
$qualDataArray = sqlGetResAsArray("select * from rep_soap_syndis_quality_data where SQD_DRS_ID=".$_GET['dev']);
//zakresy dla wykresów
if (empty($_SESSION['site401_scope']))
{
$wynik = mysql_query("select PEP_X_PARAM from seg_pump_eng_param where PEP_TYPE='H' and PEP_PUP_ID=".$_SESSION['well_details']['pumpID']." order by PEP_X_PARAM");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$_SESSION['site401_scope'][] = (float) $r["PEP_X_PARAM"]/60;
}
}
// punkty pomiarowe ze stacji prób dla H
if (empty($_SESSION['site401_lift_xy']))
{
$i=0; $j=0;
$wynik = mysql_query("select TSD_VAL_04/60 PEP_X_PARAM, TSD_VAL_08 PEP_Y_PARAM from tst_tests left join tst_test_details on TSD_TST_ID=TST_ID where TST_ID=".$_SESSION['well_details']['testID']." order by TSD_MSR_STEP");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$_SESSION['site401_lift_xy'][$i][$j] = (float) $r["PEP_X_PARAM"];
$j++;
$_SESSION['site401_lift_xy'][$i][$j] = (float) $r["PEP_Y_PARAM"];
$i++; $j=0;
}
$wynik = mysql_query("select max(TSD_VAL_04)/60 X_MAX, max(TSD_VAL_08) Y_MAX from tst_tests left join tst_test_details on TSD_TST_ID=TST_ID where TST_ID=".$_SESSION['well_details']['testID']);
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$_SESSION['site401_minmax_params'] = array(
'x_min' => 0,
'x_max' => (float) $r["X_MAX"],
'y_min' => 0,
'y_max' => (float) $r["Y_MAX"]
);
}
}
// punkty pomiarowe ze stacji prób dla ETA
if (empty($_SESSION['site401_eta_xy']))
{
$i=0; $j=0;
$wynik = mysql_query("select TSD_VAL_04/60 PEP_X_PARAM, TSD_VAL_18 PEP_Y_PARAM from tst_tests left join tst_test_details on TSD_TST_ID=TST_ID where TST_ID=".$_SESSION['well_details']['testID']." order by TSD_MSR_STEP");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$_SESSION['site401_eta_xy'][$i][$j] = (float) $r["PEP_X_PARAM"];
$j++;
$_SESSION['site401_eta_xy'][$i][$j] = (float) $r["PEP_Y_PARAM"];
$i++; $j=0;
}
}
$imgSPM = sqlStringValue("select DIC_NAME from sys_dictionaries where DIC_ID=(select WLL_CAT_DIC_ID from seg_wells where WLL_ID=".$_SESSION['well_details']['wellID'].")","DIC_NAME")."_polish.png";
?>
<?php
include("./pChart/pData.class.php");
include("./pChart/pDraw.class.php");
include("./pChart/pImage.class.php");
include("./pChart/pScatter.class.php");
$isDiagOK = getLastValueFromDevResourceDetail('WELL_HIDDEN_PARAMETERS','DGN',$_SESSION['well_details']['devID']);
$wynik = mysql_query("select RHD_Q_VAL,RHD_HD_VAL,RHD_P1_VAL,RHD_P2_VAL,RHD_PP_VAL,RHD_HH_VAL,RHD_PE_VAL,RHD_DATE from rep_his_data_everyday where RHD_ID=(select max(RHD_ID) from rep_his_data_everyday where RHD_DRS_ID=".$_SESSION['well_details']['devID'].")");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$qParam = $r["RHD_Q_VAL"];
$P1param = $r["RHD_P1_VAL"];
$P2param = $r["RHD_P2_VAL"];
$PEparam = $r["RHD_PE_VAL"];
$PPparam = $r["RHD_PP_VAL"];
$HHparam = $r["RHD_HH_VAL"];
$resHD = $r["RHD_HD_VAL"];
$resWorkStatus = $r["RHD_DATE"];
if (empty($qualDataArray)) $qualDataArray[0]['SQD_AUDIT_CD'] = $r["RHD_DATE"];
}
// =============================================================== //
$Evaluation4_q = wellEvaluation4_q($_SESSION['well_details']['QnVal'], $qParam);
// =============================================================== //
//$resHP = (setPumpHparameterForQ($_SESSION['well_details']['pumpID'],$qParam)-($PPparam-$HHparam))/($PPparam-$HHparam);
//$resHP = (getPolynomialValue($_SESSION['site401_lift_xy'],$qParam/60)-($PPparam-$HHparam))/($PPparam-$HHparam);
//$Evaluation4_HfQ = wellEvaluation4_HfQ($resHP,$PPparam);
$HPparam = (float) ($PPparam - $HHparam);
$HPSparam = (float) getPolynomialValue($_SESSION['site401_lift_xy'],$qParam/60);
$Evaluation4_HfQ = wellEvaluation4_HfQ_new($HPSparam,$PPparam,$HHparam);
// =============================================================== //
$Evaluation4_Throt = wellEvaluation4_Throt($resHD,$P1param,$P2param);
// =============================================================== //
$Evaluation4_LineLoss = wellEvaluation4_LineLoss($P1param,$PPparam,$_SESSION['well_details']['LpVal'],$_SESSION['well_details']['DrVal']);
// =============================================================== //
$qRZ = $qParam;
$fileName0="./charts/".$_SESSION['user']."_".date("Ymd")."_".date("His")."_chart_401inf_01.png";
if (file_exists( $fileName0)) unlink($fileName0);
// =============================================================== //
if (empty($PEparam)) $PEparam=1;
$resETA = ($qParam*($resHD+$P2param))/(367*$PEparam);
$RedYellowParam = setRedYellowLimes($_SESSION['well_details']['QnVal']);
$YellowGreenParam = setYellowGreenLimes($_SESSION['well_details']['QnVal']);
// =============================================================== //
// Jeśli mamy odchyłke CH na czerwono, wtedy obrazek jest szary
// =============================================================== //
if ($greyChart==1 || $_SESSION['well_details']['wellTypeID']==20)
pumpImageGreyBell($fileName0);
else pumpImageStatus($fileName0, $RedYellowParam, $YellowGreenParam, $resETA);
// =============================================================== //
$fileName1="./charts/".$_SESSION['user']."_".date("Ymd")."_".date("His")."_chart_401inf_02.png";
$fileName2="./charts/".$_SESSION['user']."_".date("Ymd")."_".date("His")."_chart_401inf_03.png";
if (file_exists( $fileName1)) unlink($fileName1);
if (file_exists( $fileName2)) unlink($fileName2);
if ($_SESSION['well_details']['testID']>0)
{
// Wysokość podnoszenia
// =======================================================================================//
require_once('./polynomial/plot.php' );
$xMin = 0;
$xMinLine = $xMin;
$xMax = $_SESSION['site401_minmax_params']['x_max'];
$xMaxLine = ceil($xMax);
$yMax = $_SESSION['site401_minmax_params']['y_max'];
$yMax = ceil($yMax+10);
$X_MajorScale = $xMax/5;
$X_MinorScale = $X_MajorScale / 2;
$Y_MajorScale = ceil($yMax/10);
$Y_MinorScale = $Y_MajorScale / 2;
$data = $_SESSION['site401_lift_xy'];
// Precision digits in BC math.
bcscale( 10 );
// Start a regression class with a maximum of 4rd degree polynomial.
$polynomialRegression = new PolynomialRegression( 4 );
// Add all the data to the regression analysis.
foreach ( $data as $dataPoint )
$polynomialRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );
// Add raw data to plot.
plotRenderData( $data, $colorMap[ "Blue" ] );
$plot->setX_Span( 0, $xMax );
$plot->setY_Span( 0, ceil($yMax/4)*4 );
plotAddScale();
// Render the points to image
$plot->setCircleSize( 3 );
$plot->renderPoints();
// Get coefficients for the polynomial.
$coefficients = $polynomialRegression->getCoefficients();
// Place text
imageString($image,3,0,0,'H[m]',$colorMap[ "Black" ]);
imageString($image,3,355,313,'Q[m3/min]',$colorMap[ "Black" ]);
// rysuje punkty
plotRenderRegression( $polynomialRegression, $coefficients, $_SESSION['site401_scope'][0], $_SESSION['site401_scope'][2], $colorMap[ "Red" ] );
plotRenderRegression( $polynomialRegression, $coefficients, $_SESSION['site401_scope'][2], $_SESSION['site401_scope'][3], $colorMap[ "DarkYellow" ] );
plotRenderRegression( $polynomialRegression, $coefficients, $_SESSION['site401_scope'][3], $_SESSION['site401_scope'][5], $colorMap[ "Green" ] );
plotRenderRegression( $polynomialRegression, $coefficients, $_SESSION['site401_scope'][5], $_SESSION['site401_scope'][6], $colorMap[ "DarkYellow" ] );
plotRenderRegression( $polynomialRegression, $coefficients, $_SESSION['site401_scope'][6], $xMaxLine, $colorMap[ "Red" ] );
unset($data);
unset($regression);
unset($coefficients);
unset($dataPoint);
if ($Evaluation4_HfQ['point_color'] == 'Green')
{
$colorKROPA = $colorMap["Green"];
$moveKROPA=0;
}
if ($Evaluation4_HfQ['point_color'] == 'Yellow')
{
$colorKROPA = $colorMap["Yellow"];
$moveKROPA=2;
}
if ($Evaluation4_HfQ['point_color'] == 'Red')
{
$colorKROPA = $colorMap["Red"];
$moveKROPA=2;
}
//plotCircleRange(0,$xMax,0,ceil($yMax/4)*4,$qRZ/60,str_replace(',','.',setPumpHparameterForQafterTest($_SESSION['well_details']['pumpID'],$_SESSION['well_details']['pumpSN'],$qRZ))-$moveKROPA,$colorKROPA);
plotCircleRange(0,$xMax,0,ceil($yMax/4)*4,$qRZ/60,getPolynomialValue($_SESSION['site401_lift_xy'],$qParam/60)-$moveKROPA,$colorKROPA);
imagePNG( $image,$fileName1);
// =======================================================================================//
}
if ($_SESSION['well_details']['testID']>0)
{
// Sprawność
// =======================================================================================//
require_once('./polynomial/plot1.php' );
$xMin = 0;
$xMinLine = $xMin;
$xMax = $_SESSION['site401_minmax_params']['x_max'];
$xMaxLine = ceil($xMax);
$X_MajorScale = $xMax/5;
$X_MinorScale = $X_MajorScale / 2;
$Y_MajorScale = 0.1;
$Y_MinorScale = $Y_MajorScale / 2;
$data1 = $_SESSION['site401_eta_xy'];
// Precision digits in BC math.
bcscale( 10 );
// Start a regression class with a maximum of 4rd degree polynomial.
$polynomialRegression1 = new PolynomialRegression( 4 );
// Add all the data to the regression analysis.
foreach ( $data1 as $dataPoint1 )
$polynomialRegression1->addData( $dataPoint1[ 0 ], $dataPoint1[ 1 ] );
// Add raw data to plot.
plotRenderData( $data1, $colorMap[ "Blue" ] );
$plot->setX_Span( 0, $xMax );
$plot->setY_Span( 0, 1 );
// Render the points to image
$plot->setCircleSize( 3 );
$plot->renderPoints();
if ($qRZ/60<$_SESSION['site401_scope'][2])
plotRectangleRange1(0,$xMax,0,$_SESSION['site401_scope'][2], 'red_value');
else if ($qRZ/60>=$_SESSION['site401_scope'][2] && $qRZ/60<$_SESSION['site401_scope'][3])
plotRectangleRange1(0,$xMax,$_SESSION['site401_scope'][2],$_SESSION['site401_scope'][3], 'yellow_value');
else if ($qRZ/60>=$_SESSION['site401_scope'][3] && $qRZ/60<$_SESSION['site401_scope'][5])
plotRectangleRange1(0,$xMax,$_SESSION['site401_scope'][3],$_SESSION['site401_scope'][5], 'green_value');
else if ($qRZ/60>=$_SESSION['site401_scope'][5] && $qRZ/60<$_SESSION['site401_scope'][6])
plotRectangleRange1(0,$xMax,$_SESSION['site401_scope'][5],$_SESSION['site401_scope'][6], 'yellow_value');
else if ($qRZ/60>=$_SESSION['site401_scope'][6])
plotRectangleRange1(0,$xMax,$_SESSION['site401_scope'][6],$xMaxLine, 'red_value');
plotAddScale();
// Get coefficients for the polynomial.
$coefficients = $polynomialRegression1->getCoefficients();
// Place text
imageString($image1,3,0,0,'n',$colorMap[ "Black" ]);
imagerectangle($image1,4,10,5,15,$colorMap[ "Black" ]);
imageString($image1,3,355,313,'Q[m3/min]',$colorMap[ "Black" ]);
// rysuje punkty
plotRenderRegression( $polynomialRegression1, $coefficients, $_SESSION['site401_scope'][0], $_SESSION['site401_scope'][2], $colorMap[ "Red" ] );
plotRenderRegression( $polynomialRegression1, $coefficients, $_SESSION['site401_scope'][2], $_SESSION['site401_scope'][3], $colorMap[ "DarkYellow" ] );
plotRenderRegression( $polynomialRegression1, $coefficients, $_SESSION['site401_scope'][3], $_SESSION['site401_scope'][5], $colorMap[ "Green" ] );
plotRenderRegression( $polynomialRegression1, $coefficients, $_SESSION['site401_scope'][5], $_SESSION['site401_scope'][6], $colorMap[ "DarkYellow" ] );
plotRenderRegression( $polynomialRegression1, $coefficients, $_SESSION['site401_scope'][6], $xMaxLine, $colorMap[ "Red" ] );
unset($data);
unset($regression);
unset($coefficients);
unset($dataPoint);
unset($moveKROPA);
//plotCircleRange1(0,$xMax,0,1,$qRZ/60,str_replace(',','.',setPumpETAparameterForQafterTest($_SESSION['well_details']['pumpID'],$_SESSION['well_details']['pumpSN'],$qRZ)));
plotCircleRange1(0,$xMax,0,1,$qRZ/60,getPolynomialValue($_SESSION['site401_eta_xy'],$qParam/60));
imagePNG( $image1,$fileName2);
// =======================================================================================//
}
?>
<?php
//tworzy nazwę pliku rysunku jaki ma podstawić w zalezności od stanu pompy (Throt i Loss)
if (strlen($Evaluation4_Throt['image'])>0 && strlen($Evaluation4_LineLoss['image'])>0 && !strstr($imgSPM,"SEGAP"))
$imgSPM = "./images/".$Evaluation4_Throt['image']."".$Evaluation4_LineLoss['image']."_".$imgSPM;
else $imgSPM = "./images/".$imgSPM;
$fileName="./charts/".$_SESSION['user']."_".date("Ymd")."_".date("His")."_site401inf.png";
if (file_exists($fileName)) unlink($fileName);
$imageSPM=imagecreatefrompng($imgSPM);
$image=imagecreatetruecolor(imagesx($imageSPM),imagesy($imageSPM));
imagecopy($image,$imageSPM,0,0,0,0,imagesx($imageSPM),imagesy($imageSPM));
$color=imagecolorallocate($image,255,255,255);
imagefill($image,0,0,$color);
$font = './fonts/verdana.ttf';
// sprawdza stan diagnostyki i podstawia odpowiedni obrazek
$imgToDiag = imagecreatefrompng("./images/diag_ok.png");
//$isDiagOK = getLastValueFromDevResourceDetail('WELL_HIDDEN_PARAMETERS','DGN',$var_DRSid);
if ($isDiagOK>0) $imgToDiag = imagecreatefrompng("./images/diag_error.png");
if ($_SESSION['well_details']['wellTypeID']==18)
{
imagecopy($image,$imgToDiag,105,450,0,0,13,13);
imagettftext($image, 10, 0, 75, 635, imagecolorallocate($image, 0, 0, 255), $font, "Data odpytania SYNDIS: ".$qualDataArray[0]['SQD_AUDIT_CD']);
}
elseif ($_SESSION['well_details']['wellTypeID']==19)
{
imagecopy($image,$imgToDiag,81,450,0,0,13,13);
imagettftext($image, 10, 0, 75, 635, imagecolorallocate($image, 0, 0, 255), $font, "Data odpytania SYNDIS: ".$qualDataArray[0]['SQD_AUDIT_CD']);
}
imagepng($image,$fileName);
// Jeśli mamy typ "SPM - inne"
if ($_SESSION['well_details']['wellTypeID']==20)
{
unset($Evaluation4_HfQ);
unset($Evaluation4_Throt);
unset($Evaluation4_LineLoss);
//pumpImageGreyBell($fileName0);
}
?>
<?php
// sprawdza informacje, czy aktualne dane są wiarygodne i zgodne z tym co trzeba
// tablice pobiera wcześniej
//przelicza algorytmem, czy dane są prawidłowe
/*
// =========================================================================================================================================
if (!empty($qualDataArray) && $qualDataArray[0]['SQD_VAL_ONOFF']==1)
{
$isOdstaja = false;
$isTest01 = false;
// Założenia
// =========================================================================================================================================
$test01_Hsa = (float) $qualDataArray[0]['SQD_VAL_P1'] - $qualDataArray[0]['SQD_VAL_P2'];
$test01_F = (float) (3.14*($_SESSION['well_details']['DrVal']*$_SESSION['well_details']['DrVal']))/4;
$test01_Ct = (float) ($qualDataArray[0]['SQD_VAL_Q']/3600) / $test01_F;
$test01_Hsl_1 = (float) 0.035*($_SESSION['well_details']['LpVal']/$_SESSION['well_details']['DrVal'])*(($test01_Ct*$test01_Ct)/19.62);
$test01_Hp = (float) $qualDataArray[0]['SQD_VAL_PP'] - $qualDataArray[0]['SQD_VAL_HH'];
$test01_Hp_1 = (float) $qualDataArray[0]['SQD_VAL_HD'] + $test01_Hsa + $test01_Hsl_1 + $qualDataArray[0]['SQD_VAL_P2'];
$test02_Hsl = (float) $qualDataArray[0]['SQD_VAL_PP'] - $_SESSION['well_details']['LpVal'] - $qualDataArray[0]['SQD_VAL_P1'];
$test03_Hps = (float) getPolynomialValue($_SESSION['site401_lift_xy'],($qualDataArray[0]['SQD_VAL_Q']/60)); //wysokość ze stacji
$i=0; $j=0;
$wynik = mysql_query("select TSD_VAL_04/60 PEP_X_PARAM, TSD_VAL_14 PEP_Y_PARAM from tst_tests left join tst_test_details on TSD_TST_ID=TST_ID where TST_ID=".$_SESSION['well_details']['testID']." order by TSD_MSR_STEP");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$_SESSION['site401_pe_xy'][$i][$j] = (float) $r["PEP_X_PARAM"];
$j++;
$_SESSION['site401_pe_xy'][$i][$j] = (float) $r["PEP_Y_PARAM"];
$i++; $j=0;
}
$test04_Pes = (float) getPolynomialValue($_SESSION['site401_pe_xy'],($qualDataArray[0]['SQD_VAL_Q']/60)); //moc ze stacji
// =========================================================================================================================================
// TEST - 1
if ( $test01_Hp > (1.07 * $test01_Hp_1) || $test01_Hp < (0.9*$test01_Hp_1) )
{
$isOdstaja = true;
$isTest01 = true;
$lista_testy .= "<br/>- Ciśnienie PP";
}
// TEST - 2
// elseif ( $test02_Hsl > (1.15*$test01_Hsl_1) || $test02_Hsl < (0.9*$test01_Hsl_1) )
// {
// $isOdstaja = true;
// $lista .= "<br/>- Ciśnienie PP";
// }
// TEST - 3
elseif ( $test01_Hp > (1.07*$test03_Hps) || $test01_Hp < (0.91*$test03_Hps) )
{
$isOdstaja = true;
$lista_testy .= "<br/>- Wysokość podnoszenia na Stacji Prób";
}
// TEST - 3
if (!$isTest01 && ($qualDataArray[0]['SQD_VAL_PE'] > (1.07*$test04_Pes) || $qualDataArray[0]['SQD_VAL_PE']<(0.9*$test04_Pes)))
{
$isOdstaja = true;
$lista_testy .= "<br/>- Moc czynna Pe";
}
elseif ($isTest01 && ($qualDataArray[0]['SQD_VAL_PE'] > (1.07*$test04_Pes) || $qualDataArray[0]['SQD_VAL_PE']<(0.9*$test04_Pes)))
{
$isOdstaja = true;
$lista_testy .= "<br/>- Wydajność Q";
}
if ($isOdstaja)
$lista_testy = "<br/><br/>Szczególna uwaga:".$lista_testy;
echo "test01_Hp: ".$test01_Hp."<br>";
echo "test01_Hp_1: ".$test01_Hp_1."<br>";
echo "test02_Hsl: ".$test02_Hsl."<br>";
echo "test01_Hsl_1: ".$test01_Hsl_1."<br>";
echo "test03_Hps: ".$test03_Hps."<br>";
echo "SQD_VAL_PE: ".$qualDataArray[0]['SQD_VAL_PE']."<br>";
echo "test04_Pes: ".$test04_Pes."<br>";
echo "SQD_VAL_Q m3/h: ".$qualDataArray[0]['SQD_VAL_Q']."<br>";
echo "SQD_VAL_Q m3/s: ".($qualDataArray[0]['SQD_VAL_Q']/3600)."<br>";
echo "DrVal: ".$_SESSION['well_details']['DrVal']."<br>";
echo "test01_Ct: ".$test01_Ct."<br>";
echo "test01_F: ".$test01_F."<br>";
echo "SQD_VAL_PP: ".$qualDataArray[0]['SQD_VAL_PP']."<br>";
echo "SQD_VAL_P1: ".$qualDataArray[0]['SQD_VAL_P1']."<br>";
}*/
// tsty na szybko
if (!empty($qualDataArray) && $qualDataArray[0]['SQD_VAL_ONOFF']==1)
{
$isOdstaja = false;
$isTest01 = false;
$test_Hp = (float) $qualDataArray[0]['SQD_VAL_PP'] - $qualDataArray[0]['SQD_VAL_HH'];
$test_Hps = (float) getPolynomialValue($_SESSION['site401_lift_xy'],($qualDataArray[0]['SQD_VAL_Q']/60)); //wysokość ze stacji
$i=0; $j=0;
$wynik = mysql_query("select TSD_VAL_04/60 PEP_X_PARAM, TSD_VAL_14 PEP_Y_PARAM from tst_tests left join tst_test_details on TSD_TST_ID=TST_ID where TST_ID=".$_SESSION['well_details']['testID']." order by TSD_MSR_STEP");
if($wynik)while ($r = mysql_fetch_array($wynik))
{
$_SESSION['site401_pe_xy'][$i][$j] = (float) $r["PEP_X_PARAM"];
$j++;
$_SESSION['site401_pe_xy'][$i][$j] = (float) $r["PEP_Y_PARAM"];
$i++; $j=0;
}
$test_Pes = (float) getPolynomialValue($_SESSION['site401_pe_xy'],($qualDataArray[0]['SQD_VAL_Q']/60)); //moc ze stacji
// test na wysokość podnoszenia
if ( $test_Hp < (0.85*$test_Hps) || $test_Hp > (1.05*$test_Hps) )
{
$isOdstaja = true;
$lista_testy .= "<br/>- Ciśnienie PP - Należy sprawdzić zakresy pomiarowe w [Stan &raquo; Stan studni &raquo; Zakresy pomiarowe dla powiązanych urządzeń]";
$lista_testy .= "<br/>- Wysokość HH - Należy sprawdzić zakresy pomiarowe w [Stan &raquo; Stan studni &raquo; Zakresy pomiarowe dla powiązanych urządzeń]";
}
// test na moc czynną
if ( $qualDataArray[0]['SQD_VAL_PE'] < (0.8*$test_Pes) || $qualDataArray[0]['SQD_VAL_PE'] > (1.2*$test_Pes) )
{
$isOdstaja = true;
$lista_testy .= "<br/>- Moc czynna Pe";
}
if ($isOdstaja)
$lista_testy = "<br/><br/>Szczególna uwaga:".$lista_testy;
/*
echo "test_Hp: ".$test_Hp."<br/>";
echo "test_Hps: ".$test_Hps."<br/>";
echo "SQD_VAL_PE: ".$qualDataArray[0]['SQD_VAL_PE']."<br/>";
echo "test_Pes: ".$test_Pes."<br/>";
*/
}
// =========================================================================================================================================
// =========================================================================================================================================
//sprawdza, czy dane nie są danymi niewiarygodnymi - jeśli tak, wyświetla komunikat
if (!empty($qualDataArray) && $qualDataArray[0]['SQD_VAL_ONOFF']==1 && ($qualDataArray[0]['SQD_FLG_Q']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_P1']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_P2']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_PE']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_PP']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_HH']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_HD']<>'CORRECT' || $qualDataArray[0]['SQD_VAL_Q']<=0 || $qualDataArray[0]['SQD_VAL_P1']<=0 || $qualDataArray[0]['SQD_VAL_P2']<=0 || $qualDataArray[0]['SQD_VAL_PE']<=0 || $qualDataArray[0]['SQD_VAL_PP']<=0 || $qualDataArray[0]['SQD_VAL_HH']<=0 || $qualDataArray[0]['SQD_VAL_HD']<=0))
{
if ($qualDataArray[0]['SQD_FLG_Q']<>'CORRECT')
$lista .= "- Wydajność Q <br>";
if ($qualDataArray[0]['SQD_FLG_P1']<>'CORRECT')
$lista .= "- Ciśnienie P1 <br>";
if ($qualDataArray[0]['SQD_FLG_P2']<>'CORRECT')
$lista .= "- Ciśnienie P2 <br>";
if ($qualDataArray[0]['SQD_FLG_PE']<>'CORRECT')
$lista .= "- Moc czynna Pe <br>";
if ($qualDataArray[0]['SQD_FLG_PP']<>'CORRECT')
$lista .= "- Ciśnienie PP - Należy sprawdzić zakresy pomiarowe w [Stan &raquo; Stan studni &raquo; Zakresy pomiarowe dla powiązanych urządzeń]<br>";
if ($qualDataArray[0]['SQD_FLG_HH']<>'CORRECT')
$lista .= "- Wysokość HH - Należy sprawdzić zakresy pomiarowe w [Stan &raquo; Stan studni &raquo; Zakresy pomiarowe dla powiązanych urządzeń]<br>";
if ($qualDataArray[0]['SQD_FLG_HD']<>'CORRECT')
$lista .= "- Zwierciadło dynamiczne HD <br>";
$lista .= "- Napięcie zasilania U<br>";
$lista .= "- Pobór energii E<br>";
$lista .= "- Pobór prądu I<br>";
if ($qualDataArray[0]['SQD_FLG_Q']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_P2']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_PP']<>'CORRECT' || $qualDataArray[0]['SQD_FLG_PE']<>'CORRECT' || $qualDataArray[0]['SQD_VAL_Q']<=0 || $qualDataArray[0]['SQD_VAL_P2']<=0 || $qualDataArray[0]['SQD_VAL_PE']<=0 || $qualDataArray[0]['SQD_VAL_PP']<=0)
{
echo"<div class='actionERROR'>
Dane z systemu SYNDIS zostały przekazane jako niewiarygodne lub niepoprawne.<br/>Należy zweryfikować parametry:<br/>
".$lista."<br/><br/>Brak poprawnej oceny!
</div>";
if (file_exists( $fileName0)) unlink($fileName0);
pumpImageGreyBell($fileName0);
}
else
echo"<div class='actionWARNING'>
Dane z systemu SYNDIS zostały przekazane jako niewiarygodne lub niepoprawne.<br/>Należy zweryfikować parametry:<br/>
".$lista."<br/><br/>Ocena przybliżona!
</div>";
}
elseif (!empty($qualDataArray) && $isOdstaja)
{
echo"<div class='actionERROR'>
Algorytm modelu oceny przekazał do weryfikacji parametry.<br/><br/>
Należy sprawdzić poprawność:<br/>
1. Parametrów technicznych studni.<br/>
2. Parametrów pracy studni i układu pompowego.<br/>
3. Konfigurację zakresów pomiarowych dla powiązanych urządzeń [Stan &raquo; Stan studni &raquo; Zakresy pomiarowe dla powiązanych urządzeń].
".$lista_testy."<br/><br/>Brak poprawnej oceny!
</div>";
if (file_exists( $fileName0)) unlink($fileName0);
pumpImageGreyBell($fileName0);
}
// =========================================================================================================================================
// =========================================================================================================================================
?>
<div class="tag50_left">
<div class="head_tag"><?php echo $lab_Tag_site301_004." - ".$_SESSION['well_details']['wellName'];?></div>
<div class="tag_center">
<a href="?pg=site401inf&dev=<?php echo $_GET['dev']?>"><img SRC="<?php echo $fileName; ?>" border="0"></a>
</div>
<div class="head_tag"><?php echo $lab_Tag_site401_005 ;?></div>
<div class="tag">
<TABLE class="desc_val">
<TR>
<TD class="desc"><?php echo $lab_Field_site401_005; ?></TD>
<TD class="<?php echo $Evaluation4_q['grid_style']; ?>"><?php echo $Evaluation4_q['grid_text']; ?></TD>
<TD CLASS="desc_value" style="max-width: 40px; text-align: center;" rowspan="4">
<a href="?pg=site401mhis&dev=<?php echo$_GET['dev']; ?>"><img SRC="<?php echo $fileName0; ?>" border="0"></a>
</TD>
</TR>
<TR>
<TD class="desc"><?php echo $lab_Field_site401_009; ?></TD>
<TD class="<?php echo $Evaluation4_HfQ['grid_style']; ?>"><?php echo $Evaluation4_HfQ['grid_text']; ?></TD>
</TR>
<TR>
<TD class="desc"><?php echo $lab_Field_site401_012; ?></TD>
<TD class="<?php echo $Evaluation4_Throt['grid_style']; ?>"><?php echo $Evaluation4_Throt['grid_text']; ?></TD>
</TR>
<TR>
<TD class="desc"><?php echo $lab_Field_site401_015; ?></TD>
<TD class="<?php echo $Evaluation4_LineLoss['grid_style']; ?>"><?php echo $Evaluation4_LineLoss['grid_text']; ?></TD>
</TR>
</table>
</div>
</div>
<div class="tag50_right">
<div class="head_tag"><?php echo $lab_Tag_site203_004 ;?></div>
<div class="tag_center">
<?php
if ($_SESSION['well_details']['testID']>0 && ($_SESSION['well_details']['wellTypeID']==18 || $_SESSION['well_details']['wellTypeID']==19))
echo"<a href='?pg=site401lift&t=".$_SESSION['well_details']['testID']."&d=".$_SESSION['well_details']['devID']."&q=".$qParam."&hp=".$HPparam."'><img SRC=$fileName1></a>";
elseif ($_SESSION['well_details']['testID']>0 && $_SESSION['well_details']['wellTypeID']==20)
echo"<img SRC=$fileName1>";
else
echo $lab_Field_site203_017;
?>
</div>
<div class="head_tag"><?php echo $lab_Tag_site203_005 ;?></div>
<div class="tag_center">
<?php
if ($_SESSION['well_details']['testID']>0)
echo"<img SRC=$fileName2>";
else
echo $lab_Field_site203_017;
?>
</div>
<?php
$workStatusArray = sqlGetResAsArray("select DRD_VALUE,DRD_DESCRIPTION,(select DIC_POL_LANG from sys_dictionaries where DIC_ID=DRD_DESCRIPTION limit 1) DRD_DESC from seg_dev_resources_det where DRD_AUDIT_DATE=(select max(DRD_AUDIT_DATE) from seg_dev_resources_det where DRD_RESOURCES_DETAIL=507 and DRD_DRS_ID=".$_SESSION['well_details']['devID'].") and DRD_RESOURCES_DETAIL=507 and DRD_DRS_ID=".$_SESSION['well_details']['devID']." limit 1");
//$well_work_status = getLastValueFromDevResourceDetail('WELL_STATUSES','ON_OFF',$_SESSION['well_details']['devID']);
if ($workStatusArray[0]['DRD_VALUE']=="ON")
{
$imgONOFF_g = "./images/green_ONOFF_ON.png";
$imgONOFF_r = "./images/red_ONOFF.png";
$stringONOFF = "Stan pracy - Załączona";
if (!empty($_SESSION['site401_well_onoff']))
$btmAcction = '
<img style="padding: 9px;" src="./images/green_ONOFF_ON.png">
<a href="./?pg=site401Eonf&dev='.$_SESSION['well_details']['devID'].'&pa=off"><img style="padding: 9px;" src="./images/red_ONOFF.png" title="Wyłącz pompe"></a>
';
else
$btmAcction = '
<img style="padding: 9px;" src="./images/green_ONOFF_ON.png">
<img style="padding: 9px;" src="./images/red_ONOFF.png">
';
}
else
{
$imgONOFF_g = "./images/green_ONOFF.png";
$imgONOFF_r = "./images/red_ONOFF_OFF.png";
$stringONOFF = "Stan pracy - Wyłączona";
if (!empty($_SESSION['site401_well_onoff']))
$btmAcction = '
<a href="./?pg=site401Eonf&dev='.$_SESSION['well_details']['devID'].'&pa=on"><img style="padding: 9px;" src="./images/green_ONOFF.png" title="Załącz pompe"></a>
<img style="padding: 9px;" src="./images/red_ONOFF_OFF.png">
';
else
$btmAcction = '
<img style="padding: 9px;" src="./images/green_ONOFF.png">
<img style="padding: 9px;" src="./images/red_ONOFF_OFF.png">
';
}
?>
<div class="head_tag"><?php echo $stringONOFF ;?></div>
<div class="tag_center">
<?php echo $btmAcction; ?>
<?php
if ($workStatusArray[0]['DRD_DESCRIPTION']>0)
echo"<br/>Powód: <i><b><a style='text-decoration: none;' href='./?pg=site401Eonf&dev=".$_SESSION['well_details']['devID']."&pa=reson'>".$workStatusArray[0]['DRD_DESC']."</a></b></i>";
elseif ($workStatusArray[0]['DRD_VALUE']!="ON" && empty($workStatusArray[0]['DRD_DESCRIPTION']))
echo"<br/><a style='text-decoration: none; color: #ff0000;' href='./?pg=site401Eonf&dev=".$_SESSION['well_details']['devID']."&pa=reson'>Kliknij, aby wprowadzić przyczynę wyłączenia</a>";
?>
</div>
<div class=tag_ChemicalButtons>
<a href='?pg=site401inf&dev=<?php echo $_SESSION['well_details']['devID']; ?>'><INPUT class='well_extra_button' TYPE='BUTTON' VALUE='Parametry pracy układu'></A>
</div>
</div>
<?php
}
else showFooterWarningAccessNotification($lab_FooterWarningAccessNotification_001);
?>