diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs
index 771e4411a..f102d2c72 100644
--- a/Config/Entities/Enums.cs
+++ b/Config/Entities/Enums.cs
@@ -76,6 +76,18 @@ namespace Config.Entities
Count,
}
+ public enum Progress
+ {
+ JustStarted,
+ TransitionBefore,
+ SwitchingFlowDetection,
+ FlowSetting,
+ Test,
+ TransitionAfter,
+ Completed,
+ Count,
+ }
+
public enum Device
{
Screen,
diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs
index 5bca9ce81..06ae19d2c 100644
--- a/Config/Properties/AssemblyInfo.cs
+++ b/Config/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.1.180.0")]
-[assembly: AssemblyFileVersion("2.1.180.0")]
+[assembly: AssemblyVersion("2.1.182.0")]
+[assembly: AssemblyFileVersion("2.1.182.0")]
diff --git a/Results/BatchResults.cs b/Results/BatchResults.cs
index b2b47a11e..a2fce7ade 100644
--- a/Results/BatchResults.cs
+++ b/Results/BatchResults.cs
@@ -170,7 +170,11 @@ namespace Results
{
for (int i = 0; i < WMPositionsCount; i++)
{
- if (WaterMeters[i] != null) Batch.WaterMeters.Add(WaterMeters[i]);
+ if (WaterMeters[i] != null)
+ {
+ WaterMeters[i].Passed = WaterMeters[i].PassedFromTests();
+ Batch.WaterMeters.Add(WaterMeters[i]);
+ }
}
}
}
diff --git a/Results/DB.cs b/Results/DB.cs
index 3ddea4101..19acb6349 100644
--- a/Results/DB.cs
+++ b/Results/DB.cs
@@ -233,9 +233,9 @@ namespace Results
try
{
- session.SaveOrUpdate(TestDataList);
- session.SaveOrUpdate(ComponentsList);
- session.SaveOrUpdate(WaterMeterDataList);
+ foreach (var td in TestDataList) if (td.Id == 0) session.SaveOrUpdate(td);
+ foreach (var cd in ComponentsList) if (cd.Id == 0) session.SaveOrUpdate(cd);
+ foreach (var wd in WaterMeterDataList) if (wd.Id == 0) session.SaveOrUpdate(wd);
session.SaveOrUpdate(batch);
@@ -248,6 +248,8 @@ namespace Results
return false;
}
+ session.Flush();
+
return true;
}
diff --git a/Results/Entities/Components.cs b/Results/Entities/Components.cs
index de3f5d0a3..2a8017b28 100644
--- a/Results/Entities/Components.cs
+++ b/Results/Entities/Components.cs
@@ -81,11 +81,13 @@ namespace Results.Entities
/// Item from the list (existing or added)
public static Components UpdateList(IList list, Components item)
{
+ if (item == null) return null; /// Null item is not stored in the list
+
Components found = list.FirstOrDefault(x => x.Equals(item));
- if (found != null) return found;
+ if (found != null) return found; /// The same item found in the list, The found item returned
- list.Add(item);
+ list.Add(item); /// Item not fund in the list, it is added to the list
return item;
}
}
diff --git a/Results/Entities/MeterTestRslt.cs b/Results/Entities/MeterTestRslt.cs
index b54c12d4d..8f7c99094 100644
--- a/Results/Entities/MeterTestRslt.cs
+++ b/Results/Entities/MeterTestRslt.cs
@@ -57,6 +57,13 @@ namespace Results.Entities
public virtual double QRise() { return WaterMeter.QRise; }
public virtual double QFall() { return WaterMeter.QFall; }
+ public virtual bool Evaluate() { return TestData().Evaluate; }
+
+ public virtual string PassedColorStr()
+ {
+ if (!Evaluate()) return Passed ? "OK|White" : "NOK|White";
+ else return Passed ? "OK|Green" : "NOK|Red";
+ }
public MeterTestRslt()
{
diff --git a/Results/Entities/TestData.cs b/Results/Entities/TestData.cs
index bb20bee5c..fee2104dd 100644
--- a/Results/Entities/TestData.cs
+++ b/Results/Entities/TestData.cs
@@ -80,11 +80,13 @@ namespace Results.Entities
/// Item from the list (existing or added)
public static TestData UpdateList(IList list, TestData item)
{
+ if (item == null) return null; /// Null item is not stored in the list
+
TestData found = list.FirstOrDefault(x => x.Equals(item));
- if (found != null) return found;
+ if (found != null) return found; /// The same item found in the list, The found item returned
- list.Add(item);
+ list.Add(item); /// Item not fund in the list, it is added to the list
return item;
}
}
diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs
index 803216b23..1c74eef02 100644
--- a/Results/Entities/WaterMeter.cs
+++ b/Results/Entities/WaterMeter.cs
@@ -53,6 +53,20 @@ namespace Results.Entities
public virtual DateTime StartTime() { return Batch.StartTime; }
public virtual DateTime EndTime() { return Batch.EndTime; }
+ public virtual bool PassedFromTests()
+ {
+ bool passed = true;
+ foreach (var mtr in MeterTestRslts)
+ {
+ if (mtr.Evaluate() && (!mtr.Passed || !mtr.TestDone))
+ {
+ passed = false;
+ break;
+ }
+ }
+ return passed;
+ }
+
///
/// Not mapped to the database
///
@@ -105,7 +119,7 @@ namespace Results.Entities
sb.AppendFormat("S/N:{0} ", SerialNr);
#endif
- foreach (var tr in MeterTestRslts) sb.AppendFormat(" {0}:{1}%", tr.Name(), tr.Error.ToString("F1"));
+ foreach (var tr in MeterTestRslts) sb.AppendFormat(" {0}:{1}%", tr.Name(), tr.Error.ToString("F2"));
sb.AppendFormat(" test start: {0} {1} batch={2}", StartTime().ToShortDateString(), StartTime().ToShortTimeString(), BatchNr());
return sb.ToString();
}
diff --git a/Results/Entities/WaterMeterData.cs b/Results/Entities/WaterMeterData.cs
index 04180fcbc..0ccbfedc1 100644
--- a/Results/Entities/WaterMeterData.cs
+++ b/Results/Entities/WaterMeterData.cs
@@ -60,11 +60,13 @@ namespace Results.Entities
/// Item from the list (existing or added)
public static WaterMeterData UpdateList(IList list, WaterMeterData item)
{
+ if (item == null) return null; /// Null item is not stored in the list
+
WaterMeterData found = list.FirstOrDefault(x => x.Equals(item));
- if (found != null) return found;
+ if (found != null) return found; /// The same item found in the list, The found item returned
- list.Add(item);
+ list.Add(item); /// Item not fund in the list, it is added to the list
return item;
}
}
diff --git a/Results/ItemSpec.cs b/Results/ItemSpec.cs
index 9935a8581..fd6db53b0 100644
--- a/Results/ItemSpec.cs
+++ b/Results/ItemSpec.cs
@@ -116,8 +116,7 @@ namespace Results
AllItems.Add(new ItemSpec("Volume", "Volume [l]", x => x.VolumeMeter.ToString("F3"), (x, y, z) => z.VolumeMeter.ToString("F3")));
AllItems.Add(new ItemSpec("Reference volume", "Vol.ref. [l]", x => x.VolumeRef.ToString("F3"), (x, y, z) => z.VolumeRef.ToString("F3")));
AllItems.Add(new ItemSpec("Error", "Error [%]", x => x.Error.ToString("F2"), (x, y, z) => z.Error.ToString("F2")));
- AllItems.Add(new ItemSpec("Passed", "Result", x => (x.Passed ? "OK" + "|Green" : "NOK" + "|Red"),
- (x, y, z) => (z.Passed ? "OK" + "|Green" : "NOK" + "|Red")));
+ AllItems.Add(new ItemSpec("Passed", "Result", x => x.PassedColorStr(), (x, y, z) => z.PassedColorStr()));
/// Single water meters only results
AllItems.Add(new ItemSpec("Serial Nr", "s/n", x => x.SerialNr(), null));
AllItems.Add(new ItemSpec("End state", "End state", x => x.EndState(), null));
@@ -172,7 +171,11 @@ namespace Results
/// String representation of the float number
public static string DoubleToStr(double value, int validDigits)
{
- if (validDigits == 4)
+ if (-float.Epsilon <= value && value <= float.Epsilon)
+ {
+ return "0";
+ }
+ else if (validDigits == 4)
{
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs
index 983c666ea..32a61b022 100644
--- a/Results/Properties/AssemblyInfo.cs
+++ b/Results/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.1.180.0")]
-[assembly: AssemblyFileVersion("2.1.180.0")]
+[assembly: AssemblyVersion("2.1.182.0")]
+[assembly: AssemblyFileVersion("2.1.182.0")]
diff --git a/ResultsBrowser/Properties/AssemblyInfo.cs b/ResultsBrowser/Properties/AssemblyInfo.cs
index c44288ee6..2509afa30 100644
--- a/ResultsBrowser/Properties/AssemblyInfo.cs
+++ b/ResultsBrowser/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.1.180.0")]
-[assembly: AssemblyFileVersion("2.1.180.0")]
+[assembly: AssemblyVersion("2.1.182.0")]
+[assembly: AssemblyFileVersion("2.1.182.0")]
diff --git a/TestBenchFramework/BenchControl/DB/SensusOracle/Database.cs b/TestBenchFramework/BenchControl/DB/SensusOracle/Database.cs
index 17bdce644..4dfe33207 100644
--- a/TestBenchFramework/BenchControl/DB/SensusOracle/Database.cs
+++ b/TestBenchFramework/BenchControl/DB/SensusOracle/Database.cs
@@ -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
{
diff --git a/TestBenchFramework/BenchControl/DataEntry/iPerl/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/iPerl/EntryForm.cs
index 04cd2a203..ced73b1c3 100644
--- a/TestBenchFramework/BenchControl/DataEntry/iPerl/EntryForm.cs
+++ b/TestBenchFramework/BenchControl/DataEntry/iPerl/EntryForm.cs
@@ -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;
}
diff --git a/TestBenchFramework/BenchControl/Events.cs b/TestBenchFramework/BenchControl/Events.cs
index 70a7ce0e5..ac942b0df 100644
--- a/TestBenchFramework/BenchControl/Events.cs
+++ b/TestBenchFramework/BenchControl/Events.cs
@@ -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,
diff --git a/TestBenchFramework/BenchControl/Formulas.cs b/TestBenchFramework/BenchControl/Formulas.cs
index 3b7713ca6..0f0bb1011 100644
--- a/TestBenchFramework/BenchControl/Formulas.cs
+++ b/TestBenchFramework/BenchControl/Formulas.cs
@@ -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));
+
///
/// Calculate density of distilled water from temperature
///
@@ -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;
- }
-
- ///
- /// Calcuate progress of the test while setting the flow.
- ///
- /// Current time from the beginning in [s]
- /// Estimated time to set the flow in [s]
- /// Estimated test time in [s]
- /// Test progress 0 .. 1.0f
- 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;
- }
-
- ///
- /// Calculate progress of the test during measurement.
- ///
- /// Current number of reference pulses
- /// Total number of reference pulses to complete the test
- /// Estimated time to set the flow in [s]
- /// Estimated test time in [s]
- /// Test progress 0 .. 1.0f
- 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;
}
///
diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
index a282b39a4..95ab399d2 100644
--- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
+++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
@@ -92,10 +92,12 @@ namespace TBF.BenchControl.Sequences
int simultWithPurgingCount = 0;
Generic.IComponentCfg simultWithPurgingCfg = null;
+ IList simultWithPurgingNames = new List();
IList simultWithPurgingParams = new List();
int simultWithEvacuationCount = 0;
Generic.IComponentCfg simultWithEvacuationCfg = null;
+ IList simultWithEvacuationNames = new List();
IList simultWithEvacuationParams = new List();
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 });
}
//--------------------------------------------------------
diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs
index 59553be34..821d331b4 100644
--- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs
+++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs
@@ -631,11 +631,9 @@ namespace TBF.BenchControl.Sequences
/// Current test time in [s]
/// Current progress 0 .. 1.0f
/// Data for the UI
- 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));
}
}
}
diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs
index c1f6e3cd8..38430daf6 100644
--- a/TestBenchFramework/BenchControl/StateMachine.cs
+++ b/TestBenchFramework/BenchControl/StateMachine.cs
@@ -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))
{
diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
index ad2848e42..2f7b81645 100644
--- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs
index 73df2447b..bc192b483 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs
index 923cdb5bf..7412314e8 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs
@@ -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 retval1 = new List(1);
retval1.Add(Event.Done);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs
index 6e77a3e7d..90e9dd356 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs
index e23bd2ea4..8f2d4abeb 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
index 467d8dcd3..d615ae232 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs
index 5af9b82ed..880cbccc9 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
index 7ef5e657c..4e3d75794 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
@@ -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 retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs
index 90ff8c112..76ac7db84 100644
--- a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs
@@ -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
diff --git a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs
index 74cec4d61..119c7626d 100644
--- a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs
@@ -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
diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs
index 2f3247183..e4f28b2ad 100644
--- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs
@@ -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())
diff --git a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs
index 0ff2c6926..3b750f7a9 100644
--- a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs
@@ -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
///
///
- void UpdateRfidCommResult(string testName)
+ void UpdateRfidCommResult(IList 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;
+ }
+ }
+ }
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
index c1fa856dc..06b43cb78 100644
--- a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
@@ -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);
diff --git a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs
index 18bf4ee8f..006a27760 100644
--- a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs
+++ b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs
@@ -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;
diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs
index 4e3b01da9..e810ca3b7 100644
--- a/TestBenchFramework/Properties/AssemblyInfo.cs
+++ b/TestBenchFramework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.1.180.1")]
-[assembly: AssemblyFileVersion("2.1.180.1")]
+[assembly: AssemblyVersion("2.1.182.1")]
+[assembly: AssemblyFileVersion("2.1.182.1")]
diff --git a/TestBenchFramework/Screens/MeasurementTabPageCtrl.cs b/TestBenchFramework/Screens/MeasurementTabPageCtrl.cs
index ec683bc88..ccd327b8f 100644
--- a/TestBenchFramework/Screens/MeasurementTabPageCtrl.cs
+++ b/TestBenchFramework/Screens/MeasurementTabPageCtrl.cs
@@ -33,30 +33,30 @@ namespace TBF.Screens
{
InitializeComponent();
- Bridge.TestSelectedHandler += delegate(object sender, TestSelectedEventArgs args)
- {
- if (InvokeRequired)
- {
- Invoke(new EventHandler(OnTestSelected), sender, args);
- }
- else OnTestSelected(sender, args);
- };
- Bridge.TestProgressHandler += delegate(object sender, TestProgressEventArgs args)
- {
- if (InvokeRequired)
- {
- Invoke(new EventHandler(OnTestProgress), sender, args);
- }
- else OnTestProgress(sender, args);
- };
- Bridge.TestCompletedHandler += delegate(object sender, TestCompletedEventArgs args)
- {
- if (InvokeRequired)
- {
- Invoke(new EventHandler(OnTestCompleted), sender, args);
- }
- else OnTestCompleted(sender, args);
- };
+ //Bridge.TestSelectedHandler += delegate(object sender, TestSelectedEventArgs args)
+ //{
+ // if (InvokeRequired)
+ // {
+ // Invoke(new EventHandler(OnTestSelected), sender, args);
+ // }
+ // else OnTestSelected(sender, args);
+ //};
+ //Bridge.TestProgressHandler += delegate(object sender, TestProgressEventArgs args)
+ //{
+ // if (InvokeRequired)
+ // {
+ // Invoke(new EventHandler(OnTestProgress), sender, args);
+ // }
+ // else OnTestProgress(sender, args);
+ //};
+ //Bridge.TestCompletedHandler += delegate(object sender, TestCompletedEventArgs args)
+ //{
+ // if (InvokeRequired)
+ // {
+ // Invoke(new EventHandler(OnTestCompleted), sender, args);
+ // }
+ // else OnTestCompleted(sender, args);
+ //};
Init();
}
diff --git a/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs b/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs
index ad2ec80ec..6164f5dec 100644
--- a/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs
+++ b/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs
@@ -7,6 +7,7 @@ using System.Drawing;
using System.Windows.Forms;
using log4net;
using Config.Entities;
+using TBF.BenchControl.Sequences;
using TBF.UiBridge;
using TBF.Resources;
@@ -412,68 +413,72 @@ namespace TBF.Screens
void OnTestProgress(object sender, TestProgressEventArgs args)
{
- /// Top part
- airTempLabel.Text = args.AmbientTemp.ToString();
- airPressLabel.Text = args.AmbientPressure.ToString();
- airHumiLabel.Text = args.AmbientHumidity.ToString();
+ airTempLabel.Text = ProcessData.AmbientTemp.ToString();
+ airPressLabel.Text = ProcessData.AmbientPressure.ToString();
+ airHumiLabel.Text = ProcessData.AmbientHumidity.ToString();
- refPulsesLabel.Text = args.RefPulses.ToString();
- refFreqLabel.Text = args.FlowMtrFreq.ToString();
- refFlowLabel.Text = Utils.FloatToStr(args.Flow.Val, 4);
- refVolumeLabel.Text = args.Volume.ToString();
+ tInLabel.Text = ProcessData.TempIn.ToString();
+ tOutLabel.Text = ProcessData.TempOut.ToString();
+ prInLabel.Text = ProcessData.PressureUp.ToString();
+ prOutLabel.Text = ProcessData.PressureDown.ToString();
- //regValvePosLabel.Text = args.RegValvePos.ToString();
- tDivLabel.Text = args.Tdiv.ToString();
+ refPulsesLabel.Text = ProcessData.RefCount.ToString();
+ refFreqLabel.Text = ProcessData.RefFreq.ToString();
+ refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4);
- /// Bottom part
- if (currentMetersKind == MetersKind.Single)
- {
- for (int i = 0; i < textBoxesCount; i++)
- {
- /// TODO: Reimplement
- //pulses[i].Text = args.TestResult.Meters[i].PulsesMeter.ToString();
- //refPulses[i].Text = args.TestResult.Meters[i].PulsesMaster.ToString();
- //volume[i].Text = args.TestResult.Meters[i].VolumeMeter.ToString();
- //error[i].Text = args.TestResult.Meters[i].VolumeErrorPct.ToString("F2");
- }
- }
- else if (currentMetersKind == MetersKind.Combined)
- {
- for (int i = 0; i < 2; i++)
- {
- /// TODO: Reimplement
- //pulses[i].Text = args.TestResult.Meters[i].PulsesMeter.ToString();
- //refPulses[i].Text = args.TestResult.Meters[i].PulsesMaster.ToString();
- //volume[i].Text = args.TestResult.Meters[i].VolumeMeter.ToString();
- //error[i].Text = args.TestResult.Meters[i].VolumeErrorPct.ToString("F2");
- }
- /// TODO: Reimplement
- //volume1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeMeter.ToString();
- //error1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeErrorPct.ToString("F2");
- }
-
- tInLabel.Text = args.Tin.ToString();
- tOutLabel.Text = args.Tout.ToString();
- prInLabel.Text = args.Pin.ToString();
- prOutLabel.Text = args.Pout.ToString();
-
- massLabel.Text = args.Mass.ToString();
-
- if (args.Mass.Valid && args.StartMass.Valid)
+ if (args.Phase == Config.Entities.Progress.Test)
{
- massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format);
- }
+ ///// Top part
+ //refVolumeLabel.Text = args.Volume.ToString();
- if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank)
- {
- //if (pumpOn != args.PumpOn)
+ ////regValvePosLabel.Text = args.RegValvePos.ToString();
+ //tDivLabel.Text = args.Tdiv.ToString();
+
+ ///// Bottom part
+ //if (currentMetersKind == MetersKind.Single)
//{
- // if (pumpOn) pumpPictureBox.Image = System.Resources.
- // else pumpPictureBox.Image = System.Resources.
+ // for (int i = 0; i < textBoxesCount; i++)
+ // {
+ // /// TODO: Reimplement
+ // //pulses[i].Text = args.TestResult.Meters[i].PulsesMeter.ToString();
+ // //refPulses[i].Text = args.TestResult.Meters[i].PulsesMaster.ToString();
+ // //volume[i].Text = args.TestResult.Meters[i].VolumeMeter.ToString();
+ // //error[i].Text = args.TestResult.Meters[i].VolumeErrorPct.ToString("F2");
+ // }
+ //}
+ //else if (currentMetersKind == MetersKind.Combined)
+ //{
+ // for (int i = 0; i < 2; i++)
+ // {
+ // /// TODO: Reimplement
+ // //pulses[i].Text = args.TestResult.Meters[i].PulsesMeter.ToString();
+ // //refPulses[i].Text = args.TestResult.Meters[i].PulsesMaster.ToString();
+ // //volume[i].Text = args.TestResult.Meters[i].VolumeMeter.ToString();
+ // //error[i].Text = args.TestResult.Meters[i].VolumeErrorPct.ToString("F2");
+ // }
+ // /// TODO: Reimplement
+ // //volume1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeMeter.ToString();
+ // //error1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeErrorPct.ToString("F2");
+ //}
+
+ //massLabel.Text = args.Mass.ToString();
+
+ //if (args.Mass.Valid && args.StartMass.Valid)
+ //{
+ // massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format);
+ //}
+
+ //if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank)
+ //{
+ // //if (pumpOn != args.PumpOn)
+ // //{
+ // // if (pumpOn) pumpPictureBox.Image = System.Resources.
+ // // else pumpPictureBox.Image = System.Resources.
+ // //}
+ // pumpOn = args.PumpOn;
+ // diverterToTank = args.DivToTank;
+ // Invalidate();
//}
- pumpOn = args.PumpOn;
- diverterToTank = args.DivToTank;
- Invalidate();
}
}
diff --git a/TestBenchFramework/TestProgressControls.cs b/TestBenchFramework/TestProgressControls.cs
index 59d365b9d..3a650c9f5 100644
--- a/TestBenchFramework/TestProgressControls.cs
+++ b/TestBenchFramework/TestProgressControls.cs
@@ -77,7 +77,7 @@ namespace TBF
for (int i = 1; i <= test.Repeats; i++)
{
UiControls.TestProgressCtrl prgrs =
- new UiControls.TestProgressCtrl(test.Id, Utils.TestTitle(test, i), i, test.Repeats);
+ new UiControls.TestProgressCtrl(test.Id, Results.Utils.GetTestName(test.Name, test.Repeats, i), Utils.TestTitle(test, i), i, test.Repeats);
progresses.Add(prgrs);
parent.Controls.Add(prgrs);
}
@@ -104,7 +104,14 @@ namespace TBF
void OnTestProgress(object sender, TestProgressEventArgs args)
{
- if (currentProgress != null) currentProgress.Progress = args.Progress;
+ foreach (var prgrs in progresses)
+ {
+ if ((prgrs.TestName == args.TestName))
+ {
+ prgrs.Progress = args.Progress;
+ break;
+ }
+ }
}
void OnTestCompleted(object sender, TestCompletedEventArgs args)
diff --git a/TestBenchFramework/UiBridge/TestProgressEventArgs.cs b/TestBenchFramework/UiBridge/TestProgressEventArgs.cs
index d3d00d2a1..b02fb6ced 100644
--- a/TestBenchFramework/UiBridge/TestProgressEventArgs.cs
+++ b/TestBenchFramework/UiBridge/TestProgressEventArgs.cs
@@ -9,10 +9,16 @@ namespace TBF.UiBridge
{
public class TestProgressEventArgs : EventArgs
{
+ public string TestName;
+ public int Part;
+ public int Repeats;
public int RepetitionNr;
- public float Progress;
+
+ public Config.Entities.Progress Phase;
+ public int Progress; /// value in the range 0..100
public float OveralProgress;
+
public int RefPulses; /// Reference pulses count since the test start
public FloatBox RegValvePos; /// Current regulation valve position in [%] (0 .. 100.0)
public FloatBox FlowMtrFreq; /// Current reference flowmeter frequency in [Hz] (0 .. 2000.0 in case within range)
@@ -32,5 +38,93 @@ namespace TBF.UiBridge
public FloatBox AmbientTemp;
public FloatBox AmbientPressure;
public FloatBox AmbientHumidity;
+
+
+#region Static and base constructor part
+
+ static int[] estimatedTime; /// Estimated time of each phase to calculate the progress [s]
+ static int[] cumulativeSumsOfEstimates;
+ static int currentPhaseStartTime;
+ static Config.Entities.Progress currentPhase;
+
+ static TestProgressEventArgs()
+ {
+ int[] estTime = new int[(int)Config.Entities.Progress.Count];
+ for (int i = 0; i < estTime.Length; i++) estTime[i] = 10;
+ cumulativeSumsOfEstimates = new int[(int)Config.Entities.Progress.Count];
+ SetEstimatedTimes(estTime);
+
+ currentPhaseStartTime = BenchControl.StateMachine.Time;
+ currentPhase = Config.Entities.Progress.JustStarted;
+ }
+
+ ///
+ /// Set estimated time of each phase in [s] (see Config.Entities.Progress).
+ ///
+ /// Array: estimated time of each phase in [s]
+ public static void SetEstimatedTimes(int[] estTime)
+ {
+ if (estTime.Length != (int)Config.Entities.Progress.Count) return;
+ estimatedTime = estTime;
+ for (int i = 0; i < estTime.Length; i++)
+ {
+ cumulativeSumsOfEstimates[i] = (i > 0) ? cumulativeSumsOfEstimates[i - 1] : 0;
+ cumulativeSumsOfEstimates[i] += estTime[i];
+ }
+ }
+
+ ///
+ /// Base constructor which maintains currentPhase, currentPhaseStartTime
+ /// and calculates 'Progress'.
+ ///
+ ///
+ private TestProgressEventArgs(Config.Entities.Progress phase)
+ {
+ if (phase != currentPhase)
+ {
+ currentPhase = phase;
+ currentPhaseStartTime = BenchControl.StateMachine.Time;
+ }
+
+ Phase = phase;
+ int phaseNr = (int)phase;
+
+ int currentPhaseTime = Math.Min(BenchControl.StateMachine.Time - currentPhaseStartTime, estimatedTime[phaseNr]);
+ int currentTestTime = currentPhaseTime + ((phaseNr == 0) ? 0 : cumulativeSumsOfEstimates[phaseNr - 1]);
+
+ int add10pct = cumulativeSumsOfEstimates[(int)Config.Entities.Progress.Count - 1] / 9;
+
+
+ Progress = 100 * (currentTestTime + add10pct)
+ / (cumulativeSumsOfEstimates[(int)Config.Entities.Progress.Count - 1] + add10pct);
+ }
+
+#endregion
+
+ public TestProgressEventArgs(Config.Entities.Test test, int repetitionNr, Config.Entities.Progress progress)
+ : this(progress)
+ {
+ TestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
+ Part = test.Part;
+ Repeats = test.Repeats;
+ RepetitionNr = repetitionNr;
+ }
+
+ public TestProgressEventArgs(Config.Entities.Test test, Config.Entities.Progress progress)
+ : this(test, 1, progress)
+ {
+ }
+
+ ///
+ /// Used by iPearl communication dialog
+ ///
+ public TestProgressEventArgs(string testName, Config.Entities.Progress progress)
+ : this(progress)
+ {
+ TestName = testName;
+ Part = 0;
+ Repeats = 1;
+ RepetitionNr = 1;
+ }
}
}
diff --git a/TestBenchFramework/UiControls/TestProgressCtrl.cs b/TestBenchFramework/UiControls/TestProgressCtrl.cs
index b820bb956..80aaab6eb 100644
--- a/TestBenchFramework/UiControls/TestProgressCtrl.cs
+++ b/TestBenchFramework/UiControls/TestProgressCtrl.cs
@@ -34,15 +34,18 @@ namespace TBF.UiControls
int testId;
public int TestId { get { return testId; } }
- string testName;
- public string TestName { get { return testName; } }
+ string testName;
+ public string TestName { get { return testName; } }
+
+ string title;
+ public string Title2 { get { return title; } }
int repetitionNr;
public int RepetitionNr { get { return repetitionNr; } }
public string Title { set { testNameLabel.Text = value; } }
- public float Progress { set { testProgressBar.Value = (int)(100.499f * value); } }
+ public int Progress { set { testProgressBar.Value = value; } }
public ProgressBar TestProgressBar { get { return testProgressBar; } }
public TestProgressCtrl()
@@ -52,11 +55,12 @@ namespace TBF.UiControls
this.TestResult = UiControls.TestProgressCtrl.Result.NotDone;
}
- public TestProgressCtrl(int testId, string title, int repetitionNr, int testRepeats)
+ public TestProgressCtrl(int testId, string testName, string title, int repetitionNr, int testRepeats)
: this()
{
this.testId = testId;
- this.testName = title;
+ this.testName = testName;
+ this.title = title;
this.repetitionNr = repetitionNr;
this.Title = title;
}
diff --git a/TestBenchFramework/Utils.cs b/TestBenchFramework/Utils.cs
index cc0fc290e..5c11b3ff8 100644
--- a/TestBenchFramework/Utils.cs
+++ b/TestBenchFramework/Utils.cs
@@ -305,7 +305,11 @@ namespace TBF
/// String representation of a float number
public static string FloatToStr(float value, int validDigits)
{
- if (validDigits == 4)
+ if (-float.Epsilon <= value && value <= float.Epsilon)
+ {
+ return "0";
+ }
+ else if (validDigits == 4)
{
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");
@@ -345,7 +349,11 @@ namespace TBF
/// String representation of a double number
public static string DoubleToStr(double value, int validDigits)
{
- if (validDigits == 4)
+ if (-float.Epsilon <= value && value <= float.Epsilon)
+ {
+ return "0";
+ }
+ else if (validDigits == 4)
{
if (value >= 999.5 || value < -999.5) return value.ToString("F0");
else if (value >= 99.95 || value < -99.95) return value.ToString("F1");