iPerl flow direction determination, saved into Oracle DB.
This commit is contained in:
parent
8a0411bd92
commit
a01f99fa7e
@ -544,6 +544,16 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
}
|
||||
|
||||
{
|
||||
int Q2CorrFlowRight;
|
||||
if (wMtr.CalibrationStruct.FlowArrow == WaterMeters.iPerl.FlowArrow.Left)
|
||||
{
|
||||
Q2CorrFlowRight = wMtr.PositiveCounting ? 1 : 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
Q2CorrFlowRight = wMtr.PositiveCounting ? 2 : 1;
|
||||
}
|
||||
|
||||
OracleCommand cmd = new OracleCommand("INSERT INTO VT_IP_ZAEHLER_PINDEX_PD(" +
|
||||
"VT_Fernum, Pruefindex, ANBID, WITHCORRECTION2HZ, CORRECTION2HZ, DIFF2HZ8HZ, " +
|
||||
"WITHQ2CORRECTION, ERRQ2, Q2CORRECTIONFLOWRIGHT, Q2CORRECTIONLEFT, Q2CORRECTIONRIGHT)" +
|
||||
@ -557,7 +567,7 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
parm = new OracleParameter("DIFF2HZ8HZ", OracleDbType.Double); parm.Value = 0; cmd.Parameters.Add(parm); ///:6
|
||||
parm = new OracleParameter("WITHQ2CORRECTION", OracleDbType.Int32); parm.Value = wMtr.Q2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:7
|
||||
parm = new OracleParameter("ERRQ2", OracleDbType.Double); parm.Value = wMtr.Q2ErrorWOCorrection; cmd.Parameters.Add(parm); ///:8
|
||||
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32); parm.Value = 1;/*TODO, 1=right to left*/ cmd.Parameters.Add(parm); ///:9
|
||||
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32); parm.Value = Q2CorrFlowRight;/*1=right to left*/ cmd.Parameters.Add(parm); ///:9
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = (int)Math.Round(wMtr.CurrentQ2Correction); cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = (int)Math.Round(wMtr.CurrentQ2Correction / 2); cmd.Parameters.Add(parm); ///:11
|
||||
|
||||
|
||||
@ -87,6 +87,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
}
|
||||
bool commFailed;
|
||||
|
||||
public bool PositiveCounting;
|
||||
|
||||
/// <summary> ConfigStruct of the water meter obtained or updated by iPerlCommunication </summary>
|
||||
public ConfigStruct ConfigStruct
|
||||
{
|
||||
@ -127,8 +129,11 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
OriginalCalibFactor = originalCalibrationFactor;
|
||||
|
||||
double volumeMeter = Math.Abs(VolumeLtrEnd - VolumeLtrStart);
|
||||
|
||||
if (volumeMeter > 1E-2)
|
||||
{
|
||||
PositiveCounting = VolumeLtrEnd > VolumeLtrStart;
|
||||
|
||||
UInt16 newFactor = (UInt16)((double)originalCalibrationFactor * VolumeLtrRef / volumeMeter + 0.5);
|
||||
log.InfoFormat("Calibration factor: orig={0} new={1} V_1={2} V_2={3} Vdiff={4} Vref={5}",
|
||||
originalCalibrationFactor, newFactor,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user