iPerlCommmunication : New Q2 correction for Australia.

This commit is contained in:
Milan Hanajik
2021-03-30 11:36:01 +02:00
parent b8eaaeb64c
commit c472bfc99d
3 changed files with 65 additions and 20 deletions
@@ -80,6 +80,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public const string WriteQ2CorrectionGreeceIncl05Str = "Write_Q2_correction_Greece_incl.-0,5..0,5%"; /// Arguments: test_name
public const string WriteQ2CorrectionRLIncl05Str = "Write_Q2_correction_R-L_incl.-0,5..0,5%"; /// Arguments: test_name
public const string WriteQ2CorrectionLRIncl05Str = "Write_Q2_correction_L-R_incl.-0,5..0,5%"; /// Arguments: test_name
public const string UpdateBothQ2FactorsTestRLOnlyStr = "Update_both_Q2_factors_Test_RL_only"; /// No arguments
public const string UpdateBothQ2FactorsTestLROnlyStr = "Update_both_Q2_factors_Test_LR_only"; /// No arguments
public const string UpdateQ2CorrectionsStr = "Update Q2 corrections"; /// Arguments: R-L_test_name L-R_test_name
public const string ConditnlUpdateQ2CorrectionsStr = "Conditional update of Q2 corrections"; /// Arguments: R-L_test_name L-R_test_name
public const string Reset2HzCorrectionStr = "Reset 2Hz correction";
@@ -870,6 +872,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionGreeceIncl05Str.ToLower()))error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece_incl_05, currentActivity.Substring(WriteQ2CorrectionGreeceIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionRLIncl05Str.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL_incl_05, currentActivity.Substring(WriteQ2CorrectionRLIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(WriteQ2CorrectionLRIncl05Str.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR_incl_05, currentActivity.Substring(WriteQ2CorrectionLRIncl05Str.Length).Trim());
else if (currentActivity.ToLower().Contains(UpdateBothQ2FactorsTestRLOnlyStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestRLDir, null);
else if (currentActivity.ToLower().Contains(UpdateBothQ2FactorsTestLROnlyStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestLRDir, null);
else if (currentActivity.ToLower().Contains(UpdateQ2CorrectionsStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Update, currentActivity.Substring(UpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrectionsStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdate, currentActivity.Substring(ConditnlUpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower() == Reset2HzCorrectionStr.ToLower()) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
@@ -2169,9 +2173,7 @@ 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;
@@ -2187,13 +2189,58 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// 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"));
ihead.Name, ihead.SerialNr, q2adjResult.Error.ToString("F2"), q2adjResult2.Error.ToString("F2"),
ihead.CalibTargetQ2.ToString("F1"), errLimitLo.ToString("F1"), errLimitHi.ToString("F1"));
ihead.Q2CorrRL = wm.Q2CorrRL;
ihead.Q2CorrLR = wm.Q2CorrLR;
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, wm.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"));
ihead.Q2CorrRL = wm.Q2CorrRL;
ihead.Q2CorrLR = wm.Q2CorrLR;
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, wm.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"));
ihead.Q2CorrRL = wm.Q2CorrRL;
ihead.Q2CorrLR = wm.Q2CorrLR;
@@ -2203,9 +2250,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
else
{
///
/// Regular Q2 corrections: 1. Use error limits from 'q2adjResult'
///
double errLimitLo = q2adjTestData.ErrLimLo + q2adjTestData.ErrLimMargin;
double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.ErrLimMargin;
@@ -2218,12 +2263,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
/// 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"));
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;
@@ -2233,7 +2274,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
Byte q2CorrRL = 0;
Byte q2CorrLR = 0;
///
if (q2CorrType == Q2CorrType.Standard || q2CorrType == Q2CorrType.Standard_incl_05)
if (q2CorrType == Q2CorrType.Standard || q2CorrType == Q2CorrType.Standard_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestRLDir)
{
///
/// Standard process
@@ -2262,7 +2303,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
q2CorrRL = (byte)((int)Math.Round(1.1 * q2Correction) & 0x000000FF);
q2CorrLR = (byte)((int)Math.Round(1.1 * q2Correction) & 0x000000FF);
}
else if (q2CorrType == Q2CorrType.Greece || q2CorrType == Q2CorrType.Greece_incl_05)
else if (q2CorrType == Q2CorrType.Greece || q2CorrType == Q2CorrType.Greece_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestLRDir)
{
///
/// Process for Greece
@@ -68,6 +68,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLIncl05Str);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRIncl05Str);
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestRLOnlyStr);
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestLROnlyStr);
retVal.Add(iPerlCommunicationForm.UpdateQ2CorrectionsStr);
retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrectionsStr);
retVal.Add("Q2 corrected from Q2adj");
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -23,6 +23,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
LR_incl_05,
Update,
ConditionalUpdate,
UpdateBothQ2FactorsTestRLDir,
UpdateBothQ2FactorsTestLRDir,
Count,
}
}