using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using SicModules.Aligners.Routines.Base; using System.Diagnostics; namespace SicModules.Aligners.Routines { public class AlignerHomeRoutine : AlignerBaseRoutine { private enum RoutineStep { ClearAlignerAlarm, ResetVar, Home, MoveToMeasure, CheckWafer, TimeDelay1, } private readonly Stopwatch _swTimer = new Stopwatch(); public AlignerHomeRoutine() { Name = "Home"; } public override Result Start(params object[] objs) { Reset(); _swTimer.Start(); Notify("Start"); return Result.RUN; } public override Result Monitor() { try { // 如果在模拟器模式,并且使用延时模拟寻边器 if (SC.GetValue($"System.IsSimulatorMode") && SC.GetValue("HiWinAligner.UseDelayToSimulate")) { TimeDelay((int)RoutineStep.TimeDelay1, 3); return Result.DONE; } //清除Aligner报警 AlignerERS((int)RoutineStep.ClearAlignerAlarm, 3); //初始化变量值Reset ResetVar((int)RoutineStep.ClearAlignerAlarm); //三轴回原点 Home((int)RoutineStep.Home, 20); //移动到测量中心 AlignerMoveToMeasure((int)RoutineStep.MoveToMeasure, 20); //检查是否有Wafer CheckHaveWafer((int)RoutineStep.CheckWafer, 10); } catch (RoutineBreakException) { return Result.RUN; } catch (RoutineFaildException) { return Result.FAIL; } _swTimer.Stop(); Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000):F1} s"); return Result.DONE; } } }