Evaluate and Publish properties of test methods changed to stateless functions Evaluate(test) and Publish(test), this fixes results, version 1.5.107

This commit is contained in:
Milan Hanajik 2015-09-06 22:21:54 +02:00
parent 264830a36b
commit d041cd1d20
17 changed files with 92 additions and 36 deletions

View File

@ -11,12 +11,12 @@ namespace TBF.BenchControl.GenericDevices
/// <summary>
/// True = use result of the test with this method when evaluating the final result
/// </summary>
bool Evaluate { get; }
bool Evaluate(Entities.Test test);
/// <summary>
/// True = use result of the test with this method when publishing (printing, saving) results
/// </summary>
bool Publish { get; }
bool Publish(Entities.Test test);
/// <summary>
/// Check compatibility of the method with the watermeters

View File

@ -13,8 +13,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
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 bool Evaluate(Entities.Test test) { return false; }
public bool Publish(Entities.Test test) { return false; }
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; }
public TestMethod()

View File

@ -13,8 +13,8 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
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 bool Evaluate(Entities.Test test) { return false; }
public bool Publish(Entities.Test test) { return false; }
public bool CanTest(Entities.MetersKind meters) { return true; }
public RoiDetection()

View File

@ -15,8 +15,8 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return true; } }
public bool Publish { get { return true; } }
public bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Combined; }
public TestMethod()

View File

@ -15,8 +15,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return true; } }
public bool Publish { get { return true; } }
public bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Combined; }
public TestMethod()

View File

@ -13,8 +13,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
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 bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; }
public TestMethod()

View File

@ -13,8 +13,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
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 bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; }
public TestMethod()

View File

@ -13,8 +13,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
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 bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; }
public TestMethod()

View File

@ -16,8 +16,34 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return testMethodCfg.TestParams.Evaluate; } }
public bool Publish { get { return testMethodCfg.TestParams.Publish; } }
public bool Evaluate(Entities.Test test)
{
TestParams tp = new TestParams();
foreach (var tstPrms in test.MoreParams)
{
if (tstPrms.CmpntName.Equals(Name))
{
tp.UpdateTestParams(tstPrms);
return tp.Evaluate;
}
}
return true;
}
public bool Publish(Entities.Test test)
{
TestParams tp = new TestParams();
foreach (var tstPrms in test.MoreParams)
{
if (tstPrms.CmpntName.Equals(Name))
{
tp.UpdateTestParams(tstPrms);
return tp.Publish;
}
}
return true;
}
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; }
public TestMethod()

View File

@ -15,8 +15,8 @@ namespace TBF.BenchControl.TestMethods.LeakTest
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return true; } }
public bool Publish { get { return true; } }
public bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return true; }
public TestMethod()

View File

@ -15,8 +15,8 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return true; } }
public bool Publish { get { return true; } }
public bool Evaluate(Entities.Test test) { return true; }
public bool Publish(Entities.Test test) { return true; }
public bool CanTest(Entities.MetersKind meters) { return true; }
public TestMethod()

View File

@ -13,8 +13,8 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
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 bool Evaluate(Entities.Test test) { return false; }
public bool Publish(Entities.Test test) { return false; }
public bool CanTest(Entities.MetersKind meters) { return true; }
public TestMethod()

View File

@ -21,8 +21,27 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public bool SimultWithPrevious { get { return testMethodCfg.TestParams.SimultWithPrevious; } }
public bool SimultWithNext { get { return testMethodCfg.TestParams.SimultWithNext; } }
public bool Evaluate { get { return false; } }
public bool Publish { get { return false; } }
public bool Evaluate(Entities.Test test)
{
return Publish(test);
}
public bool Publish(Entities.Test test)
{
iPerlCommunicationParams tp = new iPerlCommunicationParams();
foreach (var tstPrms in test.MoreParams)
{
if (tstPrms.CmpntName.Equals(Name))
{
tp.UpdateTestParams(tstPrms);
string lowercaseAct = tp.Activity.ToLower();
return lowercaseAct.Contains("simulate ") || lowercaseAct.Contains("q2 corrected from ");
}
}
return false;
}
public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; }
public TestMethod()

View File

@ -59,9 +59,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
const string Q2correctedFromCmd = "Q2 corrected from ";
const string Q2correctedFromCmd = "q2 corrected from ";
if (testParams.Activity.Contains(Q2correctedFromCmd))
if (testParams.Activity.ToLower().Contains(Q2correctedFromCmd))
{
string fromTestName = testParams.Activity.Substring(Q2correctedFromCmd.Length);
@ -81,7 +81,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rList.Add(Event.Done);
return rList;
}
else if (testParams.Activity.Contains("Simulate "))
else if (testParams.Activity.ToLower().Contains("simulate "))
{
Entities.TestResult tstRslt;
@ -104,6 +104,17 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
iPerl.NominalTestFlow = 500.0 * (double)(test.Qfrom + test.Qto); /// Ave. + convert to liter/hour
}
}
//------------------------------------------------
Bridge.OnActivity(this, testParams.Activity);
//------------------------------------------------
State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity))
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) retVal = Event.UiCmdStop;
}
else
{

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.5.106.1")]
[assembly: AssemblyFileVersion("1.5.106.1")]
[assembly: AssemblyVersion("1.5.107.1")]
[assembly: AssemblyFileVersion("1.5.107.1")]

View File

@ -249,9 +249,9 @@ namespace TBF.Screens
/// Get decorated test names for the specified watermeter
/// The parameter meterNr is used in the same way as the parameter meterNr of Utils.GetSortedTestResults
/// </summary>
/// <param name="meterNr">Water meter nr (1-based): 1 .. Program.WMsCount</param>
/// <param name="meterPartNr">Water meter nr (1-based): 1 .. Program.WMsCount</param>
/// <returns>A list of strings</returns>
IList<string> GetAllDecoratedTestNames(int meterNr)
IList<string> GetAllDecoratedTestNames(int meterPartNr)
{
IList<string> rslt = new List<string>();
@ -260,7 +260,7 @@ namespace TBF.Screens
BenchControl.GenericDevices.ITestMethod method =
BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod;
if ((method != null) && method.Publish && ((test.Part == 0) || (meterNr == 0) || (test.Part == meterNr)))
if ((method != null) && method.Publish(test) && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
{
if (test.Repeats == 1)
{

View File

@ -196,7 +196,7 @@ namespace TBF
BenchControl.GenericDevices.ITestMethod method =
BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod;
if ((method != null) && method.Publish && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
if ((method != null) && method.Publish(test) && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
{
for (int rpt = 1; rpt <= test.Repeats; rpt++)
{
@ -238,7 +238,7 @@ namespace TBF
BenchControl.GenericDevices.ITestMethod method =
BenchControl.TbfComponents.FindComponent(test.Method) as BenchControl.GenericDevices.ITestMethod;
if ((method != null) && method.Publish && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
if ((method != null) && method.Publish(test) && ((test.Part == 0) || (meterPartNr == 0) || (test.Part == meterPartNr)))
{
if (test.Repeats == 1)
{