Results printing and saving uses Publish property of GenericDevices.ITestMethod

This commit is contained in:
Milan Hanajik 2015-02-01 16:20:27 +01:00
parent 0238a96975
commit 806f4efe6a
16 changed files with 78 additions and 51 deletions

View File

@ -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<Event> Execute(Entities.Test test);
}
}

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
namespace TBF.BenchControl
{
public interface ISequence
{
IList<Event> Execute(Entities.Test test);
}
}

View File

@ -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);

View File

@ -11,39 +11,39 @@ namespace TBF.BenchControl
{
Factories = new List<IComponentFactory>();
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());
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -194,9 +194,13 @@ namespace TBF.Screens
IList<string> GetAllDecoratedTestNames(int meterNr)
{
IList<string> rslt = new List<string>();
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)
{

View File

@ -671,7 +671,6 @@
<Compile Include="BenchControl\Sequences\MainSeq.cs" />
<Compile Include="BenchControl\Greco\Ambient.cs" />
<Compile Include="BenchControl\Elde\ControlBoardDev.cs" />
<Compile Include="BenchControl\ISequence.cs" />
<Compile Include="BenchControl\Sequences\SequenceBase.cs" />
<Compile Include="BenchControl\State.cs" />
<Compile Include="BenchControl\Transition.cs" />

View File

@ -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;