From 806f4efe6ad74837701b0bbfc956160815f2f24e Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Sun, 1 Feb 2015 16:20:27 +0100 Subject: [PATCH] Results printing and saving uses Publish property of GenericDevices.ITestMethod --- .../GenericDevices/ITestMethod.cs | 9 +++- TestBenchFramework/BenchControl/ISequence.cs | 10 ---- .../BenchControl/Sequences/MainSeq.cs | 6 +-- .../BenchControl/TbfComponents.cs | 46 +++++++++---------- .../TestMethods/Adjustment/AdjustmentSeq.cs | 4 +- .../TestMethods/Adjustment/TestMethod.cs | 5 +- .../CameraRoiDetection/RoiDetection.cs | 5 +- .../TestMethods/CombinedMeters/TestMethod.cs | 5 +- .../CombinedWithDetection/TestMethod.cs | 5 +- .../FixedStartMassCollection/TestMethod.cs | 5 +- .../TestMethods/FlyingStart/TestMethod.cs | 5 +- .../FlyingStartCollectionMethod/TestMethod.cs | 5 +- .../TestMethod.cs | 5 +- .../Screens/ResultsTabPageCtrl.cs | 6 ++- TestBenchFramework/TBF.csproj | 1 - TestBenchFramework/Utils.cs | 7 ++- 16 files changed, 78 insertions(+), 51 deletions(-) delete mode 100644 TestBenchFramework/BenchControl/ISequence.cs diff --git a/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs b/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs index fc0a61938..fd8262cf5 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs @@ -3,7 +3,14 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.GenericDevices { - public interface ITestMethod : IComponent, ISequence + public interface ITestMethod : IComponent { + /// True = use result of the test with this method when evaluating the final result + bool Evaluate { get; } + + /// True = use result of the test with this method when publishing (printing, saving) results + bool Publish { get; } + + IList Execute(Entities.Test test); } } diff --git a/TestBenchFramework/BenchControl/ISequence.cs b/TestBenchFramework/BenchControl/ISequence.cs deleted file mode 100644 index 11d515305..000000000 --- a/TestBenchFramework/BenchControl/ISequence.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace TBF.BenchControl -{ - public interface ISequence - { - IList Execute(Entities.Test test); - } -} diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 8d28a59da..8abf39be7 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -9,7 +9,7 @@ using TBF.Resources; namespace TBF.BenchControl.Sequences { - public class MainSeq : SequenceBase, ISequence + public class MainSeq : SequenceBase { private static readonly ILog log = LogManager.GetLogger(typeof(MainSeq)); @@ -272,7 +272,7 @@ namespace TBF.BenchControl.Sequences TimeEstimateOneTest = test.TstTime + 10.0f; //-------------------------------------------------------------- - ISequence testMethodSequence = TbfComponents.FindComponent(test.Method) as ISequence; + ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod; if (testMethodSequence != null) { StateMachine.LoadTestParams(test); @@ -311,7 +311,7 @@ namespace TBF.BenchControl.Sequences TimeEstimateOneTest = test.TstTime + 10.0f; TimeEstimateBeginRpts = 0; - ISequence testMethodSequence = TbfComponents.FindComponent(test.Method) as ISequence; + ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod; if (testMethodSequence != null) { StateMachine.LoadTestParams(test); diff --git a/TestBenchFramework/BenchControl/TbfComponents.cs b/TestBenchFramework/BenchControl/TbfComponents.cs index e1579dd05..9b2319496 100644 --- a/TestBenchFramework/BenchControl/TbfComponents.cs +++ b/TestBenchFramework/BenchControl/TbfComponents.cs @@ -11,39 +11,39 @@ namespace TBF.BenchControl { Factories = new List(); + Factories.Add(new TestMethods.Adjustment.TestMethodFactory()); + Factories.Add(new ResultsPrinters.Basic.PrinterFactory()); + Factories.Add(new ResultsWriters.Basic.WriterFactory()); Factories.Add(new BenchId.ComponentFactory()); - Factories.Add(new Cameras.IdcCamera.IdcCameraFactory()); Factories.Add(new Cameras.CameraRoi.CameraRoiFactory()); + Factories.Add(new TestMethods.CombinedMeters.TestMethodFactory()); + Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory()); + Factories.Add(new Elde.ControlBoardFactory()); + Factories.Add(new DataEntry.Munich3.EntryFormFactory()); Factories.Add(new DataEntry.Munich.EntryFormFactory()); - Factories.Add(new DataEntry.Munich3.EntryFormFactory()); - Factories.Add(new DataEntry.WMStates.EntryFormFactory()); - Factories.Add(new Elde.ControlBoardFactory()); Factories.Add(new Elde.Diverter.DiverterFactory()); - Factories.Add(new Elde.FixedStartRegisterReader.RegisterReaderFactory()); - Factories.Add(new Elde.FlowMeter.FlowMeterFactory()); - Factories.Add(new Elde.FlowMeterTwins.FlowMeterFactory()); - Factories.Add(new Elde.PressureMeter.PressureMeterFactory()); + Factories.Add(new TestMethods.FixedStartMassCollection.TestMethodFactory()); + Factories.Add(new Elde.FixedStartRegisterReader.RegisterReaderFactory()); + Factories.Add(new Elde.FlowMeter.FlowMeterFactory()); + Factories.Add(new Elde.FlowMeterTwins.FlowMeterFactory()); + Factories.Add(new TestMethods.FlyingStart.TestMethodFactory()); + Factories.Add(new TestMethods.FlyingStartCollectionMethod.TestMethodFactory()); + Factories.Add(new DataEntry.WMStates.EntryFormFactory()); + Factories.Add(new Greco.AmbientFactory()); + Factories.Add(new Cameras.IdcCamera.IdcCameraFactory()); + Factories.Add(new MettlerToledo.BalanceFactory()); + Factories.Add(new MettlerToledo.BalanceNewFactory()); + Factories.Add(new Elde.PressureMeter.PressureMeterFactory()); Factories.Add(new Elde.Pump.PumpFactory()); Factories.Add(new Elde.PumpWithFM.PumpFactory()); Factories.Add(new Elde.PumpTandem.PumpFactory()); - Factories.Add(new Elde.RegisterReader.RegisterReaderFactory()); + Factories.Add(new TestMethods.ReferenceFlowmeterCalibration.TestMethodFactory()); + Factories.Add(new Elde.RegisterReader.RegisterReaderFactory()); Factories.Add(new Elde.RegulValve.RegulValveFactory()); + Factories.Add(new ResultsPrinters.Munich.PrinterFactory()); + Factories.Add(new TestMethods.CameraRoiDetection.RoiDetectionFactory()); Factories.Add(new Elde.TempMeter.TempMeterFactory()); Factories.Add(new Elde.Valve.ValveFactory()); - Factories.Add(new Greco.AmbientFactory()); - Factories.Add(new MettlerToledo.BalanceFactory()); - Factories.Add(new MettlerToledo.BalanceNewFactory()); - Factories.Add(new ResultsPrinters.Basic.PrinterFactory()); - Factories.Add(new ResultsPrinters.Munich.PrinterFactory()); - Factories.Add(new ResultsWriters.Basic.WriterFactory()); - Factories.Add(new TestMethods.Adjustment.TestMethodFactory()); - Factories.Add(new TestMethods.CameraRoiDetection.RoiDetectionFactory()); - Factories.Add(new TestMethods.CombinedMeters.TestMethodFactory()); - Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory()); - Factories.Add(new TestMethods.FixedStartMassCollection.TestMethodFactory()); - Factories.Add(new TestMethods.FlyingStart.TestMethodFactory()); - Factories.Add(new TestMethods.FlyingStartCollectionMethod.TestMethodFactory()); - Factories.Add(new TestMethods.ReferenceFlowmeterCalibration.TestMethodFactory()); Factories.Add(new WaterMeter.WaterMeterFactory()); } diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index ad9e17341..24391910b 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -66,6 +66,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment /// Start the test, initialize test results Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Entities.TestResult tstRslt = new Entities.TestResult(test, repetitionNr, Entities.MetersKind.Single); + tstRslt.DoNotEvaluate = true; + tstRslt.DoNotPublish = true; //------------------------------------------------ Bridge.OnActivity(this, Strings.Setting_the_flow); @@ -228,8 +230,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment /// tstRslt.TimeEnd = DateTime.Now; tstRslt.CycleNr = Program.LocalSettings.CycleNr; - tstRslt.DoNotEvaluate = true; - tstRslt.DoNotPublish = true; UpdateTestRsltWithAveragedData(tstRslt); tstRslt.MassStart = 0; tstRslt.MassEnd = 0; diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs index c85a8ad21..6d15625a7 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs @@ -5,11 +5,14 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.Adjustment { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.Adjustment({0})", Cfg.ToString(1)); } + public bool Evaluate { get { return false; } } + public bool Publish { get { return false; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetection.cs b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetection.cs index 97784c821..c73b0151d 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetection.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetection.cs @@ -5,11 +5,14 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.CameraRoiDetection { - public class RoiDetection : ComponentBase, GenericDevices.ITestMethod, ISequence + public class RoiDetection : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(RoiDetection)); public override string ToString() { return string.Format("TestMethods.CameraRoiDetection({0})", Cfg.ToString(1)); } + public bool Evaluate { get { return false; } } + public bool Publish { get { return false; } } + public RoiDetection(RoiDetectionCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethod.cs index b35fb0e3b..00ec18574 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/TestMethod.cs @@ -5,13 +5,16 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.CombinedMeters { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.CombinedMeters({0})", Cfg.ToString(1)); } readonly TestMethodCfg testMethodCfg; + public bool Evaluate { get { return true; } } + public bool Publish { get { return true; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs index 8b2428c38..056d02f8f 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs @@ -5,13 +5,16 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.CombinedWithDetection { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.CombinedWithDetection({0})", Cfg.ToString(1)); } readonly TestMethodCfg testMethodCfg; + public bool Evaluate { get { return true; } } + public bool Publish { get { return true; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethod.cs index b12938904..46bf791e7 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/TestMethod.cs @@ -5,11 +5,14 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.FixedStartMassCollection { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.FixedStartMassCollection({0})", Cfg.ToString(1)); } + public bool Evaluate { get { return true; } } + public bool Publish { get { return true; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethod.cs index 740179641..360f53238 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/TestMethod.cs @@ -5,11 +5,14 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.FlyingStart { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.FlyingStart({0})", Cfg.ToString(1)); } + public bool Evaluate { get { return true; } } + public bool Publish { get { return true; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs index 4cbd0ae51..05063cb1a 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs @@ -5,11 +5,14 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.FlyingStartCollectionMethod({0})", Cfg.ToString(1)); } + public bool Evaluate { get { return true; } } + public bool Publish { get { return true; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs index 9e6f13faf..8f43b34f4 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs @@ -5,11 +5,14 @@ using TBF.BenchControl; namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration { - public class TestMethod : ComponentBase, GenericDevices.ITestMethod, ISequence + public class TestMethod : ComponentBase, GenericDevices.ITestMethod { private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.ReferenceFlowmeterCalibration({0})", Cfg.ToString(1)); } + public bool Evaluate { get { return false; } } + public bool Publish { get { return false; } } + public TestMethod(TestMethodCfg cfg) : base(cfg) { diff --git a/TestBenchFramework/Screens/ResultsTabPageCtrl.cs b/TestBenchFramework/Screens/ResultsTabPageCtrl.cs index b5d4b305c..430f6d356 100644 --- a/TestBenchFramework/Screens/ResultsTabPageCtrl.cs +++ b/TestBenchFramework/Screens/ResultsTabPageCtrl.cs @@ -194,9 +194,13 @@ namespace TBF.Screens IList GetAllDecoratedTestNames(int meterNr) { IList rslt = new List(); + foreach (var test in procedure.Tests) { - if ((test.Part == 0) || (test.Part == meterNr + 1)) + BenchControl.GenericDevices.ITestMethod method = + BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod; + + if ((method != null) && method.Publish && ((test.Part == 0) || (test.Part == meterNr + 1))) { if (test.Repeats == 1) { diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 044b3561a..7a5fa56b2 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -671,7 +671,6 @@ - diff --git a/TestBenchFramework/Utils.cs b/TestBenchFramework/Utils.cs index 264930f30..4e0cb4931 100644 --- a/TestBenchFramework/Utils.cs +++ b/TestBenchFramework/Utils.cs @@ -182,7 +182,10 @@ namespace TBF foreach (var test in procedure.Tests) { - if ((test.Part == 0) || (test.Part == meterNr + 1)) + BenchControl.GenericDevices.ITestMethod method = + BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod; + + if ((method != null) && method.Publish && ((test.Part == 0) || (test.Part == meterNr + 1))) { for (int rpt = 1; rpt <= test.Repeats; rpt++) { @@ -191,7 +194,7 @@ namespace TBF { foreach (var testRslt in testResults) { - if ((testRslt.TestId == test.Id) && (testRslt.RepetitionNr == rpt) && !testRslt.DoNotPublish) + if ((testRslt.TestId == test.Id) && (testRslt.RepetitionNr == rpt)) { rslts.Add(testRslt); added = true;