diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index b916b352d..c2bccd3bf 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.31.2017.0")] -[assembly: AssemblyFileVersion("2.31.2017.0")] +[assembly: AssemblyVersion("2.31.2018.0")] +[assembly: AssemblyFileVersion("2.31.2018.0")] diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index 483f78d62..a560f065d 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -71,22 +71,24 @@ 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 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 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 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 WriteQ2CorrectionPlusIncl05Str = "Write_Q2_correction_plus_incl.-0,5..0,5%"; /// No arguments + public const string WriteQ2CorrectionPlusAltIncl05Str = "Write_Q2_correction_plus_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 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"; public const string DewaReworkRLStr = "DEWA rework R-L"; @@ -1219,8 +1221,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication 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() == WriteQ2CorrectionPlusIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Standard_plus_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() == WriteQ2CorrectionPlusAltIncl05Str.ToLower()) error = CalculateAndWriteQ2Corrections(threadID, ihead, wm, currentTest, ref resultStr, Q2CorrType.Dewa_plus_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); @@ -2685,7 +2689,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication int q2CorrRL = 0; int q2CorrLR = 0; /// - if (q2CorrType == Q2CorrType.Standard || q2CorrType == Q2CorrType.Standard_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestRLDir) + if (q2CorrType == Q2CorrType.Standard || + q2CorrType == Q2CorrType.Standard_incl_05 || + q2CorrType == Q2CorrType.Standard_plus_incl_05 || + q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestRLDir) { /// /// Standard process @@ -2696,10 +2703,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication return CommErr.None; } - q2CorrRL = (int)Math.Round(1.1 * q2Correction); + q2CorrRL = (q2CorrType == Q2CorrType.Standard_plus_incl_05) ? (int)Math.Round(0.9 * q2Correction) : (int)Math.Round(1.1 * q2Correction); q2CorrLR = (int)Math.Round(0.5 * q2Correction); } - else if (q2CorrType == Q2CorrType.Dewa || q2CorrType == Q2CorrType.Dewa_incl_05) + else if (q2CorrType == Q2CorrType.Dewa || + q2CorrType == Q2CorrType.Dewa_incl_05 || + q2CorrType == Q2CorrType.Dewa_plus_incl_05) { /// /// Process for DEWA @@ -2711,8 +2720,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication } /// Use the same correction factor in both directions - q2CorrRL = (int)Math.Round(1.0 * q2Correction2); - q2CorrLR = (int)Math.Round(1.0 * q2Correction2); + q2CorrRL = (q2CorrType == Q2CorrType.Dewa_plus_incl_05) ? (int)Math.Round(0.9 * q2Correction2) : (int)Math.Round(1.0 * q2Correction2); + q2CorrLR = (q2CorrType == Q2CorrType.Dewa_plus_incl_05) ? (int)Math.Round(0.9 * q2Correction2) : (int)Math.Round(1.0 * q2Correction2); } else if (q2CorrType == Q2CorrType.Greece || q2CorrType == Q2CorrType.Greece_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestLRDir) { diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs index 98efbfd07..ddf2df0f1 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs @@ -65,6 +65,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRStr); retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionIncl05Str); retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionAltIncl05Str); + retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionPlusIncl05Str); + retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionPlusAltIncl05Str); retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceIncl05Str); retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLIncl05Str); retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRIncl05Str); diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs index f91f8b28d..9876d36a2 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs @@ -24,6 +24,14 @@ namespace TBF.Rig.TestMethods.iPerlCommunication public const string IperlCheckCmd = "iPERL_check "; + public static Dictionary testParamsDict; + /// + static iPerlCommunicationSeq() + { + testParamsDict = new Dictionary(); + } + + System.Windows.Forms.Form modelessDlg; /// delegate void iPerlCommFormDlgt(iPerlCommunicationSeq myRef, TestMethod method, Test test, iPerlCommunicationParams testParams); @@ -56,6 +64,15 @@ namespace TBF.Rig.TestMethods.iPerlCommunication { TestMethodCfg cfg = method.Cfg as TestMethodCfg; + if (testParamsDict.ContainsKey(test.Name)) + { + testParamsDict[test.Name] = testParams; + } + else + { + testParamsDict.Add(test.Name, testParams); + } + IList e; /// Events from currently running operations checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state modelessDlg = null; @@ -124,8 +141,15 @@ namespace TBF.Rig.TestMethods.iPerlCommunication Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting)); string fromTestName = testParams.Activity.Substring(cmd.Length); - - MakeQ2CorrectedFrom(test.Name, fromTestName); + iPerlCommunicationParams fromTestParams; + if (testParamsDict.TryGetValue(fromTestName, out fromTestParams) && fromTestParams.Activity.ToLower().Contains("plus")) + { + MakeQ2CorrectedFrom(test.Name, fromTestName, true); + } + else + { + MakeQ2CorrectedFrom(test.Name, fromTestName); + } Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed)); Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0))); @@ -334,10 +358,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication bool completed = false; State.Create("iPerlCommunicationSeq : Wait until the entry form is closed") - .AddOperation(checkUiOp) - .EnterState(); - do - { + .AddOperation(checkUiOp) + .EnterState(); + do { e = StateMachine.WaitRunDevsRunOps(); stopPressed = TestAndLogUiCmdStop(test, e); completed = (modelessDlg is GenericDevices.IHasCompleted) @@ -477,7 +500,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication /// This test name /// Name of Q2 test done before Q2 correction (Q2adj) /// Assuming this test does not have multiple parts (part = 0) - void MakeQ2CorrectedFrom(string testName, string oriTestName) + void MakeQ2CorrectedFrom(string testName, string oriTestName, bool isPlus = false) { Results.Entities.TestRslt oriTestRslt = ProcessData.BatchRslts.GetTestRslt(oriTestName, 0); Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0); @@ -597,29 +620,30 @@ namespace TBF.Rig.TestMethods.iPerlCommunication { /// Either no iPerl head or no Q2 correction meterRslt.Error = oriMeterRslt.Error; - meterRslt.VolumeMeter = oriMeterRslt.VolumeMeter; - meterRslt.VolumeStart = oriMeterRslt.VolumeStart; - meterRslt.VolumeEnd = oriMeterRslt.VolumeEnd; - meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin() - && meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin()); - meterRslt.TestDone = true; - tstRslt.TestDone = true; + } + else if (isPlus) + { + /// iPerl with Q2 correction => generate an artificial error equal to +1/10 of the original one (relative to Q2 target error) + double targetError = iPerl.CalibTargetQ2; + meterRslt.Error = targetError + 0.1 * (oriMeterRslt.Error - targetError); } else { /// iPerl with Q2 correction => generate an artificial error equal to -1/10 of the original one (relative to Q2 target error) double targetError = iPerl.CalibTargetQ2; meterRslt.Error = targetError - 0.1 * (oriMeterRslt.Error - targetError); - meterRslt.VolumeMeter = oriMeterRslt.VolumeRef * (100.0 + meterRslt.Error) / 100.0; - meterRslt.VolumeStart = oriMeterRslt.VolumeStart; - double signature = (oriMeterRslt.VolumeEnd > oriMeterRslt.VolumeStart) ? (+1) : (-1); - meterRslt.VolumeEnd = meterRslt.VolumeStart + signature * meterRslt.VolumeMeter; - meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin() - && meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin()); - meterRslt.TestDone = true; - tstRslt.TestDone = true; } - } + + meterRslt.VolumeMeter = meterRslt.VolumeRef * (100.0 + meterRslt.Error) / 100.0; + double signature = (oriMeterRslt.VolumeEnd > oriMeterRslt.VolumeStart) ? (+1) : (-1); + meterRslt.VolumeStart = oriMeterRslt.VolumeStart; + meterRslt.VolumeEnd = meterRslt.VolumeStart + signature * meterRslt.VolumeMeter; + + meterRslt.Passed = (meterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin() + && meterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin()); + meterRslt.TestDone = true; + tstRslt.TestDone = true; + } } } diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlEnums.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlEnums.cs index e13313ce2..12ac3a0c1 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlEnums.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlEnums.cs @@ -17,7 +17,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication RL, LR, Standard_incl_05, + Standard_plus_incl_05, Dewa_incl_05, + Dewa_plus_incl_05, Greece_incl_05, RL_incl_05, LR_incl_05,