Q2 correction calculation and Q2CorrectionCheck activity modifications, ver. 2.18.1187
This commit is contained in:
@@ -2016,6 +2016,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
|
||||
double targetError = ihead.CalibTarget;
|
||||
Byte q2CorrRL = 0;
|
||||
Byte q2CorrLR = 0;
|
||||
///
|
||||
@@ -2024,7 +2025,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
///
|
||||
/// Standard process
|
||||
///
|
||||
if (Math.Abs(q2adjResult.Error) <= 0.5)
|
||||
if (Math.Abs(q2adjResult.Error - targetError) <= 0.5)
|
||||
{
|
||||
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
|
||||
return CommErr.None;
|
||||
@@ -2062,7 +2063,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.RL) /// SUEZ
|
||||
{
|
||||
if (Math.Abs(q2adjResult.Error) <= 0.5)
|
||||
if (Math.Abs(q2adjResult.Error - targetError) <= 0.5)
|
||||
{
|
||||
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
|
||||
return CommErr.None;
|
||||
@@ -2072,7 +2073,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.LR) /// SUEZ
|
||||
{
|
||||
if (Math.Abs(q2adjResult.Error) <= 0.5)
|
||||
if (Math.Abs(q2adjResult.Error - targetError) <= 0.5)
|
||||
{
|
||||
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
|
||||
return CommErr.None;
|
||||
@@ -2086,10 +2087,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
q2CorrLR = (byte)((int)Math.Round(q2Correction2) & 0x000000FF);
|
||||
}
|
||||
|
||||
if (OpenPort(threadId, ihead) != 0) return CommErr.OpenPort; /// Open RFID port
|
||||
|
||||
///
|
||||
/// Write calculated Q2 correction factors into the water meter
|
||||
///
|
||||
if (OpenPort(threadId, ihead) != 0) return CommErr.OpenPort; /// Open RFID port
|
||||
CommErr error = CommErr.Write;
|
||||
|
||||
if (q2CorrType == Q2CorrType.RL)
|
||||
{
|
||||
///
|
||||
@@ -2163,7 +2166,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
///
|
||||
/// Update WaterMeter entity and IperlHead
|
||||
///
|
||||
if (error == CommErr.None)
|
||||
{
|
||||
if (q2CorrType == Q2CorrType.RL)
|
||||
|
||||
@@ -422,10 +422,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
else
|
||||
{
|
||||
/// iPerl with Q2 correction
|
||||
meterRslt.VolumeStart = 0;
|
||||
/// iPerl with Q2 correction => generate an artificial error equal to -1/10 of the original one (relative to target error)
|
||||
double targetError = iPerl.CalibTarget;
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = 0;
|
||||
meterRslt.Error = -1 / 10 * iPerl.Q2ErrWOCorrection;
|
||||
meterRslt.Error = targetError - 0.1 * (oriMeterRslt.Error - targetError);
|
||||
meterRslt.VolumeMeter = (100.0 + meterRslt.Error / 100.0) * oriMeterRslt.VolumeRef;
|
||||
meterRslt.Passed = true;
|
||||
meterRslt.TestDone = true;
|
||||
@@ -555,22 +556,20 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
meterRslt.TestDone = meterRsltQ2ac.TestDone;
|
||||
tstRslt.TestDone = true;
|
||||
|
||||
double errorTarget = 0;
|
||||
double targetError = 0;
|
||||
if ((sensPath != null) && (sensPath.RegisterReaders != null) && (sensPath.RegisterReaders.Length > i) && (sensPath.RegisterReaders[i] is iPerlHead.IperlHead))
|
||||
{
|
||||
errorTarget = (sensPath.RegisterReaders[i] as iPerlHead.IperlHead).CalibTarget;
|
||||
targetError = (sensPath.RegisterReaders[i] as iPerlHead.IperlHead).CalibTarget;
|
||||
}
|
||||
|
||||
if (((meterRsltQ2bc.Error < errorTarget - 0.5) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
|
||||
((meterRsltQ2bc.Error > errorTarget + 0.5) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
|
||||
if ((((meterRsltQ2bc.Error - targetError) < -0.51) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
|
||||
(((meterRsltQ2bc.Error - targetError) > +0.51) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
|
||||
{
|
||||
/// Q2 correction check failed
|
||||
meterRslt.Passed = false;
|
||||
meterRslt.Passed = false; /// Q2 correction check failed
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Q2 correction check passed
|
||||
meterRslt.Passed = meterRsltQ2ac.Passed;
|
||||
meterRslt.Passed = true; /// Q2 correction check passed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
public double PulsesPerLtr { get { return 1000.0; } }
|
||||
public double LtrsPerPulse { get { return 1 / PulsesPerLtr; } }
|
||||
|
||||
public float CalibTarget { get { return iperlHeadCfg.ProcParams.CalibTarget; } }
|
||||
public double CalibTarget { get { return iperlHeadCfg.ProcParams.CalibTarget; } }
|
||||
public ushort FactorLimitLo { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitLo; } }
|
||||
public ushort FactorLimitHi { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitHi; } }
|
||||
public Counting InitFlowDir { get { return (iperlHeadCfg != null && iperlHeadCfg.ProcParams != null) ? iperlHeadCfg.ProcParams.Counting : Counting.Arbitrary; } }
|
||||
@@ -239,7 +239,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt q2adjResult, double nominalFlow, int currentFactor = 0)
|
||||
{
|
||||
double nominalTestFlowLph = Config.Units.ConvertTo(Config.Unit.lph, nominalFlow);
|
||||
double volumeRefShiftedToTarget = q2adjResult.VolumeRef * (1.0f + CalibTarget / 100.0f);
|
||||
double volumeRefShiftedToTarget = q2adjResult.VolumeRef * (1.0 + CalibTarget / 100.0);
|
||||
double q2adjErrorShiftedToTarget = Config.Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, volumeRefShiftedToTarget);
|
||||
|
||||
double A = 16.0 / ScalingFactor(); /// Raw units per ml: DN15=16, DN20=8, DN25=4, DN32=2, DN40=1
|
||||
|
||||
Reference in New Issue
Block a user