iPerlCommunications : Modifications for Australia (plus), ver. 2.31.2018

This commit is contained in:
Milan Hanajik
2023-02-24 10:17:24 +01:00
parent b38ee92fe4
commit 78575e4f6f
5 changed files with 84 additions and 47 deletions
+2 -2
View File
@@ -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")]
@@ -78,6 +78,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
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
@@ -1219,7 +1221,9 @@ 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() == 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());
@@ -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)
{
@@ -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);
@@ -24,6 +24,14 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public const string IperlCheckCmd = "iPERL_check ";
public static Dictionary<string, iPerlCommunicationParams> testParamsDict;
///
static iPerlCommunicationSeq()
{
testParamsDict = new Dictionary<string, iPerlCommunicationParams>();
}
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<Event> 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);
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)));
@@ -336,8 +360,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
State.Create("iPerlCommunicationSeq : Wait until the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
stopPressed = TestAndLogUiCmdStop(test, e);
completed = (modelessDlg is GenericDevices.IHasCompleted)
@@ -477,7 +500,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="testName">This test name</param>
/// <param name="oriTestRslt">Name of Q2 test done before Q2 correction (Q2adj)</param>
/// <remarks>Assuming this test does not have multiple parts (part = 0)</remarks>
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,23 +620,25 @@ 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;
}
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;
@@ -621,7 +646,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
}
}
}
}
/// <summary>
/// Evaluate a given Q2 test result agains stricter error limits when Oruefindex == 1.
@@ -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,