|
@@ -0,0 +1,375 @@
|
|
|
|
+using Aitex.Core.RT.Device;
|
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
|
+using Aitex.Core.RT.Routine;
|
|
|
|
+using CyberX8_Core;
|
|
|
|
+using CyberX8_RT.Devices.AXIS;
|
|
|
|
+using CyberX8_RT.Devices.Facilities;
|
|
|
|
+using CyberX8_RT.Devices.SRD;
|
|
|
|
+using MECF.Framework.Common.Equipment;
|
|
|
|
+using MECF.Framework.Common.Routine;
|
|
|
|
+using MECF.Framework.Common.SubstrateTrackings;
|
|
|
|
+using Aitex.Core.Common;
|
|
|
|
+
|
|
|
|
+namespace CyberX8_RT.Modules.SRD
|
|
|
|
+{
|
|
|
|
+ public class SRDLoaderRoutine : RoutineBase, IRoutine
|
|
|
|
+ {
|
|
|
|
+ private enum SRDLoaderStep
|
|
|
|
+ {
|
|
|
|
+ LiftUpOff,
|
|
|
|
+ FlippersIn,
|
|
|
|
+ N2On,
|
|
|
|
+ Delay,
|
|
|
|
+ N2Off,
|
|
|
|
+ ChuckVacuumOn,
|
|
|
|
+ FlippersOut,
|
|
|
|
+ End
|
|
|
|
+ }
|
|
|
|
+ #region 常量
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 内部变量
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Rotation Axis
|
|
|
|
+ /// </summary>
|
|
|
|
+ private JetAxisBase _rotationAxis;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// SRD Common
|
|
|
|
+ /// </summary>
|
|
|
|
+ private SrdCommonDevice _srdCommon;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Total SRD
|
|
|
|
+ /// </summary>
|
|
|
|
+ private TotalSRDDevice _totalSRDDevice;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// System Facility
|
|
|
|
+ /// </summary>
|
|
|
|
+ private SystemFacilities _systemFacilities;
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 当前WaferSize
|
|
|
|
+ /// </summary>
|
|
|
|
+ private int _waferSize = 200;
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ #region 属性
|
|
|
|
+ #endregion
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 构造函数
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="module"></param>
|
|
|
|
+ public SRDLoaderRoutine(string module) : base(module)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 中止
|
|
|
|
+ /// </summary>
|
|
|
|
+ public void Abort()
|
|
|
|
+ {
|
|
|
|
+ Runner.Stop("SRD Loader Abort");
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 监控
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public RState Monitor()
|
|
|
|
+ {
|
|
|
|
+ Runner.Run(SRDLoaderStep.LiftUpOff, LiftUpOff, CheckLiftUpOffEndStatus, CheckLiftUpOffStopStatus)
|
|
|
|
+ .Run(SRDLoaderStep.FlippersIn, FlippersIn, CheckFlippersInEndStatus, CheckFlippersInStopStatus)
|
|
|
|
+ .Run(SRDLoaderStep.N2On, N2On, _delay_1ms)
|
|
|
|
+ .Delay(SRDLoaderStep.Delay, 500)
|
|
|
|
+ .Run(SRDLoaderStep.N2Off, N2Off, _delay_1ms)
|
|
|
|
+ .Run(SRDLoaderStep.ChuckVacuumOn, ChuckVacuumOn, CheckChuckVacuumOnEndStatus, CheckChuckVacuumOnStopStatus)
|
|
|
|
+ .Run(SRDLoaderStep.FlippersOut, FlippersOut, CheckFlippersOutEndStatus, CheckFlippersOutStopStatus)
|
|
|
|
+ .End(SRDLoaderStep.End, NullFun, _delay_1ms);
|
|
|
|
+ return Runner.Status;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 启动
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="objs"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public RState Start(params object[] objs)
|
|
|
|
+ {
|
|
|
|
+ _srdCommon = DEVICE.GetDevice<SrdCommonDevice>($"{Module}.Common");
|
|
|
|
+ _totalSRDDevice = DEVICE.GetDevice<TotalSRDDevice>("SRD");
|
|
|
|
+ _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
|
|
|
|
+ _systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
|
|
|
|
+ if (!GetWaferSize())
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "Wafer Size is invalid", 0);
|
|
|
|
+ return RState.Failed;
|
|
|
|
+ }
|
|
|
|
+ if (!CheckPreCondition())
|
|
|
|
+ {
|
|
|
|
+ return RState.Failed;
|
|
|
|
+ }
|
|
|
|
+ return Runner.Start(Module, "SRD Loader Start");
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Check Pre Condition
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckPreCondition()
|
|
|
|
+ {
|
|
|
|
+ //Check Rotation Home
|
|
|
|
+ //if (!_rotationAxis.IsHomed)
|
|
|
|
+ //{
|
|
|
|
+ // NotifyError(eEvent.ERR_SRD, "Rotation is not homed", 0);
|
|
|
|
+ // return false;
|
|
|
|
+ //}
|
|
|
|
+ //Check LiftUp
|
|
|
|
+ if (!_srdCommon.CommonData.LiftUp)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "LiftUp is off", 0);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //Check LiftUp Status
|
|
|
|
+ if (!_srdCommon.CommonData.LiftUpStatus)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "LiftUp sensor is off", 0);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //Check Wafer Present
|
|
|
|
+ if (!_srdCommon.CommonData.WaferPresent)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "WaferPresent sensor is off", 0);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //Check LoaderDI
|
|
|
|
+ if (!_systemFacilities.LoaderDiEnable)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "Load DI Is Disable", 0);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //Check Flippers
|
|
|
|
+ if (_srdCommon.CommonData.FlippersIn150 || _srdCommon.CommonData.FlippersIn200)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "FlippersIn is on", 0);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (!_srdCommon.CommonData.Flipper1Out150Status || !_srdCommon.CommonData.Flipper2Out150Status || !_srdCommon.CommonData.Flipper3Out150Status
|
|
|
|
+ || !_srdCommon.CommonData.Flipper1Out200Status || !_srdCommon.CommonData.Flipper2Out200Status || !_srdCommon.CommonData.Flipper3Out200Status)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "Flippers are at In position", 0);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Get current WaferSize
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool GetWaferSize()
|
|
|
|
+ {
|
|
|
|
+ WaferInfo waferInfo = WaferManager.Instance.GetWafer(ModuleNameString.ToEnum(Module), 0);
|
|
|
|
+ switch (waferInfo.Size)
|
|
|
|
+ {
|
|
|
|
+ case WaferSize.WS0:
|
|
|
|
+ _waferSize = 200;
|
|
|
|
+ break;
|
|
|
|
+ case WaferSize.WS4:
|
|
|
|
+ _waferSize = 100;
|
|
|
|
+ break;
|
|
|
|
+ case WaferSize.WS6:
|
|
|
|
+ case WaferSize.WS150:
|
|
|
|
+ case WaferSize.WS159:
|
|
|
|
+ _waferSize = 150;
|
|
|
|
+ break;
|
|
|
|
+ case WaferSize.WS8:
|
|
|
|
+ _waferSize = 200;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// LiftUpOff
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool LiftUpOff()
|
|
|
|
+ {
|
|
|
|
+ bool result = _srdCommon.LiftUpOffAction("", null);
|
|
|
|
+ if (!result)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "Lift Up Off Action is failed", 0);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验LiftUpOff结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckLiftUpOffEndStatus()
|
|
|
|
+ {
|
|
|
|
+ return _srdCommon.Status == RState.End && !_srdCommon.CommonData.LiftUpStatus;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验LiftUpOff结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckLiftUpOffStopStatus()
|
|
|
|
+ {
|
|
|
|
+ if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "Check LiftUpOff is failed", 0);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Flippers In
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool FlippersIn()
|
|
|
|
+ {
|
|
|
|
+ bool result = false;
|
|
|
|
+ object[] objects = new object[1];
|
|
|
|
+ objects[0] = _waferSize;
|
|
|
|
+ result = _srdCommon.FlipperInAction("", objects);
|
|
|
|
+ if (!result)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, $"FlipperIn{_waferSize} Action is failed", 0);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验FlippersIn结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckFlippersInEndStatus()
|
|
|
|
+ {
|
|
|
|
+ return _srdCommon.Status == RState.End;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验FlippersIn结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckFlippersInStopStatus()
|
|
|
|
+ {
|
|
|
|
+ if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, $"Check FlipperIn{_waferSize} Action is failed", 0);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 打开 Wafer N2
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool N2On()
|
|
|
|
+ {
|
|
|
|
+ bool result = _srdCommon.N2OnAction("", null);
|
|
|
|
+ if (!result)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, $"N2 On Action is failed", 0);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 关闭 Wafer N2
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool N2Off()
|
|
|
|
+ {
|
|
|
|
+ bool result = _srdCommon.N2OffAction("", null);
|
|
|
|
+ if (!result)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, $"N2 Off Action is failed", 0);
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// ChuckVacuumOn
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool ChuckVacuumOn()
|
|
|
|
+ {
|
|
|
|
+ bool result = _srdCommon.ChuckVacuumOnAction("", null);
|
|
|
|
+ if (!result)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "ChuckVacuumOn Action is failed", 0);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验ChuckVacuumOn结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckChuckVacuumOnEndStatus()
|
|
|
|
+ {
|
|
|
|
+ return _srdCommon.Status == RState.End && _srdCommon.CommonData.ChuckVacuum;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验ChuckVacuumOn结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckChuckVacuumOnStopStatus()
|
|
|
|
+ {
|
|
|
|
+ if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, "Check ChuckVacuumOn is failed", 0);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Flippers In
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool FlippersOut()
|
|
|
|
+ {
|
|
|
|
+ bool result = false;
|
|
|
|
+ object[] objects = new object[1];
|
|
|
|
+ objects[0] = _waferSize;
|
|
|
|
+ result = _srdCommon.FlipperOutAction("", objects);
|
|
|
|
+ if (!result)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, $"FlipperOut{_waferSize} Action is failed", 0);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验FlippersIn结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckFlippersOutEndStatus()
|
|
|
|
+ {
|
|
|
|
+ return _srdCommon.Status == RState.End;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 检验FlippersIn结束状态
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="param"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private bool CheckFlippersOutStopStatus()
|
|
|
|
+ {
|
|
|
|
+ if (_srdCommon.Status == RState.Failed || _srdCommon.Status == RState.Timeout)
|
|
|
|
+ {
|
|
|
|
+ NotifyError(eEvent.ERR_SRD, $"Check FlipperOut{_waferSize} Action is failed", 0);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|