iPerlCommunicationForm : wm.PassedFromTests() => q2adjResult/2/.Passed, limits for Q2 corr. from the iPerlComm test, ver. 2.26.1728
This commit is contained in:
parent
9ecba98b4c
commit
f5e5d1fd0c
@ -2119,19 +2119,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
static CommErr CalculateAndWriteQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm,
|
||||
Test test, ref string resultStr, Q2CorrType q2CorrType, string restOfLine)
|
||||
{
|
||||
if ((q2CorrType == Q2CorrType.ConditionalUpdate || q2CorrType == Q2CorrType.ConditionalUpdateRL || q2CorrType == Q2CorrType.ConditionalUpdateLR)
|
||||
&& wm.PassedFromTests())
|
||||
{
|
||||
resultStr = string.Format("No Q2 correction update (iPerl is OK)");
|
||||
return CommErr.None; /// No Q2 correction when doing conditional update and WM passed
|
||||
}
|
||||
|
||||
string[] args = new string[0];
|
||||
if (!string.IsNullOrEmpty(restOfLine))
|
||||
{
|
||||
args = restOfLine.Split(new char[] { ' ' });
|
||||
}
|
||||
|
||||
var args = string.IsNullOrEmpty(restOfLine) ? new string[0] : restOfLine.Split(new char[] { ' ' });
|
||||
|
||||
Results.Entities.MeterTestRslt q2adjResult; /// The only test or the 1st test (the test in R-L direction)
|
||||
Results.Entities.TestData q2adjTestData;
|
||||
@ -2222,13 +2210,47 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
|
||||
if (q2adjResult == null)
|
||||
if (q2adjResult == null ||
|
||||
((q2CorrType == Q2CorrType.Update || q2CorrType == Q2CorrType.ConditionalUpdate) && q2adjResult2 == null))
|
||||
{
|
||||
return CommErr.MissingTest; /// This should never happen
|
||||
return CommErr.MissingTest; /// Procedure configuration error
|
||||
}
|
||||
if ((q2CorrType == Q2CorrType.Update || q2CorrType == Q2CorrType.ConditionalUpdate) && (q2adjResult2 == null))
|
||||
|
||||
|
||||
if ((q2CorrType == Q2CorrType.ConditionalUpdate && q2adjResult.Passed && q2adjResult2.Passed) ||
|
||||
((q2CorrType == Q2CorrType.ConditionalUpdateRL || q2CorrType == Q2CorrType.ConditionalUpdateLR) && q2adjResult.Passed))
|
||||
{
|
||||
return CommErr.MissingTest; /// This should never happen, 2 test names required as activity arguments
|
||||
resultStr = string.Format("No Q2 correction update");
|
||||
rfidDataLogger.InfoFormat("{0}({1}): No Q2 correction update", ihead.Name, ihead.SerialNr);
|
||||
return CommErr.None; /// No Q2 correction when doing conditional update and WM passed
|
||||
}
|
||||
|
||||
|
||||
double errLimitLo = test.ErrLimLo + test.Uncertainty;
|
||||
double errLimitHi = test.ErrLimHi - test.Uncertainty;
|
||||
///
|
||||
if (q2adjResult.Error < errLimitLo || errLimitHi < q2adjResult.Error ||
|
||||
(q2adjResult2 != null && (q2adjResult2.Error < errLimitLo || errLimitHi < q2adjResult2.Error)))
|
||||
{
|
||||
/// At least one of Q2 errors is out of range for Q2 correction
|
||||
log.WarnFormat("OoR => no Q2 correction: Pos={0}, PCB#={1}, ***Q2_RL err={2}%***, ***Q2_LR err={3}%***, CalTarget={4}%, [Lo={5}%, Hi={6}%]",
|
||||
ihead.Name,
|
||||
ihead.SerialNr,
|
||||
q2adjResult.Error.ToString("F2"),
|
||||
q2adjResult2 != null ? q2adjResult2.Error.ToString("F2") : string.Empty,
|
||||
ihead.CalibTargetQ2.ToString("F1"),
|
||||
errLimitLo.ToString("F2"),
|
||||
errLimitHi.ToString("F2"));
|
||||
|
||||
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
|
||||
rfidDataLogger.InfoFormat("{0}({1}): Q2 error ({2},{3}) is out of range ({4}..{5}) => Failed",
|
||||
ihead.Name,
|
||||
ihead.SerialNr,
|
||||
q2adjResult.Error.ToString("F2"),
|
||||
q2adjResult2 != null ? q2adjResult2.Error.ToString("F2") : string.Empty,
|
||||
errLimitLo.ToString("F2"),
|
||||
errLimitHi.ToString("F2"));
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
|
||||
|
||||
@ -2240,104 +2262,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
///
|
||||
if (q2CorrType == Q2CorrType.Update || q2CorrType == Q2CorrType.ConditionalUpdate)
|
||||
{
|
||||
/// Update or ConditionalUpdate: 1. Calculate updates, not corrections, 2. Use error limits from this test
|
||||
double errLimitLo = test.ErrLimLo + test.Uncertainty;
|
||||
double errLimitHi = test.ErrLimHi - test.Uncertainty;
|
||||
|
||||
if (errLimitLo <= q2adjResult.Error && q2adjResult.Error <= errLimitHi &&
|
||||
errLimitLo <= q2adjResult2.Error && q2adjResult2.Error <= errLimitHi)
|
||||
{
|
||||
/// Calculate updated Q2 correction factors
|
||||
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
|
||||
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult2, ihead.CalibTargetQ2, q2adjTestData2.Qfrom, q2adjResult2.Q2CorrLR);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// At least one of Q2 errors is out of range for Q2 correction
|
||||
/// Q2 error is out of range for the Q2 correction
|
||||
log.WarnFormat("OoR => no Q2 correction: Pos={0}, PCB#={1}, ***Q2_RL err={2}%***, ***Q2_LR err={3}%***, CalTarget={4}%, [Lo={5}%, Hi={6}%]",
|
||||
ihead.Name,
|
||||
ihead.SerialNr,
|
||||
q2adjResult.Error.ToString("F2"),
|
||||
q2adjResult2.Error.ToString("F2"),
|
||||
ihead.CalibTargetQ2.ToString("F1"),
|
||||
errLimitLo.ToString("F1"),
|
||||
errLimitHi.ToString("F1"));
|
||||
|
||||
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestRLDir)
|
||||
{
|
||||
/// Regular Q2 corrections: 1. Use error limits from 'q2adjResult'
|
||||
double errLimitLo = q2adjTestData.ErrLimLo + q2adjTestData.ErrLimMargin;
|
||||
double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.ErrLimMargin;
|
||||
|
||||
if (errLimitLo <= q2adjResult.Error && q2adjResult.Error <= errLimitHi)
|
||||
{
|
||||
/// Calculate updated Q2 correction factors
|
||||
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// At least one of Q2 errors is out of range for Q2 correction
|
||||
/// Q2 error is out of range for the Q2 correction
|
||||
log.WarnFormat("OoR => no Q2 correction: Pos={0}, PCB#={1}, ***Q2_RL err={2}%***, ***Q2_LR err={3}%***, CalTarget={4}%, [Lo={5}%, Hi={6}%]",
|
||||
ihead.Name, ihead.SerialNr, q2adjResult.Error.ToString("F2"), q2adjResult2.Error.ToString("F2"),
|
||||
ihead.CalibTargetQ2.ToString("F1"), errLimitLo.ToString("F1"), errLimitHi.ToString("F1"));
|
||||
|
||||
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestLRDir)
|
||||
{
|
||||
/// Regular Q2 corrections: 1. Use error limits from 'q2adjResult'
|
||||
double errLimitLo = q2adjTestData.ErrLimLo + q2adjTestData.ErrLimMargin;
|
||||
double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.ErrLimMargin;
|
||||
|
||||
if (errLimitLo <= q2adjResult.Error && q2adjResult.Error <= errLimitHi)
|
||||
{
|
||||
/// Calculate updated Q2 correction factors
|
||||
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// At least one of Q2 errors is out of range for Q2 correction
|
||||
/// Q2 error is out of range for the Q2 correction
|
||||
log.WarnFormat("OoR => no Q2 correction: Pos={0}, PCB#={1}, ***Q2_RL err={2}%***, ***Q2_LR err={3}%***, CalTarget={4}%, [Lo={5}%, Hi={6}%]",
|
||||
ihead.Name, ihead.SerialNr, q2adjResult.Error.ToString("F2"), q2adjResult2.Error.ToString("F2"),
|
||||
ihead.CalibTargetQ2.ToString("F1"), errLimitLo.ToString("F1"), errLimitHi.ToString("F1"));
|
||||
|
||||
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
/// Calculate two Q2 correction factors from two tests done in both directions
|
||||
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
|
||||
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult2, ihead.CalibTargetQ2, q2adjTestData2.Qfrom, q2adjResult2.Q2CorrLR);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Regular Q2 corrections: 1. Use error limits from 'q2adjResult'
|
||||
double errLimitLo = q2adjTestData.ErrLimLo + q2adjTestData.ErrLimMargin;
|
||||
double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.ErrLimMargin;
|
||||
|
||||
if ((errLimitLo <= q2adjResult.Error) && (q2adjResult.Error <= errLimitHi))
|
||||
{
|
||||
/// Calculate Q2 correction factor (assuming it was 0 when doing a test)
|
||||
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
|
||||
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Q2 error is out of range for Q2 correction
|
||||
log.WarnFormat("OoR => no Q2 correction: Pos={0}, PCB#={1}, ***Q2adj err={2}%***, CalTarget={3}%, [Lo={4}%, Hi={5}%]",
|
||||
ihead.Name, ihead.SerialNr, q2adjResult.Error.ToString("F2"),
|
||||
ihead.CalibTargetQ2.ToString("F1"), errLimitLo.ToString("F1"), errLimitHi.ToString("F1"));
|
||||
|
||||
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
/// Calculate Q2 correction factors from a single test
|
||||
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
|
||||
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR);
|
||||
}
|
||||
|
||||
|
||||
int q2CorrRL = 0;
|
||||
int q2CorrLR = 0;
|
||||
///
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.26.1725.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1725.0")]
|
||||
[assembly: AssemblyVersion("2.26.1728.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1728.0")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user