Make sure CycleBeginForm is closed before the 1st test ends and s/n is in all results
This commit is contained in:
parent
44b1f77b70
commit
bb31cdae56
@ -29,8 +29,6 @@ namespace TBF.BenchControl.Sequences
|
||||
/// <returns></returns>
|
||||
public IList<Event> Execute(Entities.Test dummyArg)
|
||||
{
|
||||
bool beginningDlgClosed = true;
|
||||
|
||||
/// Operations running in more then one state
|
||||
checkUiOp = new CheckUIOp(true);
|
||||
|
||||
@ -159,6 +157,14 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
select_procedure:
|
||||
|
||||
/// Make sure the CycleBeginForm is closed (aftrer an abnormal procedure/test end, etc.)
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stop;
|
||||
}
|
||||
|
||||
selection = MakeSelection(MKSelContext.ProcedureNotSelected);
|
||||
|
||||
//--------------------------------
|
||||
@ -211,8 +217,8 @@ namespace TBF.BenchControl.Sequences
|
||||
case Event.UiCmdStop: goto stop;
|
||||
}
|
||||
|
||||
if (OpenDataEntryBeginning()) goto stop;
|
||||
beginningDlgClosed = false;
|
||||
if (OpenCycleBeginForm()) goto stop;
|
||||
cycleBeginFormOpened = true;
|
||||
|
||||
assume_bench_filled:
|
||||
|
||||
@ -274,10 +280,10 @@ namespace TBF.BenchControl.Sequences
|
||||
//--------------------------------------------------------------
|
||||
e = testMethodSequence.Execute(test);
|
||||
|
||||
if (!beginningDlgClosed)
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
beginningDlgClosed = true;
|
||||
if (CloseDataEntryBeginning()) goto stop;
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stop;
|
||||
}
|
||||
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
@ -313,10 +319,10 @@ namespace TBF.BenchControl.Sequences
|
||||
//--------------------------------------------------------------
|
||||
e = testMethodSequence.Execute(test);
|
||||
|
||||
if (!beginningDlgClosed)
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
beginningDlgClosed = true;
|
||||
if (CloseDataEntryBeginning()) goto stop;
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stop;
|
||||
}
|
||||
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
@ -692,68 +698,6 @@ namespace TBF.BenchControl.Sequences
|
||||
while (true) StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a modeless dialog for entering data at the beginning of a procedure (serial numbers)
|
||||
/// </summary>
|
||||
/// <returns>false = OK, true = stop pressed</returns>
|
||||
bool OpenDataEntryBeginning()
|
||||
{
|
||||
IList<Event> e;
|
||||
GenericDevices.IDataEntry dataEntryCmpnt =
|
||||
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
|
||||
if (dataEntryCmpnt is IHasCycleBeginForm)
|
||||
{
|
||||
Bridge.OnActivity(this, "Enter the water meter data");
|
||||
State.Create("MainSeq : Enter begin data")
|
||||
.AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits until a modeless dialog for entering data at the beginnig of a procedure is closed.
|
||||
/// This function is typically called at the end of the first test of the procedure.
|
||||
/// </summary>
|
||||
/// <returns>false = OK, true = stop pressed</returns>
|
||||
bool CloseDataEntryBeginning()
|
||||
{
|
||||
IList<Event> e;
|
||||
GenericDevices.IDataEntry dataEntryCmpnt =
|
||||
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
|
||||
if (dataEntryCmpnt as IHasCycleBeginForm != null)
|
||||
{
|
||||
if (!State.LastEvents.Contains(Event.ModelessFormClosed))
|
||||
{
|
||||
/// Wait until modeless dialg is closed
|
||||
State.Create("MainSeq : Check whether the entry form is closed")
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) return true;
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
}
|
||||
|
||||
/// A state without any dataEntryCmpnt operation so that Stop() when entering
|
||||
/// this state and Start() when entering the following state are executed.
|
||||
State.Create("MainSeq : Nothing")
|
||||
.AddOperation(checkUiOp)
|
||||
.RemovePermanentOperation(dataEntryCmpnt as IOperation)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) return true;
|
||||
|
||||
dataEntryCmpnt.UpdateTestResults(WaterMeters, results);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform a camera test
|
||||
/// </summary>
|
||||
|
||||
@ -102,6 +102,8 @@ namespace TBF.BenchControl.Sequences
|
||||
protected static float TimeEstimateBeginRpts; /// Time estimate at the beginning of all repetitions of the current tests
|
||||
protected static float TimeEstimateOneTest; /// Time estimate of the current test (one repetition)
|
||||
|
||||
protected static bool cycleBeginFormOpened;
|
||||
|
||||
static SequenceBase()
|
||||
{
|
||||
results = new List<Entities.TestResult>();
|
||||
@ -113,7 +115,9 @@ namespace TBF.BenchControl.Sequences
|
||||
WMVolumes[i] = new FloatBox() { Name = string.Format("Volume{0}", i), Format = "F2" };
|
||||
WMErrors[i] = new FloatBox() { Name = string.Format("Error{0}", i), Format = "F2" };
|
||||
}
|
||||
}
|
||||
|
||||
cycleBeginFormOpened = false;
|
||||
}
|
||||
|
||||
///------------------------------------------------------------
|
||||
/// Test related (instance) variables.
|
||||
@ -555,6 +559,68 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Opens a modeless dialog for entering data at the beginning of a procedure (serial numbers)
|
||||
/// </summary>
|
||||
/// <returns>false = OK, true = stop pressed</returns>
|
||||
protected bool OpenCycleBeginForm()
|
||||
{
|
||||
IList<Event> e;
|
||||
GenericDevices.IDataEntry dataEntryCmpnt =
|
||||
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
|
||||
if (dataEntryCmpnt is IHasCycleBeginForm)
|
||||
{
|
||||
Bridge.OnActivity(this, "Enter the water meter data");
|
||||
State.Create("MainSeq : Enter begin data")
|
||||
.AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Waits until a modeless dialog for entering data at the beginnig of a procedure is closed.
|
||||
/// This function is typically called at the end of the first test of the procedure.
|
||||
/// </summary>
|
||||
/// <returns>false = OK, true = stop pressed</returns>
|
||||
protected bool CloseCycleBeginForm()
|
||||
{
|
||||
IList<Event> e;
|
||||
GenericDevices.IDataEntry dataEntryCmpnt =
|
||||
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
|
||||
if (dataEntryCmpnt as IHasCycleBeginForm != null)
|
||||
{
|
||||
if (!State.LastEvents.Contains(Event.ModelessFormClosed))
|
||||
{
|
||||
/// Wait until modeless dialg is closed
|
||||
State.Create("MainSeq : Check whether the entry form is closed")
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) return true;
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
}
|
||||
|
||||
/// A state without any dataEntryCmpnt operation so that Stop() when entering
|
||||
/// this state and Start() when entering the following state are executed.
|
||||
State.Create("MainSeq : Nothing")
|
||||
.AddOperation(checkUiOp)
|
||||
.RemovePermanentOperation(dataEntryCmpnt as IOperation)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.UiCmdStop)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Main loop where measurements are collected.
|
||||
/// </summary>
|
||||
|
||||
@ -311,9 +311,14 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
///
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stopTest;
|
||||
}
|
||||
|
||||
/// Optionally supress pulses from the large water meter
|
||||
///
|
||||
if (testParams.SupressTrills)
|
||||
{
|
||||
WMPulses[0] = 0;
|
||||
@ -321,7 +326,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestRasult data entity with data
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.TimeEnd = DateTime.Now;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
@ -375,7 +380,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
|
||||
tstRslt.Meters[i].VolumeMeter = Convert.ToSingle(WMPulses[i]) / sensPath.RegisterReaders[i].PulsesPerLtr;
|
||||
}
|
||||
|
||||
tstRslt.Meters[i].SerialNr = "not specified";
|
||||
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
|
||||
tstRslt.Meters[i].VolumeStart = 0; /// [l]
|
||||
tstRslt.Meters[i].VolumeEnd = 0; /// [l]
|
||||
|
||||
|
||||
@ -522,9 +522,15 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
///
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stop;
|
||||
}
|
||||
|
||||
/// Optionally supress pulses from the large water meter
|
||||
///
|
||||
if (testParams.SupressTrills)
|
||||
{
|
||||
WMPulses[0] = 0;
|
||||
@ -532,7 +538,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestRasult data entity with data
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
tstRslt.TimeEnd = DateTime.Now;
|
||||
UpdateTestRsltWithAveragedData(tstRslt);
|
||||
@ -584,11 +590,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
tstRslt.Meters[i].VolumeMeter = Convert.ToSingle(WMPulses[i]) / sensPath.RegisterReaders[i].PulsesPerLtr;
|
||||
}
|
||||
|
||||
tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString();
|
||||
tstRslt.Meters[i].VolumeStart = 0; /// liter
|
||||
tstRslt.Meters[i].VolumeEnd = 0; /// liter
|
||||
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
|
||||
tstRslt.Meters[i].VolumeStart = 0; /// liter
|
||||
tstRslt.Meters[i].VolumeEnd = 0; /// liter
|
||||
|
||||
tstRslt.Meters[i].VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
tstRslt.Meters[i].VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
if (WMRefPulses[i] != 0)
|
||||
{
|
||||
tstRslt.Meters[i].VolumeMeter *= ((float)cBrd.EtPulses(0) / (float)WMRefPulses[i]);
|
||||
@ -601,7 +607,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
tstRslt.Meters[i].VolumeErrorPct = 0; /// Not used
|
||||
}
|
||||
|
||||
tstRslt.CombinedMeters[iCmbnd].VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
tstRslt.CombinedMeters[iCmbnd].VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
tstRslt.CombinedMeters[iCmbnd].VolumeMeter = tstRslt.Meters[2 * iCmbnd].VolumeMeter + tstRslt.Meters[2 * iCmbnd + 1].VolumeMeter;
|
||||
|
||||
tstRslt.CombinedMeters[iCmbnd].PulsesMaster = cBrd.EtPulses(0);
|
||||
|
||||
@ -412,6 +412,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stopTest;
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
@ -453,8 +460,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
tstRslt.TimeDivEnd5 = 0;
|
||||
for (int i = 0; i < Program.WMsCount; i++)
|
||||
{
|
||||
tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString();
|
||||
tstRslt.Meters[i].VolumeMeter = tstRslt.Meters[i].VolumeEnd - tstRslt.Meters[i].VolumeStart;
|
||||
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
|
||||
tstRslt.Meters[i].VolumeMeter = tstRslt.Meters[i].VolumeEnd - tstRslt.Meters[i].VolumeStart;
|
||||
tstRslt.Meters[i].VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
tstRslt.Meters[i].PulsesMeter = 0;
|
||||
tstRslt.Meters[i].PulsesMaster = tstRslt.PulsesMaster;
|
||||
|
||||
@ -237,6 +237,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stopTest;
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
@ -273,7 +280,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
{
|
||||
if (sensPath.RegisterReaders[i] != null)
|
||||
{
|
||||
tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString();
|
||||
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
|
||||
tstRslt.Meters[i].VolumeStart = 0; /// liter
|
||||
tstRslt.Meters[i].VolumeEnd = 0; /// liter
|
||||
if (sensPath.RegisterReaders[i].PulsesPerLtr <= float.Epsilon) tstRslt.Meters[i].VolumeMeter = 0;
|
||||
|
||||
@ -320,6 +320,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stopTest;
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
@ -363,7 +370,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
|
||||
{
|
||||
if (sensPath.RegisterReaders[i] != null)
|
||||
{
|
||||
tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString();
|
||||
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
|
||||
tstRslt.Meters[i].VolumeStart = 0; /// liter
|
||||
tstRslt.Meters[i].VolumeEnd = 0; /// liter
|
||||
if (sensPath.RegisterReaders[i].PulsesPerLtr <= float.Epsilon) tstRslt.Meters[i].VolumeMeter = 0;
|
||||
|
||||
@ -303,6 +303,13 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (cycleBeginFormOpened)
|
||||
{
|
||||
cycleBeginFormOpened = false;
|
||||
if (CloseCycleBeginForm()) goto stopTest;
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
|
||||
Loading…
Reference in New Issue
Block a user