using Aitex.Core.RT.Device; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot; using MECF.Framework.RT.ModuleLibrary.Commons; using MECF.Framework.RT.ModuleLibrary.VceModules; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Venus_Core; using Venus_RT.Devices; using Venus_RT.Devices.VCE; namespace Venus_RT.Modules.VCE { public class LoadRoutine : ModuleRoutineBase, IRoutine { public enum LoadStep { CloseOutDoor, Mapping, ReadMap, PumpDown, OpenInnerDoor, NotifyOver } VceModuleBase _vce; HongHuTM _tm; int _timeout; public LoadRoutine(ModuleName module, VceModuleBase vce) : base(module) { _vce = vce; } public RState Start(params object[] objs) { _tm = DEVICE.GetDevice("SETM"); _timeout = SC.GetValue("VCE.MotionTimeout"); Reset(); return Runner.Start(Module,"Vce Load Routine"); } public RState Monitor() { Runner.Run(LoadStep.CloseOutDoor, CloseOutDoor, CheckVceIdle, _timeout) .Run(LoadStep.Mapping, Mapping, CheckVceIdle, _timeout) .Run(LoadStep.ReadMap, ReadMap, CheckVceIdle, _timeout) .Run(LoadStep.PumpDown, PumpDown, CheckPumpOver) .Run(LoadStep.OpenInnerDoor, OpenInnerDoor, CheckInnerDoorOpen) .End(LoadStep.NotifyOver, NullFun, 100); return Runner.Status; } private bool CheckInnerDoorOpen() { return _tm.TurnSlitDoor(Module,true); } private bool OpenInnerDoor() { return !_tm.VCESlitDoorClosed; } // private bool CheckPumpOver() { return true; } private bool PumpDown() { return true; } private bool ReadMap() { return _vce.ReadMap(); } private bool Mapping() { return _vce.Map(); } private bool CloseOutDoor() { return _vce.CloseDoor(); } private bool CheckVceIdle() { if (_vce.Status == RState.Failed || _vce.Status == RState.Timeout) { Singleton.Instance.GetVCE(Module).PostMsg(VceMSG.Error); return false; } return _vce.Status == RState.End; } public void Abort() { } } }