123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.Routine;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using System;
- using System.Collections.Generic;
- using CyberX8_Core;
- using CyberX8_RT.Devices.EFEM;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Routine;
- using Aitex.Core.RT.SCCore;
- namespace CyberX8_RT.Modules.EFEM
- {
- public class EFEMAlignRoutine : RoutineBase, IRoutine
- {
- private enum AlignStep
- {
- WaitIdle,
- SetAngle,
- ReWaitIdle,
- Rotate,
- End
- }
- private int _moveTimeout = 20 * 1000;
- EfemBase _efem;
- private double angle = 25;
- private WaferSize ws = WaferSize.WS12;
- private int _angleOffset = 0;
- public EFEMAlignRoutine(EfemBase efem) : base(ModuleName.Aligner1.ToString())
- {
- _efem = efem;
- }
- public RState Start(params object[] objs)
- {
- if (SC.ContainsItem($"EFEM.AlignerOffsetAngle"))
- {
- _angleOffset = SC.GetValue<int>($"EFEM.AlignerOffsetAngle");
- }
- if (objs.Length >= 3)
- {
- try
- {
- angle = Convert.ToDouble(objs[2]) + _angleOffset;
- }
- catch
- {
- LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"ALIAN PARAMETER IS ILLEGAL ");
- }
-
- }
- if (!CheckPreCondition())
- {
- return RState.Failed;
- }
- return Runner.Start(Module,$"PreAligner Start align");
- }
- /// <summary>
- /// 检验前置条件
- /// </summary>
- /// <returns></returns>
- private bool CheckPreCondition()
- {
- if (!WaferManager.Instance.CheckHasWafer(ModuleName.Aligner1, 0))
- {
- NotifyError(eEvent.ERR_EFEM_ROBOT, $"Efem PreAligner not have wafer, cannot do the align action",0);
- return false;
- }
- return true;
- }
- public RState Monitor()
- {
- Runner.Wait(AlignStep.WaitIdle, WaitEFEMIdle)
- .Run(AlignStep.SetAngle,SetAlignAngle,CheckAlignDone,_delay_5s)
- .Wait(AlignStep.ReWaitIdle, WaitEFEMIdle)
- .Run(AlignStep.Rotate, Align, CheckAlignDone, _moveTimeout)
- .End( AlignStep.End, ActionDone, 0);
- return Runner.Status;
- }
- private bool SetAlignAngle()
- {
- return _efem.SetAlignAngle(ModuleName.Aligner1, angle);
- }
- private bool Align()
- {
- return _efem.Align(ModuleName.Aligner1,angle,0,ws);
- }
- private bool CheckAlignDone()
- {
- if (_efem.Status == RState.End)
- {
- return true;
- }
- else if (_efem.Status == RState.Failed)
- {
- LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"Efem PreAligner align failed: {_efem.Status}");
- return true;
- }
- return false;
- }
- private bool ActionDone()
- {
- return true;
- }
- private bool WaitEFEMIdle()
- {
- return Singleton<RouteManager>.Instance.EFEM.RobotStatus == RState.End;
- }
- public void Abort()
- {
- }
- /// <summary>
- /// 重试
- /// </summary>
- /// <param name="step"></param>
- public RState Retry(int step)
- {
- if (!CheckPreCondition())
- {
- return RState.Failed;
- }
- _efem.Reset();
- List<Enum> preStepIds = new List<Enum>();
- return Runner.Retry(AlignStep.WaitIdle, preStepIds, Module, "Align Retry");
- }
- /// <summary>
- /// 检验前面完成状态
- /// </summary>
- /// <returns></returns>
- public bool CheckCompleteCondition(int index)
- {
- return true;
- }
- }
- }
|