首次上传
This commit is contained in:
@@ -0,0 +1,396 @@
|
||||
using System;
|
||||
using Aitex.Core.RT.DataCenter;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Event;
|
||||
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 MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner;
|
||||
using SicModules.Aligners.Routines;
|
||||
|
||||
namespace SicModules.Aligners
|
||||
{
|
||||
public class AlignerModule : AlignerModuleBase
|
||||
{
|
||||
public enum STATE
|
||||
{
|
||||
NotInstall,
|
||||
|
||||
Init,
|
||||
|
||||
Idle,
|
||||
|
||||
Homing,
|
||||
|
||||
Aligning,
|
||||
|
||||
Error,
|
||||
}
|
||||
|
||||
public enum MSG
|
||||
{
|
||||
Home,
|
||||
Reset,
|
||||
Abort,
|
||||
Error,
|
||||
Aligner,
|
||||
|
||||
SetOnline,
|
||||
SetOffline,
|
||||
|
||||
ToInit,
|
||||
};
|
||||
|
||||
|
||||
public bool IsAlarm
|
||||
{
|
||||
get
|
||||
{
|
||||
return FsmState == (int)STATE.Error;
|
||||
}
|
||||
}
|
||||
|
||||
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 event Action<string> OnEnterError;
|
||||
|
||||
private bool _isInit;
|
||||
|
||||
public HwAlignerGuide _alignerDevice { get; set; }
|
||||
private AlignerAlignRoutine _alignerAlignRoutine;
|
||||
private AlignerHomeRoutine _alignerHomeRoutine;
|
||||
|
||||
public AlignerModule(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();
|
||||
|
||||
return base.Initialize();
|
||||
}
|
||||
|
||||
private void InitRoutine()
|
||||
{
|
||||
ModuleName module = ModuleHelper.Converter(Module);
|
||||
|
||||
_alignerAlignRoutine = new AlignerAlignRoutine();
|
||||
_alignerHomeRoutine = new AlignerHomeRoutine();
|
||||
|
||||
}
|
||||
|
||||
private void InitDevice()
|
||||
{
|
||||
_alignerDevice = DEVICE.GetDevice<HwAlignerGuide>($"TM.HiWinAligner");
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//Vent
|
||||
Transition(STATE.Idle, MSG.Aligner, FsmStartAligner, STATE.Aligning);
|
||||
Transition(STATE.Aligning, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
|
||||
Transition(STATE.Aligning, 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($"{Name}.Aligner", (string cmd, object[] args) => CheckToPostMessage((int)MSG.Aligner));
|
||||
}
|
||||
|
||||
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 (FsmState == (int)STATE.Error)
|
||||
{
|
||||
_alignerDevice.Reset();
|
||||
EV.ClearAlarmEvent();
|
||||
}
|
||||
if (!_isInit)
|
||||
{
|
||||
PostMsg(MSG.ToInit);
|
||||
return false;
|
||||
}
|
||||
|
||||
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(_alignerHomeRoutine);
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private bool FsmStartAligner(object[] param)
|
||||
{
|
||||
Result ret = StartRoutine(_alignerAlignRoutine);
|
||||
if (ret == Result.FAIL || ret == Result.DONE)
|
||||
return false;
|
||||
return ret == Result.RUN;
|
||||
}
|
||||
|
||||
private bool FsmAbortTask(object[] param)
|
||||
{
|
||||
AbortRoutine();
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool FsmExitIdle(object[] param)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool FsmEnterIdle(object[] param)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool FsmToInit(object[] param)
|
||||
{
|
||||
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 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 int InvokeAligner()
|
||||
{
|
||||
if (CheckToPostMessage((int)MSG.Aligner))
|
||||
return (int)MSG.Aligner;
|
||||
|
||||
return (int)FSM_MSG.NONE;
|
||||
}
|
||||
|
||||
|
||||
public int InvokeError()
|
||||
{
|
||||
if (CheckToPostMessage((int)MSG.Error))
|
||||
return (int)MSG.Error;
|
||||
|
||||
return (int)FSM_MSG.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.Aligners
|
||||
{
|
||||
public abstract class AlignerModuleBase : ModuleFsmDevice, ITransferTarget, IModuleDevice
|
||||
{
|
||||
private int _slot = 1;
|
||||
|
||||
public AlignerModuleBase(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 int InvokeAligner();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Diagnostics;
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
|
||||
namespace SicModules.Aligners.Routines
|
||||
{
|
||||
public class AlignerAlignRoutine :AlignerBaseRoutine
|
||||
{
|
||||
enum RoutineStep
|
||||
{
|
||||
CheckWafer,
|
||||
OpenVacuum,
|
||||
Aligner,
|
||||
CloseVacuum,
|
||||
TimeDelay1,
|
||||
AlignerMoveTo
|
||||
}
|
||||
|
||||
|
||||
private Stopwatch _swTimer = new Stopwatch();
|
||||
private int _alignerTimeOut = 60;
|
||||
|
||||
public AlignerAlignRoutine()
|
||||
{
|
||||
Module = ModuleName.Aligner.ToString();
|
||||
Name = "Align";
|
||||
}
|
||||
|
||||
public override Result Start(params object[] objs)
|
||||
{
|
||||
Reset();
|
||||
_swTimer.Restart();
|
||||
_alignerTimeOut= SC.GetValue<int>("HiWinAligner.AlignerTimeout");
|
||||
Notify("Start");
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
|
||||
public override Result Monitor()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SC.GetValue<bool>($"System.IsSimulatorMode"))
|
||||
{
|
||||
TimeDelay((int)RoutineStep.TimeDelay1, 3);
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
CheckWafer((int)RoutineStep.CheckWafer, 10);
|
||||
|
||||
AlignerMove((int)RoutineStep.Aligner, _alignerTimeOut);
|
||||
|
||||
}
|
||||
catch (RoutineBreakException)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
catch (RoutineFaildException)
|
||||
{
|
||||
return Result.FAIL;
|
||||
}
|
||||
|
||||
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
using System;
|
||||
using Aitex.Core.RT.Device;
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Routine;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners.HiWinAligner;
|
||||
|
||||
namespace SicModules.Aligners.Routines
|
||||
{
|
||||
public class AlignerBaseRoutine : ModuleRoutine, IRoutine
|
||||
{
|
||||
|
||||
private HwAlignerGuide _alignerDevice = null;
|
||||
|
||||
protected AlignerBaseRoutine() : base(ModuleName.Aligner.ToString())
|
||||
{
|
||||
Module = ModuleName.Aligner.ToString();
|
||||
_alignerDevice = DEVICE.GetDevice<HwAlignerGuide>($"TM.HiWinAligner");
|
||||
}
|
||||
|
||||
|
||||
public virtual Result Monitor()
|
||||
{
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
public virtual Result Start(params object[] objs)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public virtual void Abort()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void AlignerSME(int id, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"Aligner SME");
|
||||
_alignerDevice.InitMachine();
|
||||
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 SME Timeout, over {timeout} seconds");
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else
|
||||
throw (new RoutineBreakException());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void MsgCheckHaveWafer(int id, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"check wafer exist or not");
|
||||
_alignerDevice.CheckWaferLoad();
|
||||
return true;
|
||||
}, () =>
|
||||
{
|
||||
if (!_alignerDevice.IsBusy)
|
||||
{
|
||||
if (_alignerDevice.HaveWafer)
|
||||
{
|
||||
if (WaferManager.Instance.CheckNoWafer(Module, 0))
|
||||
{
|
||||
WaferManager.Instance.CreateWafer(ModuleHelper.Converter(Module), 0,Aitex.Core.Common.WaferStatus.Normal);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WaferManager.Instance.CheckHasWafer(Module, 0))
|
||||
{
|
||||
WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(Module), 0);
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
protected void Home(int id, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"Aligner Home Msg");
|
||||
_alignerDevice.MsgHome();
|
||||
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 home Timeout, over {timeout} seconds");
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else
|
||||
throw (new RoutineBreakException());
|
||||
}
|
||||
}
|
||||
|
||||
protected void CheckWafer(int id, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"Aligner Check Wafer");
|
||||
_alignerDevice.CheckWaferLoad();
|
||||
return true;
|
||||
}, () =>
|
||||
{
|
||||
if (!_alignerDevice.IsBusy)
|
||||
{
|
||||
if (_alignerDevice.HaveWafer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
EV.PostAlarmLog(Module, $"Aligner Check No Wafer");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}, timeout * 1000);
|
||||
|
||||
if (ret.Item1)
|
||||
{
|
||||
if (ret.Item2 == Result.FAIL)
|
||||
{
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else if (ret.Item2 == Result.TIMEOUT) //timeout
|
||||
{
|
||||
Stop($"Aligner Check Wafer Timeout, over {timeout} seconds");
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else
|
||||
throw (new RoutineBreakException());
|
||||
}
|
||||
}
|
||||
|
||||
protected void OpenVacuum(int id, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"Open Vacuum");
|
||||
_alignerDevice.OpenVacuum();
|
||||
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 Open Vacuum 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;
|
||||
|
||||
}, 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 AlignerMove(int id, int timeout)
|
||||
{
|
||||
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
|
||||
{
|
||||
Notify($"Alinger");
|
||||
_alignerDevice.DoAliger();
|
||||
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 Alinger Timeout, over {timeout} seconds");
|
||||
throw (new RoutineFaildException());
|
||||
}
|
||||
else
|
||||
throw (new RoutineBreakException());
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Core.RT.SCCore;
|
||||
|
||||
namespace SicModules.Aligners.Routines
|
||||
{
|
||||
public class AlignerHomeRoutine : AlignerBaseRoutine
|
||||
{
|
||||
enum RoutineStep
|
||||
{
|
||||
Home,
|
||||
SME,
|
||||
MsgCheckWafer,
|
||||
TimeDelay1,
|
||||
}
|
||||
|
||||
public AlignerHomeRoutine()
|
||||
{
|
||||
Name = "Home";
|
||||
}
|
||||
|
||||
public override Result Start(params object[] objs)
|
||||
{
|
||||
Reset();
|
||||
|
||||
Notify("Start");
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
public override Result Monitor()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SC.GetValue<bool>($"System.IsSimulatorMode"))
|
||||
{
|
||||
TimeDelay((int)RoutineStep.TimeDelay1, 3);
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
Home((int)RoutineStep.Home, 40);
|
||||
AlignerSME((int)RoutineStep.SME, 30);
|
||||
MsgCheckHaveWafer((int)RoutineStep.MsgCheckWafer, 30);
|
||||
}
|
||||
catch (RoutineBreakException)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
catch (RoutineFaildException)
|
||||
{
|
||||
return Result.FAIL;
|
||||
}
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Xml;
|
||||
using MECF.Framework.Common.Equipment;
|
||||
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligner;
|
||||
|
||||
namespace SicModules.Aligners
|
||||
{
|
||||
public class SicAligner : Aligner
|
||||
{
|
||||
private ModuleName _module;
|
||||
|
||||
public SicAligner(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()
|
||||
{
|
||||
return base.Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user