iPerlCommmunication : New Q2 correction for Australia.
This commit is contained in:
@@ -70,13 +70,20 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
public const string ResetQ2CorrectionStr = "Reset Q2 correction";
|
||||
public const string WriteDefaultQ2CorrectionsStr = "Write default Q2 corrections";
|
||||
public const string InitOrReadQ2CorrectionsStr = "Init or read Q2 corrections";
|
||||
public const string WriteQ2CorrectionStr = "Write Q2 correction"; /// No arguments
|
||||
public const string WriteQ2CorrectionAltStr = "Write Q2 correction Alt"; /// No arguments
|
||||
public const string WriteQ2CorrectionGreeceStr = "Write Q2 correction Greece"; /// Arguments: test_name
|
||||
public const string WriteQ2CorrectionRLStr = "Write Q2 correction R-L"; /// Arguments: test_name
|
||||
public const string WriteQ2CorrectionLRStr = "Write Q2 correction L-R"; /// Arguments: test_name
|
||||
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 WriteQ2CorrectionStr = "Write Q2 correction"; /// No arguments
|
||||
public const string WriteQ2CorrectionAltStr = "Write Q2 correction Alt"; /// No arguments
|
||||
public const string WriteQ2CorrectionGreeceStr = "Write Q2 correction Greece"; /// Arguments: test_name
|
||||
public const string WriteQ2CorrectionRLStr = "Write Q2 correction R-L"; /// Arguments: test_name
|
||||
public const string WriteQ2CorrectionLRStr = "Write Q2 correction L-R"; /// Arguments: test_name
|
||||
public const string WriteQ2CorrectionIncl05Str = "Write_Q2_correction_incl.-0,5..0,5%"; /// No arguments
|
||||
public const string WriteQ2CorrectionAltIncl05Str = "Write_Q2_correction_Alt_incl.-0,5..0,5%"; /// No arguments
|
||||
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";
|
||||
public const string Write2HzCorrectionStr = "Write 2Hz correction";
|
||||
|
||||
@@ -860,11 +867,18 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
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() == 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);
|
||||
else if (currentActivity.ToLower() == GetDefaultQ2CorrectionsStr.ToLower()) error = GetQ2PreCorrectionsFormRest(threadID, ihead, wm, ref resultStr);
|
||||
|
||||
#endif
|
||||
else
|
||||
@@ -2191,6 +2205,56 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
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;
|
||||
resultStr = string.Format("Q2 error is out of range => no Q2 correction");
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
@@ -2208,12 +2272,8 @@ namespace TBF.Rig.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;
|
||||
@@ -2223,7 +2283,7 @@ namespace TBF.Rig.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
|
||||
@@ -2252,7 +2312,7 @@ namespace TBF.Rig.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
|
||||
|
||||
@@ -62,6 +62,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionAltIncl05Str);
|
||||
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.Rig.TestMethods.iPerlCommunication
|
||||
LR_incl_05,
|
||||
Update,
|
||||
ConditionalUpdate,
|
||||
UpdateBothQ2FactorsTestRLDir,
|
||||
UpdateBothQ2FactorsTestLRDir,
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user