From 6e3f0dad0e0cc3372497b700fd63984bc926aba6 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 11 Oct 2023 09:39:23 +0200 Subject: [PATCH] iPerlCommunication : simulate iperls --- .../iPerlCommunicationSeq.cs | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs index ec84d31f9..74cbde751 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs @@ -12,6 +12,8 @@ using TBF.Rig.Sequences; using TBF.Resources; using TBF.UiBridge; using Results; +using Results.Entities; +using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead; namespace TBF.Rig.TestMethods.iPerlCommunication { @@ -23,9 +25,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication public const string StrictQ2ErrorCheckStr = "Strict Q2 error check "; public const string Q2correctionCheckCmd = "Q2 correction check "; public const string IperlCheckCmd = "iPERL_check "; + public const string SimulateCmd = "simulate "; - System.Windows.Forms.Form modelessDlg; + System.Windows.Forms.Form modelessDlg; /// delegate void iPerlCommFormDlgt(iPerlCommunicationSeq myRef, TestMethod method, Test test, iPerlCommunicationParams testParams); /// @@ -288,7 +291,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication return new List { Event.Done }; } - else if (testParams.Activity.ToLower().Contains(cmd = "simulate ")) + else if (testParams.Activity.ToLower().Contains(cmd = SimulateCmd)) { TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 }); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted)); @@ -301,6 +304,46 @@ namespace TBF.Rig.TestMethods.iPerlCommunication else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound nok") MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f); else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound rise") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f); else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound fall") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f); + else if (testParams.Activity.Substring(cmd.Length).ToLower() == "iperls") + { + string[] pcbNrs = new string[] { "831232435539", "831232435562", "831232435587", + "831232432141", "831232432497", "831232763641" }; + + TestRslt tstRslt = BatchRslts.GetTestRslt(test.Name, test.Part); + if (tstRslt != null) + { + Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters); + + /// Auxiliary results ... not required + + /// Main results + tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName; + tstRslt.TestDone = true; + tstRslt.StartTime = tstRslt.Batch.StartTime; + tstRslt.EndTime = DateTime.Now; + tstRslt.FlowSetTime = 0; + tstRslt.MassOfEvapWater = 0; + tstRslt.TestTime = 1; + + for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++) + { + MeterTestRslt meterRslt = + BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single); + + if (meterRslt != null) + { + meterRslt.WaterMeter.SerialNr = pcbNrs[i % pcbNrs.Length]; + meterRslt.Passed = true; + meterRslt.TestDone = true; + } + //if (iperlHeads[i] != null) + //{ + // iperlHeads[i].CommFailed = iperlHeads[i].Disabled = false; + // iperlHeads[i].SerialNr = pcbNrs[i % pcbNrs.Length]; + //} + } + } + } Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed)); Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0))); @@ -311,8 +354,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication //------------------------------------------------ State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity)) - .AddOperation(checkUiOp) - .EnterState(); + .AddOperation(checkUiOp) + .EnterState(); e = StateMachine.WaitRunDevsRunOps(); if (TestAndLogUiCmdStop(test, e))