diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs
index 0e17ee2d5..5c2c088e4 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs
@@ -33,12 +33,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
Read4, /// 7
Write, /// 8
ReadAfterWrite, /// 9
- CmdActive, /// A = 10
- CmdTest, /// B = 11
- Verify, /// C = 12
- WrongIPerlType, /// D = 13
- OutOfRange, /// E = 14
- Q2OutOfRange, /// F = 15
+ CmdActive, /// 0AH = 10
+ CmdTest, /// 0BH = 11
+ Verify, /// 0CH = 12
+ WrongIPerlType, /// 0DH = 13
+ OutOfRange, /// 0EH = 14
+ Q2OutOfRange, /// 0FH = 15
MissingTest, /// 10H = 16
RFPowerRecordMissing, /// 11H = 17
HeadDisabledByUser, /// 12H = 18
@@ -84,6 +84,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
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 ConditnlUpdateQ2CorrRLStr = "Conditional update of Q2 correction R-L"; /// Arguments: R-L_test_name
+ public const string ConditnlUpdateQ2CorrLRStr = "Conditional update of Q2 correction L-R"; /// Arguments: L-R_test_name
public const string Reset2HzCorrectionStr = "Reset 2Hz correction";
public const string Write2HzCorrectionStr = "Write 2Hz correction";
@@ -822,20 +824,22 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
else if (currentActivity.ToLower() == ResetQ2CorrectionStr.ToLower()) error = ResetQ2Correction(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == WriteDefaultQ2CorrectionsStr.ToLower()) error = WriteDefaultQ2Corrections(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == InitOrReadQ2CorrectionsStr.ToLower()) error = InitOrReadQ2Corrections(threadID, ihead, wm, ref resultStr);
- else if (currentActivity.ToLower() == WriteQ2CorrectionStr.ToLower()) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard, null);
- else if (currentActivity.ToLower() == WriteQ2CorrectionAltStr.ToLower()) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa, null);
- else if (currentActivity.ToLower().Contains(WriteQ2CorrectionGreeceStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece, currentActivity.Substring(WriteQ2CorrectionGreeceStr.Length).Trim());
- else if (currentActivity.ToLower().Contains(WriteQ2CorrectionRLStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL, currentActivity.Substring(WriteQ2CorrectionRLStr.Length).Trim());
- else if (currentActivity.ToLower().Contains(WriteQ2CorrectionLRStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR, currentActivity.Substring(WriteQ2CorrectionLRStr.Length).Trim());
- else if (currentActivity.ToLower() == WriteQ2CorrectionIncl05Str.ToLower()) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_incl_05, null);
- else if (currentActivity.ToLower() == WriteQ2CorrectionAltIncl05Str.ToLower()) error = WriteQ2Correction(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_incl_05, null);
- 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() == WriteQ2CorrectionStr.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard, null);
+ else if (currentActivity.ToLower() == WriteQ2CorrectionAltStr.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa, null);
+ else if (currentActivity.ToLower().Contains(WriteQ2CorrectionGreeceStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece, currentActivity.Substring(WriteQ2CorrectionGreeceStr.Length).Trim());
+ else if (currentActivity.ToLower().Contains(WriteQ2CorrectionRLStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL, currentActivity.Substring(WriteQ2CorrectionRLStr.Length).Trim());
+ else if (currentActivity.ToLower().Contains(WriteQ2CorrectionLRStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR, currentActivity.Substring(WriteQ2CorrectionLRStr.Length).Trim());
+ else if (currentActivity.ToLower() == WriteQ2CorrectionIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_incl_05, null);
+ else if (currentActivity.ToLower() == WriteQ2CorrectionAltIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_incl_05, null);
+ else if (currentActivity.ToLower().Contains(WriteQ2CorrectionGreeceIncl05Str.ToLower()))error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Greece_incl_05, currentActivity.Substring(WriteQ2CorrectionGreeceIncl05Str.Length).Trim());
+ else if (currentActivity.ToLower().Contains(WriteQ2CorrectionRLIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.RL_incl_05, currentActivity.Substring(WriteQ2CorrectionRLIncl05Str.Length).Trim());
+ else if (currentActivity.ToLower().Contains(WriteQ2CorrectionLRIncl05Str.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.LR_incl_05, currentActivity.Substring(WriteQ2CorrectionLRIncl05Str.Length).Trim());
+ else if (currentActivity.ToLower().Contains(UpdateBothQ2FactorsTestRLOnlyStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestRLDir, null);
+ else if (currentActivity.ToLower().Contains(UpdateBothQ2FactorsTestLROnlyStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.UpdateBothQ2FactorsTestLRDir, null);
+ else if (currentActivity.ToLower().Contains(UpdateQ2CorrectionsStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Update, currentActivity.Substring(UpdateQ2CorrectionsStr.Length).Trim());
+ else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrectionsStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdate, currentActivity.Substring(ConditnlUpdateQ2CorrectionsStr.Length).Trim());
+ else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrRLStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdateRL, currentActivity.Substring(ConditnlUpdateQ2CorrectionsStr.Length).Trim());
+ else if (currentActivity.ToLower().Contains(ConditnlUpdateQ2CorrLRStr.ToLower())) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.ConditionalUpdateLR, currentActivity.Substring(ConditnlUpdateQ2CorrectionsStr.Length).Trim());
else if (currentActivity.ToLower() == Reset2HzCorrectionStr.ToLower()) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == Write2HzCorrectionStr.ToLower()) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr);
else if (currentActivity.ToLower() == GetDefaultQ2CorrectionsStr.ToLower()) error = GetQ2PreCorrectionsFormRest(threadID, ihead, wm, ref resultStr);
@@ -1979,17 +1983,51 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (wm.Pruefindex == 1)
{
+ int q2corrRL;
+ int q2corrLR;
if (ProcessData.IsQ2PreCorrectionCalculated)
{
- return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, ProcessData.CalculatedQ2PreCorrectionLR,
- ProcessData.CalculatedQ2PreCorrectionRL);
+ q2corrRL = ProcessData.CalculatedQ2PreCorrectionRL;
+ q2corrLR = ProcessData.CalculatedQ2PreCorrectionLR;
}
- //else
- //{
- // return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, ihead.Q2PreCorrectionLR, ihead.Q2PreCorrectionRL);
- //}
+ else
+ {
+ switch (ihead.MeterType)
+ {
+ case MeterType.DN15:
+ q2corrRL = cfg.DfltQ2c_15_rl;
+ q2corrLR = cfg.DfltQ2c_15_lr;
+ break;
+ case MeterType.DN20:
+ q2corrRL = cfg.DfltQ2c_20_rl;
+ q2corrLR = cfg.DfltQ2c_20_lr;
+ break;
+ case MeterType.DN25:
+ q2corrRL = cfg.DfltQ2c_25_63_rl;
+ q2corrLR = cfg.DfltQ2c_25_63_lr;
+ break;
+ case MeterType.DN25_Q3_10:
+ q2corrRL = cfg.DfltQ2c_25_10_rl;
+ q2corrLR = cfg.DfltQ2c_25_10_lr;
+ break;
+ case MeterType.DN32:
+ q2corrRL = cfg.DfltQ2c_32_rl;
+ q2corrLR = cfg.DfltQ2c_32_lr;
+ break;
+ case MeterType.DN40:
+ q2corrRL = cfg.DfltQ2c_40_rl;
+ q2corrLR = cfg.DfltQ2c_40_lr;
+ break;
+ default:
+ q2corrRL = 0;
+ q2corrLR = 0;
+ break;
+ }
+ }
+
+ return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, q2corrLR, q2corrRL);
}
- //else
+ else
{
return ReadQ2Correction(threadId, ihead, wm, ref resultStr);
}
@@ -2078,10 +2116,11 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// Water meter object
/// String passed to caller
/// true on success
- static CommErr WriteQ2Correction(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, Test test, ref string resultStr,
- Q2CorrType q2CorrType, string restOfLine)
+ static CommErr CalculateAndWriteQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm,
+ Test test, ref string resultStr, Q2CorrType q2CorrType, string restOfLine)
{
- if ((q2CorrType == Q2CorrType.ConditionalUpdate) && wm.PassedFromTests())
+ 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
@@ -2100,7 +2139,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (args.Length == 0)
{
/// In case of no test name argument, ihead.LastTestResult is used (if it exists)
- if ((ihead.LastTestResult == null) || !ihead.LastTestResult.TestDone) return CommErr.MissingTest;
+ if (ihead.LastTestResult == null || !ihead.LastTestResult.TestDone) return CommErr.MissingTest;
q2adjResult = ihead.LastTestResult;
q2adjTestData = q2adjResult.TestRslt.TestData;
}
@@ -2127,6 +2166,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
q2adjResult.VolumeMeter += oneMTR.VolumeMeter;
q2adjResult.VolumeRef += oneMTR.VolumeRef;
+
+ if (i == 1)
+ {
+ q2adjResult.CalibFactor = oneMTR.CalibFactor;
+ q2adjResult.CalibFactorLNA = oneMTR.CalibFactorLNA;
+ q2adjResult.Q2CorrRL = oneMTR.Q2CorrRL;
+ q2adjResult.Q2CorrLR = oneMTR.Q2CorrLR;
+ }
}
q2adjResult.Error = Config.Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, q2adjResult.VolumeRef);
@@ -2160,6 +2207,14 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
q2adjResult2.VolumeMeter += oneMTR.VolumeMeter;
q2adjResult2.VolumeRef += oneMTR.VolumeRef;
+
+ if (i == 1)
+ {
+ q2adjResult2.CalibFactor = oneMTR.CalibFactor;
+ q2adjResult2.CalibFactorLNA = oneMTR.CalibFactorLNA;
+ q2adjResult2.Q2CorrRL = oneMTR.Q2CorrRL;
+ q2adjResult2.Q2CorrLR = oneMTR.Q2CorrLR;
+ }
}
q2adjResult2.Error = Config.Formulas.ErrorFromVolumes(q2adjResult2.VolumeMeter, q2adjResult2.VolumeRef);
@@ -2183,7 +2238,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
double q2Correction = 0;
double q2Correction2 = 0; /// L-R direction in case of Q2CorrType.Update and Q2CorrType.ConditionalUpdate
///
- if ((q2CorrType == Q2CorrType.Update) || (q2CorrType == Q2CorrType.ConditionalUpdate))
+ 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;
@@ -2193,8 +2248,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
errLimitLo <= q2adjResult2.Error && q2adjResult2.Error <= errLimitHi)
{
/// Calculate updated Q2 correction factors
- q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, wm.Q2CorrRL);
- q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult2, ihead.CalibTargetQ2, q2adjTestData2.Qfrom, wm.Q2CorrLR);
+ q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
+ q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult2, ihead.CalibTargetQ2, q2adjTestData2.Qfrom, q2adjResult2.Q2CorrLR);
}
else
{
@@ -2209,8 +2264,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
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;
}
@@ -2224,7 +2277,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (errLimitLo <= q2adjResult.Error && q2adjResult.Error <= errLimitHi)
{
/// Calculate updated Q2 correction factors
- q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, wm.Q2CorrRL);
+ q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
}
else
{
@@ -2234,8 +2287,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
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;
}
@@ -2249,7 +2300,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (errLimitLo <= q2adjResult.Error && q2adjResult.Error <= errLimitHi)
{
/// Calculate updated Q2 correction factors
- q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, wm.Q2CorrLR);
+ q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR);
}
else
{
@@ -2259,8 +2310,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
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;
}
@@ -2274,7 +2323,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
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);
+ q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
+ q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR);
}
else
{
@@ -2317,8 +2367,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
/// Use the same correction factor in both directions
- q2CorrRL = (byte)((int)Math.Round(1.1 * q2Correction) & 0x000000FF);
- q2CorrLR = (byte)((int)Math.Round(1.1 * q2Correction) & 0x000000FF);
+ q2CorrRL = (byte)((int)Math.Round(1.0 * q2Correction2) & 0x000000FF);
+ q2CorrLR = (byte)((int)Math.Round(1.0 * q2Correction2) & 0x000000FF);
}
else if (q2CorrType == Q2CorrType.Greece || q2CorrType == Q2CorrType.Greece_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestLRDir)
{
@@ -2331,10 +2381,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
return CommErr.None;
}
- q2CorrRL = (byte)((int)Math.Round(2.0 * q2Correction) & 0x000000FF);
- q2CorrLR = (byte)((int)Math.Round(1.1 * q2Correction) & 0x000000FF);
+ q2CorrRL = (byte)((int)Math.Round(2.0 * q2Correction2) & 0x000000FF);
+ q2CorrLR = (byte)((int)Math.Round(1.0 * q2Correction2) & 0x000000FF);
}
- else if (q2CorrType == Q2CorrType.RL || q2CorrType == Q2CorrType.RL_incl_05) /// SUEZ RL only
+ else if (q2CorrType == Q2CorrType.RL || q2CorrType == Q2CorrType.RL_incl_05 || q2CorrType == Q2CorrType.ConditionalUpdateRL) /// RL only
{
if (q2CorrType == Q2CorrType.RL && Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
{
@@ -2344,7 +2394,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
q2CorrRL = (byte)((int)Math.Round(q2Correction) & 0x000000FF);
}
- else if (q2CorrType == Q2CorrType.LR || q2CorrType == Q2CorrType.LR_incl_05) /// SUEZ LR only
+ else if (q2CorrType == Q2CorrType.LR || q2CorrType == Q2CorrType.LR_incl_05 || q2CorrType == Q2CorrType.ConditionalUpdateLR) /// LR only
{
if (q2CorrType == Q2CorrType.LR && Math.Abs(q2adjResult.Error - ihead.CalibTargetQ2) <= 0.5)
{
@@ -2352,7 +2402,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
return CommErr.None;
}
- q2CorrLR = (byte)((int)Math.Round(q2Correction) & 0x000000FF);
+ q2CorrLR = (byte)((int)Math.Round(q2Correction2) & 0x000000FF);
}
else if ((q2CorrType == Q2CorrType.Update) || (q2CorrType == Q2CorrType.ConditionalUpdate))
{
@@ -2368,7 +2418,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (OpenPort(threadId, ihead) != 0) return CommErr.OpenPort; /// Open RFID port
CommErr error = CommErr.Write;
- if (q2CorrType == Q2CorrType.RL)
+ if (q2CorrType == Q2CorrType.RL || q2CorrType == Q2CorrType.RL_incl_05 || q2CorrType == Q2CorrType.ConditionalUpdateRL)
{
///
/// Write R-L Q2 correction factor only
@@ -2379,6 +2429,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddrRL, wrData.Length, wrData, cfg.CommTimeout))
{
error = CommErr.None;
+ wm.Q2CorrRL = ihead.Q2CorrRL = q2CorrRL;
break;
}
@@ -2386,7 +2437,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
}
}
- else if (q2CorrType == Q2CorrType.LR)
+ else if (q2CorrType == Q2CorrType.LR || q2CorrType == Q2CorrType.LR_incl_05 || q2CorrType == Q2CorrType.ConditionalUpdateLR)
{
///
/// Write L-R Q2 correction factor only
@@ -2397,6 +2448,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddrLR, wrData.Length, wrData, cfg.CommTimeout))
{
error = CommErr.None;
+ wm.Q2CorrLR = ihead.Q2CorrLR = q2CorrLR;
break;
}
@@ -2415,6 +2467,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, wrData.Length, wrData, cfg.CommTimeout))
{
error = CommErr.None;
+ wm.Q2CorrRL = ihead.Q2CorrRL = q2CorrRL;
+ wm.Q2CorrLR = ihead.Q2CorrLR = q2CorrLR;
break;
}
@@ -2477,8 +2531,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
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;
}
#endif
diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs
index 20b427358..d5202f57c 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs
@@ -71,6 +71,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestLROnlyStr);
retVal.Add(iPerlCommunicationForm.UpdateQ2CorrectionsStr);
retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrectionsStr);
+ retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrRLStr);
+ retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrLRStr);
retVal.Add("Q2 corrected from Q2adj");
retVal.Add("Q2 correction check Q2bc Q2ac");
retVal.Add(iPerlCommunicationForm.SetActiveModeStr);
diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs
index 26b6e0275..7819c7c75 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs
@@ -23,6 +23,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
LR_incl_05,
Update,
ConditionalUpdate,
+ ConditionalUpdateRL,
+ ConditionalUpdateLR,
UpdateBothQ2FactorsTestRLDir,
UpdateBothQ2FactorsTestLRDir,
Count,