首次上传

This commit is contained in:
hanqiangqiang
2026-03-24 15:04:02 +08:00
commit 2e080a8764
1392 changed files with 406579 additions and 0 deletions
+492
View File
@@ -0,0 +1,492 @@
using System;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Fsm;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.Utilities;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Schedulers;
using SicModules.EFEMs.Routines;
namespace SicModules.EFEMs
{
public class EFEMModule : EFEMModuleBase
{
public enum STATE
{
NotInstall,
Init,
Idle,
Homing,
Cooling,
Error,
OpenSlitValve,
CloseSlitValve,
}
public enum MSG
{
Home,
Reset,
Abort,
Error,
ToInit,
SetOnline,
SetOffline,
OpenSlitValve,
CloseSlitValve,
};
public WaferRobotModule WaferRobotModule { get; set; }
public TrayRobotModule TrayRobotModule { get; set; }
public override bool IsReady
{
get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
}
public override bool IsError
{
get { return FsmState == (int)STATE.Error; }
}
public override bool IsInit
{
get { return FsmState == (int)STATE.Init; }
}
public bool IsBusy
{
get { return !IsInit && !IsError && !IsReady; }
}
public override bool IsIdle
{
get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
}
public bool IsAlarm
{
get
{
return FsmState == (int)STATE.Error;
}
}
public event Action<string> OnEnterError;
private EfemSlitValveRoutine _slitValveRoutine;
private bool _isInit;
public SicEFEM _cassetteDevice { get; set; }
public EFEMModule(ModuleName module) : base(1)
{
Module = module.ToString();
Name = module.ToString();
IsOnline = false;
EnumLoop<STATE>.ForEach((item) =>
{
MapState((int)item, item.ToString());
});
EnumLoop<MSG>.ForEach((item) =>
{
MapMessage((int)item, item.ToString());
});
EnableFsm(50, IsInstalled ? STATE.Init : STATE.NotInstall);
}
public override bool Initialize()
{
InitRoutine();
InitDevice();
InitFsm();
InitOp();
InitData();
WaferRobotModule.Initialize();
TrayRobotModule.Initialize();
return base.Initialize();
}
private void InitRoutine()
{
ModuleName module = ModuleHelper.Converter(Module);
_slitValveRoutine = new EfemSlitValveRoutine();
}
private void InitDevice()
{
_cassetteDevice = DEVICE.GetDevice<SicEFEM>($"{Module}.{Module}");
WaferRobotModule = new WaferRobotModule(ModuleName.WaferRobot);
TrayRobotModule = new TrayRobotModule(ModuleName.TrayRobot);
}
private void InitFsm()
{
//Error
AnyStateTransition(MSG.Error, FsmOnError, STATE.Error);
AnyStateTransition(FSM_MSG.ALARM, FsmOnError, STATE.Error);
Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
EnterExitTransition<STATE, FSM_MSG>(STATE.Error, FsmEnterError, FSM_MSG.NONE, FsmExitError);
//Home
Transition(STATE.Init, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Error, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Idle, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Homing, FSM_MSG.TIMER, FsmMonitorHomeTask, STATE.Idle);
Transition(STATE.Homing, MSG.Error, null, STATE.Init);
Transition(STATE.Homing, MSG.Abort, FsmAbortTask, STATE.Init);
EnterExitTransition((int)STATE.Homing, FsmEnterIdle, (int)FSM_MSG.NONE, FsmExitIdle);
AnyStateTransition(MSG.ToInit, FsmToInit, STATE.Init);
//Online
Transition(STATE.Idle, MSG.SetOnline, FsmStartSetOnline, STATE.Idle);
Transition(STATE.Idle, MSG.SetOffline, FsmStartSetOffline, STATE.Idle);
//open SlitValve
Transition(STATE.Idle, MSG.OpenSlitValve, FsmStartOpenSlitValve, STATE.OpenSlitValve);
Transition(STATE.OpenSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.OpenSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
//close SlitValve
Transition(STATE.Idle, MSG.CloseSlitValve, FsmStartCloseSlitValve, STATE.CloseSlitValve);
Transition(STATE.CloseSlitValve, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.CloseSlitValve, MSG.Abort, FsmAbortTask, STATE.Idle);
}
private void InitOp()
{
OP.Subscribe($"{Name}.Home", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Home));
OP.Subscribe($"{Name}.Reset", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Reset));
OP.Subscribe($"{Name}.Abort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Abort));
OP.Subscribe($"{Module}.SetOnline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOnline));
OP.Subscribe($"{Module}.SetOffline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOffline));
OP.Subscribe($"{Module}.PickWafer", (string cmd, object[] args) => WaferRobotModule.PickWafer(args));
OP.Subscribe($"{Module}.PlaceWafer", (string cmd, object[] args) => WaferRobotModule.PlaceWafer(args));
OP.Subscribe($"{Module}.MapWafer", (string cmd, object[] args) => WaferRobotModule.MapWafer(args));
OP.Subscribe($"{Module}.RobotHome", (string cmd, object[] args) => WaferRobotModule.Home(out _) && TrayRobotModule.Home(out _));
OP.Subscribe($"{Module}.PickTray", (string cmd, object[] args) => TrayRobotModule.PickTray(args));
OP.Subscribe($"{Module}.PlaceTray", (string cmd, object[] args) => TrayRobotModule.PlaceTray(args));
OP.Subscribe($"{Module}.MapTray", (string cmd, object[] args) => TrayRobotModule.MapTray(args));
OP.Subscribe($"{Module}.OpenSlitValve", (string cmd, object[] args) => { return CheckToPostMessage((int)MSG.OpenSlitValve, args[0], args[1]); });
OP.Subscribe($"{Module}.CloseSlitValve", (string cmd, object[] args) => { return CheckToPostMessage((int)MSG.CloseSlitValve, args[0], args[1]); });
}
private void InitData()
{
DATA.Subscribe($"{Name}.Status", () => StringFsmStatus);
DATA.Subscribe($"{Name}.IsOnline", () => IsOnline);
DATA.Subscribe($"{Name}.IsBusy", () => IsBusy);
DATA.Subscribe($"{Module}.IsAlarm", () => IsAlarm);
}
private bool FsmOnError(object[] param)
{
IsOnline = false;
if (FsmState == (int)STATE.Error)
{
return false;
}
if (FsmState == (int)STATE.Init)
return false;
return true;
}
private bool FsmReset(object[] param)
{
if (!_isInit)
{
PostMsg(MSG.ToInit);
return false;
}
WaferRobotModule.Reset();
TrayRobotModule.Reset();
return true;
}
private bool FsmExitError(object[] param)
{
return true;
}
private bool FsmEnterError(object[] param)
{
if (OnEnterError != null)
OnEnterError(Module);
return true;
}
private bool FsmStartHome(object[] param)
{
return WaferRobotModule.Home(out _) && TrayRobotModule.Home(out _);
}
private bool FsmMonitorHomeTask(object[] param)
{
Result waferRobotRet = WaferRobotModule.MonitorRoutine();
Result trayRobotRet = TrayRobotModule.MonitorRoutine();
if (waferRobotRet == Result.FAIL || trayRobotRet == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
if (waferRobotRet == Result.DONE && trayRobotRet == Result.DONE)
{
_isInit = true;
OP.DoOperation($"{Module}.ResetTask");
return true;
}
return false;
}
private bool FsmAbortTask(object[] param)
{
AbortRoutine();
WaferRobotModule.Abort();
TrayRobotModule.Abort();
return true;
}
private bool FsmExitIdle(object[] param)
{
return true;
}
private bool FsmEnterIdle(object[] param)
{
return true;
}
private bool FsmToInit(object[] param)
{
WaferRobotModule.Reset();
TrayRobotModule.Reset();
return true;
}
private bool FsmStartSetOffline(object[] param)
{
IsOnline = false;
WaferRobotModule.IsOnline = false;
TrayRobotModule.IsOnline = false;
return true;
}
private bool FsmStartSetOnline(object[] param)
{
IsOnline = true;
WaferRobotModule.IsOnline = true;
TrayRobotModule.IsOnline = true;
return true;
}
private bool FsmMonitorTask(object[] param)
{
Result ret = MonitorRoutine();
if (ret == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
return ret == Result.DONE;
}
public override bool Home(out string reason)
{
CheckToPostMessage((int)MSG.Home);
reason = string.Empty;
return true;
}
public override bool CheckAcked(int entityTaskToken)
{
return FsmState == (int)STATE.Idle && CheckAllMessageProcessed();
//return true;
}
public override void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
{
//CheckToPostMessage(MSG.InTransfer);
}
public override void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType)
{
//if (FsmState == (int)STATE.InTransfer)
// CheckToPostMessage(MSG.TransferComplete);
}
public override bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
{
reason = string.Empty;
return true;
}
public override bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
{
reason = string.Empty;
return true;
}
public override bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason)
{
reason = string.Empty;
return true;
}
public override bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType,
out string reason)
{
reason = string.Empty;
return true;
}
public override bool CheckReadyForMap(ModuleName robot, Hand blade, out string reason)
{
reason = string.Empty;
return true;
}
public void InvokeOffline()
{
PostMsg((int)MSG.SetOffline);
}
public void InvokeOnline()
{
PostMsg((int)MSG.SetOnline);
}
public override bool MapWafer(ModuleName target)
{
if (WaferRobotModule.MapWafer(target))
{
return true;
}
return false;
}
public override bool PickWafer(ModuleName target, Hand blade, int targetSlot)
{
if (WaferRobotModule.PickWafer(target, blade, targetSlot))
{
return true;
}
return false;
}
public override bool PlaceWafer(ModuleName target, Hand blade, int targetSlot)
{
if (WaferRobotModule.PlaceWafer(target, blade, targetSlot))
{
return true;
}
return false;
}
public override bool GotoWafer(ModuleName target, Hand blade, int targetSlot)
{
throw new NotImplementedException();
}
public override bool MapTray(ModuleName target)
{
if (TrayRobotModule.MapTray(target))
{
return true;
}
return false;
}
public override bool PickTray(ModuleName target, Hand blade, int targetSlot)
{
if (TrayRobotModule.PickTray(target, blade, targetSlot))
{
return true;
}
return false;
}
public override bool PlaceTray(ModuleName target, Hand blade, int targetSlot)
{
if (TrayRobotModule.PlaceTray(target, blade, targetSlot))
{
return true;
}
return false;
}
public override bool GotoTray(ModuleName target, Hand blade, int targetSlot)
{
throw new NotImplementedException();
}
private bool FsmStartOpenSlitValve(object[] param)
{
if (ModuleHelper.Converter(param[1].ToString()) == ModuleName.WaferRobot && !WaferRobotModule.IsIdle)
return false;
if (ModuleHelper.Converter(param[1].ToString()) == ModuleName.TrayRobot && !TrayRobotModule.IsIdle)
return false;
_slitValveRoutine.Init(ModuleHelper.Converter(param[0].ToString()), ModuleHelper.Converter(param[1].ToString()), true);
Result ret = StartRoutine(_slitValveRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartCloseSlitValve(object[] param)
{
if (ModuleHelper.Converter(param[1].ToString()) == ModuleName.WaferRobot && !WaferRobotModule.IsIdle)
return false;
if (ModuleHelper.Converter(param[1].ToString()) == ModuleName.TrayRobot && !TrayRobotModule.IsIdle)
return false;
_slitValveRoutine.Init(ModuleHelper.Converter(param[0].ToString()), ModuleHelper.Converter(param[1].ToString()), false);
Result ret = StartRoutine(_slitValveRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
public int InvokeError()
{
if (CheckToPostMessage((int)MSG.Error))
return (int)MSG.Error;
return (int)FSM_MSG.NONE;
}
}
}
@@ -0,0 +1,55 @@
using Aitex.Core.RT.Device;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Fsm;
using MECF.Framework.Common.Schedulers;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
namespace SicModules.EFEMs
{
public abstract class EFEMModuleBase : ModuleFsmDevice, ITransferTarget, IModuleDevice
{
private int _slot = 1;
public EFEMModuleBase(int slot)
{
_slot = slot;
}
public override bool Initialize()
{
WaferManager.Instance.SubscribeLocation(Module, _slot);
return base.Initialize();
}
public abstract bool IsIdle { get; }
//IModuleDevice
public abstract bool IsReady { get; }
public abstract bool IsError { get; }
public abstract bool IsInit { get; }
public abstract bool Home(out string reason);
//ITransferTarget
public abstract bool PrepareTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason);
public abstract bool TransferHandoff(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason);
public abstract bool PostTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason);
public abstract bool CheckReadyForTransfer(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType, out string reason);
public abstract void NoteTransferStart(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType);
public abstract void NoteTransferStop(ModuleName robot, Hand blade, int targetSlot, EnumTransferType transferType);
public abstract bool CheckReadyForMap(ModuleName robot, Hand blade, out string reason);
public abstract bool CheckAcked(int entityTaskToken);
public abstract bool MapWafer(ModuleName target );
public abstract bool PickWafer(ModuleName target, Hand blade, int targetSlot);
public abstract bool PlaceWafer(ModuleName target, Hand blade, int targetSlot);
public abstract bool GotoWafer(ModuleName target, Hand blade, int targetSlot);
public abstract bool MapTray(ModuleName target );
public abstract bool PickTray(ModuleName target, Hand blade, int targetSlot);
public abstract bool PlaceTray(ModuleName target, Hand blade, int targetSlot);
public abstract bool GotoTray(ModuleName target, Hand blade, int targetSlot);
}
}
@@ -0,0 +1,62 @@
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.EFEMs.Routines
{
public class EFEMHomeRoutine : EfemBaseRoutine
{
enum RoutineStep
{
Home,
Home2,
TimeDelay1,
TimeDelay2,
TimeDelay3,
WaitReady1,
WaitReady2
}
private int _homeTimeout1;
private int _homeTimeout2;
public EFEMHomeRoutine()
{
Name = "RobortHome";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout1 = SC.GetValue<int>("WaferRobot.HomeTimeout");
_homeTimeout2 = SC.GetValue<int>("TrayRobot.HomeTimeout");
return Result.RUN;
}
public override Result Monitor()
{
try
{
RobotHomeExcute((int)RoutineStep.Home, WaferRobot, _homeTimeout1);
RobotHomeExcute((int)RoutineStep.Home2, TrayRobot, _homeTimeout2);
TimeDelay((int)RoutineStep.TimeDelay1, 2);
CheckRobotReady((int)RoutineStep.WaitReady1, WaferRobot, _homeTimeout1);
CheckRobotReady((int)RoutineStep.WaitReady2, TrayRobot, _homeTimeout2);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
}
}
@@ -0,0 +1,752 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.EFEM;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
using SicModules.Devices;
using static MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase.RobotBaseDevice;
namespace SicModules.EFEMs.Routines
{
public class EfemBaseRoutine : ModuleRoutine, IRoutine
{
private RobotBaseDevice _waferRobot = null;
private RobotBaseDevice _trayRobot = null;
private IEFEM _efemDevice;
public IoSensor _loadTrayHomeSensor; //Tray定位
public IoSensor _loadWaferPlaced; //上下对射,检测Wafer有无
public IoSensor _loadTrayPresence; //检测托盘有无
public IoSensor _cassAL6Inch; //6寸检测
public IoSensor _cassAR6Inch; //6寸检测
public IoSensor _cassBL6Inch; //6寸检测
public IoSensor _cassALWaferConvex; //凸片检测
public IoSensor _cassARWaferConvex; //凸片检测
public IoSensor _cassBLWaferConvex; //凸片检测
private IoInterLockEx _tmIoInterLock;
public IoLift4 _llLift;
public IoClaw _loadWaferClaw;
public IoLift4 _unLoadLift;
public IoClaw _unLoadWaferClaw;
private HwAlignerGuide _alignerDevice = null;
protected RobotBaseDevice WaferRobot
{
get { return _waferRobot; }
}
protected RobotBaseDevice TrayRobot
{
get { return _trayRobot; }
}
protected IEFEM EfemDevice
{
get { return _efemDevice; }
}
public EfemBaseRoutine() : base(ModuleName.EFEM.ToString())
{
_waferRobot = DEVICE.GetDevice<SicWaferRobot>($"WaferRobot.WaferRobot");
_trayRobot = DEVICE.GetDevice<SicTrayRobot>($"TrayRobot.TrayRobot");
_efemDevice = DEVICE.GetDevice<SicEFEM>($"EFEM.EFEM");
_loadTrayHomeSensor = DEVICE.GetDevice<IoSensor>($"TM.LoadTrayHomeSensor");
_alignerDevice = DEVICE.GetDevice<HwAlignerGuide>($"TM.HiWinAligner");
_loadWaferPlaced = DEVICE.GetDevice<IoSensor>($"TM.LLWaferPlaced");
_loadTrayPresence = DEVICE.GetDevice<IoSensor>($"TM.LLTrayPresence");
_cassBLWaferConvex = DEVICE.GetDevice<IoSensor>($"TM.CassBLWaferConvexSensor");
_cassALWaferConvex = DEVICE.GetDevice<IoSensor>($"TM.CassALWaferConvexSensor");
_cassARWaferConvex = DEVICE.GetDevice<IoSensor>($"TM.CassARWaferConvexSensor");
_cassAL6Inch = DEVICE.GetDevice<IoSensor>($"TM.CassALInch6Sensor");
_cassAR6Inch = DEVICE.GetDevice<IoSensor>($"TM.CassARInch6Sensor");
_cassBL6Inch = DEVICE.GetDevice<IoSensor>($"TM.CassBLInch6Sensor");
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
_llLift= DEVICE.GetDevice<IoLift4>($"LoadLock.LLLift");
_unLoadLift= DEVICE.GetDevice<IoLift4>($"UnLoad.UnLoadLift");
_loadWaferClaw = DEVICE.GetDevice<IoClaw>($"LoadLock.LLWaferClaw");
_unLoadWaferClaw = DEVICE.GetDevice<IoClaw>($"UnLoad.UnLoadWaferClaw");
}
public virtual Result Start(params object[] objs)
{
return Result.DONE;
}
public virtual Result Monitor()
{
return Result.DONE;
}
public virtual void Abort()
{
}
protected void CheckTraySensor(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
if (SC.GetValue<bool>($"System.IsSimulatorMode"))
{
return true;
}
return _loadTrayPresence.Value;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Sensor[DI-32] check no tray");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void ClearRobortExtendToDO(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify("Clear RobortExtendTO DO");
_tmIoInterLock.DoATMRobotExtendLoaLSideEnable = false;
_tmIoInterLock.DoATMRobotExtendLoaRSideEnable = false;
_tmIoInterLock.DoATMRobotExtendUnloadEnable = false;
return true;
});
}
protected void Pick(int id, RobotBaseDevice robot, ModuleName source, int slot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Pick from {source} {slot + 1} use Blade1 ");
if (!robot.Pick(MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotArmEnum.Blade1, source.ToString(), slot))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Pick failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop(string.Format("pick timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void ExtendForPick(int id, RobotBaseDevice robot, ModuleName source, int slot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"ExtendForPick from {source} {slot + 1} use Blade1 ");
if (!robot.CheckToPostMessage(RobotMsg.ExtendForPick, RobotArmEnum.Blade1, source.ToString(), slot))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"ExtendForPick failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop(string.Format("ExtendForPick timeout, can not complete in {0} seconds", timeout));
robot.Abort();
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void ExtendForPlace(int id, RobotBaseDevice robot, ModuleName source, int slot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"ExtendForPlace to {source} {slot + 1} use Blade1 ");
if (!robot.CheckToPostMessage(RobotMsg.ExtendForPlace, MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotArmEnum.Blade1, source.ToString(), slot))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"ExtendForPlace failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop(string.Format("ExtendForPlace timeout, can not complete in {0} seconds", timeout));
robot.Abort();
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void RobotActionComplete(int id, RobotBaseDevice robot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Robot Action Complete ");
if (!robot.CheckToPostMessage(RobotMsg.ActionDone))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Robot Action failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop(string.Format("Robot Action timeout, can not complete in {0} seconds", timeout));
robot.Abort();
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void Place(int id, RobotBaseDevice robot, ModuleName source, int slot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Place wafer to {source} {slot + 1} use Blade1 ");
if (!robot.Place(MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotArmEnum.Blade1, source.ToString(), slot))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Place failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop(string.Format("Place timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void CheckWaferStatuBeforePick(int id, RobotBaseDevice robot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Check Wafer Status Before Pick");
if (!robot.ExecuteCommand(new object[] { true }))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
{
if (WaferManager.Instance.CheckHasWafer(robot.Name, 0))
{
EV.PostWarningLog(ModuleName.EFEM.ToString(), "Robot Check Has Wafer!");
return null;
}
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Place failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop(string.Format("Place timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void CheckWaferStatuAfterPlace(int id, RobotBaseDevice robot,int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Check Wafer Status After Place");
if (!robot.ExecuteCommand(new object[] { true}))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
{
if (WaferManager.Instance.CheckHasWafer(robot.Name, 0))
{
EV.PostWarningLog(ModuleName.EFEM.ToString(), "Place Finished and Robot Check Has Wafer!");
return null;
}
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Place failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop(string.Format("Place timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void CheckTrayStatuBeforePick(int id, RobotBaseDevice robot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Check Tray Status Before Pick");
if (!robot.ExecuteCommand(new object[] { true }))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
{
if (WaferManager.Instance.CheckHasTray(ModuleHelper.Converter(robot.Name), 0))
{
EV.PostWarningLog(ModuleName.EFEM.ToString(), "Robot Check Has Tray!");
return null;
}
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Place failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop(string.Format("Place timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void Map(int id, RobotBaseDevice robot, ModuleName source, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Mapping wafer {source}");
if (!robot.WaferMapping(source))
{
robot.IsBusy = false;
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Mapping failed, error {robot.ErrorCode}");
robot.Abort();
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop(string.Format("Mapping timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void CheckRobotReady(int id, RobotBaseDevice robot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"{robot.Name} Check robot ready");
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
robot.Abort();
Stop($"{robot.Name} timeout, can not complete in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void RobotHomeExcute(int id, RobotBaseDevice robot, int timeout)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"{robot.Name} Execute home");
if (!robot.Home(null))
{
EV.PostAlarmLog(Module, $"{robot.Name} Can not home robot");
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
robot.Abort();
Stop($"{robot.Name} home timeout over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void CloseVacuum(int id, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Close Vacuum");
_alignerDevice.CloseVacuum();
return true;
}, () =>
{
//return !_alignerDevice.IsBusy;
return true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Aligner Close Vacuum Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void SetWaferRobortExtendToDO(int id, ModuleName target, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify("Set RobortExtendTO DO");
_tmIoInterLock.DoATMRobotExtendLoaLSideEnable = false;
_tmIoInterLock.DoATMRobotExtendLoaRSideEnable = false;
_tmIoInterLock.DoATMRobotExtendUnloadEnable = false;
if (ModuleHelper.IsLoadLock(target) || target == ModuleName.Load)
{
if (!_tmIoInterLock.SetWaferRobotExtendLoadEnable(true, out string reasen))
{
Notify(reasen);
return false;
}
}
else if (target == ModuleName.UnLoad)
{
if (!_tmIoInterLock.SetWaferRobotExtendUnLoadEnable(true, out string reasen))
{
Notify(reasen);
return false;
}
}
return true;
}, () =>
{
if (ModuleHelper.IsLoadLock(target) || target == ModuleName.Load)
{
return _tmIoInterLock.DiATMRobotExtendLoadLSideEnableFB;
}
else if (target == ModuleName.UnLoad)
{
return _tmIoInterLock.DiATMRobotExtendUnloadEnableFB;
}
return true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Set Robot extend to Do timeout over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void SetTrayRobortExtendToDO(int id, ModuleName target, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify("Set RobortExtendTO DO");
_tmIoInterLock.DoATMRobotExtendLoaLSideEnable = false;
_tmIoInterLock.DoATMRobotExtendLoaRSideEnable = false;
_tmIoInterLock.DoATMRobotExtendUnloadEnable = false;
if (ModuleHelper.IsLoadLock(target) || target == ModuleName.Load)
{
if (!_tmIoInterLock.SetTrayRobotExtendLoadEnable(true, out string reasen))
{
Notify(reasen);
return false;
}
}
return true;
}, () =>
{
if (ModuleHelper.IsLoadLock(target) || target == ModuleName.Load)
{
return _tmIoInterLock.DiATMRobotExtendLoadRSideEnableFB;
}
return true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Set Robot extend to Do timeout over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void CheckLoadTrayPresence(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
if (SC.GetValue<bool>("LoadLock.TrayPresenceCheckEnable"))
{
if (!_loadTrayPresence.Value)
{
EV.PostAlarmLog(Module, $"check load Tray Presence sensor false,no Tray in load");
return false;
}
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,298 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.UnLoad;
using SicModules.LLs;
using SicModules.LLs.Routines;
using SicModules.TMs;
using SicModules.UnLoads;
using SicModules.UnLoads.Routines;
namespace SicModules.EFEMs.Routines
{
public class EfemSlitValveRoutine : EfemBaseRoutine
{
enum RoutineStep
{
ServoRoutine,
LiftRoutine,
CheckPressureCondition,
CheckPressure,
SetSlitValve,
CheckPressureCondition2,
TimeDlay1
}
private int _motionTimeout = 30;
private ModuleName _paramTarget; //目标腔体
private ModuleName _robot; //机械手
private bool _paramIsOpen; //是否开门
private bool _bothPressureIsATM; //判断两边压力是否都为ATM
private SicTM _tm;
private LoadLock _loadLock;
private UnLoad _unLoad;
private LoadLockServoToRoutine _llServoToRoutine;
private UnLoadServoToRoutine _unLoadServoToRoutine;
private LoadLockLiftRoutine _llLiftRoutine;
private UnLoadLiftRoutine _unLoadLiftRoutine;
private double _maxPressureDiffOpenSlitValve = SC.GetValue<double>("EFEM.MaxPressureDiffOpenSlitValve");
public void Init(ModuleName targetModule,ModuleName robot, bool isOpen)
{
_paramTarget = targetModule;
_robot = robot;
_paramIsOpen = isOpen;
Name = isOpen ? "Open Slit Valve" : "Close Slit Valve";
}
public EfemSlitValveRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "EFEMSlitValue";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ ModuleName.TM.ToString()}");
_loadLock= DEVICE.GetDevice<SicLoadLock>($"{ ModuleName.LoadLock.ToString()}.{ ModuleName.LoadLock.ToString()}");
_unLoad = DEVICE.GetDevice<SicUnLoad>($"{ ModuleName.UnLoad.ToString()}.{ ModuleName.UnLoad.ToString()}");
_llServoToRoutine = new LoadLockServoToRoutine(ModuleName.LoadLock);
_unLoadServoToRoutine = new UnLoadServoToRoutine(ModuleName.UnLoad);
_llLiftRoutine = new LoadLockLiftRoutine();
_unLoadLiftRoutine = new UnLoadLiftRoutine();
}
public override Result Start(params object[] objs)
{
Reset();
//只有LoadLock和UnLoad需要开门
if (_robot == ModuleName.WaferRobot)
{
if (_paramTarget != ModuleName.LoadLock && _paramTarget != ModuleName.Load && _paramTarget != ModuleName.UnLoad)
{
return Result.DONE;
}
}
else if (_robot == ModuleName.TrayRobot)
{
if (_paramTarget != ModuleName.LoadLock)
{
return Result.DONE;
}
}
else
{
return Result.DONE;
}
if (_paramIsOpen)
{
if (EfemDevice.CheckSlitValveOpen(_paramTarget, _robot))
{
return Result.DONE;
}
//判断TM到LoadLock或者UnLoad的门是否关上
if (!_tm.CheckSlitValveClose(_paramTarget))
{
EV.PostWarningLog(Module, $"can not open slit valve {_paramTarget}, {_paramTarget} to TM slit valve not closed, can not open at same time");
return Result.FAIL;
}
if (!EfemDevice.CheckSlitValveClose(ModuleName.LoadLock, ModuleName.WaferRobot)) //此门是必须要关上的
{
EV.PostWarningLog(Module, $"can not open slit valve {_paramTarget}, {ModuleName.LoadLock} to Efem slit valve not closed, can not open at same time");
return Result.FAIL;
}
if (!EfemDevice.CheckSlitValveClose(ModuleName.UnLoad, _robot))
{
EV.PostWarningLog(Module, $"can not open slit valve {_paramTarget}, {ModuleName.UnLoad} to Efem slit valve not closed, can not open at same time");
return Result.FAIL;
}
if (!EfemDevice.CheckSlitValveClose(ModuleName.LoadLock, _robot))
{
EV.PostWarningLog(Module, $"can not open slit valve {_paramTarget}, {ModuleName.LoadLock} to Efem slit valve not closed, can not open at same time");
return Result.FAIL;
}
_motionTimeout = SC.GetValue<int>("System.SlitValveMotionTimeout");
_llServoToRoutine.Init(SC.GetValue<double>("LoadLock.AtmPressureBase"));
_unLoadServoToRoutine.Init(SC.GetValue<double>("UnLoad.AtmPressureBase"));
_llLiftRoutine.Init(false);
_unLoadLiftRoutine.Init(false);
}
else
{
if (EfemDevice.CheckSlitValveClose(_paramTarget, _robot))
{
return Result.DONE;
}
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//开门之前需要对两边腔体进行气压调节,降Lift
if (_paramIsOpen)
{
if (_paramTarget == ModuleName.LoadLock)
{
CheckPressureConditionATM((int)RoutineStep.CheckPressureCondition, _paramTarget);//先判断Load腔是否在大气,因为EFEM始终在大气
if (!_bothPressureIsATM)
{
ExecuteRoutine((int)RoutineStep.ServoRoutine, _llServoToRoutine);
ExecuteRoutine((int)RoutineStep.LiftRoutine, _llLiftRoutine);
}
}
else if (_paramTarget == ModuleName.UnLoad)
{
CheckPressureConditionATM((int)RoutineStep.CheckPressureCondition, _paramTarget);//先判断UnLoad腔是否在大气
if (!_bothPressureIsATM)
{
ExecuteRoutine((int)RoutineStep.ServoRoutine, _unLoadServoToRoutine);
ExecuteRoutine((int)RoutineStep.LiftRoutine, _unLoadLiftRoutine);
}
}
CheckPressureCondition((int)RoutineStep.CheckPressureCondition2,_paramTarget);
}
SetSlitValve((int)RoutineStep.SetSlitValve, _paramTarget, _robot, _paramIsOpen, _motionTimeout);
TimeDelay((int)RoutineStep.TimeDlay1, 1);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public void CheckPressureConditionATM(int id, ModuleName target)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"check pressure condition to open {target} slit valve");
double targetPressure = 0.0;
if (target == ModuleName.LoadLock)
{
targetPressure = _loadLock.ChamberPressure;
}
else
{
targetPressure = _unLoad.ChamberPressure;
}
_bothPressureIsATM = Math.Abs(EfemDevice.AtmPressureBase - targetPressure) <= _maxPressureDiffOpenSlitValve;
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CheckPressureCondition(int id, ModuleName target)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"check {target} pressure is atm");
double targetPressure = 0.0;
if (target == ModuleName.LoadLock)
{
targetPressure = _loadLock.ChamberPressure;
}
else
{
targetPressure = _unLoad.ChamberPressure;
}
if (Math.Abs(EfemDevice.AtmPressureBase - targetPressure) > _maxPressureDiffOpenSlitValve)
{
Stop($"pressure difference {Math.Abs(EfemDevice.AtmPressureBase - targetPressure):F3} between Efem and {target} exceed tolerance {_maxPressureDiffOpenSlitValve}");
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void SetSlitValve(int id, ModuleName module,ModuleName _robort, bool isOpen, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"set slit valve {module} " + (isOpen ? "Open" : "Close"));
if (!EfemDevice.SetSlitValve(module, _robort, isOpen, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return isOpen ? EfemDevice.CheckSlitValveOpen(module, _robort) : EfemDevice.CheckSlitValveClose(module, _robort);
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"can not complete in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,54 @@
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.EFEMs.Routines
{
public class TrayRobotHomeRoutine : EfemBaseRoutine
{
enum RoutineStep
{
Home,
TimeDelay,
WaitReady,
}
private int _homeTimeout;
public TrayRobotHomeRoutine()
{
Name = "TrayRobotHome";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout = SC.GetValue<int>("TrayRobot.HomeTimeout");
return Result.RUN;
}
public override Result Monitor()
{
try
{
RobotHomeExcute((int)RoutineStep.Home, TrayRobot, _homeTimeout);
TimeDelay((int)RoutineStep.TimeDelay, 2);
CheckRobotReady((int)RoutineStep.WaitReady, TrayRobot, _homeTimeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
}
}
@@ -0,0 +1,82 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.EFEMs.Routines
{
public class TrayRobotMapRoutine : EfemBaseRoutine
{
enum RoutineStep
{
CheckRobotReady,
RobotMap,
TimeDelay1,
}
public TrayRobotMapRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "TrayRobortPick";
}
private ModuleName _source;
private int _motionTimeOut = 10;
public void Init(ModuleName source)
{
_source = source;
}
public override Result Start(params object[] objs)
{
Reset();
if (_source == ModuleName.LoadLock || _source == ModuleName.UnLoad)
{
return Result.DONE;
}
if (_source == ModuleName.CassBL)
{
//检测凸片Sensor和有无Sensor
if (_cassBLWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not map,{_source} check wafer convex");
return Result.FAIL;
}
if (!_cassBL6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not map,{_source} sensor check no cassette");
return Result.FAIL;
}
}
_motionTimeOut = SC.GetConfigItem($"{ModuleName.TrayRobot}.MotionTimeout").IntValue;
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRobotReady((int)RoutineStep.CheckRobotReady, WaferRobot, _motionTimeOut); //判断机械手当前是否空闲
Map((int)RoutineStep.RobotMap, TrayRobot, _source, _motionTimeOut); //机械手吸住,收回
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
}
}
@@ -0,0 +1,158 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using SicModules.LLs;
using SicModules.LLs.Routines;
namespace SicModules.EFEMs.Routines
{
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
{
OpenSlitValve,
SetLiftUp,
CheckRobotReady,
PickComplete,
SetLiftDown,
TimeDelay1,
CloseSlitValve,
SetExtendToDo,
Pick,
CheckTrayStatuBeforePick,
ClearRobortExtendToDo
}
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 wafer");
return Result.FAIL;
}
//Pick之前先,根据Sensor检测是否有盘
if (!WaferManager.Instance.CheckHasTray(_source, _sourceSlot))
{
EV.PostWarningLog(Module, $"Can not pick, {_source} slot {_sourceSlot} no tray");
return Result.FAIL;
}
if (TrayRobot.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not pick, WaferRobot is not Idle");
return Result.FAIL;
}
if (_source == ModuleName.CassBL)
{
//检测凸片Sensor和有无Sensor
if (_cassBLWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} check wafer convex");
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;
}
_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
{
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);
}
}
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();
}
}
}
@@ -0,0 +1,207 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using SicModules.Devices;
using SicModules.LLs;
using SicModules.LLs.Routines;
namespace SicModules.EFEMs.Routines
{
public class TrayRobotPlaceRoutine : EfemBaseRoutine
{
/* 1.Place to LoadLock(需要开门)/Cassette
* 2.判断目标是否无Tray,判断Robot是否有Tray
* 3.判断是否需要开门(包括气压等)
* 4.判断顶针是否下降
* 5.伸出
* 6.托盘旋转到定位角
* 7.托盘对中(夹紧放开)
* 8.关门
*/
private LoadRotationHomeOffsetRoutine _loadRotationHomeRoutine = new LoadRotationHomeOffsetRoutine();
private EfemSlitValveRoutine _efemSlitValveOpenRoutine = new EfemSlitValveRoutine();
private EfemSlitValveRoutine _efemSlitValveCloseRoutine = new EfemSlitValveRoutine();
private LoadLockLiftRoutine _loadLockLiftDown = new LoadLockLiftRoutine();
//private LoadLockTrayAlignerRoutine _trayAligner = new LoadLockTrayAlignerRoutine();
private LoadLockTrayClawRoutine _trayClamp = new LoadLockTrayClawRoutine();
private LoadLockTrayClawRoutine _trayUnClamp = new LoadLockTrayClawRoutine();
private IoLoadRotation _llRotation = null;
private ModuleName _source;
private int _sourceSlot;
private int _placeTimeout;
private double _homeOffset;
private int _loadRotationTimeOut = 60;
enum RoutineStep
{
OpenSlitValve,
SetLiftUp,
CheckRobotReady,
PickComplete,
SetLiftDown,
Place,
TrayAligner,
TrayClamp,
TrayUnClamp,
CloseSlitValve,
TrayUnClamp1,
LoadRotationRelativeHome,
FindPositionSensor,
SetExtendToDo,
ClearRobortExtendToDo,
CheckTraySensor,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
}
public TrayRobotPlaceRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "TrayRobortPlace";
_llRotation = DEVICE.GetDevice<IoLoadRotation>("Load.Rotation");
}
public void Init(ModuleName sourseMod,int sourceSlt)
{
_source = sourseMod;
_sourceSlot = sourceSlt;
}
public override Result Start(params object[] objs)
{
Reset();
if (!WaferManager.Instance.CheckHasTray(ModuleName.TrayRobot, 0))
{
Stop("Can not place,TrayRobot no tray");
return Result.FAIL;
}
//Place之前先,根据Sensor检测是否有盘
if (WaferManager.Instance.CheckHasTray(_source, _sourceSlot))
{
EV.PostWarningLog(Module, $"Can not place, {_source} slot {_sourceSlot} has tray");
return Result.FAIL;
}
if (TrayRobot.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not place, WaferRobot is not Idle");
EV.PostWarningLog(Module, $"Can not place, TrayRobot is not Idle");
return Result.FAIL;
}
//LoadLock传感器是否需要检测有Tray盘
if (_source == ModuleName.LoadLock || _source == ModuleName.Load)
{
if (_loadTrayPresence.Value)
{
EV.PostWarningLog(Module, $"Can not place,{_source} sensor[DI-32] check have tray");
return Result.FAIL;
}
if (!_llLift.IsDown)
{
EV.PostWarningLog(Module, $"Can not place,{_source} lift is not in down position!");
return Result.FAIL;
}
}
else if (_source == ModuleName.CassBL)
{
//检测凸片Sensor和有无Sensor
if (_cassBLWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not place,{_source} check wafer convex");
return Result.FAIL;
}
if (!_cassBL6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not place,{_source} sensor check no cassette");
return Result.FAIL;
}
}
_loadRotationTimeOut = SC.GetValue<int>("LoadLock.LoadRotation.RotationTimeOut");
_efemSlitValveOpenRoutine.Init(_source, ModuleName.TrayRobot, true);
_efemSlitValveCloseRoutine.Init(_source, ModuleName.TrayRobot, false);
_loadLockLiftDown.Init(false);
_trayClamp.Init(true);
_trayUnClamp.Init(false);
_placeTimeout = SC.GetConfigItem($"{ModuleName.TrayRobot}.MotionTimeout").IntValue;
_homeOffset = SC.GetConfigItem($"LoadLock.LoadRotation.HomeOffset").DoubleValue;
return Result.RUN;
}
public override Result Monitor()
{
try
{
/* DI_LoadTrayPresence 托盘有无
* DI_LoadWaferPlaced Wafer有无
* DI_LoadHomeTraySensor 托盘测距
*/
if (_source == ModuleName.LoadLock)
{
ExecuteRoutine((int)RoutineStep.TrayUnClamp1, _trayUnClamp); //夹爪打开
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _efemSlitValveOpenRoutine); //打开闸板阀
SetTrayRobortExtendToDO((int)RoutineStep.SetExtendToDo, _source, 10); //设置ExtendToDO,用于检测InterLock
CheckRobotReady((int)RoutineStep.CheckRobotReady, TrayRobot, _placeTimeout); //判断机械手当前是否空闲
Place((int)RoutineStep.Place, TrayRobot, _source, _sourceSlot, _placeTimeout); //机械手
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
CheckTraySensor((int)RoutineStep.CheckTraySensor);
//对中
ExecuteRoutine((int)RoutineStep.TrayClamp, _trayClamp); //夹爪关闭
TimeDelay((int)RoutineStep.TimeDelay2, 1);//延迟1s
ExecuteRoutine((int)RoutineStep.TrayUnClamp, _trayUnClamp); //夹爪打开
//ExecuteRoutine((int)RoutineStep.LoadRotationRelativeHome, _loadRotationHomeRoutine); //Tray找原点
//TimeDelay((int)RoutineStep.TimeDelay1, 1);
ExecuteRoutine((int)RoutineStep.CloseSlitValve, _efemSlitValveCloseRoutine); //关闭闸板阀
}
else
{
CheckRobotReady((int)RoutineStep.CheckRobotReady, TrayRobot, _placeTimeout); //判断机械手当前是否空闲
SetTrayRobortExtendToDO((int)RoutineStep.SetExtendToDo, _source, 10); //设置ExtendToDO,用于检测InterLock
Place((int)RoutineStep.Place, TrayRobot, _source, _sourceSlot, _placeTimeout); //机械手
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
}
}
@@ -0,0 +1,54 @@
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.EFEMs.Routines
{
public class WaferRobotHomeRoutine : EfemBaseRoutine
{
enum RoutineStep
{
Home,
TimeDelay,
WaitReady,
}
private int _homeTimeout1;
public WaferRobotHomeRoutine()
{
Name = "WaferRobotHome";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout1 = SC.GetValue<int>("WaferRobot.HomeTimeout");
return Result.RUN;
}
public override Result Monitor()
{
try
{
RobotHomeExcute((int)RoutineStep.Home, WaferRobot, _homeTimeout1);
TimeDelay((int)RoutineStep.TimeDelay, 2);
CheckRobotReady((int)RoutineStep.WaitReady, WaferRobot, _homeTimeout1);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
}
}
@@ -0,0 +1,118 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.EFEMs.Routines
{
public class WaferRobotMapRoutine : EfemBaseRoutine
{
/* Pick From Cassette,LoadLock(需要开门),Aligner/Unload(需要开门)
* 1.判断目标是否有Wafer
* 2.判断是否需要开门(包括气压等)
* 3.判断顶针是否上升
* 4.伸出,吸住
* 5.ActionDone
* 6.关门
*
*/
private ModuleName _source;
private int _pickTimeout;
enum RoutineStep
{
OpenSlitValve,
SetClawOpen,
SetLiftUp,
CheckRobotReady,
SetClawOpen2,
SetClaw,
PickComplete,
SetLiftDown,
SetLiftDown2,
TimeDelay1,
ExtendForPick,
Pick,
}
public WaferRobotMapRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "WaferRobortMap";
}
public void Init(ModuleName sourseMod)
{
_source = sourseMod;
}
public override Result Start(params object[] objs)
{
Reset();
if (!ModuleHelper.IsCassette(_source))
{
return Result.DONE;
}
if (_source == ModuleName.CassAL)
{
//检测凸片Sensor和有无Sensor
if (_cassALWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not map,{_source} check wafer convex");
return Result.FAIL;
}
if (!_cassAL6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not map,{_source} sensor check no cassette");
return Result.FAIL;
}
}
else if (_source == ModuleName.CassAR)
{
//检测凸片Sensor和有无Sensor
if (_cassARWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not map,{_source} check wafer convex");
return Result.FAIL;
}
if (!_cassAR6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not map,{_source} sensor check no cassette");
return Result.FAIL;
}
}
_pickTimeout = SC.GetConfigItem($"{ModuleName.WaferRobot}.MotionTimeout").IntValue;
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRobotReady((int)RoutineStep.CheckRobotReady, WaferRobot, _pickTimeout); //判断机械手当前是否空闲
Map((int)RoutineStep.Pick, WaferRobot, _source, _pickTimeout); //机械手吸住,收回
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
}
}
@@ -0,0 +1,248 @@
using Aitex.Core.Common;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using SicModules.LLs;
using SicModules.LLs.Routines;
using SicModules.UnLoads;
using SicModules.UnLoads.Routines;
namespace SicModules.EFEMs.Routines
{
public class WaferRobotPickRoutine : EfemBaseRoutine
{
private EfemSlitValveRoutine _efemSlitValveOpenRoutine = new EfemSlitValveRoutine();
private EfemSlitValveRoutine _efemSlitValveCloseRoutine = new EfemSlitValveRoutine();
private UnLoadLiftRoutine _unLoadLiftDown = new UnLoadLiftRoutine();
private UnLoadLiftRoutine _unLoadLiftUp = new UnLoadLiftRoutine();
private UnLoadClawRoutine _unLoadClaw = new UnLoadClawRoutine();
private UnLoadClawRoutine _unLoadClawOpen = new UnLoadClawRoutine();
private LoadLockLiftRoutine _loadLockLiftDown = new LoadLockLiftRoutine();
private LoadLockLiftRoutine _loadLockLiftUp = new LoadLockLiftRoutine();
private LoadLockClawRoutine _loadLockClaw = new LoadLockClawRoutine();
private LoadLockClawRoutine _loadLockClawOpen= new LoadLockClawRoutine();
private LoadRotationHomeOffsetRoutine _loadRotationHomeRoutine = new LoadRotationHomeOffsetRoutine();
//private AlignerAlignRoutine _alignRoutine = new AlignerAlignRoutine();
private ModuleName _source;
private int _sourceSlot;
private int _pickTimeout;
private bool _isSimulator = false;
enum RoutineStep
{
CheckWaferStatuBeforePick,
OpenSlitValve,
SetClawOpen,
SetLiftUp,
CheckRobotReady,
SetClawOpen2,
SetClaw,
PickComplete,
SetLiftDown,
SetLiftDown2,
TimeDelay1,
ExtendForPick,
CloaseSlitValve,
Pick,
CloseVacuum,
SetExtendToDo,
ClearRobortExtendToDo,
CheckWaferStatusByRq,
LoadRotationHome,
}
public WaferRobotPickRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "WaferRobortPick";
}
public void Init(ModuleName source, int sourceSlot)
{
_source = source;
_sourceSlot = sourceSlot;
}
public override Result Start(params object[] objs)
{
Reset();
if (WaferManager.Instance.CheckHasWafer(ModuleName.WaferRobot, 0))
{
Stop("Can not pick,WaferRobot has wafer");
return Result.FAIL;
}
//Pick之前先,检查source是否有Wafer
if (!WaferManager.Instance.CheckHasWafer(_source, _sourceSlot))
{
EV.PostWarningLog(Module, $"Can not pick, {_source} slot {_sourceSlot} no wafer");
return Result.FAIL;
}
if (WaferRobot.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not pick, WaferRobot is not Idle");
return Result.FAIL;
}
if (_source == ModuleName.CassAL)
{
//检测凸片Sensor和有无Sensor
if (_cassALWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} check wafer convex");
return Result.FAIL;
}
if (!_cassAL6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} sensor check no cassette");
return Result.FAIL;
}
if (WaferManager.Instance.GetWafer(_source, _sourceSlot).WaferStatus != WaferStatus.Normal)
{
EV.PostWarningLog(Module, $"Can not pick,wafer statu is error!");
return Result.FAIL;
}
}
else if (_source == ModuleName.CassAR)
{
//检测凸片Sensor和有无Sensor
if (_cassARWaferConvex.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} check wafer convex");
return Result.FAIL;
}
if (!_cassAR6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not pick,{_source} sensor check no cassette");
return Result.FAIL;
}
if (WaferManager.Instance.GetWafer(_source, _sourceSlot).WaferStatus != WaferStatus.Normal)
{
EV.PostWarningLog(Module, $"Can not pick,wafer statu is error!");
return Result.FAIL;
}
}
else if (_source == ModuleName.Load || _source == ModuleName.LoadLock)
{
//夹爪打开,顶针在低位,说明没Wafer
if (_loadWaferClaw.State == ClawStateEnum.Open && !_llLift.IsDown)
{
EV.PostWarningLog(Module, $"Can not pick, Load Claw is open,Make sure wafer and Tray has Separated!");
return Result.FAIL;
}
}
else if (_source == ModuleName.UnLoad)
{
//夹爪打开,顶针在低位,说明没Wafer
if (_unLoadWaferClaw.State == ClawStateEnum.Open && !_unLoadLift.IsDown)
{
EV.PostWarningLog(Module, $"Can not pick, UnLoad Claw is open,Make sure wafer and Tray has Separated!");
return Result.FAIL;
}
}
_isSimulator = SC.GetValue<bool>($"System.IsSimulatorMode");
_pickTimeout = SC.GetConfigItem($"{ModuleName.WaferRobot}.MotionTimeout").IntValue;
_efemSlitValveOpenRoutine.Init(_source, ModuleName.WaferRobot, true);
_efemSlitValveCloseRoutine.Init(_source, ModuleName.WaferRobot, false);
_unLoadLiftDown.Init(false);
_unLoadLiftUp.Init(true);
_unLoadClaw.Init(true);
_unLoadClawOpen.Init(false);
_loadLockLiftDown.Init(false);
_loadLockLiftUp.Init(true);
_loadLockClaw.Init(true,true);
_loadLockClawOpen.Init(true,false);
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (_source == ModuleName.Aligner && !_isSimulator)
{
//关Aligner真空吸
CloseVacuum((int)RoutineStep.CloseVacuum, 15);
}
//判断机械手当前是否空闲
CheckRobotReady((int)RoutineStep.CheckRobotReady, WaferRobot, _pickTimeout);
//开始前先检查Wafer
CheckWaferStatuBeforePick((int)RoutineStep.CheckWaferStatuBeforePick, WaferRobot, 10);
//执行Load Tray 找原点
if ((_source == ModuleName.Load || _source == ModuleName.LoadLock) && WaferManager.Instance.CheckHasTray(_source, _sourceSlot))
{
ExecuteRoutine((int)RoutineStep.LoadRotationHome, _loadRotationHomeRoutine);
}
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _efemSlitValveOpenRoutine); //打开闸板阀
SetWaferRobortExtendToDO((int)RoutineStep.SetExtendToDo, _source, 10); //设置ExtendToDO,用于检测InterLock
if (_source == ModuleName.UnLoad)
{
ExecuteRoutine((int)RoutineStep.SetLiftUp, _unLoadLiftUp); //UnLoad,顶针上升
}
else if (_source == ModuleName.LoadLock || _source == ModuleName.Load)
{
ExecuteRoutine((int)RoutineStep.SetLiftUp, _loadLockLiftUp); //Load,顶针上升
}
ExtendForPick((int)RoutineStep.ExtendForPick, WaferRobot, _source, _sourceSlot, _pickTimeout); //机械手到位
if(_source == ModuleName.UnLoad)
{
ExecuteRoutine((int)RoutineStep.SetClawOpen, _unLoadClawOpen); //UnLoad夹爪松开
ExecuteRoutine((int)RoutineStep.SetLiftDown, _unLoadLiftDown);
}
else if (_source == ModuleName.LoadLock || _source == ModuleName.Load)
{
ExecuteRoutine((int)RoutineStep.SetClawOpen, _loadLockClawOpen); //Load夹爪松开
ExecuteRoutine((int)RoutineStep.SetLiftDown, _loadLockLiftDown);
}
Pick((int)RoutineStep.Pick, WaferRobot, _source, _sourceSlot, _pickTimeout); //机械手吸住,收回
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
ExecuteRoutine((int)RoutineStep.CloaseSlitValve, _efemSlitValveCloseRoutine); //关闭闸板阀
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
public override void Abort()
{
WaferRobot.Abort();
base.Abort();
}
}
}
@@ -0,0 +1,307 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using SicModules.LLs;
using SicModules.LLs.Routines;
using SicModules.UnLoads;
using SicModules.UnLoads.Routines;
namespace SicModules.EFEMs.Routines
{
public class WaferRobotPlaceRoutine : EfemBaseRoutine
{
/* 1.Place to LoadLock(需要开门)/Aligner/Cassette
* 2.判断目标是否无Wafer,判断Robot是否有Wafer
* 3.判断是否需要开门(包括气压等)
* 4.判断顶针是否上升
* 5.伸出
* 6.判断顶针上升
* 7.ActionDone
* 8.关门
*
机械手伸进来
顶针顶起来
夹爪夹住
夹爪松开
机械手退出
顶针下降
*/
private EfemSlitValveRoutine _efemSlitValveOpenRoutine = new EfemSlitValveRoutine();
private EfemSlitValveRoutine _efemSlitValveCloseRoutine = new EfemSlitValveRoutine();
private LoadLockLiftRoutine _loadLockLiftDown = new LoadLockLiftRoutine();
private LoadLockLiftRoutine _loadLockLiftUp = new LoadLockLiftRoutine();
private LoadLockClawRoutine _loadLockClaw = new LoadLockClawRoutine();
private LoadLockClawRoutine _loadLockClawOpen = new LoadLockClawRoutine();
private UnLoadLiftRoutine _unLoadLiftDown = new UnLoadLiftRoutine();
private UnLoadLiftRoutine _unLoadLiftUp = new UnLoadLiftRoutine();
private UnLoadClawRoutine _unLoadClaw = new UnLoadClawRoutine();
private UnLoadClawRoutine _unLoadClawOpen = new UnLoadClawRoutine();
private HwAlignerGuide _alignerDevice;
private ModuleName _target;
private int _targetSlot;
private int _placeTimeout;
private int _alignerMoveTimeOut = 10;
private bool _isSimulator = false;
enum RoutineStep
{
SetLiftDown0,
AlignerMoveTo,
OpenSlitValve,
SetLiftUp,
CheckRobotReady,
ExtendForPlace,
PickComplete,
SetLiftDown,
CloseSlitValve,
TimeDelay1,
Place,
SetClawOpen1,
SetClawOpen2,
SetClaw,
AlignerCheckWafer,
SetExtendToDo,
ClearRobortExtendToDo,
CheckWaferStatusByRq
}
public WaferRobotPlaceRoutine()
{
Module = ModuleName.EFEM.ToString();
Name = "WaferRobotPlace";
_alignerDevice = DEVICE.GetDevice<HwAlignerGuide>($"TM.HiWinAligner");
}
public void Init(ModuleName targetModule, int targetSlt)
{
_target = targetModule;
_targetSlot = targetSlt;
}
public override Result Start(params object[] objs)
{
Reset();
if (!WaferManager.Instance.CheckHasWafer(ModuleName.WaferRobot, 0))
{
Stop("Can not place,WaferRobot no wafer");
return Result.FAIL;
}
//Place之前先,根据Sensor检测是否有盘
if (WaferManager.Instance.CheckHasWafer(_target, _targetSlot))
{
EV.PostWarningLog(Module, $"Can not place, {_target} slot {_targetSlot} has wafer");
return Result.FAIL;
}
if (WaferRobot.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not place, WaferRobot is not Idle");
return Result.FAIL;
}
//LoadLock传感器是否需要检测有Wafer
//if (_target == ModuleName.LoadLock || _target == ModuleName.Load)
//{
// if (_loadWaferPlaced.Value)
// {
// EV.PostWarningLog(Module, $"Can not place,{_target} sensor[DI-35] check have wafer");
// return Result.FAIL;
// }
//}
if (_target == ModuleName.CassAL)
{
if (!_cassAL6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not place,{_target} sensor check no cassette");
return Result.FAIL;
}
}
else if (_target == ModuleName.CassAR)
{
if (!_cassAR6Inch.Value)
{
EV.PostWarningLog(Module, $"Can not place,{_target} sensor check no cassette");
return Result.FAIL;
}
}
_efemSlitValveOpenRoutine.Init(_target, ModuleName.WaferRobot, true);
_efemSlitValveCloseRoutine.Init(_target, ModuleName.WaferRobot, false);
_loadLockLiftDown.Init(false);
_loadLockLiftUp.Init(true);
_loadLockClaw.Init(true,true);
_loadLockClawOpen.Init(true, false);
_unLoadLiftDown.Init(false);
_unLoadLiftUp.Init(true);
_unLoadClaw.Init(true);
_unLoadClawOpen.Init(false);
_placeTimeout = SC.GetConfigItem($"{ModuleName.WaferRobot}.MotionTimeout").IntValue;
_isSimulator = SC.GetValue<bool>($"System.IsSimulatorMode");
_alignerMoveTimeOut = SC.GetValue<int>("HiWinAligner.AlignerMoveToCenterTimeOut");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (_target == ModuleName.Aligner && !_isSimulator)
{
AlignerCheckHaveWafer((int)RoutineStep.AlignerCheckWafer, 15); //发送指令检测是否有Wafer
AlignerMoveToRobotPutPalce((int)RoutineStep.AlignerMoveTo, _alignerMoveTimeOut); //Aligner移动至测量中心点
}
if (_target == ModuleName.LoadLock)
{
ExecuteRoutine((int)RoutineStep.SetLiftDown0, _loadLockLiftDown);
ExecuteRoutine((int)RoutineStep.SetClawOpen1, _loadLockClawOpen); //夹爪打开
}
else if (_target == ModuleName.UnLoad)
{
ExecuteRoutine((int)RoutineStep.SetLiftDown0, _unLoadLiftDown);
ExecuteRoutine((int)RoutineStep.SetClawOpen1, _unLoadClawOpen); //夹爪打开
}
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _efemSlitValveOpenRoutine); //打开闸板阀
SetWaferRobortExtendToDO((int)RoutineStep.SetExtendToDo, _target, 10); //设置ExtendToDO,用于检测InterLock
CheckRobotReady((int)RoutineStep.CheckRobotReady, WaferRobot, _placeTimeout); //判断机械手当前是否空闲
ExtendForPlace((int)RoutineStep.ExtendForPlace, WaferRobot, _target, _targetSlot, _placeTimeout); //伸出,关真空
//夹爪打开,顶针上升
if (_target == ModuleName.LoadLock)
{
ExecuteRoutine((int)RoutineStep.SetLiftUp, _loadLockLiftUp);
}
else if (_target == ModuleName.UnLoad)
{
ExecuteRoutine((int)RoutineStep.SetLiftUp, _unLoadLiftUp);
}
Place((int)RoutineStep.Place, WaferRobot, _target, _targetSlot, _placeTimeout); //机械手收回
if (_target == ModuleName.LoadLock)
{
ExecuteRoutine((int)RoutineStep.SetClaw, _loadLockClaw);
ExecuteRoutine((int)RoutineStep.SetLiftDown, _loadLockLiftDown);
}
else if (_target == ModuleName.UnLoad)
{
ExecuteRoutine((int)RoutineStep.SetClaw, _unLoadClaw);
ExecuteRoutine((int)RoutineStep.SetLiftDown, _unLoadLiftDown);
}
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
CheckWaferStatuAfterPlace((int)RoutineStep.CheckWaferStatusByRq, WaferRobot, 10); //结束后检查Wafer
ExecuteRoutine((int)RoutineStep.CloseSlitValve, _efemSlitValveCloseRoutine); //关闭闸板阀
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify($"Finish");
return Result.DONE;
}
public override void Abort()
{
WaferRobot.Abort();
WaferRobot.Stop();
base.Abort();
}
protected void AlignerMoveToRobotPutPalce(int id, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Move to Robot Put Place");
_alignerDevice.MoveToRobotPutPlace();
return true;
}, () =>
{
return !_alignerDevice.IsBusy;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Aligner Move to Robot Put Place Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void AlignerCheckHaveWafer(int id, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Aligner check wafer exist or not");
_alignerDevice.CheckWaferLoad();
return true;
}, () =>
{
if (!_alignerDevice.IsBusy)
{
if (_alignerDevice.HaveWafer)
{
Notify($"Check result : aligner have wafer, can not place to aligner");
return null;
}
else
{
return true;
}
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Aligner Move to Robot Put Place Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
+111
View File
@@ -0,0 +1,111 @@
using System.Xml;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.EFEM;
namespace SicModules.EFEMs
{
public class SicEFEM : EFEM
{
private ModuleName _module;
private IoSlitValve _slitvalveUnLoad;
private IoSlitValve _slitvalveLoadLockLeft;
private IoSlitValve _slitvalveLoadLockRight;
public SicEFEM(string module, XmlElement node, string ioModule = "") : base(module)
{
var attrModule = node.GetAttribute("module");
base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
base.Name = node.GetAttribute("id");
base.Display = node.GetAttribute("display");
base.DeviceID = node.GetAttribute("schematicId");
_module = ModuleHelper.Converter(Module);
}
public override bool Initialize()
{
_slitvalveUnLoad = DEVICE.GetDevice<IoSlitValve>("EFEM.UnLoadSubDoor");
_slitvalveLoadLockLeft = DEVICE.GetDevice<IoSlitValve>("EFEM.LoadLockLSideDoor");
_slitvalveLoadLockRight = DEVICE.GetDevice<IoSlitValve>("EFEM.LoadLockRSideDoor");
return base.Initialize();
}
public override double AtmPressureBase
{
get
{
return SC.GetValue<double>("EFEM.AtmPressureBase");
}
}
public override bool CheckSlitValveOpen(ModuleName module,ModuleName robot)
{
if (robot == ModuleName.WaferRobot)
{
if (module == ModuleName.LoadLock)
{
return _slitvalveLoadLockLeft.IsOpen;
}
else if (module == ModuleName.UnLoad)
{
return _slitvalveUnLoad.IsOpen;
}
return true;
}
else if (robot == ModuleName.TrayRobot && module == ModuleName.LoadLock)
{
return _slitvalveLoadLockRight.IsOpen;
}
return true;
}
public override bool CheckSlitValveClose(ModuleName module, ModuleName robot)
{
if (robot == ModuleName.WaferRobot)
{
if (module == ModuleName.LoadLock)
{
return _slitvalveLoadLockLeft.IsClose;
}
else if (module == ModuleName.UnLoad)
{
return _slitvalveUnLoad.IsClose;
}
return true;
}
else if (robot == ModuleName.TrayRobot && module == ModuleName.LoadLock)
{
return _slitvalveLoadLockRight.IsClose;
}
return true;
}
public override bool SetSlitValve(ModuleName module, ModuleName robot, bool isOpen, out string reason)
{
reason = string.Empty;
if (robot == ModuleName.WaferRobot)
{
if (module == ModuleName.LoadLock)
{
return _slitvalveLoadLockLeft.SetSlitValve(isOpen, out reason);
}
else if (module == ModuleName.UnLoad)
{
return _slitvalveUnLoad.SetSlitValve(isOpen, out reason);
}
return true;
}
else if (robot == ModuleName.TrayRobot && module == ModuleName.LoadLock)
{
return _slitvalveLoadLockRight.SetSlitValve(isOpen, out reason);
}
return true;
}
}
}
+33
View File
@@ -0,0 +1,33 @@
using System.Xml;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HwinRobot;
namespace SicModules.EFEMs
{
public class SicWaferRobot : HwinRobot
{
private ModuleName _module;
public SicWaferRobot(string module, XmlElement node, string ioModule = "") : base("WaferRobot", "WaferRobot", "\r\n")
{
var attrModule = node.GetAttribute("module");
base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
base.Name = node.GetAttribute("id");
_module = ModuleHelper.Converter(Module);
}
}
public class SicTrayRobot : HwinRobotB
{
private ModuleName _module;
public SicTrayRobot(string module, XmlElement node, string ioModule = "") : base("TrayRobot", "TrayRobot", "\r\n")
{
var attrModule = node.GetAttribute("module");
base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
base.Name = node.GetAttribute("id");
_module = ModuleHelper.Converter(Module);
}
}
}
+446
View File
@@ -0,0 +1,446 @@
using System;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Fsm;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.Utilities;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Fsm;
using SicModules.EFEMs.Routines;
namespace SicModules.EFEMs
{
public class TrayRobotModule : ModuleFsmDevice, IModuleDevice
{
public enum STATE
{
NotInstall,
Init,
Idle,
Homing,
Cooling,
Error,
RobotHoming,
TrayRobotPick,
TrayRobotPlace,
TrayRobotMap,
}
public enum MSG
{
Home,
Reset,
Abort,
Error,
ToInit,
SetOnline,
SetOffline,
RobotHome,
TrayRobotPick,
TrayRobotPlace,
TrayRobotMap,
};
public SicTrayRobot TrayRobotDevice { get; set; }
public bool IsReady
{
get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
}
public bool IsError
{
get { return FsmState == (int)STATE.Error; }
}
public bool IsInit
{
get { return FsmState == (int)STATE.Init; }
}
public bool IsBusy
{
get { return !IsInit && !IsError && !IsReady; }
}
public bool IsIdle
{
get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
}
public bool IsAlarm
{
get
{
return FsmState == (int)STATE.Error;
}
}
public event Action<string> OnEnterError;
private TrayRobotPickRoutine _trayRobotPickRoutine;
private TrayRobotPlaceRoutine _trayRobotPlaceRoutine;
private EFEMHomeRoutine _robotHomeRoutine;
private TrayRobotMapRoutine _trayRobotMapRoutine;
private bool _isInit;
public SicEFEM _cassetteDevice { get; set; }
public TrayRobotModule(ModuleName module)
{
Module = module.ToString();
Name = module.ToString();
IsOnline = false;
EnumLoop<STATE>.ForEach((item) =>
{
MapState((int)item, item.ToString());
});
EnumLoop<MSG>.ForEach((item) =>
{
MapMessage((int)item, item.ToString());
});
EnableFsm(50, IsInstalled ? STATE.Init : STATE.NotInstall);
}
public override bool Initialize()
{
InitRoutine();
InitDevice();
InitFsm();
InitOp();
InitData();
return base.Initialize();
}
private void InitRoutine()
{
ModuleName module = ModuleHelper.Converter(Module);
_trayRobotPlaceRoutine = new TrayRobotPlaceRoutine();
_robotHomeRoutine = new EFEMHomeRoutine();
_trayRobotPickRoutine = new TrayRobotPickRoutine();
_trayRobotPlaceRoutine = new TrayRobotPlaceRoutine();
_trayRobotMapRoutine = new TrayRobotMapRoutine();
}
private void InitDevice()
{
_cassetteDevice = DEVICE.GetDevice<SicEFEM>($"{Module}.{Module}");
TrayRobotDevice = DEVICE.GetDevice<SicTrayRobot>($"{ModuleName.TrayRobot}.{ModuleName.TrayRobot}");
}
private void InitFsm()
{
//Error
AnyStateTransition(MSG.Error, FsmOnError, STATE.Error);
AnyStateTransition(FSM_MSG.ALARM, FsmOnError, STATE.Error);
Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
EnterExitTransition<STATE, FSM_MSG>(STATE.Error, FsmEnterError, FSM_MSG.NONE, FsmExitError);
//Home
Transition(STATE.Init, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Error, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Idle, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Homing, FSM_MSG.TIMER, FsmMonitorHomeTask, STATE.Idle);
Transition(STATE.Homing, MSG.Error, null, STATE.Init);
Transition(STATE.Homing, MSG.Abort, FsmAbortTask, STATE.Init);
EnterExitTransition((int)STATE.Homing, FsmEnterIdle, (int)FSM_MSG.NONE, FsmExitIdle);
AnyStateTransition(MSG.ToInit, FsmToInit, STATE.Init);
//Online
Transition(STATE.Idle, MSG.SetOnline, FsmStartSetOnline, STATE.Idle);
Transition(STATE.Idle, MSG.SetOffline, FsmStartSetOffline, STATE.Idle);
Transition(STATE.Idle, MSG.RobotHome, FsmStartRobotHome, STATE.RobotHoming);
Transition(STATE.RobotHoming, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.RobotHoming, MSG.Abort, FsmAbortTask, STATE.Idle);
Transition(STATE.Idle, MSG.TrayRobotMap, FsmStartTrayRobotMap, STATE.TrayRobotMap);
Transition(STATE.TrayRobotMap, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.TrayRobotMap, MSG.Abort, FsmAbortTask, STATE.Idle);
Transition(STATE.Idle, MSG.TrayRobotPick, FsmStartTrayRobotPick, STATE.TrayRobotPick);
Transition(STATE.TrayRobotPick, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.TrayRobotPick, MSG.Abort, FsmAbortTask, STATE.Idle);
Transition(STATE.Idle, MSG.TrayRobotPlace, FsmStartTrayRobotPlace, STATE.TrayRobotPlace);
Transition(STATE.TrayRobotPlace, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.TrayRobotPlace, MSG.Abort, FsmAbortTask, STATE.Idle);
}
private void InitOp()
{
OP.Subscribe($"{Name}.Home", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Home));
OP.Subscribe($"{Name}.Reset", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Reset));
OP.Subscribe($"{Name}.Abort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Abort));
OP.Subscribe($"{Module}.SetOnline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOnline));
OP.Subscribe($"{Module}.SetOffline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOffline));
OP.Subscribe($"{Module}.RobotHome", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RobotHome));
OP.Subscribe($"{Module}.PickTray", (string cmd, object[] args) => CheckToPostMessage((int)MSG.TrayRobotPick, args[0], args[1]));
OP.Subscribe($"{Module}.PlaceTray", (string cmd, object[] args) => CheckToPostMessage((int)MSG.TrayRobotPlace, args[0], args[1]));
OP.Subscribe($"{Module}.MapTray", (string cmd, object[] args) => CheckToPostMessage((int)MSG.TrayRobotMap, args[0]));
}
private void InitData()
{
DATA.Subscribe($"{Name}.Status", () => StringFsmStatus);
DATA.Subscribe($"{Name}.IsOnline", () => IsOnline);
DATA.Subscribe($"{Name}.IsBusy", () => IsBusy);
DATA.Subscribe($"{Module}.IsAlarm", () => IsAlarm);
}
private bool FsmOnError(object[] param)
{
IsOnline = false;
if (FsmState == (int)STATE.Error)
{
return false;
}
if (FsmState == (int)STATE.Init)
return false;
return true;
}
private bool FsmReset(object[] param)
{
if (!_isInit)
{
PostMsg(MSG.ToInit);
return false;
}
TrayRobotDevice.RobotReset();
return true;
}
private bool FsmExitError(object[] param)
{
return true;
}
private bool FsmEnterError(object[] param)
{
if (OnEnterError != null)
OnEnterError(Module);
return true;
}
private bool FsmStartHome(object[] param)
{
Result ret = StartRoutine(_robotHomeRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmMonitorHomeTask(object[] param)
{
Result ret = MonitorRoutine();
if (ret == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
if (ret == Result.DONE)
{
_isInit = true;
OP.DoOperation($"{Module}.ResetTask");
return true;
}
return false;
}
private bool FsmAbortTask(object[] param)
{
AbortRoutine();
TrayRobotDevice.Abort();
return true;
}
private bool FsmExitIdle(object[] param)
{
return true;
}
private bool FsmEnterIdle(object[] param)
{
return true;
}
private bool FsmToInit(object[] param)
{
TrayRobotDevice.RobotReset();
return true;
}
private bool FsmStartSetOffline(object[] param)
{
IsOnline = false;
return true;
}
private bool FsmStartSetOnline(object[] param)
{
IsOnline = true;
return true;
}
private bool FsmMonitorTask(object[] param)
{
Result ret = MonitorRoutine();
if (ret == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
return ret == Result.DONE;
}
public bool Abort()
{
CheckToPostMessage((int)MSG.Abort);
return true;
}
public bool Home(out string reason)
{
CheckToPostMessage((int)MSG.Home);
reason = string.Empty;
return true;
}
public bool CheckAcked(int entityTaskToken)
{
return FsmState == (int)STATE.Idle && CheckAllMessageProcessed();
//return true;
}
public void InvokeOffline()
{
PostMsg((int)MSG.SetOffline);
}
public void InvokeOnline()
{
PostMsg((int)MSG.SetOnline);
}
public bool MapTray(object[] objs)
{
if (CheckToPostMessage((int)MSG.TrayRobotMap, objs))
return true;
return false;
}
public bool MapTray(ModuleName target)
{
if (CheckToPostMessage((int)MSG.TrayRobotMap, target.ToString()))
return true;
return false;
}
public bool PickTray(object[] objs)
{
if (CheckToPostMessage((int)MSG.TrayRobotPick, objs))
return true;
return false;
}
public bool PickTray(ModuleName target, Hand blade, int targetSlot)
{
if (CheckToPostMessage((int)MSG.TrayRobotPick, target.ToString(), targetSlot, blade))
return true;
return false;
}
public bool PlaceTray(object[] objs)
{
if (CheckToPostMessage((int)MSG.TrayRobotPlace, objs))
return true;
return false;
}
public bool PlaceTray(ModuleName target, Hand blade, int targetSlot)
{
if (CheckToPostMessage((int)MSG.TrayRobotPlace, target.ToString(), targetSlot, blade))
return true;
return false;
}
private bool FsmStartRobotHome(object[] param)
{
Result ret = StartRoutine(_robotHomeRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartTrayRobotMap(object[] param)
{
_trayRobotMapRoutine.Init(ModuleHelper.Converter((string)param[0]));
Result ret = StartRoutine(_trayRobotMapRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartTrayRobotPick(object[] param)
{
_trayRobotPickRoutine.Init(ModuleHelper.Converter((string)param[0]), (int)param[1]);
Result ret = StartRoutine(_trayRobotPickRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartTrayRobotPlace(object[] param)
{
_trayRobotPlaceRoutine.Init(ModuleHelper.Converter((string)param[0]), (int)param[1]);
Result ret = StartRoutine(_trayRobotPlaceRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
public int InvokeError()
{
if (CheckToPostMessage((int)MSG.Error))
return (int)MSG.Error;
return (int)FSM_MSG.NONE;
}
}
}
@@ -0,0 +1,438 @@
using System;
using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Fsm;
using Aitex.Core.RT.OperationCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.Utilities;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Fsm;
using SicModules.EFEMs.Routines;
namespace SicModules.EFEMs
{
public class WaferRobotModule : ModuleFsmDevice, IModuleDevice
{
public enum STATE
{
NotInstall,
Init,
Idle,
Homing,
Error,
WaferRobotPick,
WaferRobotPlace,
WaferRobotMap,
RobotHoming,
}
public enum MSG
{
Home,
Reset,
Abort,
Error,
ToInit,
SetOnline,
SetOffline,
RobotHome,
WaferRobotPick,
WaferRobotPlace,
WaferRobotMap,
};
public SicWaferRobot WaferRobotDevice { get; set; }
public bool IsReady
{
get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
}
public bool IsError
{
get { return FsmState == (int)STATE.Error; }
}
public bool IsInit
{
get { return FsmState == (int)STATE.Init; }
}
public bool IsBusy
{
get { return !IsInit && !IsError && !IsReady; }
}
public bool IsIdle
{
get { return FsmState == (int)STATE.Idle && CheckAllMessageProcessed(); }
}
public bool IsAlarm
{
get
{
return FsmState == (int)STATE.Error;
}
}
public event Action<string> OnEnterError;
private WaferRobotHomeRoutine _robotHomeRoutine;
private WaferRobotPlaceRoutine _WaferRobotPlaceRoutine;
private WaferRobotPickRoutine _waferRobotPickRoutine;
private WaferRobotMapRoutine _waferRobotMapRoutine;
private bool _isInit;
public SicEFEM _cassetteDevice { get; set; }
public WaferRobotModule(ModuleName module)
{
Module = module.ToString();
Name = module.ToString();
IsOnline = false;
EnumLoop<STATE>.ForEach((item) =>
{
MapState((int)item, item.ToString());
});
EnumLoop<MSG>.ForEach((item) =>
{
MapMessage((int)item, item.ToString());
});
EnableFsm(50, IsInstalled ? STATE.Init : STATE.NotInstall);
}
public override bool Initialize()
{
InitRoutine();
InitDevice();
InitFsm();
InitOp();
InitData();
return base.Initialize();
}
private void InitRoutine()
{
ModuleName module = ModuleHelper.Converter(Module);
_robotHomeRoutine = new WaferRobotHomeRoutine();
_WaferRobotPlaceRoutine = new WaferRobotPlaceRoutine();
_waferRobotPickRoutine = new WaferRobotPickRoutine();
_waferRobotMapRoutine = new WaferRobotMapRoutine();
}
private void InitDevice()
{
_cassetteDevice = DEVICE.GetDevice<SicEFEM>($"{Module}.{Module}");
WaferRobotDevice = DEVICE.GetDevice<SicWaferRobot>($"{ModuleName.WaferRobot}.{ModuleName.WaferRobot}");
}
private void InitFsm()
{
//Error
AnyStateTransition(MSG.Error, FsmOnError, STATE.Error);
AnyStateTransition(FSM_MSG.ALARM, FsmOnError, STATE.Error);
Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
EnterExitTransition<STATE, FSM_MSG>(STATE.Error, FsmEnterError, FSM_MSG.NONE, FsmExitError);
//Home
Transition(STATE.Init, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Error, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Idle, MSG.Home, FsmStartHome, STATE.Homing);
Transition(STATE.Homing, FSM_MSG.TIMER, FsmMonitorHomeTask, STATE.Idle);
Transition(STATE.Homing, MSG.Error, null, STATE.Init);
Transition(STATE.Homing, MSG.Abort, FsmAbortTask, STATE.Init);
EnterExitTransition((int)STATE.Homing, FsmEnterIdle, (int)FSM_MSG.NONE, FsmExitIdle);
AnyStateTransition(MSG.ToInit, FsmToInit, STATE.Init);
//Online
Transition(STATE.Idle, MSG.SetOnline, FsmStartSetOnline, STATE.Idle);
Transition(STATE.Idle, MSG.SetOffline, FsmStartSetOffline, STATE.Idle);
Transition(STATE.Idle, MSG.WaferRobotMap, FsmStartWaferRobotMap, STATE.WaferRobotMap);
Transition(STATE.WaferRobotMap, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.WaferRobotMap, MSG.Abort, FsmAbortTask, STATE.Idle);
Transition(STATE.Idle, MSG.WaferRobotPick, FsmStartWaferRobotPick, STATE.WaferRobotPick);
Transition(STATE.WaferRobotPick, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.WaferRobotPick, MSG.Abort, FsmAbortTask, STATE.Idle);
Transition(STATE.Idle, MSG.WaferRobotPlace, FsmStartWaferRobotPlace, STATE.WaferRobotPlace);
Transition(STATE.WaferRobotPlace, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.WaferRobotPlace, MSG.Abort, FsmAbortTask, STATE.Idle);
Transition(STATE.Idle, MSG.RobotHome, FsmStartRobotHome, STATE.RobotHoming);
Transition(STATE.RobotHoming, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.RobotHoming, MSG.Abort, FsmAbortTask, STATE.Idle);
}
private void InitOp()
{
OP.Subscribe($"{Name}.Home", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Home));
OP.Subscribe($"{Name}.Reset", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Reset));
OP.Subscribe($"{Name}.Abort", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Abort));
OP.Subscribe($"{Module}.SetOnline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOnline));
OP.Subscribe($"{Module}.SetOffline", (string cmd, object[] args) => CheckToPostMessage((int)MSG.SetOffline));
OP.Subscribe($"{Module}.PickWafer", (string cmd, object[] args) => CheckToPostMessage((int)MSG.WaferRobotPick, args[0], args[1]));
OP.Subscribe($"{Module}.PlaceWafer", (string cmd, object[] args) => CheckToPostMessage((int)MSG.WaferRobotPlace, args[0], args[1]));
OP.Subscribe($"{Module}.MapWafer", (string cmd, object[] args) => CheckToPostMessage((int)MSG.WaferRobotMap, args[0]));
OP.Subscribe($"{Module}.RobotHome", (string cmd, object[] args) => CheckToPostMessage((int)MSG.RobotHome));
}
private void InitData()
{
DATA.Subscribe($"{Name}.Status", () => StringFsmStatus);
DATA.Subscribe($"{Name}.IsOnline", () => IsOnline);
DATA.Subscribe($"{Name}.IsBusy", () => IsBusy);
DATA.Subscribe($"{Module}.IsAlarm", () => IsAlarm);
}
private bool FsmOnError(object[] param)
{
IsOnline = false;
if (FsmState == (int)STATE.Error)
{
return false;
}
if (FsmState == (int)STATE.Init)
return false;
return true;
}
private bool FsmReset(object[] param)
{
if (!_isInit)
{
PostMsg(MSG.ToInit);
return false;
}
WaferRobotDevice.RobotReset();
return true;
}
private bool FsmExitError(object[] param)
{
return true;
}
private bool FsmEnterError(object[] param)
{
if (OnEnterError != null)
OnEnterError(Module);
return true;
}
private bool FsmStartHome(object[] param)
{
Result ret = StartRoutine(_robotHomeRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmMonitorHomeTask(object[] param)
{
Result ret = MonitorRoutine();
if (ret == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
if (ret == Result.DONE)
{
_isInit = true;
OP.DoOperation($"{Module}.ResetTask");
return true;
}
return false;
}
private bool FsmAbortTask(object[] param)
{
AbortRoutine();
WaferRobotDevice.Abort();
return true;
}
private bool FsmExitIdle(object[] param)
{
return true;
}
private bool FsmEnterIdle(object[] param)
{
return true;
}
private bool FsmToInit(object[] param)
{
WaferRobotDevice.RobotReset();
return true;
}
private bool FsmStartSetOffline(object[] param)
{
IsOnline = false;
return true;
}
private bool FsmStartSetOnline(object[] param)
{
IsOnline = true;
return true;
}
private bool FsmMonitorTask(object[] param)
{
Result ret = MonitorRoutine();
if (ret == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
return ret == Result.DONE;
}
public bool Abort()
{
CheckToPostMessage((int)MSG.Abort);
return true;
}
public bool Home(out string reason)
{
CheckToPostMessage((int)MSG.Home);
reason = string.Empty;
return true;
}
public bool CheckAcked(int entityTaskToken)
{
return FsmState == (int)STATE.Idle && CheckAllMessageProcessed();
//return true;
}
public void InvokeOffline()
{
PostMsg((int)MSG.SetOffline);
}
public void InvokeOnline()
{
PostMsg((int)MSG.SetOnline);
}
public bool MapWafer(object[] objs)
{
if (CheckToPostMessage((int)MSG.WaferRobotMap, objs))
{
return true;
}
return false;
}
public bool MapWafer(ModuleName target)
{
if(CheckToPostMessage((int)MSG.WaferRobotMap, target.ToString()))
{
return true;
}
return false;
}
public bool PickWafer(object[] objs)
{
if (CheckToPostMessage((int)MSG.WaferRobotPick, objs))
return true;
return false;
}
public bool PickWafer(ModuleName target, Hand blade, int targetSlot)
{
if (CheckToPostMessage((int)MSG.WaferRobotPick, target.ToString(), targetSlot, blade))
return true;
return false;
}
public bool PlaceWafer(object[] objs)
{
if (CheckToPostMessage((int)MSG.WaferRobotPlace, objs))
return true;
return false;
}
public bool PlaceWafer(ModuleName target, Hand blade, int targetSlot)
{
if (CheckToPostMessage((int)MSG.WaferRobotPlace, target.ToString(), targetSlot, blade))
return true;
return false;
}
private bool FsmStartWaferRobotMap(object[] param)
{
_waferRobotMapRoutine.Init(ModuleHelper.Converter((string)param[0]));
Result ret = StartRoutine(_waferRobotMapRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartWaferRobotPick(object[] param)
{
_waferRobotPickRoutine.Init(ModuleHelper.Converter((string)param[0]), (int)param[1]);
Result ret = StartRoutine(_waferRobotPickRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartWaferRobotPlace(object[] param)
{
_WaferRobotPlaceRoutine.Init(ModuleHelper.Converter((string)param[0]), (int)param[1]);
Result ret = StartRoutine(_WaferRobotPlaceRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartRobotHome(object[] param)
{
Result ret = StartRoutine(_robotHomeRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
public int InvokeError()
{
if (CheckToPostMessage((int)MSG.Error))
return (int)MSG.Error;
return (int)FSM_MSG.NONE;
}
}
}