using Aitex.Core.RT.Log; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts; using System; using Venus_Core; using MECF.Framework.Common.Equipment; namespace Venus_RT.Modules.LPs { class LoadPortClampRoutine : ModuleRoutineBase, IRoutine { enum RoutineStep { WaitEFEMIdle, Clamp, End, } public bool IsUnloadClamp { get; set; } private int _timeout = 0; private LoadPortModule _lpModule; public LoadPortClampRoutine(LoadPortModule lpModule) : base( ModuleHelper.Converter(lpModule.Module)) { _lpModule = lpModule; Name = "Clamp"; } public RState Start(params object[] objs) { Reset(); _timeout = SC.GetValue("EFEM.LoadPort.MotionTimeout"); Notify($"Start"); return Runner.Start(Module, Name); } public RState Monitor() { Runner.Wait(RoutineStep.WaitEFEMIdle, () => _lpModule.IsRobotIdle, _delay_60s) .Run(RoutineStep.Clamp, Clamp, CheckDevice, _timeout * 1000) .End(RoutineStep.End, NullFun, _delay_1s); return Runner.Status; } public bool Clamp() { Notify($"Start clamp {_lpModule.LPDevice.Module}, unload clamp = {IsUnloadClamp}"); _lpModule.LPDevice.Clamp(IsUnloadClamp); return true; } bool CheckDevice() { if (_lpModule.LPDevice.IsError) return false; if (_lpModule.LPDevice.IsBusy) return false; return true; } public void Abort() { } } }