Sic04/Modules/Mainframe/EFEMs/Routines/TrayRobotPickRoutine.cs

189 lines
7.0 KiB
C#
Raw Normal View History

2022-09-19 09:16:33 +08:00
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using Mainframe.LLs.Routines;
2022-09-19 09:16:33 +08:00
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
namespace Mainframe.EFEMs.Routines
2022-09-19 09:16:33 +08:00
{
public class TrayRobotPickRoutine : EfemBaseRoutine
{
/* Pick From Cassette,LoadLock(),Aligner/Unload()
* 1.Wafer
* 2.
* 3.
* 4.,
* 5.ActionDone
* 6.
*
*/
//private LoadLock _loadLock;
private EfemSlitValveRoutine _efemSlitValveOpenRoutine = new EfemSlitValveRoutine();
private EfemSlitValveRoutine _efemSlitValveCloseRoutine = new EfemSlitValveRoutine();
private LoadLockLiftRoutine _loadLockLiftDown = new LoadLockLiftRoutine();
private ModuleName _source;
private int _sourceSlot;
private int _pickTimeout;
enum RoutineStep
{
OpenSlowVent,
2022-09-19 09:16:33 +08:00
OpenSlitValve,
SetLiftUp,
CheckRobotReady,
PickComplete,
SetLiftDown,
TimeDelay1,
CloseSlitValve,
CloseSlowVent,
2022-09-19 09:16:33 +08:00
SetExtendToDo,
Pick,
CheckTrayStatuBeforePick,
ClearRobortExtendToDo,
DelayAftVent,
2022-09-19 09:16:33 +08:00
}
public TrayRobotPickRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "TrayRobortPick";
}
public void Init(ModuleName source, int sourceSlot)
{
_source = source;
_sourceSlot = sourceSlot;
}
public override Result Start(params object[] objs)
{
Reset();
if (WaferManager.Instance.CheckHasTray(ModuleName.TrayRobot, 0))
{
Stop("Can not pick,TrayRobot has tray");
2022-09-19 09:16:33 +08:00
return Result.FAIL;
}
//Pick之前先,根据Sensor检测是否有盘
if (!WaferManager.Instance.CheckHasTray(_source, _sourceSlot))
{
EV.PostWarningLog(Module, $"Can not pick, {_source} slot {_sourceSlot + 1} has no tray");
2022-09-19 09:16:33 +08:00
return Result.FAIL;
}
if (TrayRobot.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not pick, TrayRobot is not Idle");
2022-09-19 09:16:33 +08:00
return Result.FAIL;
}
if (_source == ModuleName.CassBL)
{
//检测凸片Sensor和有无Sensor
if (_cassBLWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} check tray convex");
2022-09-19 09:16:33 +08:00
return Result.FAIL;
}
if (!_cassBL6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} sensor check no cassette");
return Result.FAIL;
}
}
if (_source == ModuleName.LoadLock && !_llLift.IsDown)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} lift is not in down position!");
return Result.FAIL;
}
// 如果从LoadLock或UnLoad取Wafer打开ATM闸板阀前先开始Vent,获取Vent参数
if (_source == ModuleName.LoadLock || _source == ModuleName.UnLoad)
{
if (_source == ModuleName.LoadLock)
{
_slowVentTimeout = SC.GetValue<int>("LoadLock.Vent.SlowVentTimeout");
_ventBasePressure = SC.GetValue<double>("LoadLock.Vent.VentBasePressure");
}
else
{
_slowVentTimeout = SC.GetValue<int>("UnLoad.Vent.SlowVentTimeout");
_ventBasePressure = SC.GetValue<double>("UnLoad.Vent.VentBasePressure");
}
}
2022-09-19 09:16:33 +08:00
_efemSlitValveOpenRoutine.Init(_source, ModuleName.TrayRobot, true);
_efemSlitValveCloseRoutine.Init(_source, ModuleName.TrayRobot, false);
_loadLockLiftDown.Init(false);
_pickTimeout = SC.GetConfigItem($"{ModuleName.TrayRobot}.MotionTimeout").IntValue;
return Result.RUN;
}
public override Result Monitor()
{
try
{
// 如果从LoadLock或UnLoad取Wafer打开ATM闸板阀前先开始Vent
if (_source == ModuleName.LoadLock || _source == ModuleName.UnLoad)
{
SlowVent((int)RoutineStep.OpenSlowVent, _source, _ventBasePressure, _slowVentTimeout);
}
2022-09-19 09:16:33 +08:00
if (_source == ModuleName.LoadLock)
{
CheckRobotReady((int)RoutineStep.CheckRobotReady, TrayRobot, _pickTimeout);
CheckTrayStatuBeforePick((int)RoutineStep.CheckTrayStatuBeforePick, TrayRobot, 10); //Pick前先检查
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _efemSlitValveOpenRoutine); //打开闸板阀
SetTrayRobortExtendToDO((int)RoutineStep.SetExtendToDo, _source, 10); //设置ExtendToDO,用于检测InterLock
Pick((int)RoutineStep.Pick, TrayRobot, _source, _sourceSlot, _pickTimeout);
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
ExecuteRoutine((int)RoutineStep.CloseSlitValve, _efemSlitValveCloseRoutine); //关闭闸板阀
}
else
{
CheckRobotReady((int)RoutineStep.CheckRobotReady, TrayRobot, _pickTimeout);
CheckTrayStatuBeforePick((int)RoutineStep.CheckTrayStatuBeforePick, TrayRobot, 10); //Pick前先检查
Pick((int)RoutineStep.Pick, TrayRobot, _source, _sourceSlot, _pickTimeout); //机械手到位,夹爪打开
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
}
// 如果从LoadLock或UnLoad取Wafer关闭ATM闸板阀后结束Vent
if (_source == ModuleName.LoadLock || _source == ModuleName.UnLoad)
{
CloseVentValve((int)RoutineStep.CloseSlowVent, _source);
TimeDelay((int)RoutineStep.DelayAftVent, 2);
}
2022-09-19 09:16:33 +08:00
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
public override void Abort()
{
TrayRobot.Abort();
base.Abort();
}
}
}