123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- 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
- {
- Loader_LiftUpOff,
- Loader_FlippersIn,
- Loader_N2On,
- Loader_Delay,
- Loader_N2Off,
- Loader_ChuckVacuumOn,
- Loader_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.Loader_LiftUpOff, LiftUpOff, CheckLiftUpOffEndStatus, CheckLiftUpOffStopStatus)
- .Run(SRDLoaderStep.Loader_FlippersIn, FlippersIn, CheckFlippersInEndStatus, CheckFlippersInStopStatus)
- .Run(SRDLoaderStep.Loader_N2On, N2On, _delay_1ms)
- .Delay(SRDLoaderStep.Loader_Delay, 500)
- .Run(SRDLoaderStep.Loader_N2Off, N2Off, _delay_1ms)
- .Run(SRDLoaderStep.Loader_ChuckVacuumOn, ChuckVacuumOn, CheckChuckVacuumOnEndStatus, CheckChuckVacuumOnStopStatus)
- .Run(SRDLoaderStep.Loader_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 Vacuum off
- if (!_srdCommon.CommonData.ChuckVacuum)
- {
- NotifyError(eEvent.ERR_SRD, "Chuck Vacuum is on", 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);
- if (waferInfo == null)
- {
- return false;
- }
- switch (waferInfo.Size)
- {
-
- case WaferSize.WS4:
- _waferSize = 100;
- break;
- case WaferSize.WS6:
- case WaferSize.WS150:
- case WaferSize.WS159:
- _waferSize = 150;
- break;
- case WaferSize.WS0:
- 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 Out
- /// </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>
- /// 检验FlippersOut结束状态
- /// </summary>
- /// <param name="param"></param>
- /// <returns></returns>
- private bool CheckFlippersOutEndStatus()
- {
- return _srdCommon.Status == RState.End;
- }
- /// <summary>
- /// 检验FlippersOut结束状态
- /// </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;
- }
- }
- }
|