using System; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using JetVirgoPM.Devices; using MECF.Framework.Common.Routine; using MECF.Framework.Common.Schedulers; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs; namespace JetVirgoPM.PMs.Routines { class PMTransferHandoffRoutine : PMRoutineBase, IStepRoutine { enum RoutineStep { SetPin, kEnd } private int _timeout; private EnumTransferType _TransferType; private EnumDualPM _pos; public PMTransferHandoffRoutine(JetDualPM chamber) : base(chamber) { Name = "TransferHandoff"; } public RState Init(EnumTransferType type, int[] slot) { _TransferType = type; _pos = (slot.Length > 1) ? EnumDualPM.Both : (slot[0] == 0) ? EnumDualPM.Left : EnumDualPM.Right; if (SC.IsDoubleFork) _pos = EnumDualPM.Both; return RState.End; } public RState Start(params object[] objs) { Reset(); _timeout = SC.GetValue($"{Module}.PrepareTransferTimeout"); return Runner.Start(_chamber.Module.ToString(), Name); } public RState Monitor() { var isUp = false; var pos = EnumDualPM.None; if (_TransferType == EnumTransferType.Pick || _TransferType == EnumTransferType.Place) { isUp = _TransferType == EnumTransferType.Pick ? false : true; pos = _pos; } Runner.Run(RoutineStep.SetPin, HOFs.Apply(SetLiftPinUpDown, pos, isUp), HOFs.Apply(ChecktLiftPinUpDown, pos, isUp), _timeout * 1000) .End(RoutineStep.kEnd, EndFunc, _delay_0s); return Runner.Status; } public override void Abort() { } } }