|
@@ -10,6 +10,13 @@ namespace Venus_RT.Modules
|
|
|
{
|
|
|
class LLEntity : Entity, IEntity, IModuleEntity
|
|
|
{
|
|
|
+ public enum LLStatus
|
|
|
+ {
|
|
|
+ Not_Ready,
|
|
|
+ Ready_For_TM,
|
|
|
+ Ready_For_EFEM,
|
|
|
+ }
|
|
|
+
|
|
|
public enum STATE
|
|
|
{
|
|
|
Unknown,
|
|
@@ -20,7 +27,11 @@ namespace Venus_RT.Modules
|
|
|
Pumping,
|
|
|
Venting,
|
|
|
Purging,
|
|
|
- Leakchecking,
|
|
|
+ LeakCheck,
|
|
|
+ Prepare_For_TM,
|
|
|
+ Prepare_For_EFEM,
|
|
|
+ Ready_For_TM,
|
|
|
+ Ready_For_EFEM,
|
|
|
}
|
|
|
|
|
|
public enum MSG
|
|
@@ -33,13 +44,18 @@ namespace Venus_RT.Modules
|
|
|
Purge,
|
|
|
CyclePurge,
|
|
|
LeakCheck,
|
|
|
+ Prepare_TM,
|
|
|
+ Prepare_EFEM,
|
|
|
+ TM_Exchange_Ready,
|
|
|
+ EFEM_Exchange_Ready,
|
|
|
Error,
|
|
|
Abort,
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public ModuleName Module { get; private set; }
|
|
|
+
|
|
|
+ public LLStatus Status { get; private set; }
|
|
|
+
|
|
|
public bool Check(int msg, out string reason, params object[] args)
|
|
|
{
|
|
|
throw new NotImplementedException();
|
|
@@ -86,20 +102,26 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
private void InitFsmMap()
|
|
|
{
|
|
|
- fsm = new StateMachine<TMEntity>(Module.ToString(), (int)STATE.Init, 50);
|
|
|
+ fsm = new StateMachine<LLEntity>(Module.ToString(), (int)STATE.Init, 50);
|
|
|
fsm.EnableRepeatedMsg(true);
|
|
|
|
|
|
- AnyStateTransition(FSM_MSG.TIMER, fnMonitor, FSM_STATE.SAME);
|
|
|
+ EnterExitTransition<STATE, FSM_MSG>(STATE.Ready_For_TM, fnEnterTMReady, FSM_MSG.NONE, fnExitTMReady);
|
|
|
+ EnterExitTransition<STATE, FSM_MSG>(STATE.Ready_For_EFEM, fnEnterEFEMReady, FSM_MSG.NONE, fnExitEFEMReady);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
- AnyStateTransition(MSG.Error, fnError, STATE.Error);
|
|
|
- AnyStateTransition(MSG.Online, fnOnline, FSM_STATE.SAME);
|
|
|
- AnyStateTransition(MSG.Offline, fnOffline, FSM_STATE.SAME);
|
|
|
- AnyStateTransition(MSG.Home, fnHome, STATE.Initializing);
|
|
|
+ AnyStateTransition(MSG.Error, fnError, STATE.Error);
|
|
|
+ AnyStateTransition(MSG.Online, fnOnline, FSM_STATE.SAME);
|
|
|
+ AnyStateTransition(MSG.Offline, fnOffline, FSM_STATE.SAME);
|
|
|
+ AnyStateTransition(MSG.Home, fnHome, STATE.Initializing);
|
|
|
|
|
|
|
|
|
Transition(STATE.Initializing, FSM_MSG.TIMER, fnHoming, STATE.Idle);
|
|
|
|
|
|
+ Transition(STATE.Idle, FSM_MSG.TIMER, fnMonitor, STATE.Idle);
|
|
|
+ Transition(STATE.Init, FSM_MSG.TIMER, fnMonitor, STATE.Init);
|
|
|
+
|
|
|
|
|
|
Transition(STATE.Idle, MSG.Vent, FnStartVent, STATE.Venting);
|
|
|
Transition(STATE.Venting, FSM_MSG.TIMER, FnVentTimeout, STATE.Idle);
|
|
@@ -111,14 +133,25 @@ namespace Venus_RT.Modules
|
|
|
Transition(STATE.Pumping, MSG.Abort, FnAbortPump, STATE.Idle);
|
|
|
|
|
|
|
|
|
- Transition(PMState.Idle, MSG.CyclePurge, FnStartPurge, PMState.Purging);
|
|
|
- Transition(PMState.Purging, FSM_MSG.TIMER, FnPurgeTimeout, PMState.Idle);
|
|
|
- Transition(PMState.Purging, MSG.Abort, FnAbortPurge, PMState.Idle);
|
|
|
+ Transition(STATE.Idle, MSG.CyclePurge, FnStartPurge, STATE.Purging);
|
|
|
+ Transition(STATE.Purging, FSM_MSG.TIMER, FnPurgeTimeout, STATE.Idle);
|
|
|
+ Transition(STATE.Purging, MSG.Abort, FnAbortPurge, STATE.Idle);
|
|
|
|
|
|
|
|
|
- Transition(PMState.Idle, MSG.LeakCheck, FnStartLeakCheck, PMState.LeakCheck);
|
|
|
- Transition(PMState.LeakCheck, FSM_MSG.TIMER, FnLeakCheckTimeout, PMState.Idle);
|
|
|
- Transition(PMState.LeakCheck, MSG.Abort, FnAbortLeakCheck, PMState.Idle);
|
|
|
+ Transition(STATE.Idle, MSG.LeakCheck, FnStartLeakCheck, STATE.LeakCheck);
|
|
|
+ Transition(STATE.LeakCheck, FSM_MSG.TIMER, FnLeakCheckTimeout, STATE.Idle);
|
|
|
+ Transition(STATE.LeakCheck, MSG.Abort, FnAbortLeakCheck, STATE.Idle);
|
|
|
+
|
|
|
+
|
|
|
+ Transition(STATE.Idle, MSG.Prepare_TM, FnStartPrepareTM, STATE.Prepare_For_TM);
|
|
|
+ Transition(STATE.Prepare_For_TM, FSM_MSG.TIMER, FnPreparaTMTimeout, STATE.Ready_For_TM);
|
|
|
+ Transition(STATE.Ready_For_TM, MSG.TM_Exchange_Ready, null, STATE.Idle);
|
|
|
+
|
|
|
+
|
|
|
+ Transition(STATE.Idle, MSG.Prepare_EFEM, FnStartPrepareEFEM, STATE.Prepare_For_EFEM);
|
|
|
+ Transition(STATE.Prepare_For_EFEM, FSM_MSG.TIMER, FnPrepareEFEMTimeout, STATE.Ready_For_EFEM);
|
|
|
+ Transition(STATE.Ready_For_EFEM, MSG.EFEM_Exchange_Ready, null, STATE.Idle);
|
|
|
+
|
|
|
|
|
|
Running = true;
|
|
|
}
|
|
@@ -154,8 +187,33 @@ namespace Venus_RT.Modules
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private bool fnEnterTMReady(object[] param)
|
|
|
+ {
|
|
|
+ Status = LLStatus.Ready_For_TM;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool fnExitTMReady(object[] param)
|
|
|
+ {
|
|
|
+ Status = LLStatus.Not_Ready;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool fnEnterEFEMReady(object[] param)
|
|
|
+ {
|
|
|
+ Status = LLStatus.Ready_For_EFEM;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool fnExitEFEMReady(object[] param)
|
|
|
+ {
|
|
|
+ Status = LLStatus.Not_Ready;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
private bool fnMonitor(object[] param)
|
|
|
{
|
|
|
+ _debugRoutine();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -167,6 +225,7 @@ namespace Venus_RT.Modules
|
|
|
|
|
|
private bool fnOnline(object[] param)
|
|
|
{
|
|
|
+ IsOnline = true;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -282,5 +341,114 @@ namespace Venus_RT.Modules
|
|
|
_leakCheckRoutine.Abort();
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ private bool FnStartPrepareTM(object[] param)
|
|
|
+ {
|
|
|
+ return _pumpingRoutine.Start() == RState.Running;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool FnPreparaTMTimeout(object[] param)
|
|
|
+ {
|
|
|
+ RState ret = _pumpingRoutine.Monitor();
|
|
|
+ if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.Error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret == RState.End;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool FnStartPrepareEFEM(object[] param)
|
|
|
+ {
|
|
|
+ return _ventingRoutine.Start() == RState.Running;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool FnPrepareEFEMTimeout(object[] param)
|
|
|
+ {
|
|
|
+ RState ret = _ventingRoutine.Monitor();
|
|
|
+ if (ret == RState.Failed || ret == RState.Timeout)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.Error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ret == RState.End;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void _debugRoutine()
|
|
|
+ {
|
|
|
+ int flag = 0;
|
|
|
+
|
|
|
+ if (flag == 1)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.Home);
|
|
|
+ }
|
|
|
+ else if (flag == 2)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.Vent);
|
|
|
+ }
|
|
|
+ else if (flag == 3)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.Pump);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ else if (flag == 10)
|
|
|
+ {
|
|
|
+ PostMsg(MSG.CyclePurge);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|