using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Venus_RT.Devices; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.SubstrateTrackings; using System.Diagnostics; using System.Collections.Generic; using Venus_Core; using Venus_RT.Modules; namespace Venus_RT.Modules.PMs { class LLPlaceRoutine : PMRoutineBase, IRoutine { private enum LLPlaceStep { kPrepareTransfer, kExtend, KDelay2s, kPinUp, kRetract, kPostTransfer, kOpenFastPump, } private int _prepareTransferTimeout = 120; private int _transferWaferTimeout = 120; public LLPlaceRoutine(JetPMBase chamber) : base(chamber) { Name = "PlaceWafer"; } public RState Start(params object[] objs) { _prepareTransferTimeout = SC.GetValue($"{Module}.PrepareTransferTimeout"); _transferWaferTimeout = SC.GetValue($"{Module}.TransferWaferTimeout"); if (WaferManager.Instance.CheckHasWafer(ModuleName.PMA, 0)) { Stop("腔体里面有 Wafer,不能执行放片动作"); return RState.Failed; } if (WaferManager.Instance.CheckNoWafer(ModuleName.LLA, 0)) { Stop("Loadlock 里面没有 Wafer,不能执行放片动作"); return RState.Failed; } if (RouteManager.IsATMMode) { if (!_chamber.IsATM || !_chamber.IsATMLoadlock) { Stop("腔体非大气状态,请先执行充气动作"); return RState.Failed; } } else { if (!_chamber.IsVAC || !_chamber.IsVACLoadLock) { Stop("腔体非真空状态,请先执行抽真空动作"); return RState.Failed; } } _chamber.OpenValve(ValveType.FastPump, false); _chamber.OpenValve(ValveType.LoadlockPumping, false); Reset(); return Runner.Start(Module, Name); } public RState Monitor() { Runner.Run((int)LLPlaceStep.kPrepareTransfer, PrepareTransfer, IsPrepareReady, _prepareTransferTimeout * 1000) .Run((int)LLPlaceStep.kExtend, _chamber.ExtendWafer, () => { return _chamber.IsLoadlockArmExtend; }, _transferWaferTimeout * 1000) .Delay((int)LLPlaceStep.KDelay2s, 2000) .Run((int)LLPlaceStep.kPinUp, SetLiftPinUp, () => { return _chamber.CheckLiftUp(); }) .Run((int)LLPlaceStep.kRetract, _chamber.RetractWafer, () => { return _chamber.IsLoadlockArmRetract; }, _transferWaferTimeout * 1000) .Run((int)LLPlaceStep.kPostTransfer, PostTransfer, IsPostTransferReady, _prepareTransferTimeout * 1000) .End((int)LLPlaceStep.kOpenFastPump, OpenFastPump, _delay_50ms); return Runner.Status; } private bool PrepareTransfer() { _chamber.SetLiftPin(MovementPosition.Down, out _); _chamber.SetSlitDoor(true, out _); return true; } private bool IsPrepareReady() { return _chamber.CheckLiftDown() && _chamber.CheckSlitDoorOpen(); } private bool PostTransfer() { WaferManager.Instance.WaferMoved(ModuleName.LLA, 0, ModuleName.PMA, 0); _chamber.SetLiftPin(MovementPosition.Down, out _); _chamber.SetSlitDoor(false, out _); return true; } private bool IsPostTransferReady() { return _chamber.CheckLiftDown() && _chamber.CheckSlitDoorClose(); } private bool SetLiftPinUp() { return _chamber.SetLiftPin(MovementPosition.Up, out _); } private bool OpenFastPump() { if (!RouteManager.IsATMMode) _chamber.OpenValve(ValveType.FastPump, true); return true; } public void Abort() { } } }