(1) DiverterTest component added, (2) Filipiny_50 component 9.7.2019, (3) flowMeterIdxAndDiv for FILIPINY_50, ver. 2.18.1263
This commit is contained in:
parent
1fb6cf4717
commit
a6b8fade23
@ -118,7 +118,7 @@ namespace TBF.BenchControl.Elde
|
||||
#elif BADGER_STREDNA_TRAT
|
||||
int flowMeterIdxAndDiv = flowMeterNr + 8 * (diverterNr - 1);
|
||||
#elif FILIPINY_50
|
||||
int flowMeterIdxAndDiv = flowMeterNr + 4 * (diverterNr - 1);
|
||||
int flowMeterIdxAndDiv = flowMeterNr + ((flowMeterNr == 3) ? (4 * (diverterNr - 1)) : 0);
|
||||
#else
|
||||
int flowMeterIdxAndDiv = flowMeterNr;
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -15,6 +15,13 @@ namespace TBF.BenchControl.Operations
|
||||
SequenceBase sequenceBase;
|
||||
bool heatMeters;
|
||||
|
||||
/// Constructor: No heat meters
|
||||
public ProcessDataLoggingOp(ILog logger, SequenceBase sequenceBase)
|
||||
: this (logger, sequenceBase, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// Constructor: Heat meters are optional
|
||||
public ProcessDataLoggingOp(ILog logger, SequenceBase sequenceBase, bool heatMeters)
|
||||
{
|
||||
this.logger = logger;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
@ -54,6 +54,7 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.ChangeFlowDirection.Factory());
|
||||
Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.Counter.Factory());
|
||||
Factories.Add(new TestMethods.DiverterTest.Factory());
|
||||
Factories.Add(new TestMethods.Endurance.Factory());
|
||||
Factories.Add(new TestMethods.FixedStart.Single.Factory());
|
||||
Factories.Add(new TestMethods.FixedStart.Compound.Factory());
|
||||
|
||||
40
TBF/BenchControl/TestMethods/DiverterTest/Component.cs
Normal file
40
TBF/BenchControl/TestMethods/DiverterTest/Component.cs
Normal file
@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
|
||||
public bool DoTransitions() { return true; }
|
||||
|
||||
readonly TestMethodCfg testMethodCfg;
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
testMethodCfg = cfg as TestMethodCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new DiverterTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
884
TBF/BenchControl/TestMethods/DiverterTest/DiverterTestSeq.cs
Normal file
884
TBF/BenchControl/TestMethods/DiverterTest/DiverterTestSeq.cs
Normal file
@ -0,0 +1,884 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using TBF.BenchControl;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
public class DiverterTestSeq : Sequences.SequenceBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(DiverterTestSeq));
|
||||
|
||||
/// <summary>
|
||||
/// Flying start mass collection method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, TestParams testParams)
|
||||
{
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
|
||||
}
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
|
||||
}
|
||||
}
|
||||
|
||||
if (test.Volume > scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
return new List<Event> { Event.ConfigurationError };
|
||||
}
|
||||
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
int tMass1 = 0;
|
||||
int tMass2 = 0;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
||||
|
||||
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
TBF.BenchControl.Elde.RegisterReader.RegisterReader eldeRR = rr as TBF.BenchControl.Elde.RegisterReader.RegisterReader;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cBrd.SetFiltersPidShortPulses(filters, outPath.PidCoef, (test.TolerRed == 0) ? 0 : 1);
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if(benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if(benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if(outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if(benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if(benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if(benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, null, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
//------------------------------------------------
|
||||
bool drainTheTank = test.DoDraining;
|
||||
|
||||
if (!drainTheTank) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
///
|
||||
/// Measure the weight and skip emptying if there is enough room in the tank
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
}
|
||||
}
|
||||
///
|
||||
if (drainTheTank)
|
||||
{
|
||||
#if BERLIN || SENTEC
|
||||
switch (DrainTheTank(outPath.Scale, readTempPressOps))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
drainTheTank = false;
|
||||
#else
|
||||
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
//------------------------------------------------
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
|
||||
|
||||
|
||||
if (test.TimePump2StartV > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
if (benchPath.StopBFValve != null)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
|
||||
|
||||
if (test.TimeBeforeFlow > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
setting_flow:
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_adjustment_failed);
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
if (e.Contains(Event.Next)) goto flow_set;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
double currentFlow = RefFlow.Val;
|
||||
if (test.DoControlWaterTemp && (benchPath.TempMtrUp != null) && (benchPath.TempMtrDown != null))
|
||||
{
|
||||
//---------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_temperature);
|
||||
//---------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Next)) goto temperature_set;
|
||||
|
||||
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
|
||||
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
|
||||
{
|
||||
goto temperature_set;
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
temperature_set:
|
||||
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
|
||||
/// Find successfully detected ROI-s
|
||||
IList<GenericDevices.IRoi> rois = new List<GenericDevices.IRoi>();
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IRoi cameraRoI = rr as GenericDevices.IRoi;
|
||||
if ((cameraRoI != null) && cameraRoI.Detected)
|
||||
{
|
||||
rois.Add(cameraRoI);
|
||||
}
|
||||
}
|
||||
|
||||
/// Find cameras
|
||||
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
|
||||
foreach (var roi in rois)
|
||||
{
|
||||
if (roi.Camera != null && !cameras.Contains(roi.Camera))
|
||||
{
|
||||
cameras.Add(roi.Camera);
|
||||
roi.Camera.ClearRoiParams();
|
||||
}
|
||||
}
|
||||
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
if (drainTheTank)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Closing_the_tank);
|
||||
//------------------------------------------------
|
||||
|
||||
///
|
||||
/// Make sure tank draining completed
|
||||
///
|
||||
switch (DrainTheTank(scale, readTempPressOps))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
drainTheTank = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Close the drain valve anyway
|
||||
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
|
||||
if (test.TimeFlow2Mass > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
|
||||
|
||||
LogProcessDataHeader(processDataLogger, "Start mass");
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.TimerExpired))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Mass_measurement_timeout);
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
///
|
||||
/// Initialize cumulated reference and water metert pulses
|
||||
///
|
||||
int[] cumulativeEtPulses = new int[Config.Data.WMsCount + 1]; /// 0 .. Config.Data.WMsCount
|
||||
int[] cumulativeWMPulses = new int[Config.Data.WMsCount + 1]; /// 1 .. Config.Data.WMsCount
|
||||
double[] cumulativeTestTime = new double[Config.Data.WMsCount + 1]; /// 0 .. Config.Data.WMsCount
|
||||
for (int i = 0; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
cumulativeEtPulses[i] = 0;
|
||||
if (i > 0) cumulativeWMPulses[i] = 0;
|
||||
cumulativeTestTime[i] = 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Diverter test loop
|
||||
///
|
||||
for (int divRepetNr = 1; divRepetNr <= testParams.DivRepetitions; divRepetNr++)
|
||||
{
|
||||
LogProcessDataHeader(processDataLogger, string.Format("Measurement {0}", divRepetNr + 1));
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses/ testParams.DivRepetitions))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)(test.TstTime / testParams.DivRepetitions);
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters {2}", test.Method, test.Name, divRepetNr))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
//.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0}. {1} ... {2} {3} {4} {5}", divRepetNr, Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0}. {1} ... {2} s", divRepetNr, Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
RefFreq.Val = cBrd.ReferenceFreq;
|
||||
RefFlow.Val = cBrd.ReferenceFlow;
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
|
||||
if (e.Contains(Event.MeasurementCompleted)) break;
|
||||
}
|
||||
while (!e.Contains(Event.Next)); /// 'Next' button can be used in Debug version
|
||||
|
||||
LogProcessDataHeader(processDataLogger, string.Format("Delay {0}", divRepetNr));
|
||||
|
||||
if (divRepetNr < testParams.DivRepetitions)
|
||||
{
|
||||
/// This is not the last diverter repetition
|
||||
|
||||
/// Delay 5s
|
||||
State.Create(string.Format("{0}({1}) : Delay {2}", test.Method, test.Name, divRepetNr))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
|
||||
/// Accumulate partial pulses
|
||||
cumulativeEtPulses[0] += cBrd.EtPulses(0);
|
||||
cumulativeTestTime[0] += cBrd.TTime;
|
||||
for (int i = 1; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
cumulativeEtPulses[i] += cBrd.EtPulses(i);
|
||||
cumulativeWMPulses[i] += cBrd.WMeterPulses(i);
|
||||
cumulativeTestTime[i] += cBrd.ImpulseTime(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
|
||||
StopRecordingStatistics();
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StopFlowRegulationOp(outPath))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.FlowRegulationStopped));
|
||||
|
||||
///
|
||||
/// (Berlin:) Water is stopped immediately after the test and before the 2nd mass measurement in case:
|
||||
/// - no 'transition sequence after test' is used
|
||||
/// - this is the last (or the only) test repetition or test is a part of an 'outer loop'
|
||||
///
|
||||
#if !CEVAK_200
|
||||
if (isLastRepetition && transitionAfter == null)
|
||||
#endif
|
||||
{
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
|
||||
|
||||
State.Create("SequenceBase : Transition : TestEnd - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired) || !e.Contains(Event.BalanceDone));
|
||||
|
||||
|
||||
LogProcessDataHeader(processDataLogger, "End mass");
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.TimerExpired))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Mass_measurement_timeout);
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
///
|
||||
tMass2 = StateMachine.Time;
|
||||
log.WarnFormat("End mass = {0}kg", EndMass);
|
||||
TestEndTime = DateTime.Now;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
///
|
||||
/// Accumulate partial pulses from the last diverter repetition
|
||||
///
|
||||
cumulativeEtPulses[0] += cBrd.EtPulses(0);
|
||||
cumulativeTestTime[0] += cBrd.TTime;
|
||||
for (int i = 1; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
cumulativeEtPulses[i] += cBrd.EtPulses(i);
|
||||
cumulativeWMPulses[i] += cBrd.WMeterPulses(i);
|
||||
cumulativeTestTime[i] += cBrd.ImpulseTime(i);
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
|
||||
if (tstRslt != null)
|
||||
{
|
||||
UpdateTempPressDensAmb(tstRslt);
|
||||
|
||||
/// Main results
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
tstRslt.EndTime = TestEndTime;
|
||||
tstRslt.FlowSetTime = flowSetTime;
|
||||
tstRslt.TestTime = cumulativeTestTime[0]; /// [s] measurement time
|
||||
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
|
||||
double massOfEvaporatedWater = (double)tstRslt.TimeBtwnMassMsrmnts * outPath.Scale.EvaporationRate(tstRslt.TempDivMean);
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cumulativeEtPulses[0]); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + massOfEvaporatedWater) / tstRslt.TestTime; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
|
||||
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart + massOfEvaporatedWater) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon))
|
||||
{
|
||||
tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume);
|
||||
tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection;
|
||||
tstRslt.VolumeCTV /= tstRslt.TestTime;
|
||||
}
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
tstRslt.FlowStart = (float)RefFlowStat.First;
|
||||
tstRslt.FlowEnd = (float)RefFlowStat.Last;
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
log.DebugFormat("Diverter switch time [s]: Start: {0}ms ({1} {2} {3}) End: {4}ms ({5} {6} {7})",
|
||||
(tstRslt.DiverterStart * 1000).ToString("F0"), tstRslt.DivStart10, tstRslt.DivStart50, tstRslt.DivStart90,
|
||||
(tstRslt.DiverterEnd * 1000).ToString("F0"), tstRslt.DivEnd90, tstRslt.DivEnd50, tstRslt.DivEnd10);
|
||||
|
||||
tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
|
||||
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, tstRslt.DiverterStart, tstRslt.DiverterEnd) : 0;
|
||||
|
||||
///
|
||||
/// Single meters
|
||||
///
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
|
||||
|
||||
/// MetersKind.Single meters
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
|
||||
GenericDevices.IDatastreamReader dstrReader = regReader as GenericDevices.IDatastreamReader;
|
||||
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = regReader as TestMethods.iPerlCommunication.iPerlHead.IperlHead;
|
||||
GenericDevices.IRoi cameraRoi = regReader as GenericDevices.IRoi;
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
||||
|
||||
if (dstrReader != null)
|
||||
{
|
||||
|
||||
meterRslt.TimestampStart = dstrReader.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = dstrReader.NoSamples ? (dstrReader.TimestampSecStart + tstRslt.TestTime) : dstrReader.TimestampSecEnd;
|
||||
meterRslt.TestTime = meterRslt.TimestampEnd - meterRslt.TimestampStart;
|
||||
meterRslt.VolumeStart = dstrReader.VolumeLtrStart; /// liter
|
||||
meterRslt.VolumeEnd = dstrReader.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(dstrReader.VolumeLtrEnd - dstrReader.VolumeLtrStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime;
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
if (iPerl.ResultCode != 0 && (meterRslt.WaterMeter.ResultCode & (int)Results.Entities.ResultCode.OptoErrorCodeMask) == 0)
|
||||
{
|
||||
meterRslt.WaterMeter.ResultCode |= iPerl.ResultCode;
|
||||
}
|
||||
#if IPERL
|
||||
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
}
|
||||
}
|
||||
else if (cameraRoi != null)
|
||||
{
|
||||
meterRslt.TimestampStart = cameraRoi.TimestampStart; /// second
|
||||
meterRslt.TimestampEnd = cameraRoi.TimestampEnd; /// second
|
||||
|
||||
meterRslt.VolumeStart = cameraRoi.VolumeStart; /// liter
|
||||
meterRslt.VolumeEnd = cameraRoi.VolumeEnd; /// liter
|
||||
meterRslt.VolumeMeter = cameraRoi.VolumeEnd - cameraRoi.VolumeStart; /// liter
|
||||
|
||||
if (meterRslt.VolumeMeter != 0)
|
||||
{
|
||||
/// Normal measurement with camera
|
||||
meterRslt.TestTime = cameraRoi.TimestampEnd - cameraRoi.TimestampStart; /// second
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// None or one pulse from the water meter using camera
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(cumulativeEtPulses[i + 1]);
|
||||
meterRslt.VolumeMeter = cumulativeWMPulses[i + 1] * regReader.LtrsPerPulse; /// liter
|
||||
meterRslt.VolumeStart = 0; /// liter
|
||||
meterRslt.VolumeEnd = meterRslt.VolumeMeter; /// liter
|
||||
|
||||
if (regReader.WMPulses >= 1)
|
||||
{
|
||||
/// Normal measurement
|
||||
meterRslt.TestTime = cumulativeTestTime[i + 1];
|
||||
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
|
||||
}
|
||||
else
|
||||
{
|
||||
/// None or one pulse from the water meter
|
||||
meterRslt.TestTime = cumulativeTestTime[0];
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
}
|
||||
}
|
||||
|
||||
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
||||
|
||||
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
|
||||
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
|
||||
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
if (ErrorFlagsComp != null)
|
||||
{
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (BatchRslts.WaterMeters[i] != null)
|
||||
{
|
||||
BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Update results
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
allResults.Info(TestResult2CsvLine(testName, test.Part));
|
||||
|
||||
stopTest:
|
||||
|
||||
StopRecordingStatistics(); /// Make sure graph files are closed
|
||||
|
||||
///
|
||||
/// Quit this sequence
|
||||
///
|
||||
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|
||||
|| retVal == Event.Error || retVal == Event.ConfigurationError)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) break;
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
}
|
||||
|
||||
stopTestWOStoppingDivGateEtc:
|
||||
|
||||
return new List<Event> { retVal };
|
||||
}
|
||||
}
|
||||
}
|
||||
26
TBF/BenchControl/TestMethods/DiverterTest/Factory.cs
Normal file
26
TBF/BenchControl/TestMethods/DiverterTest/Factory.cs
Normal file
@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
49
TBF/BenchControl/TestMethods/DiverterTest/TestMethodCfg.cs
Normal file
49
TBF/BenchControl/TestMethods/DiverterTest/TestMethodCfg.cs
Normal file
@ -0,0 +1,49 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
|
||||
|
||||
/// <summary> Test parameters </summary>
|
||||
[XmlIgnore]
|
||||
public TestParams TestParams;
|
||||
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
|
||||
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(true); }
|
||||
public override IParamsProvider GetUITestParamsProvider(Test test)
|
||||
{
|
||||
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg()
|
||||
{
|
||||
TestParams = new TestParams(true);
|
||||
}
|
||||
|
||||
public TestMethodCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TestMethodCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TestMethodCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TestMethodCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
86
TBF/BenchControl/TestMethods/DiverterTest/TestMethodCfgCtrl.designer.cs
generated
Normal file
86
TBF/BenchControl/TestMethods/DiverterTest/TestMethodCfgCtrl.designer.cs
generated
Normal file
@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
partial class TestMethodCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
}
|
||||
}
|
||||
120
TBF/BenchControl/TestMethods/DiverterTest/TestMethodCfgCtrl.resx
Normal file
120
TBF/BenchControl/TestMethods/DiverterTest/TestMethodCfgCtrl.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
119
TBF/BenchControl/TestMethods/DiverterTest/TestParams.cs
Normal file
119
TBF/BenchControl/TestMethods/DiverterTest/TestParams.cs
Normal file
@ -0,0 +1,119 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
{
|
||||
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public int DivRepetitions; /// Duration of the test in [s]
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
DivRepetitions = 10;
|
||||
}
|
||||
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.Repeats_nr_chdr,
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return DivRepetitions.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: DivRepetitions = int.Parse(strValue); return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
int iDummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(strValue, out iDummy) && (iDummy > 0)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TestParams prms)
|
||||
{
|
||||
prms.DivRepetitions = this.DivRepetitions;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
TestParams pars = new TestParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentTest dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
|
||||
|
||||
testParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
test = dbEntity.Test;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public TestParams()
|
||||
{
|
||||
}
|
||||
|
||||
public TestParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public TestParams(ComponentTest testParamsEntity, string componentName, Test test)
|
||||
{
|
||||
this.testParamsEntity = testParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.test = test;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,10 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|
||||
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
|
||||
public override string ToString() { return string.Format("TestMethods.PMaxTest({0})", Cfg.ToString(1)); }
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
public bool CanTest(MetersKind meters) { return true; }
|
||||
public bool DoTransitions() { return true; }
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.1262.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1262.0")]
|
||||
[assembly: AssemblyVersion("2.18.1263.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1263.0")]
|
||||
|
||||
@ -1089,6 +1089,17 @@
|
||||
<Compile Include="BenchControl\TestMethods\Counter\CounterSeq.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Counter\Factory.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Counter\TestMethod.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\Component.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\Factory.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\DiverterTestSeq.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\TestParams.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\TestMethodCfg.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.designer.cs">
|
||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\Endurance\Component.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Endurance\CycleStep.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Endurance\EnduranceSeq.cs" />
|
||||
@ -2793,6 +2804,9 @@
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\Adjustment\WMErrorsForm24.resx">
|
||||
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.resx">
|
||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\CycleDlg.pl.resx">
|
||||
<DependentUpon>CycleDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user