123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.Core.Equipments;
- using MECF.Framework.RT.ModuleLibrary.VceModules;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using Venus_Core;
- using Venus_RT.Devices;
- using Venus_RT.Modules.TM.VenusEntity;
- namespace Venus_RT.Modules.VCE
- {
- public class LoadPrepareRoutine : ModuleRoutineBase, IRoutine
- {
- private enum LoadPrepareStep
- {
- VceGotoLP,
- VceOuterDoorOpen,
- NotifyDone
- }
-
- private VceModuleBase _vce;//动作驱动
- private int _vcetimeout;
- public LoadPrepareRoutine(ModuleName module, VceModuleBase vce) : base(module)
- {
- Module = module;
- _vce = vce;
- }
- public RState Start(params object[] objs)
- {
- //如果不是ATM 不允许执行
- if (!Singleton<RouteManager>.Instance.seTM.VCEIsATM(Module))
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE is not atm cannot load prepare! Please Vent it First!");
- return RState.Failed;
- }
-
- _vcetimeout = SC.GetValue<int>($"{Module}.MotionTimeout") * 1000;
- Reset();
- return Runner.Start(Module, $"Load Prepare");
- }
- public RState Monitor()
- {
- Runner.Run(LoadPrepareStep.VceGotoLP, VceGotoLP, CheckVceStageDownDone , _vcetimeout)
- .Run(LoadPrepareStep.VceOuterDoorOpen, VceOuterDoorOpen, CheckVceOuterDoorOpenDone, _vcetimeout)
- .End(LoadPrepareStep.NotifyDone, NullFun, 100);
- return Runner.Status;
- }
- private bool CheckVceStageDownDone()
- {
- if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE Stage Down failed");
- }
- return _vce.Status == RState.End;
- }
- private bool CheckVceOuterDoorOpenDone()
- {
- if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"VCE OuterDoor Open failed");
- }
- return _vce.Status == RState.End;
- }
- private bool VceGotoLP()
- {
- return _vce.GotoLP();
- }
- private bool VceOuterDoorOpen()
- {
- if (Singleton<RouteManager>.Instance.seTM.VCEIsATM(Module) && Singleton<RouteManager>.Instance.seTM.VCEPressure(Module) >= SC.GetValue<int>($"{Module}.OutDoorOpenPressure"))
- {
- return _vce.OpenDoor();
- }
- else
- {
- LOG.Write(eEvent.ERR_VCE_COMMON_Failed, Module, $"{Module} is not ATM or Pressure not arrive {SC.GetValue<int>($"{Module}.OutDoorOpenPressure")}");
- return false;
- }
- }
- public void Abort()
- {
- }
- }
- }
|