MainSeq modification : Purging End does not leave a measurement session, ver. 2.14.596

This commit is contained in:
Milan Hanajik 2017-06-30 12:04:55 +02:00
parent 1ef666be9e
commit dac91b094e
2 changed files with 95 additions and 64 deletions

View File

@ -22,6 +22,8 @@ namespace TBF.BenchControl.Sequences
public override string ToString() { return "Sequences.MainSeq"; }
bool benchFilled;
int simultWithPurgingCount;
Generic.IComponentCfg simultWithPurgingCfg;
IList<Config.Entities.Test> simultWithPurgingTests;
@ -78,8 +80,15 @@ namespace TBF.BenchControl.Sequences
/// <summary> Constructor </summary>
public MainSeq()
{
benchFilled = false;
simultWithPurgingCount = 0;
simultWithPurgingCfg = null;
simultWithPurgingTests = new List<Config.Entities.Test>();
simultWithPurgingParams = new List<Generic.ITestParams>();
simultWithEvacuationCount = 0;
simultWithEvacuationCfg = null;
simultWithEvacuationTests = new List<Config.Entities.Test>();
simultWithEvacuationParams = new List<Generic.ITestParams>();
}
@ -97,17 +106,6 @@ namespace TBF.BenchControl.Sequences
IList<Event> e;
Selection selection;
bool benchFilled = false;
simultWithPurgingCount = 0;
simultWithPurgingCfg = null;
simultWithPurgingTests.Clear();
simultWithPurgingParams.Clear();
simultWithEvacuationCount = 0;
simultWithEvacuationCfg = null;
simultWithEvacuationTests.Clear();
simultWithEvacuationParams.Clear();
StateMachine.LoadProcedure(true); // TODO: Implement as an operation so that the worker thread is not blocked
@ -466,7 +464,15 @@ namespace TBF.BenchControl.Sequences
selection = MakeSelection(MKSelContext.InsideProcedure);
///
if (selection == Selection.PurgeBegin) goto fill_the_bench;
if (selection == Selection.PurgeEnd) goto evacuation;
if (selection == Selection.PurgeEnd)
{
switch (DoEvacuation(purgeEnd))
{
case Event.Error: goto error;
case Event.UiCmdStop: goto stop;
default: goto select_cycle_or_test;
}
}
if (selection == Selection.Break)
{
StateMachine.ControlBoard.ManualUIAllowed = true;
@ -950,61 +956,18 @@ namespace TBF.BenchControl.Sequences
StateMachine.ControlBoard.ManualUIAllowed = true;
if (simultWithEvacuationCount > 0)
switch (DoEvacuation(purgeEnd))
{
/// Open iPerlCommunicationForm
ProcessData.RegisterReaders = StateMachine.GetMetersPath(simultWithEvacuationTests[0]).RegisterReaders;
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithEvacuationCfg, simultWithEvacuationTests, simultWithEvacuationParams });
case Event.Error: goto error;
case Event.UiCmdStop: goto stop;
default: break;
}
//--------------------------------------------------------
switch (Transition(purgeEnd, TransitionContext.PurgeEnd))
{
case Event.Error:
if (simultWithEvacuationCount > 0) CloseIPerlCommForm();
goto error;
case Event.UiCmdStop:
if (simultWithEvacuationCount > 0) CloseIPerlCommForm();
goto stop;
default:
break;
}
if (simultWithEvacuationCount > 0)
{
///
/// Wait until iPerl communications are completed
///
bool completed = !(modelessDlg is GenericDevices.IHasCompleted)
|| (modelessDlg as GenericDevices.IHasCompleted).Completed;
if (!completed)
{
State.Create("MainSeq : Wait until the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop))
{
CloseIPerlCommForm();
goto stop;
}
completed = (modelessDlg as GenericDevices.IHasCompleted).Completed;
}
while (!completed);
}
modelessDlg = null;
}
benchFilled = false;
Bridge.Bench2UI(ButtonsEtc.ShowBenchEmpty);
Bridge.OnProcedureCompleted(this, new ProcedureCompletedEventArgs(StateMachine.Procedure));
Bridge.OnProcedureCompleted(this, new ProcedureCompletedEventArgs(StateMachine.Procedure));
goto select_procedure;
stop_within_cycle:
//--------------------------------
State.Create("MainSeq : Turning IDLE -> Closing the valves")
@ -1516,5 +1479,73 @@ namespace TBF.BenchControl.Sequences
simultWithEvacuationCount++;
}
}
/// <summary>
/// Executes steps of a evacuation sequence
/// </summary>
/// <returns>
/// Event.Done Transition sequence completed OK
/// Event.UiCmdStop Transition sequence interrupted by the STOP on-screen button
/// Event.Error Error (e.g. RegulValveTimeOut returned by Run() of SetRegulValvePositionOp)
/// </returns>
Event DoEvacuation(TransitionSequence purgeEnd)
{
IList<Event> e;
if (simultWithEvacuationCount > 0)
{
/// Open iPerlCommunicationForm
ProcessData.RegisterReaders = StateMachine.GetMetersPath(simultWithEvacuationTests[0]).RegisterReaders;
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithEvacuationCfg, simultWithEvacuationTests, simultWithEvacuationParams });
}
//--------------------------------------------------------
switch (Transition(purgeEnd, TransitionContext.PurgeEnd))
{
case Event.Error:
if (simultWithEvacuationCount > 0) CloseIPerlCommForm();
return Event.Error;
case Event.UiCmdStop:
if (simultWithEvacuationCount > 0) CloseIPerlCommForm();
return Event.UiCmdStop;
default:
break;
}
if (simultWithEvacuationCount > 0)
{
///
/// Wait until iPerl communications are completed
///
bool completed = !(modelessDlg is GenericDevices.IHasCompleted)
|| (modelessDlg as GenericDevices.IHasCompleted).Completed;
if (!completed)
{
State.Create("MainSeq : Wait until the entry form is closed")
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop))
{
CloseIPerlCommForm();
return Event.UiCmdStop;
}
completed = (modelessDlg as GenericDevices.IHasCompleted).Completed;
}
while (!completed);
}
modelessDlg = null;
}
benchFilled = false;
Bridge.Bench2UI(ButtonsEtc.ShowBenchEmpty);
return Event.Done;
}
}
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.14.595.1")]
[assembly: AssemblyFileVersion("2.14.595.1")]
[assembly: AssemblyVersion("2.14.596.1")]
[assembly: AssemblyFileVersion("2.14.596.1")]