enum FillState in Common.Enums, FillState ProcessData.FillState introduced and used in TBF.Rig.Sequences.

This commit is contained in:
Milan Hanajik
2022-01-04 18:10:44 +01:00
parent 1133a2d5bf
commit 8da5512eb0
5 changed files with 56 additions and 29 deletions
+7 -5
View File
@@ -25,8 +25,6 @@ namespace TBF.Rig.Sequences
public override string ToString() { return "Sequences.MainSeq"; }
bool benchFilled;
int simultWithPurgingCount;
Generic.IComponentCfg simultWithPurgingCfg;
Generic.IProcedureParams simultWithPurgingProcParams;
@@ -132,7 +130,7 @@ namespace TBF.Rig.Sequences
/// </summary>
public MainSeq()
{
benchFilled = false;
FillState = FillState.Unknown;
simultWithPurgingCount = 0;
simultWithPurgingCfg = null;
@@ -521,7 +519,10 @@ namespace TBF.Rig.Sequences
{
goto assume_bench_filled;
}
else if ((selection == Selection.Cycle && benchFilled) || (selection == Selection.RestoreBatch) || (selection == Selection.RestoreAndFixBatch) || (selection == Selection.RestoreInterruptedSession))
else if ((selection == Selection.Cycle && FillState == FillState.Full) ||
(selection == Selection.RestoreBatch) ||
(selection == Selection.RestoreAndFixBatch) ||
(selection == Selection.RestoreInterruptedSession))
{
///
/// Always ask a question in case of a restored batch
@@ -608,7 +609,7 @@ namespace TBF.Rig.Sequences
assume_bench_filled:
benchFilled = true;
FillState = FillState.Full;
Bridge.Bench2UI(ButtonsEtc.ShowBenchFilled);
if ((selection == Selection.Cycle) || (selection == Selection.RestoreBatch) || (selection == Selection.RestoreAndFixBatch))
@@ -726,6 +727,7 @@ namespace TBF.Rig.Sequences
if (selection == Selection.PurgeBegin) goto fill_the_bench;
if (selection == Selection.PurgeEnd)
{
FillState = FillState.Unknown; /// Enfoce evacuation
switch (DoEvacuation(purgeEnd))
{
case Event.Error: goto error;
+15 -14
View File
@@ -789,31 +789,32 @@ namespace TBF.Rig.Sequences
var firstRR = ProcessData.RegisterReaders.FirstOrDefault<IRegReader>(x => x != null);
if (firstRR is TBF.Rig.TestMethods.iPerlCommunication.iPerlHead.IperlHead)
{
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm),
new object[] { this, simultWithEvacuationCfg, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm),
new object[] { this, simultWithEvacuationCfg, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
}
else if (firstRR is TBF.Rig.RegisterReaders.S640Stream.S640Stream)
{
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenS640CommForm),
new object[] { this, simultWithEvacuationCfg, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
new object[] { this, simultWithEvacuationCfg, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
}
}
//--------------------------------------------------------
benchFilled = false; /// because evacuation sequence started
///
switch (Transition(purgeEnd, TransitionContext.PurgeEnd))
if (FillState != FillState.Empty)
{
case Event.Error:
if (simultWithEvacuationCount > 0) CloseCommunicationForm();
return Event.Error;
switch (Transition(purgeEnd, TransitionContext.PurgeEnd))
{
case Event.Error:
if (simultWithEvacuationCount > 0) CloseCommunicationForm();
return Event.Error;
case Event.UiCmdStop:
if (simultWithEvacuationCount > 0) CloseCommunicationForm();
return Event.UiCmdStop;
case Event.UiCmdStop:
if (simultWithEvacuationCount > 0) CloseCommunicationForm();
return Event.UiCmdStop;
default:
break;
default:
break;
}
}
if (simultWithEvacuationCount > 0)
+8
View File
@@ -74,6 +74,13 @@ namespace TBF.Rig.Sequences
public static IList<Results.Output.SensusTestInfo> RawTestInfos; /// Incomplete raw test infos from Oracle DB
public static Results.Output.SensusTestInfo[] CompleteTestInfos; /// Complete TBF test infos obtained as a best mathch
/// <summary>
/// State of water filled in the test bench.
/// Updated by Transition(sequence, context)
/// when context == TransitionContext.PurgeBegin
/// or context == TransitionContext.PurgeEnd
/// </summary>
public static FillState FillState;
static ProcessData()
{
@@ -85,6 +92,7 @@ namespace TBF.Rig.Sequences
IsQ2PreCorrectionCalculated = false;
CalculatedQ2PreCorrectionLR = 0;
CalculatedQ2PreCorrectionRL = 0;
FillState = FillState.Unknown;
ComponentsWithMeasuredVal = new List<IDrawingItCmpntWithMeasuredVal>();
ComponentsWithSetpoint = new List<IDrawingItCmpntWithSetpoint>();
+15 -10
View File
@@ -380,6 +380,9 @@ namespace TBF.Rig.Sequences
default: message = "Transition"; break;
}
if (context == TransitionContext.PurgeBegin && FillState != FillState.Full) FillState = FillState.Unknown;
if (context == TransitionContext.PurgeEnd && FillState != FillState.Empty) FillState = FillState.Unknown;
if (transitionSequence == null)
{
///
@@ -393,11 +396,9 @@ namespace TBF.Rig.Sequences
State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
@@ -445,7 +446,7 @@ namespace TBF.Rig.Sequences
{
ISequenceCondition seqCondition = TbfComponents.FindComponent(fields[0]) as ISequenceCondition;
int condID;
if ((seqCondition != null) && int.TryParse(fields[1], out condID))
if ((seqCondition != null) && int.TryParse(fields[1], out condID))
{
conditionOperation = seqCondition.ConditionOp(condID);
}
@@ -643,7 +644,7 @@ namespace TBF.Rig.Sequences
while (e.Contains(Event.ValvesBusy));
}
}
else if ((context == TransitionContext.AfterTestWithOverlap) && (nextInPath != null) && (nextBenchPath != null) && (nextOutPath != null))
else if (context == TransitionContext.AfterTestWithOverlap && nextInPath != null && nextBenchPath != null && nextOutPath != null)
{
log.WarnFormat("Transition(., context={0}), overlapped action (next flow regulation)", context);
@@ -696,10 +697,14 @@ namespace TBF.Rig.Sequences
if (errorFlag)
return Event.Error;
else if (stopFlag)
return Event.UiCmdStop;
else
return Event.Done;
else if (stopFlag)
return Event.UiCmdStop;
else
{
if (context == TransitionContext.PurgeBegin) FillState = FillState.Full;
if (context == TransitionContext.PurgeEnd) FillState = FillState.Empty;
return Event.Done;
}
}