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