Q2CorrectionCheck modified, ver. 2.18.1185

This commit is contained in:
Milan Hanajik 2019-04-04 14:39:16 +02:00
parent 32d560d164
commit 6a61c9400b
4 changed files with 24 additions and 31 deletions

View File

@ -1664,7 +1664,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
resultStr = "Q2 corrections successfully read";
wm.Q2CorrLR = ihead.Q2CorrLR = (int)((SByte)rdData[0]);
wm.Q2CorrRL = ihead.Q2CorrRL = (int)((SByte)rdData[1]);
ihead.Q2CorrectionDone = (ihead.Q2CorrRL != 0) || (ihead.Q2CorrLR != 0);
}
ClosePort(threadId, ihead); /// Close RFID port
@ -1709,8 +1708,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
wm.Q2CorrRL = ihead.Q2CorrRL = factorRL;
wm.Q2CorrLR = ihead.Q2CorrLR = factorLR;
ihead.Q2CorrectionDone = (factorRL != 0) || (factorLR != 0);
error = CommErr.None;
break;
}
@ -1986,7 +1983,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
errLimitLo.ToString("F1"),
errLimitHi.ToString("F1"));
ihead.Q2CorrectionDone = false;
ihead.Q2CorrRL = wm.Q2CorrRL;
ihead.Q2CorrLR = wm.Q2CorrLR;
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
@ -2001,7 +1997,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if ((errLimitLo <= q2adjResult.Error) && (q2adjResult.Error <= errLimitHi))
{
/// Calculate Q2 correction factor (assuming it was 0 when doing a test)
ihead.Q2ErrWOCorrection = q2adjResult.Error;
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjTestData.Qfrom);
}
else
@ -2015,9 +2010,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
errLimitLo.ToString("F1"),
errLimitHi.ToString("F1"));
ihead.Q2ErrWOCorrection = q2adjResult.Error;
ihead.Q2CorrectionDone = false;
ihead.Q2CorrRL = 0;
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
return CommErr.OutOfRange;
}
@ -2164,8 +2156,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rfidDataLogger.Warn(ihead.Name + ": " + resultStr);
wm.Q2ErrWOCorrection = ihead.Q2ErrorWOCorrection;
wm.Q2CorrectionDone = ihead.Q2CorrectionDone = true;
wm.Q2Correction = ihead.Q2Correction = q2Correction;
if (q2CorrType != Q2CorrType.LR) wm.Q2CorrRFlow = ihead.Q2CorrRFlow = (int)(sbyte)q2CorrRFlow;
if (q2CorrType != Q2CorrType.RL) wm.Q2CorrLFlow = ihead.Q2CorrLFlow = (int)(sbyte)q2CorrLFlow;
break;
@ -2190,9 +2180,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
rfidDataLogger.WarnFormat("{0}: {1}", ihead.Name, resultStr);
ihead.Q2CorrectionDone = true;
ihead.Q2Correction = q2Correction;
wm.Q2ErrWOCorrection = ihead.Q2ErrWOCorrection;
if ((q2CorrType != Q2CorrType.Update) && (q2CorrType != Q2CorrType.ConditionalUpdate))
{
wm.Q2ErrWOCorrection = ihead.Q2ErrWOCorrection = q2adjResult.Error;
}
if (q2CorrType != Q2CorrType.LR) wm.Q2CorrRL = ihead.Q2CorrRL = (int)(sbyte)q2CorrRL;
if (q2CorrType != Q2CorrType.RL) wm.Q2CorrLR = ihead.Q2CorrLR = (int)(sbyte)q2CorrLR;
}

View File

@ -397,9 +397,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
/// Reference to iPerl water meter or null:
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
: null;
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath != null) && (sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
: null;
if (meterRslt != null && oriMeterRslt != null)
{
@ -409,12 +409,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
meterRslt.VolumeRef = oriMeterRslt.VolumeRef;
meterRslt.TestTime = oriMeterRslt.TestTime;
if (iPerl == null ||
Math.Abs(oriMeterRslt.Error) <= 0.5f ||
oriMeterRslt.Error < oriTestRslt.ErrLimLo() + oriTestRslt.Uncertainty() ||
oriMeterRslt.Error > oriTestRslt.ErrLimHi() - oriTestRslt.Uncertainty())
if (iPerl == null || ((iPerl.Q2CorrRL == 0) && (iPerl.Q2CorrLR == 0)))
{
/// Normal meter or iPerl without correction
/// Either no iPerl head or no Q2 correction
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
meterRslt.VolumeEnd = oriMeterRslt.VolumeEnd;
meterRslt.VolumeMeter = oriMeterRslt.VolumeMeter;
@ -425,11 +422,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
else
{
/// corrected iPerl
/// iPerl with Q2 correction
meterRslt.VolumeStart = 0;
meterRslt.VolumeEnd = 0;
meterRslt.VolumeMeter = oriMeterRslt.VolumeRef;
meterRslt.Error = 0;
meterRslt.Error = -1 / 10 * iPerl.Q2ErrWOCorrection;
meterRslt.VolumeMeter = (100.0 + meterRslt.Error / 100.0) * oriMeterRslt.VolumeRef;
meterRslt.Passed = true;
meterRslt.TestDone = true;
tstRslt.TestDone = true;
@ -558,8 +555,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
meterRslt.TestDone = meterRsltQ2ac.TestDone;
tstRslt.TestDone = true;
if (((meterRsltQ2bc.Error < -0.5f) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
((meterRsltQ2bc.Error > +0.5f) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
double errorTarget = 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;
}
if (((meterRsltQ2bc.Error < errorTarget - 0.5) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
((meterRsltQ2bc.Error > errorTarget + 0.5) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
{
/// Q2 correction check failed
meterRslt.Passed = false;

View File

@ -141,8 +141,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public double Q2ErrWOCorrection;
public bool Q2CorrectionDone;
public double Q2Correction;
public int Q2CorrRL;
public int Q2CorrLR;
@ -427,8 +425,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
OrigCalibFactor = 0;
OrigCalibFactorLNA = 0;
Q2ErrWOCorrection = 0;
Q2CorrectionDone = false;
Q2CorrRL = 0;
Q2CorrLR = 0;
optoDataCount = 0;

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1184.0")]
[assembly: AssemblyFileVersion("2.18.1184.0")]
[assembly: AssemblyVersion("2.18.1185.0")]
[assembly: AssemblyFileVersion("2.18.1185.0")]