123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Routine;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Utilities;
- using CyberX8_Core;
- using CyberX8_RT.Devices.AXIS;
- using CyberX8_RT.Devices.PUF;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using CyberX8_RT.Devices.Safety;
- using Aitex.Core.RT.Log;
- namespace CyberX8_RT.Modules.PUF
- {
- public class PufHomeAllRoutine : ModuleRoutineBase, IRoutine
- {
- private enum PufHomeAllStep
- {
- CheckWafer,
- ChuckIn,
- WaitChuck,
- RotationHome,
- CheckRotationHome,
- RotationHomeStation,
- RotationHomeStationWait,
- FlipHome,
- CheckFlipHome,
- FlipSideA,
- FlipSideAWait,
- End
- }
- #region 内部变量
- private JetAxisBase _flipAxis;
- private JetAxisBase _rotationAxis;
- private PUFEntity _pufEntity;
- private PufChuckRoutine _chuckRoutine;
- #endregion
- public PufHomeAllRoutine(ModuleName module,PUFEntity pufEntity) : base(module)
- {
- _flipAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.Flip");
- _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.Rotation");
- _chuckRoutine = new PufChuckRoutine(module.ToString());
- _pufEntity = pufEntity;
- Name = "Home";
- }
- public void Abort()
- {
- Runner.Stop("Manual Abort");
- }
- public RState Monitor()
- {
- Runner.Run(PufHomeAllStep.CheckWafer, () => { return !_pufEntity.SideAWaferPresent && !_pufEntity.SideBWaferPresent; },NullFun,100)
- .Run(PufHomeAllStep.ChuckIn, () => _chuckRoutine.Start(false) == RState.Running, _delay_1ms)
- .WaitWithStopCondition(PufHomeAllStep.WaitChuck, () => CommonFunction.CheckRoutineEndState(_chuckRoutine),
- CheckChuckStopStatus)
- .Run(PufHomeAllStep.RotationHome, RotationAxisHome, _delay_1ms)
- .WaitWithStopCondition(PufHomeAllStep.CheckRotationHome, CheckRotationPositionStatus, CheckRotationPositionRunStop)
- .Run(PufHomeAllStep.RotationHomeStation, () => { return _rotationAxis.PositionStation("Home",true); }, NullFun, 100)
- .WaitWithStopCondition(PufHomeAllStep.RotationHomeStationWait, CheckRotationPositionStatus, CheckRotationPositionRunStop)
- .Run(PufHomeAllStep.FlipHome, FlipAxisHome, _delay_1ms)
- .WaitWithStopCondition(PufHomeAllStep.CheckFlipHome, CheckFlipPositionStatus, CheckFlipPositionRunStop)
- .Run(PufHomeAllStep.FlipSideA, () => { return _flipAxis.PositionStation("SideA", true); }, NullFun, 100)
- .WaitWithStopCondition(PufHomeAllStep.FlipSideAWait, CheckFlipPositionStatus, CheckFlipPositionRunStop)
- .End(PufHomeAllStep.End,NullFun);
- return Runner.Status;
- }
- /// <summary>
- /// 检验chuck routine停止状态
- /// </summary>
- /// <returns></returns>
- private bool CheckChuckStopStatus()
- {
- bool result = CommonFunction.CheckRoutineStopState(_chuckRoutine);
- if (result)
- {
- LOG.WriteLog(eEvent.ERR_PUF,Module.ToString(), _chuckRoutine.ErrorMsg);
- }
- return result;
- }
- /// <summary>
- /// Flip Home
- /// </summary>
- /// <returns></returns>
- private bool FlipAxisHome()
- {
- return _flipAxis.Home();
- }
- /// <summary>
- /// 检验Flip home状态
- /// </summary>
- /// <returns></returns>
- private bool CheckFlipHome()
- {
- return _flipAxis.IsHomed && _flipAxis.Status == RState.End;
- }
- /// <summary>
- /// 检验Flip移动状态
- /// </summary>
- /// <returns></returns>
- private bool CheckFlipPositionStatus()
- {
- return _flipAxis.Status == RState.End;
- }
- /// <summary>
- /// 检验Flip是否还在运动
- /// </summary>
- /// <returns></returns>
- private bool CheckFlipPositionRunStop()
- {
- return _flipAxis.Status == RState.Failed;
- }
- /// <summary>
- /// rotation home
- /// </summary>
- /// <returns></returns>
- private bool RotationAxisHome()
- {
- return _rotationAxis.Home();
- }
- /// <summary>
- /// rotation Home状态
- /// </summary>
- /// <returns></returns>
- private bool CheckRotationHome()
- {
- return _rotationAxis.IsHomed&&_rotationAxis.Status==RState.End;
- }
- /// <summary>
- /// 检验Rotation移动状态
- /// </summary>
- /// <returns></returns>
- private bool CheckRotationPositionStatus()
- {
- return _rotationAxis.Status == RState.End;
- }
- /// <summary>
- /// 检验Rotation是否还在运动
- /// </summary>
- /// <returns></returns>
- private bool CheckRotationPositionRunStop()
- {
- return _rotationAxis.Status == RState.Failed;
- }
- /// <summary>
- /// 启动
- /// </summary>
- /// <param name="objs"></param>
- /// <returns></returns>
- public RState Start(params object[] objs)
- {
- Runner.Start(Module, Name);
- return RState.Running;
- }
- }
- }
|