iPearl debugging, progress management, OracleDB simulation, etc, version 2.1.182
This commit is contained in:
@@ -82,6 +82,8 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
conn = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
}
|
||||
|
||||
if (dbCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
///
|
||||
/// Do something with the database to see if the connection works well
|
||||
///
|
||||
@@ -212,11 +214,14 @@ namespace TBF.BenchControl.DB.SensusOracle
|
||||
bool anyError = false;
|
||||
if (WriteResultsToDisk(batch) == Retv.Error) anyError = true;
|
||||
#if IPERLST
|
||||
if (WriteResultsToDatabase(batch) == Retv.Error) anyError = true;
|
||||
if (dbCfg.DebugLevel != DebugMode.Simulate)
|
||||
{
|
||||
if (WriteResultsToDatabase(batch) == Retv.Error) anyError = true;
|
||||
}
|
||||
#endif
|
||||
if (anyError)
|
||||
{
|
||||
return Event.Error;
|
||||
return Event.ResultsNotWritten;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -241,7 +241,11 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
wm.Q2ErrWOCorrection = iPerl.Q2ErrorWOCorrection;
|
||||
wm.Q2CorrectionDone = iPerl.Q2CorrectionDone;
|
||||
wm.Q2Correction = iPerl.CurrentQ2Correction;
|
||||
if (iPerl.CalibrationStruct.FlowArrow == WaterMeters.iPerl.FlowArrow.Left)
|
||||
if (iPerl.CalibrationStruct == null)
|
||||
{
|
||||
wm.Q2CorrFlowRight = 0;
|
||||
}
|
||||
else if (iPerl.CalibrationStruct.FlowArrow == WaterMeters.iPerl.FlowArrow.Left)
|
||||
{
|
||||
wm.Q2CorrFlowRight = iPerl.PositiveCounting ? 1 : 2;
|
||||
}
|
||||
|
||||
@@ -139,8 +139,11 @@ namespace TBF.BenchControl
|
||||
MeasurementStarted,
|
||||
ReadAllRegistersDone,
|
||||
MeasurementCompleted,
|
||||
|
||||
/// At the end of cycle when saving /printing resultss
|
||||
ResultsPrinted,
|
||||
ResultsWritten,
|
||||
ResultsNotWritten,
|
||||
|
||||
/// Timer events
|
||||
TimerExpired,
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl
|
||||
{
|
||||
public static class Formulas
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
|
||||
|
||||
/// <summary>
|
||||
/// Calculate density of distilled water from temperature
|
||||
/// </summary>
|
||||
@@ -71,41 +74,18 @@ namespace TBF.BenchControl
|
||||
{
|
||||
if (trueVolume <= float.Epsilon)
|
||||
{
|
||||
if (measuredVolume <= float.Epsilon) return 0;
|
||||
if (measuredVolume <= float.Epsilon)
|
||||
{
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, 99.0);
|
||||
return 99.0;
|
||||
}
|
||||
return 100.0 * (measuredVolume - trueVolume) / trueVolume;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcuate progress of the test while setting the flow.
|
||||
/// </summary>
|
||||
/// <param name="currentTime">Current time from the beginning in [s]</param>
|
||||
/// <param name="flowSetTime">Estimated time to set the flow in [s]</param>
|
||||
/// <param name="testTime">Estimated test time in [s]</param>
|
||||
/// <returns>Test progress 0 .. 1.0f</returns>
|
||||
public static float TestProgress(float currentTime, float flowSetTime, float testTime)
|
||||
{
|
||||
// Never return more then 'fixedPart'
|
||||
if (flowSetTime <= float.Epsilon) return 0;
|
||||
float fixedPart = flowSetTime / (flowSetTime + testTime);
|
||||
return (currentTime < flowSetTime) ? (currentTime / flowSetTime) * fixedPart : fixedPart;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate progress of the test during measurement.
|
||||
/// </summary>
|
||||
/// <param name="refPulses">Current number of reference pulses</param>
|
||||
/// <param name="totalPulses">Total number of reference pulses to complete the test</param>
|
||||
/// <param name="flowSetTime">Estimated time to set the flow in [s]</param>
|
||||
/// <param name="testTime">Estimated test time in [s]</param>
|
||||
/// <returns>Test progress 0 .. 1.0f</returns>
|
||||
public static float TestProgress(int refPulses, int totalPulses, float flowSetTime, float testTime)
|
||||
{
|
||||
// Never return less then 'fixedPart' and more then 1.0f
|
||||
if (refPulses > totalPulses) refPulses = totalPulses;
|
||||
float fixedPart = flowSetTime / (flowSetTime + testTime);
|
||||
return fixedPart + (1.0f - fixedPart) * Convert.ToSingle(refPulses) / Convert.ToSingle(totalPulses);
|
||||
double error = 100.0 * (measuredVolume - trueVolume) / trueVolume;
|
||||
log.InfoFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, error);
|
||||
return error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -92,10 +92,12 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
int simultWithPurgingCount = 0;
|
||||
Generic.IComponentCfg simultWithPurgingCfg = null;
|
||||
IList<string> simultWithPurgingNames = new List<string>();
|
||||
IList<Generic.ITestParams> simultWithPurgingParams = new List<Generic.ITestParams>();
|
||||
|
||||
int simultWithEvacuationCount = 0;
|
||||
Generic.IComponentCfg simultWithEvacuationCfg = null;
|
||||
IList<string> simultWithEvacuationNames = new List<string>();
|
||||
IList<Generic.ITestParams> simultWithEvacuationParams = new List<Generic.ITestParams>();
|
||||
|
||||
StateMachine.LoadProcedure(true); // TODO: Implement as an operation so that the worker thread is not blocked
|
||||
@@ -306,6 +308,7 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
simultWithPurgingCount = 0;
|
||||
simultWithPurgingCfg = null;
|
||||
simultWithPurgingNames.Clear();
|
||||
simultWithPurgingParams.Clear();
|
||||
///
|
||||
foreach (var test in StateMachine.Tests)
|
||||
@@ -329,6 +332,7 @@ namespace TBF.BenchControl.Sequences
|
||||
break;
|
||||
}
|
||||
|
||||
simultWithPurgingNames.Add(test.Name);
|
||||
simultWithPurgingParams.Add(testMethodComp.Cfg.GetTestParams().Clone() as Generic.ITestParams);
|
||||
simultWithPurgingCount++;
|
||||
}
|
||||
@@ -338,6 +342,7 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
simultWithEvacuationCount = 0;
|
||||
simultWithEvacuationCfg = null;
|
||||
simultWithEvacuationNames.Clear();
|
||||
simultWithEvacuationParams.Clear();
|
||||
///
|
||||
for (int i = StateMachine.Tests.Count - 1; i >= simultWithPurgingCount; i--)
|
||||
@@ -363,6 +368,7 @@ namespace TBF.BenchControl.Sequences
|
||||
break;
|
||||
}
|
||||
|
||||
simultWithEvacuationNames.Insert(0, test.Name);
|
||||
simultWithEvacuationParams.Insert(0, testMethodComp.Cfg.GetTestParams().Clone() as Generic.ITestParams);
|
||||
simultWithEvacuationCount++;
|
||||
}
|
||||
@@ -374,7 +380,7 @@ namespace TBF.BenchControl.Sequences
|
||||
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stop;
|
||||
|
||||
/// Open iPerlCommunicationForm
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingParams });
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingNames, simultWithPurgingParams });
|
||||
}
|
||||
|
||||
///
|
||||
@@ -644,17 +650,20 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
//------------------------------------------------------
|
||||
Bridge.OnActivity(this, "Saving and printing results");
|
||||
IResultsWriter writer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsWriter) as IResultsWriter;
|
||||
IResultsPrinter printer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsPrinter) as IResultsPrinter;
|
||||
State savingAndPrintingRslts = State.Create("MainSeq : Saving and printing results");
|
||||
|
||||
IResultsWriter writer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsWriter) as IResultsWriter;
|
||||
if (writer != null)
|
||||
{
|
||||
savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(ProcessData.BatchRslts.Batch));
|
||||
}
|
||||
|
||||
IResultsPrinter printer = TbfComponents.FindComponent(StateMachine.Procedure.ResultsPrinter) as IResultsPrinter;
|
||||
if (printer != null && !printer.SupressPrinting)
|
||||
{
|
||||
savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(ProcessData.BatchRslts.Batch, protocolTitle));
|
||||
}
|
||||
|
||||
savingAndPrintingRslts.AddOperation(checkUiOp).EnterState();
|
||||
do
|
||||
{
|
||||
@@ -664,7 +673,7 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
|
||||
bool resultsSent = !e.Contains(Event.Error);
|
||||
bool resultsSent = !e.Contains(Event.ResultsNotWritten);
|
||||
ProcessData.BatchRslts.Batch.RsltsSent = resultsSent;
|
||||
|
||||
///
|
||||
@@ -688,7 +697,7 @@ namespace TBF.BenchControl.Sequences
|
||||
if (simultWithEvacuationCount > 0)
|
||||
{
|
||||
/// Open iPerlCommunicationForm
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithEvacuationCfg, simultWithEvacuationParams });
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithEvacuationCfg, simultWithEvacuationNames, simultWithEvacuationParams });
|
||||
}
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
||||
@@ -631,11 +631,9 @@ namespace TBF.BenchControl.Sequences
|
||||
/// <param name="time">Current test time in [s]</param>
|
||||
/// <param name="progress">Current progress 0 .. 1.0f</param>
|
||||
/// <returns>Data for the UI</returns>
|
||||
protected TestProgressEventArgs GetTestProgressData(Test test, int repetitionNr, bool testRunning, Elde.ControlBoardDev cBrd, float time, float progress)
|
||||
protected TestProgressEventArgs CreateProgressData(Test test, int repetitionNr, Config.Entities.Progress phase, Elde.ControlBoardDev cBrd, float time, int progress)
|
||||
{
|
||||
TestProgressEventArgs data = new TestProgressEventArgs();
|
||||
|
||||
data.RepetitionNr = repetitionNr;
|
||||
TestProgressEventArgs data = new TestProgressEventArgs(test, repetitionNr, phase);
|
||||
|
||||
RefFreq.Val = cBrd.ReferenceFreq;
|
||||
data.FlowMtrFreq = RefFreq;
|
||||
@@ -659,7 +657,7 @@ namespace TBF.BenchControl.Sequences
|
||||
data.AmbientPressure = AmbientPressure;
|
||||
data.AmbientHumidity = AmbientHumidity;
|
||||
|
||||
if (testRunning)
|
||||
if (phase == Config.Entities.Progress.Test)
|
||||
{
|
||||
/// Only when test is running
|
||||
data.RefPulses = cBrd.EtPulses(0);
|
||||
@@ -952,6 +950,16 @@ namespace TBF.BenchControl.Sequences
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
|
||||
@@ -1066,6 +1074,16 @@ namespace TBF.BenchControl.Sequences
|
||||
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
|
||||
compoundRslt.TestDone = true;
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace TBF.BenchControl
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
if (cmpnt is Elde.ControlBoardDev) ControlBoard = cmpnt as Elde.ControlBoardDev;
|
||||
if (cmpnt is IBenchInfo) SequenceBase.BenchInfo = cmpnt as IBenchInfo;
|
||||
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
|
||||
if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter);
|
||||
if ((cmpnt is IRegulValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem))
|
||||
{
|
||||
|
||||
@@ -88,27 +88,25 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
|
||||
State.Create("Adjustment : Starting the pump")
|
||||
State.Create("Adjustment : Waiting 5 sec")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
//Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -122,10 +120,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
//Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -139,12 +134,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
//Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
{
|
||||
@@ -157,6 +149,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
/// Show the modeless dialog with error indication
|
||||
Program.MainWnd.Invoke(new ErrorsFormDlgt(OpenWMErrorsForm), new object[] { this, WaterMeters });
|
||||
|
||||
@@ -240,9 +233,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -333,6 +324,16 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
meterRslt.TestDone = meterRslt.Passed;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
}
|
||||
@@ -382,6 +383,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
@@ -63,29 +63,26 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
|
||||
State.Create("CombinedMeters : Starting the pump")
|
||||
State.Create("CombinedMeters : Waiting 5 sec")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
@@ -98,10 +95,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -120,7 +114,9 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
@@ -153,10 +149,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -171,7 +164,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int time = StateMachine.Time;
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float currentFlow = RefFlow.Val;
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
@@ -285,8 +278,6 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
TestProgressEventArgs data = GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress);
|
||||
/// TODO: Reimplement
|
||||
//for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
|
||||
//{
|
||||
@@ -298,7 +289,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
|
||||
// }
|
||||
//}
|
||||
Bridge.OnTestProgress(this, data);
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -459,10 +450,21 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -500,6 +502,8 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
+27
-26
@@ -80,6 +80,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, (int)totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 120, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
Qrise = 0;
|
||||
Qfall = 0;
|
||||
@@ -139,10 +141,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowDetectTime = StateMachine.Time - flowDetectTime0;
|
||||
float progress = Formulas.TestProgress(flowDetectTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowDetectTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) goto stopTest;
|
||||
}
|
||||
@@ -157,10 +156,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowDetectTime = StateMachine.Time - flowDetectTime0;
|
||||
float progress = Formulas.TestProgress(flowDetectTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowDetectTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) goto stopTest;
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
@@ -201,6 +197,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
float detectedFlow = 0;
|
||||
|
||||
int detectionStartTime = StateMachine.Time;
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
|
||||
|
||||
do
|
||||
{
|
||||
@@ -213,10 +210,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowDetectTime = StateMachine.Time - flowDetectTime0;
|
||||
float progress = Formulas.TestProgress(flowDetectTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowDetectTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) goto stopTest;
|
||||
}
|
||||
@@ -333,8 +327,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
bool goBackToInitFlow = ((rvPulse > 0) && (relativeQave < 0)) ||
|
||||
((rvPulse < 0) && (relativeQave > 0));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
|
||||
if (goBackToInitFlow)
|
||||
{
|
||||
@@ -347,10 +341,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) goto stopTest;
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
@@ -373,16 +364,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, testTimeFromDetectedFlow);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) goto stopTest;
|
||||
//if (e.Contains(Event.FlowTimeOut)) goto do_detection;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
int flowSetTime = StateMachine.Time - flowDetectTime0;
|
||||
|
||||
//start_measurement:
|
||||
|
||||
@@ -464,8 +453,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
TestProgressEventArgs data = GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress);
|
||||
/// TODO: Reimplement
|
||||
//for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
|
||||
//{
|
||||
@@ -477,14 +464,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
|
||||
// }
|
||||
//}
|
||||
Bridge.OnTestProgress(this, data);
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
|
||||
|
||||
measurement_completed:
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
State.Create(Strings.Measure_the_mass)
|
||||
@@ -644,10 +631,22 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
if (Qfall != 0) BatchRslts.WaterMeters[i].QFall = Qfall;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -681,6 +680,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create the return value - a list with one event Event.Done - and return
|
||||
IList<Event> retval1 = new List<Event>(1);
|
||||
retval1.Add(Event.Done);
|
||||
|
||||
+30
-27
@@ -64,28 +64,26 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
|
||||
State.Create("FixedStartAdvanced : Starting the pump")
|
||||
State.Create("FixedStartAdvanced : Waiting 5 sec")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -99,10 +97,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -121,7 +116,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
@@ -155,10 +152,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -172,10 +166,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -190,6 +181,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
|
||||
@@ -351,10 +343,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress));
|
||||
}
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (cBrd.EtPulses(0) < totalPulses);
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -513,9 +503,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
tstRslt.TempDivEnd = TempDivStat.Last;
|
||||
tstRslt.TempDivMin = TempDivStat.Min;
|
||||
tstRslt.TempDivMax = TempDivStat.Max;
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
||||
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
||||
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
||||
|
||||
/// Main results
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
@@ -556,10 +546,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -597,6 +598,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
+25
-23
@@ -64,11 +64,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
@@ -82,10 +83,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -99,10 +97,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -121,7 +116,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
@@ -155,10 +152,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -172,10 +166,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -190,6 +181,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
|
||||
@@ -350,9 +342,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
TestProgressEventArgs data = GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress);
|
||||
/// TODO: Reimplement
|
||||
//for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
|
||||
//{
|
||||
@@ -364,7 +353,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
|
||||
// }
|
||||
//}
|
||||
Bridge.OnTestProgress(this, data);
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (cBrd.EtPulses(0) < totalPulses);
|
||||
/// Measurement loop - end
|
||||
@@ -585,10 +574,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -626,6 +626,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
+26
-23
@@ -64,11 +64,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
@@ -82,10 +83,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -99,10 +97,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -121,7 +116,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
@@ -155,10 +152,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -172,10 +166,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -190,6 +181,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
|
||||
@@ -350,10 +342,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress));
|
||||
}
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (cBrd.EtPulses(0) < totalPulses);
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -555,10 +545,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -596,6 +597,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
@@ -61,13 +61,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
State.Create("FlyingStart : Starting the pump")
|
||||
@@ -77,10 +79,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -94,10 +93,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -112,7 +108,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int time = StateMachine.Time;
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float currentFlow = RefFlow.Val;
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
@@ -189,9 +185,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -277,9 +271,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = iPerl.TimestampSecEnd;
|
||||
meterRslt.TestTime = meterRslt.TimestampEnd - meterRslt.TimestampStart;
|
||||
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = iPerl.NoSamples ? (iPerl.TimestampSecStart + tstRslt.TestTime) : iPerl.TimestampSecEnd;
|
||||
meterRslt.TestTime = iPerl.NoSamples ? tstRslt.TestTime : (meterRslt.TimestampEnd - meterRslt.TimestampStart);
|
||||
meterRslt.VolumeStart = iPerl.VolumeLtrStart; /// liter
|
||||
meterRslt.VolumeEnd = iPerl.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(iPerl.VolumeLtrEnd - iPerl.VolumeLtrStart);
|
||||
@@ -294,7 +288,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.TestTime = tstRslt.TestTime; /// TODO: Malo by sa citat z dosky
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = 0;
|
||||
meterRslt.VolumeMeter = (meterRslt.PulsesPerLiter <= float.Epsilon) ? 0 : meterRslt.PulsesMeter / meterRslt.PulsesPerLiter;
|
||||
@@ -307,10 +301,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -348,6 +353,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
+34
-28
@@ -55,16 +55,18 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
@@ -78,10 +80,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -95,10 +94,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -117,7 +113,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
@@ -150,10 +148,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -168,7 +163,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int time = StateMachine.Time;
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float currentFlow = RefFlow.Val;
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
@@ -325,10 +320,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress));
|
||||
}
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (true);
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -465,10 +458,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = iPerl.TimestampSecEnd;
|
||||
meterRslt.TestTime = meterRslt.TimestampEnd - meterRslt.TimestampStart;
|
||||
meterRslt.VolumeStart = iPerl.VolumeLtrStart; /// liter
|
||||
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = iPerl.NoSamples ? (iPerl.TimestampSecStart + tstRslt.TestTime) : iPerl.TimestampSecEnd;
|
||||
meterRslt.TestTime = iPerl.NoSamples ? tstRslt.TestTime : (meterRslt.TimestampEnd - meterRslt.TimestampStart);
|
||||
meterRslt.VolumeStart = iPerl.VolumeLtrStart; /// liter
|
||||
meterRslt.VolumeEnd = iPerl.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(iPerl.VolumeLtrEnd - iPerl.VolumeLtrStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
@@ -482,8 +475,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.VolumeStart = 0; /// liter
|
||||
meterRslt.TestTime = tstRslt.TestTime; /// TODO: Malo by sa citat z dosky
|
||||
meterRslt.VolumeStart = 0; /// liter
|
||||
meterRslt.VolumeEnd = 0; /// liter
|
||||
meterRslt.VolumeMeter = (meterRslt.PulsesPerLiter <= float.Epsilon) ? 0 : meterRslt.PulsesMeter / meterRslt.PulsesPerLiter;
|
||||
meterRslt.VolumeRef = tstRslt.ConstMaster * meterRslt.PulsesMaster; /// liter
|
||||
@@ -495,10 +488,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
@@ -535,6 +539,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
|
||||
@@ -360,10 +360,21 @@ namespace TBF.BenchControl.TestMethods.LeakTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
|
||||
@@ -276,10 +276,21 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
|
||||
+23
-19
@@ -61,11 +61,12 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
int flowSetTime = 0;
|
||||
float estFlowSetTime = 10.0f;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
@@ -79,10 +80,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -96,10 +94,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -118,6 +113,8 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
@@ -149,10 +146,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, false, cBrd, flowSetTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -167,7 +161,8 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
int time = StateMachine.Time;
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
|
||||
float currentFlow = RefFlow.Val;
|
||||
|
||||
//------------------------------------------------
|
||||
@@ -244,9 +239,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
}
|
||||
log.Debug(logstr);
|
||||
|
||||
|
||||
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
||||
Bridge.OnTestProgress(this, GetTestProgressData(test, repetitionNr, true, cBrd, cBrd.TTime, progress));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
|
||||
@@ -371,15 +364,27 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
LtrPerRefPulse[outPath.FlowMeter.Idx1 - 1] = Convert.ToSingle(tstRslt.ConstMaster);
|
||||
log.InfoFormat("Updating LtrPerRefPulse[{0}] = {1}", outPath.FlowMeter.Idx1 - 1, tstRslt.ConstMaster);
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components(BenchInfo.TestBenchId,
|
||||
BenchInfo.TestBenchName,
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
/// Add data - end
|
||||
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
allResults.Info(TestResult2CsvLine(testName, test.Part));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
|
||||
if (++repetitionNr <= test.Repeats)
|
||||
{
|
||||
@@ -392,7 +397,6 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
///----------------------///
|
||||
/// Quit this sequence ///
|
||||
///----------------------///
|
||||
|
||||
State.Create("ReferenceFlowmeterCalibration : Stopping diverter, gate, etc.")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
|
||||
+55
-14
@@ -241,6 +241,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
const string WriteQ2CorrectionStr = "Write Q2 correction";
|
||||
|
||||
|
||||
DateTime startTime;
|
||||
int startTimeSec;
|
||||
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return formCompleted; } }
|
||||
bool formCompleted;
|
||||
@@ -326,6 +330,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
|
||||
formCompleted = false;
|
||||
|
||||
startTime = DateTime.Now;
|
||||
startTimeSec = StateMachine.Time;
|
||||
|
||||
/// Find QuidoRS
|
||||
foreach (var comp in StateMachine.Components)
|
||||
{
|
||||
@@ -539,7 +546,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
CommCompletedHandler = null;
|
||||
AllCompletedHandler = null;
|
||||
|
||||
UpdateRfidCommResult(StateMachine.Tests[0].Name); /// TODO: Pass the test info in a correct way
|
||||
UpdateRfidCommResult(testNames); /// TODO: Pass the test info in a correct way
|
||||
|
||||
TBF.UiBridge.Bridge.OnTestCompleted(this, new TBF.UiBridge.TestCompletedEventArgs(StateMachine.Tests[0].Name, 0));
|
||||
|
||||
@@ -588,8 +595,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
|
||||
int activityStep = 0; /// activity step > 0 in case multiTestParams are used
|
||||
|
||||
foreach (var testParams in multiTestParams)
|
||||
for (int i = 0; i < multiTestParams.Count; i++ )
|
||||
{
|
||||
iPerlCommunicationParams testParams = multiTestParams[i];
|
||||
|
||||
TBF.UiBridge.TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 10, 140, 0, 0, 0 });
|
||||
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(testNames[i], Config.Entities.Progress.JustStarted));
|
||||
|
||||
string activity = testParams.Activity; /// Current activity
|
||||
|
||||
|
||||
@@ -656,9 +668,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
break;
|
||||
}
|
||||
wmNr++;
|
||||
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(testNames[i], Config.Entities.Progress.FlowSetting));
|
||||
}
|
||||
|
||||
if (!wmFound) OnCommCompleted(null, new CommCompletedEventArgs(threadId, -1, string.Empty)); /// Send negative wmNr
|
||||
if (!wmFound)
|
||||
{
|
||||
OnCommCompleted(null, new CommCompletedEventArgs(threadId, -1, string.Empty)); /// Send negative wmNr
|
||||
}
|
||||
|
||||
if (stopWorkerThreads) break;
|
||||
}
|
||||
@@ -666,6 +682,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
if (stopWorkerThreads) break;
|
||||
} /// for (int group
|
||||
|
||||
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(testNames[i], Config.Entities.Progress.Completed));
|
||||
activityStep++;
|
||||
|
||||
if (stopWorkerThreads) break;
|
||||
@@ -1166,21 +1183,45 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
/// Update test result representing RFID communication success/failure
|
||||
/// </summary>
|
||||
/// <param name="test"></param>
|
||||
void UpdateRfidCommResult(string testName)
|
||||
void UpdateRfidCommResult(IList<string> testNames)
|
||||
{
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
|
||||
DateTime endTime = DateTime.Now;
|
||||
int testTime = StateMachine.Time - startTimeSec;
|
||||
|
||||
for (int i = 0; i < Math.Min(ProcessData.BatchRslts.WMPositionsCount, waterMeters.Count); i++)
|
||||
if (!testNames.Contains(StateMachine.Tests[0].Name))
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt =
|
||||
ProcessData.BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
WaterMeters.iPerl.WaterMeter iPerl = waterMeters[i] as WaterMeters.iPerl.WaterMeter;
|
||||
testNames.Insert(0, StateMachine.Tests[0].Name); /// Add RFID test as th 1st item
|
||||
}
|
||||
|
||||
if (meterRslt != null && iPerl != null)
|
||||
{
|
||||
meterRslt.Passed = (!iPerl.CommFailed && !iPerl.Disabled);
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
foreach (var testName in testNames)
|
||||
{
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
|
||||
|
||||
if (tstRslt != null)
|
||||
{
|
||||
/// Auxiliary results ... not required
|
||||
|
||||
/// Main results
|
||||
tstRslt.StartTime = tstRslt.Batch.StartTime;
|
||||
tstRslt.EndTime = endTime;
|
||||
tstRslt.FlowSetTime = 0;
|
||||
tstRslt.TestTime += testTime; /// [s] total communication time of all tests
|
||||
|
||||
for (int i = 0; i < Math.Min(ProcessData.BatchRslts.WMPositionsCount, waterMeters.Count); i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt =
|
||||
ProcessData.BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
|
||||
WaterMeters.iPerl.WaterMeter iPerl = waterMeters[i] as WaterMeters.iPerl.WaterMeter;
|
||||
|
||||
if (meterRslt != null && iPerl != null)
|
||||
{
|
||||
meterRslt.WaterMeter.SerialNr = iPerl.SerialNr;
|
||||
meterRslt.Passed = (!iPerl.CommFailed && !iPerl.Disabled);
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -85,6 +85,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
}
|
||||
else if (testParams.Activity.ToLower().Contains("simulate "))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 60, 0, 0, 0 } );
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (testParams.Activity.ToLower().Contains("q3")) MakeSimulated(test.Name, 1, 1, 0, -0.5f);
|
||||
else if (testParams.Activity.ToLower().Contains("q2")) MakeSimulated(test.Name, 1, 1, 0, 0.5f);
|
||||
else if (testParams.Activity.ToLower().Contains("q1")) MakeSimulated(test.Name, 1, 1, 0, -5.1f);
|
||||
@@ -93,6 +97,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
else if (testParams.Activity.ToLower().Contains("compound rise")) MakeSimulatedCompound(test.Name, 1, 1, 0, 0.7f, 0.0f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound fall")) MakeSimulatedCompound(test.Name, 1, 1, 0, 0.7f, 0.9f);
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, test.Part));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
@@ -125,7 +130,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
///
|
||||
/// Show the modeless dialog with error indication
|
||||
///
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, cfg, testParams });
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, cfg, test.Name, testParams });
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.iPerl_Communication_in_progress);
|
||||
|
||||
@@ -232,8 +232,11 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
private double timestampSec;
|
||||
private double timestampSec0;
|
||||
|
||||
public double TimestampSecStart;
|
||||
public double TimestampSecEnd;
|
||||
public bool NoSamples { get { return (timestampSecEnd - timestampSecStart) < float.Epsilon; } }
|
||||
public double TimestampSecStart { get { return timestampSecStart; } }
|
||||
public double TimestampSecEnd { get { return timestampSecEnd; } }
|
||||
double timestampSecStart;
|
||||
double timestampSecEnd;
|
||||
double timestampSecEnd1;
|
||||
double timestampSecEnd2;
|
||||
double timestampSecEnd3;
|
||||
@@ -487,7 +490,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
{
|
||||
/// Take the test start sample
|
||||
VolumeLtrStart = volumeLtr;
|
||||
TimestampSecStart = timestampSec;
|
||||
timestampSecStart = timestampSec;
|
||||
TestStartTelegramIx = telegramIx;
|
||||
}
|
||||
|
||||
@@ -497,7 +500,7 @@ namespace TBF.BenchControl.WaterMeters.iPerl
|
||||
volumeLtrEnd2 = volumeLtrEnd1;
|
||||
volumeLtrEnd1 = volumeLtr;
|
||||
|
||||
TimestampSecEnd = timestampSecEnd3;
|
||||
timestampSecEnd = timestampSecEnd3;
|
||||
timestampSecEnd3 = timestampSecEnd2;
|
||||
timestampSecEnd2 = timestampSecEnd1;
|
||||
timestampSecEnd1 = timestampSec;
|
||||
|
||||
Reference in New Issue
Block a user