iPearl debugging, progress management, OracleDB simulation, etc, version 2.1.182

This commit is contained in:
Milan Hanajik
2016-01-09 20:06:59 +01:00
parent 68c4bf5956
commit 98c8b0e7a8
40 changed files with 670 additions and 381 deletions
@@ -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);