首次上传

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
+823
View File
@@ -0,0 +1,823 @@
using System;
using System.Threading;
using System.Threading.Tasks;
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.RT.SCCore;
using Aitex.Core.Util;
using Aitex.Core.Utilities;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Schedulers;
using SicModules.LLs.Routines;
namespace SicModules.LLs
{
public class LoadLockModule : LoadLockModuleBase
{
public enum STATE
{
NotInstall,
Init,
Idle,
Homing,
Pump,
Vent,
MoveLift,
Purge,
LeakCheck,
Transfer,
Error,
PrepareTransfer,
OpenDoor,
CloseDoor,
Cooling,
Separating,
Grouping,
RotationHomeOffset,
}
public enum MSG
{
Home,
Reset,
Abort,
Error,
Transfer,
PrepareTransfer,
MoveLift,
Pump,
Vent,
Purge,
LeakCheck,
OpenDoor,
CloseDoor,
Cooling,
SetOnline,
SetOffline,
ToInit,
Separate,
Group,
RelativeHomeOffset,
}
private R_TRIG _trigAlarm = new R_TRIG();
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 int CurrentRoutineLoop
{
get
{
if (FsmState == (int)STATE.Purge)
{
return _purgeRoutine.LoopCounter + 1;
}
else if (FsmState == (int)STATE.LeakCheck)
{
return _leakCheckRoutine.LoopCounter + 1;
}
return 0;
}
}
public int CurrentRoutineLoopTotal
{
get
{
if (FsmState == (int)STATE.Purge)
{
return _purgeRoutine.LoopTotalTime;
}
else if (FsmState == (int)STATE.LeakCheck)
{
return _leakCheckRoutine.LoopTotalTime;
}
return 0;
}
}
public bool JobDone
{
get
{
if (_llDevice != null)
{
return _llDevice.JobDone;
}
return false;
}
}
public event Action<string> OnEnterError;
private bool _isInit;
public SicLoadLock _llDevice { get; set; }
private LoadHomeRoutine _homeRoutine;
private LoadLockPumpRoutine _pumpRoutine;
private LoadLockVentRoutine _ventRoutine;
private LoadLockPurgeRoutine _purgeRoutine;
private LoadLockLeakCheckRoutine _leakCheckRoutine;
private LoadLockServoToRoutine _llServoTo;
private LoadLockPrepareTransferRoutine _prepareTransferRoutine;
//private LoadLockLiftRoutine _loadLockLiftRoutine;
private LoadLockGroupRoutine _loadLockGroupRoutine;
private LoadSeparateRoutine _loadSeparateRoutine;
private LoadRotationHomeOffsetRoutine _loadRotationHomeOffsetRoutine;
public LoadLockModule(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);
_pumpRoutine = new LoadLockPumpRoutine(module);
_homeRoutine = new LoadHomeRoutine(module);
_ventRoutine = new LoadLockVentRoutine(module);
_purgeRoutine = new LoadLockPurgeRoutine(module);
_leakCheckRoutine = new LoadLockLeakCheckRoutine(module);
_llServoTo = new LoadLockServoToRoutine(module);
_prepareTransferRoutine = new LoadLockPrepareTransferRoutine(module);
_loadLockGroupRoutine = new LoadLockGroupRoutine(module);
_loadSeparateRoutine = new LoadSeparateRoutine(module);
_loadRotationHomeOffsetRoutine = new LoadRotationHomeOffsetRoutine();
}
private void InitDevice()
{
_llDevice = DEVICE.GetDevice<SicLoadLock>($"{Module}.{Module}");
}
private void InitFsm()
{
//Error
AnyStateTransition(MSG.Error, FsmOnError, STATE.Error);
AnyStateTransition(FSM_MSG.ALARM, FsmOnError, STATE.Error);
AnyStateTransition(MSG.ToInit, FsmToInit, STATE.Init);
//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);
Transition(STATE.Error, MSG.Reset, FsmReset, STATE.Idle);
//PrepareTransfer
Transition(STATE.Idle, MSG.PrepareTransfer, FsmStartPrepareTransfer, STATE.PrepareTransfer);
Transition(STATE.PrepareTransfer, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.PrepareTransfer, MSG.Abort, FsmAbortTask, STATE.Idle);
//Online
Transition(STATE.Idle, MSG.SetOnline, FsmStartSetOnline, STATE.Idle);
Transition(STATE.Idle, MSG.SetOffline, FsmStartSetOffline, STATE.Idle);
//Pump
Transition(STATE.Idle, MSG.Pump, FsmStartPump, STATE.Pump);
Transition(STATE.Pump, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.Pump, MSG.Abort, FsmAbortTask, STATE.Idle);
//Vent
Transition(STATE.Idle, MSG.Vent, FsmStartVent, STATE.Vent);
Transition(STATE.Vent, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.Vent, MSG.Abort, FsmAbortTask, STATE.Idle);
//Purge
Transition(STATE.Idle, MSG.Purge, FsmStartPurge, STATE.Purge);
Transition(STATE.Purge, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.Purge, MSG.Abort, FsmAbortTask, STATE.Idle);
//Leak Check
Transition(STATE.Idle, MSG.LeakCheck, FsmStartLeakCheck, STATE.LeakCheck);
Transition(STATE.LeakCheck, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.LeakCheck, MSG.Abort, FsmAbortTask, STATE.Idle);
//Separate
Transition(STATE.Idle, MSG.Separate, FsmStartSeparate, STATE.Separating);
Transition(STATE.Separating, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.Separating, MSG.Abort, FsmAbortTask, STATE.Idle);
//Group
Transition(STATE.Idle, MSG.Group, FsmStartGroup, STATE.Grouping);
Transition(STATE.Grouping, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.Grouping, MSG.Abort, FsmAbortTask, STATE.Idle);
//LoadRotationHome
Transition(STATE.Idle, MSG.RelativeHomeOffset, FsmStartRelativeHomeOffset, STATE.RotationHomeOffset);
Transition(STATE.RotationHomeOffset, FSM_MSG.TIMER, FsmMonitorTask, STATE.Idle);
Transition(STATE.RotationHomeOffset, MSG.Abort, FsmAbortTask, STATE.Idle);
}
private void InitOp()
{
OP.Subscribe($"{Name}.Home", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Home);
});
OP.Subscribe($"{Name}.Pump", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Pump);
});
OP.Subscribe($"{Name}.Vent", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Vent);
});
OP.Subscribe($"{Name}.Purge", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Purge);
});
OP.Subscribe($"{Name}.LeakCheck", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.LeakCheck, args);
});
OP.Subscribe($"{Name}.MoveLift", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.MoveLift, args[0]);
});
OP.Subscribe($"{Name}.OpenDoor", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.OpenDoor);
});
OP.Subscribe($"{Name}.CloseDoor", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.CloseDoor);
});
OP.Subscribe($"{Name}.Reset", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Reset);
});
OP.Subscribe($"{Name}.Group", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Group);
});
OP.Subscribe($"{Name}.Separate", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Separate);
});
OP.Subscribe($"{Name}.RotationRelativeHomeOffset", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.RelativeHomeOffset);
});
OP.Subscribe($"{Name}.Abort", (string cmd, object[] args) =>
{
return CheckToPostMessage((int)MSG.Abort);
});
OP.Subscribe($"{Module}.SetOnline", (string cmd, object[] args) => PutOnline());
OP.Subscribe($"{Module}.SetOffline", (string cmd, object[] args) => PutOffline());
}
private void InitData()
{
DATA.Subscribe($"{Name}.Status", () => StringFsmStatus);
DATA.Subscribe($"{Name}.IsOnline", () => IsOnline);
DATA.Subscribe($"{Name}.IsBusy", () => IsBusy);
DATA.Subscribe($"{Name}.CurrentRoutineLoop", () => CurrentRoutineLoop);
DATA.Subscribe($"{Name}.CurrentRoutineLoopTotal", () => CurrentRoutineLoopTotal);
DATA.Subscribe($"{Module}.IsAlarm", () => IsAlarm);
/*DATA.Subscribe($"{Name}.LeakCheckElapseTime", () =>
{
if (FsmState == (int)STATE.LeakCheck)
return _leakCheckRoutine.ElapsedTime;
return 0;
});*/
/*DATA.Subscribe($"{Name}.AtATM", () =>
{
if (_llDevice.CheckAtm())
{
return true;
}
return false;
});*/
DATA.Subscribe($"{Name}.UnderVAC", () =>
{
if (_llDevice.CheckVacuum())
{
return true;
}
return false;
});
DATA.Subscribe($"{Name}.LidState", () =>
{
if (_llDevice.CheckLidClose())
{
return "Closed";
}
return "Open";
});
}
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)
{
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(_homeRoutine);
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 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 FsmStartPrepareTransfer(object[] param)
{
QueueRoutine.Clear();
ModuleName mod = (ModuleName)param[0];
if (mod == ModuleName.TrayRobot || mod == ModuleName.WaferRobot)
{
//if ((EnumTransferType)param[2] == EnumTransferType.Place)
{
QueueRoutine.Enqueue(_prepareTransferRoutine);
}
}
if (mod == ModuleName.TMRobot)
{
double tragetPressure = SC.GetConfigItem("TM.PressureBalance.BalancePressure").DoubleValue;
if (tragetPressure > 20) //20mbar以上需要充到一定气压
{
QueueRoutine.Enqueue(_prepareTransferRoutine);
}
else
{
_pumpRoutine.Init();
QueueRoutine.Enqueue(_pumpRoutine);
}
}
else
{
QueueRoutine.Enqueue(_ventRoutine);
}
Result ret = StartRoutine();
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmMonitorTask(object[] param)
{
Result ret = MonitorRoutine();
if (ret == Result.FAIL)
{
PostMsg(MSG.Error);
return false;
}
return ret == Result.DONE;
}
private bool FsmStartSetOffline(object[] param)
{
IsOnline = false;
return true;
}
private bool FsmStartSetOnline(object[] param)
{
IsOnline = true;
return true;
}
private bool FsmStartPump(object[] param)
{
Result ret = StartRoutine(_pumpRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartVent(object[] param)
{
Result ret = StartRoutine(_ventRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartPurge(object[] param)
{
Result ret = StartRoutine(_purgeRoutine, param);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartLeakCheck(object[] param)
{
if (param != null && param.Length >= 2)
{
_leakCheckRoutine.Init((int)param[0], (int)param[1]);
}
else
{
_leakCheckRoutine.Init();
}
Result ret = StartRoutine(_leakCheckRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
//private bool FsmStartSeparate(object[] param)
//{
// Result ret = StartRoutine(_loadLockSeparateRoutine);
// if (ret == Result.FAIL || ret == Result.DONE)
// return false;
// return ret == Result.RUN;
//}
private bool FsmStartRelativeHomeOffset(object[] param)
{
Result ret = StartRoutine(_loadRotationHomeOffsetRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartGroup(object[] param)
{
Result ret = StartRoutine(_loadLockGroupRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
private bool FsmStartSeparate(object[] param)
{
Result ret = StartRoutine(_loadSeparateRoutine);
if (ret == Result.FAIL || ret == Result.DONE)
return false;
return ret == Result.RUN;
}
public override bool Home(out string reason)
{
CheckToPostMessage((int)MSG.Home);
reason = string.Empty;
return true;
}
public override int InvokeCooling(int time)
{
if (CheckToPostMessage((int)MSG.Cooling, time))
return (int)MSG.Cooling;
return (int)FSM_MSG.NONE;
}
public override int InvokeVent()
{
if (CheckToPostMessage((int)MSG.Vent))
return (int)MSG.Vent;
return (int)FSM_MSG.NONE;
}
public override int InvokePump()
{
if (CheckToPostMessage((int)MSG.Pump))
return (int)MSG.Pump;
return (int)FSM_MSG.NONE;
}
public override int InvokePurge(params object[] objs)
{
if (CheckToPostMessage((int)MSG.Purge,objs))
return (int)MSG.Purge;
return (int)FSM_MSG.NONE;
}
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;
if (CheckToPostMessage((int)MSG.PrepareTransfer, robot, targetSlot, transferType))
return true;
return false;
}
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 (_llDevice.CheckVacuum() && !SC.GetValue<bool>("System.IsATMMode"))
|| (_llDevice.CheckAtm() && SC.GetValue<bool>("System.IsATMMode"));
}
public override bool CheckReadyForMap(ModuleName robot, Hand blade, out string reason)
{
reason = string.Empty;
return true;
}
public override bool CheckSlitValveClosed()
{
return _llDevice.CheckSlitValveClosed();
}
public override bool CheckTrayPlaced()
{
return _llDevice.CheckTrayPlaced();
}
public override bool CheckLiftUp()
{
return _llDevice.CheckLiftUp();
}
public override bool CheckLiftDown()
{
return _llDevice.CheckLiftDown();
}
public override bool CheckTrayClamped()
{
throw new NotImplementedException();
}
public override bool CheckTrayUnClamped()
{
throw new NotImplementedException();
}
public override bool CheckWaferClamped()
{
return _llDevice.CheckWaferClamped();
}
public override bool CheckWaferUnClamped()
{
throw new NotImplementedException();
}
public override bool CheckWaferPlaced()
{
throw new NotImplementedException();
}
private bool PutOnline()
{
IsOnline = true;
return true;
}
private bool PutOffline()
{
IsOnline = false;
return true;
}
public void InvokeOffline()
{
PutOffline();
}
public void InvokeOnline()
{
PutOnline();
}
private CancellationTokenSource NotifyModuleOfflineCancellation = new CancellationTokenSource();
private Task NotifyModuleOfflineTask(int delayTime)
{
var t1 = Task.Run(async () =>
{
await Task.Delay(delayTime, NotifyModuleOfflineCancellation.Token).ContinueWith(x => EV.PostWarningLog(Module, $"{Module} is still in offline"), NotifyModuleOfflineCancellation.Token);
});
return t1;
}
public override int InvokeGroupWaferTray()
{
if (CheckToPostMessage((int)MSG.Group))
return (int)MSG.Group;
return (int)FSM_MSG.NONE;
}
public override int InvokeSeparateWaferTray()
{
if (CheckToPostMessage((int)MSG.Separate))
return (int)MSG.Separate;
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,64 @@
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.LLs
{
public abstract class LoadLockModuleBase : ModuleFsmDevice, ITransferTarget, IModuleDevice
{
private int _slot = 1;
public LoadLockModuleBase(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 CheckSlitValveClosed();
public abstract bool CheckLiftUp();
public abstract bool CheckLiftDown();
public abstract bool CheckTrayClamped();
public abstract bool CheckTrayUnClamped();
public abstract bool CheckWaferClamped();
public abstract bool CheckWaferUnClamped();
public abstract bool CheckWaferPlaced();
public abstract bool CheckTrayPlaced();
public abstract int InvokeCooling(int time);
public abstract int InvokeVent();
public abstract int InvokePump();
public abstract int InvokePurge(params object[] objs);
public abstract int InvokeGroupWaferTray();
public abstract int InvokeSeparateWaferTray();
public abstract bool CheckAcked(int entityTaskToken);
}
}
@@ -0,0 +1,146 @@
using System;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.LLs.Routines
{
public class LoadHomeRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
CloseV79,
CloseV83,
CloseV84
}
private int _homeTimeout;
public LoadHomeRoutine(ModuleName module)
{
Module = module.ToString();
Name = "Home";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout = SC.GetValue<int>("LoadLock.HomeTimeout");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CloseLoadVent((int)RoutineStep.CloseV79);
CloseFastPump((int)RoutineStep.CloseV83);
CloseSlowPump((int)RoutineStep.CloseV84);
LoadLockDevice.AutoCreatWafer();
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public void CloseLoadVent(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close Load vent valve");
if (!LoadLockDevice.SetFastVentValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseFastPump(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close Load fast pump valve");
if (!LoadLockDevice.SetFastPumpValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseSlowPump(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close slow pump valve");
if (!LoadLockDevice.SetSlowPumpValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public override void Abort()
{
base.Abort();
}
}
}
@@ -0,0 +1,859 @@
using System;
using System.Collections.Generic;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.MachineVision.Keyence;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
using SicModules.Devices;
using SicModules.TMs;
namespace SicModules.LLs.Routines
{
public class LoadLockBaseRoutine : ModuleRoutine, IRoutine
{
protected LoadLock LoadLockDevice
{
get { return _ll; }
}
protected TM TMDevice
{
get { return _tm; }
}
protected IoLift4 Lift
{
get { return _llLift; }
}
protected IoLoadRotation Rotation
{
get { return _llRotation; }
}
protected IoClaw WaferClaw
{
get { return _llWaferClaw; }
}
protected IoClaw TrayClaw
{
get { return _llTrayClaw; }
}
private LoadLock _ll = null;
private TM _tm = null;
private IoLift4 _llLift = null;
private IoLoadRotation _llRotation = null;
private IoClaw _llWaferClaw = null;
private IoClaw _llTrayClaw = null;
private KeyenceCVX300F _loadCCD = null;
public IoSensor _loadTrayHomeSensor; //Tray��λ
public IoSensor _loadWaferPlaced; //�����䣬���Wafer����
public IoSensor _loadTrayPlaced; //�����������
public LoadLockBaseRoutine() : base(ModuleName.LoadLock.ToString())
{
Module = ModuleName.LoadLock.ToString();
_ll = DEVICE.GetDevice<SicLoadLock>($"{Module}.{Module}");
_tm = DEVICE.GetDevice<SicTM>($"{ModuleName.System}.{ModuleName.TM}");
_llLift = DEVICE.GetDevice<IoLift4>($"{Module}.LLLift");
_llWaferClaw = DEVICE.GetDevice<IoClaw>($"{Module}.LLWaferClaw");
_llTrayClaw = DEVICE.GetDevice<IoClaw>($"{Module}.LLTrayClaw");
_llRotation = DEVICE.GetDevice<IoLoadRotation>("Load.Rotation");
_loadCCD = DEVICE.GetDevice<KeyenceCVX300F>($"TM.KeyenceCVX300F");
_loadTrayHomeSensor = DEVICE.GetDevice<IoSensor>($"TM.LoadTrayHomeSensor");
_loadWaferPlaced = DEVICE.GetDevice<IoSensor>($"TM.LLWaferPlaced");
_loadTrayPlaced = DEVICE.GetDevice<IoSensor>($"TM.LLTrayPresence");
}
public virtual Result Start(params object[] objs)
{
return Result.DONE;
}
public virtual Result Monitor()
{
return Result.DONE;
}
public virtual void Abort()
{
LoadLockDevice.SetSlowPumpValve(false, out _);
LoadLockDevice.SetFastPumpValve(false, out _);
LoadLockDevice.SetSlowVentValve(false, out _);
}
protected void LiftMove(int id, bool up, int timeout)
{
string note = up ? "Up" : "Down";
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set {Module} Lift to {note}");
if(up)
{
if (!Lift.MoveUp(out string reason))
{
Stop($"Set {Module} Lift to {note} failed:" + reason);
return false;
}
}
else
{
if (!Lift.MoveDown(out string reason))
{
Stop($"Set {Module} Lift to {note} failed:" + reason);
return false;
}
}
return true;
}, () =>
{
if(up)
{
return Lift.IsUp && !Lift.IsDown;
}
else
{
return !Lift.IsUp && Lift.IsDown;
}
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Set {Module} Lift to {note} Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void MoveRelativeHome(int id, int timeout)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Set {Module} Rotation move relative home");
if (!_llRotation.MoveRelativeHome(out string reason))
{
Stop($"Set {Module} Rotation move relative home:" + reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void MoveLoadRotationHomeOffset(int id, float offset, int timeout)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Set {Module} Rotation move offset");
if (!_llRotation.JogCW(offset, out string reason))
{
Stop($"Set {Module} Rotation move offset:" + reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void WaitLoadRotationDone(int id, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
//�����κζ���
return true;
},
() =>
{
//���Rotation���Error
if (_llRotation.IsServoError)
{
Stop($"Set {Module} Rotation Servo Error");
return null;
}
return !_llRotation.IsServoBusy;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Wait Load Rotation Done timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void MoveOneCircle(int id,int timeout)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Set {Module} Rotation One Circle Wafter check sensor");
if (!_llRotation.MoveOneCircle(out string reason))
{
Stop($"Set {Module} Rotation One Circle Wafter check sensor:" + reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
//Result WaitMoveOneCircleDoneResult;
//protected Result WaitMoveOneCircleDone(int id, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Wait {Module} Rotation One Circle Wafter check sensor");
// WaitMoveOneCircleDoneResult = Result.RUN;
// return true;
// }, () =>
// {
// //��⵽δ�ź�Sensor�ź�
// if (!_loadWaferPlaced.Value)
// {
// //ʧ�ܺ�Stop���
// _llRotation.Stop(out _);
// Stop($"Set {Module} Rotation One Circle Wafter check sensor fail [TM DI-35]");
// WaitMoveOneCircleDoneResult = Result.VERIFYFAIL;
// return true;
// }
// //���Rotation���Error
// if (_llRotation.IsServoError)
// {
// //ʧ�ܺ�Stop���
// _llRotation.Stop(out _);
// Stop($"Set {Module} Rotation Servo Error");
// WaitMoveOneCircleDoneResult = Result.VERIFYFAIL;
// return true;
// }
// if (!_llRotation.IsServoBusy)
// {
// Notify($"{Module} Rotation One Circle Wafter check result ok");
// WaitMoveOneCircleDoneResult = Result.Succeed;
// 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($"Set {Module}Rotation One Circle Wafter check sensor Timeout, over {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
// return WaitMoveOneCircleDoneResult;
//}
Result WaitMoveOneCircleDoneResult;
public Queue<bool> DISensroQueuen = new Queue<bool>();
protected Result WaitMoveOneCircleDone(int id, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Wait {Module} Rotation One Circle Wafter check sensor");
WaitMoveOneCircleDoneResult = Result.RUN;
DISensroQueuen = new Queue<bool>();
return true;
}, () =>
{
DISensroQueuen.Enqueue(_loadWaferPlaced.Value);
//��⵽δ�ź�Sensor�ź�
//if (!_loadWaferPlaced.Value)
//{
// //ʧ�ܺ�Stop���
// _llRotation.Stop(out _);
// Stop($"Set {Module} Rotation One Circle Wafter check sensor fail [TM DI-35]");
// WaitMoveOneCircleDoneResult = Result.VERIFYFAIL;
// return true;
//}
//���Rotation���Error
if (_llRotation.IsServoError)
{
//ʧ�ܺ�Stop���
_llRotation.Stop(out _);
Stop($"Set {Module} Rotation Servo Error");
return null;
}
if (!_llRotation.IsServoBusy)
{
//Notify($"{Module} Rotation One Circle Wafter check finish");
WaitMoveOneCircleDoneResult = Result.Succeed;
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($"Set {Module}Rotation One Circle Wafter check sensor Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
return WaitMoveOneCircleDoneResult;
}
protected void MoveHomePos(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"{Module} Rotation move Home Pos");
if (!_llRotation.MoveRelativeHome(out string reason))
{
Stop($"{Module} Rotation move Home Pos fail:" + reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void MoveCCD1Pos(int id,int timeout)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"{Module} Rotation move CCD Pos1");
if (!_llRotation.MoveCCD1Pos(out string reason))
{
Stop($"{Module} Rotation move CCD Pos1 fail:" + reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void MoveCCD2Pos(int id, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"{Module} Rotation move CCD Pos2");
if (!_llRotation.MoveCCD2Pos(out string reason))
{
Stop($"{Module} Rotation move CCD Pos2 fail:" + reason);
return false;
}
return true;
}, () =>
{
if (!_llRotation.IsServoBusy)
{
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($"Set {Module} Rotation move CCD Pos2 Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void ClawMove(int id, IoClaw _claw,bool claw, int timeout)
{
string note = claw ? "Clawing" : "Opening";
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set {Module} {note}");
if (!_claw.SetValue(claw, out string reason))
{
Stop($"Set {Module} {note} failed:" + reason);
return false;
}
return true;
}, () =>
{
return _claw.State == (claw ? ClawStateEnum.Clamp : ClawStateEnum.Open);
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Set {Module} {note} Timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
//public void CheckForelinePressure(int id,double basePressure, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Check {Module} foreline pressure under {basePressure} mbar");
// return true;
// }, () =>
// {
// return LoadLockDevice.ForelinePressure <= basePressure;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT) //timeout
// {
// Stop($"{Module} foreline pressure can not lower than {basePressure} in {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
public void SlowPump(int id, double switchPressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {Module} slow pump valve to {switchPressure} mbar");
if (!LoadLockDevice.SetSlowPumpValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return LoadLockDevice.ChamberPressure <= switchPressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
LoadLockDevice.SetSlowPumpValve(false, out string _);
Stop($"{Module} pressure can not pump to {switchPressure} in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void FastPump(int id, double basePressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {Module} fast pump valve to {basePressure} mbar");
if (!LoadLockDevice.SetFastPumpValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return LoadLockDevice.ChamberPressure <= basePressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
LoadLockDevice.SetSlowPumpValve(false, out string _);
LoadLockDevice.SetFastPumpValve(false, out string _);
Stop($"{Module} pressure can not pump to {basePressure} in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseSlowPumpValve(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close {Module} slow pump valve");
if (!LoadLockDevice.SetSlowPumpValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseFastPumpValve(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close {Module} fast pump valve");
if (!LoadLockDevice.SetFastPumpValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void SlowVent(int id,double switchPressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {Module} slow vent valve to {switchPressure} mbar");
if (!LoadLockDevice.SetSlowVentValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return LoadLockDevice.ChamberPressure >= switchPressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
LoadLockDevice.SetSlowVentValve(false, out string _);
Stop($"{Module} pressure can not vent to {switchPressure} mbar in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void SlowVent(int id,double switchPressure, double pressureDiff, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {Module} slow vent valve to {switchPressure} mbar");
if (!_ll.SetSlowVentValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return LoadLockDevice.ChamberPressure >= switchPressure - pressureDiff;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
_ll.SetSlowVentValve(false, out string _);
Stop($"{Module} pressure can not vent to {switchPressure} mbar in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseVentValveAndWait(int id, int timeout = 3)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Close {Module} slow vent valve");
if (!LoadLockDevice.SetSlowVentValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return LoadLockDevice.CheckSlowVentValve(false);
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Close {Module} slow vent valve in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseVentValve(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close {Module} slow vent valve");
if (!LoadLockDevice.SetSlowVentValve(false, out string reason))
{
Stop(reason);
return false;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CCDModeSet(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Set CCD Mode to 0");
_loadCCD.RunR0();
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
Result CCDTriggerResult;
public Result CCDTrigger(int id,int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Load CCD Check Trigger");
_loadCCD.ClearResult();
_loadCCD.GetResult(1);
CCDTriggerResult = Result.RUN;
return true;
}, () =>
{
if(_loadCCD._sResult != "")
{
if(_loadCCD._sResult.Contains("OK"))
{
//Notify($"Load CCD Check Result OK");
CCDTriggerResult = Result.Succeed;
return true;
}
else
{
//Stop($"Load CCD Check Result NG");
CCDTriggerResult = Result.VERIFYFAIL;
return true;
}
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
return Result.VERIFYFAIL;
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"Load CCD receive result in {timeout} seconds");
return Result.VERIFYFAIL;
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
return CCDTriggerResult;
}
}
}
@@ -0,0 +1,84 @@
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.LLs.Routines
{
public class LoadLockClawRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
LiftMove,
ClawMove,
}
private bool _llCalw;
private bool _isWaferClaw;
private int _clawMoveTimeOut = 30;
public LoadLockClawRoutine()
{
Name = "Claw";
}
public void Init(bool isWaferClaw,bool clawed)
{
_llCalw = clawed;
_isWaferClaw = isWaferClaw;
}
public override Result Start(params object[] objs)
{
Reset();
if (_isWaferClaw)
{
if ((_llCalw && WaferClaw.State == ClawStateEnum.Clamp) || (!_llCalw && WaferClaw.State == ClawStateEnum.Open))
{
return Result.DONE;
}
}
else
{
if ((_llCalw && TrayClaw.State == ClawStateEnum.Clamp) || (!_llCalw && TrayClaw.State == ClawStateEnum.Open))
{
return Result.DONE;
}
}
_clawMoveTimeOut = SC.GetValue<int>("LoadLock.ClawMoveTimeOut");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
ClawMove((int)RoutineStep.ClawMove, (_isWaferClaw ? WaferClaw : TrayClaw), _llCalw, _clawMoveTimeOut);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
}
}
@@ -0,0 +1,163 @@
using System.Linq;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.LLs.Routines
{
public class LoadLockGroupRoutine : LoadLockBaseRoutine
{
/*
* 8、顶升上升
9、夹爪打开
10、下降wafer
11、托盘旋转一周,进行距离判断
12、旋转到指定角度,视觉判断
13、抽真空
* 旋转一周,检测到未放好,报错,人为干预
* 拍照确认指令(Ok,NG)NG则报错,人为干预
*/
enum RoutineStep
{
CCDModeSet,
LiftUp,
ClawOpen,
LiftDown,
MoveOneCircle,//旋转一周检查上测距Sensor是否感应到
TimeDelay1,
WaitMoveOneCircleDone,
MoveCCD1Pos,//运动到CCDPos1
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
WaitMoveDone,
TrigCCD1Pos,//CCDPos1拍照
MoveCCD2Pos,//运动到CCDPos2
TrigCCD2Pos,//CCDPos2拍照
LoadRotationRelativeHome,
}
private float _ccdPos1;
private float _ccdPos2;
private int _loadRatationMoveTimeout = 30;
private int _liftMoveTimeOut = 30;
private int _clawMoveTimeOut = 30;
private bool _isSimulator = false;
private bool _enableCCDCheck = false;
private bool _enableDistanceSensorCheck = false;
private LoadRotationHomeOffsetRoutine _loadRotationHomeRoutine = new LoadRotationHomeOffsetRoutine();
public LoadLockGroupRoutine(ModuleName module)
{
Module = module.ToString();
Name = "TrayGroup";
}
public override Result Start(params object[] objs)
{
Reset();
Notify("Start");
_liftMoveTimeOut = SC.GetValue<int>("LoadLock.LiftMoveTimeOut");
_clawMoveTimeOut = SC.GetValue<int>("LoadLock.ClawMoveTimeOut");
_loadRatationMoveTimeout = SC.GetValue<int>("LoadLock.LoadRotation.RotationTimeOut");
_ccdPos1 = (float)SC.GetValue<double>("LoadLock.LoadRotation.CCD1Pos");
_ccdPos2 = (float)SC.GetValue<double>("LoadLock.LoadRotation.CCD2Pos");
_isSimulator = SC.GetValue<bool>($"System.IsSimulatorMode");
_enableCCDCheck = SC.GetValue<bool>($"LoadLock.EnableCCDCheck");
_enableDistanceSensorCheck = SC.GetValue<bool>($"LoadLock.EnableDistanceSensorCheck");
return Result.RUN;
}
Result MoveOneCircleResult;
Result CCDCheckResult;
public override Result Monitor()
{
try
{
//第一步Tray找原点
ExecuteRoutine((int)RoutineStep.LoadRotationRelativeHome, _loadRotationHomeRoutine);
TimeDelay((int)RoutineStep.TimeDelay1, 3);
LiftMove((int)RoutineStep.LiftUp, true, _liftMoveTimeOut);
ClawMove((int)RoutineStep.ClawOpen, WaferClaw, false, _clawMoveTimeOut);
LiftMove((int)RoutineStep.LiftDown, false, _liftMoveTimeOut);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
if (!_isSimulator)
{
if (_enableDistanceSensorCheck)
{
MoveOneCircle((int)RoutineStep.MoveOneCircle, _loadRatationMoveTimeout); //旋转1周检查上方测距Sensor
TimeDelay((int)RoutineStep.TimeDelay3, 3);
MoveOneCircleResult = WaitMoveOneCircleDone((int)RoutineStep.WaitMoveOneCircleDone, _loadRatationMoveTimeout);
}
TimeDelay((int)RoutineStep.TimeDelay4, 3);
if (_enableCCDCheck)
{
CCDModeSet((int)RoutineStep.CCDModeSet);
MoveCCD1Pos((int)RoutineStep.MoveCCD1Pos, _loadRatationMoveTimeout); //移动到CCD位置1
TimeDelay((int)RoutineStep.TimeDelay5, 3);
WaitLoadRotationDone((int)RoutineStep.WaitMoveDone, _loadRatationMoveTimeout);
CCDCheckResult = CCDTrigger((int)RoutineStep.TrigCCD1Pos, 10); //拍照
}
double _distanceSensorOKRatio = SC.GetValue<double>("LoadLock.LoadRotation.DistanceSensorOKRatio");
int _calRatio = (int)(DISensroQueuen.Count(x => x) * 1.0 / DISensroQueuen.Count * 100);
if (_enableDistanceSensorCheck && _calRatio < _distanceSensorOKRatio)
{
Stop($"{Module} Rotation One Circle Wafter check sensor fail [TM DI-35],the OK Ratio is {_calRatio}%");
}
else
{
Notify($"{Module} Rotation One Circle Wafter check sensor Succeed [TM DI-35],the OK Ratio is {_calRatio}%");
}
if (_enableCCDCheck && CCDCheckResult == Result.VERIFYFAIL)
{
Stop($"Load CCD Check Result NG");
}
else
{
Notify($"Load CCD Check Result OK");
}
if ((_enableDistanceSensorCheck && _calRatio < _distanceSensorOKRatio) ||
(_enableCCDCheck && CCDCheckResult == Result.VERIFYFAIL))
{
return Result.FAIL;
}
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
}
}
@@ -0,0 +1,320 @@
using System;
using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.DBCore;
using MECF.Framework.Common.Equipment;
using SicModules.Devices;
namespace SicModules.LLs.Routines
{
public class LoadLockLeakCheckRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
CheckDoor,
RunPumpRoutine,
ContinuePump,
ClosePumpValve,
DoLeakCheck,
DoLeakCheckDelay,
CalcLeakCheck,
StartLoop,
LoopVent,
LoopPump,
StopLoop,
SlowPumpP, FastPumpP, PumpDelayP, CloseFastValveP, CloseSlowValveP, SlowVentV, CloseFastVentValveV, VentDelayV,
TimeDelay1,
TimeDelay2
}
private LoadLockPumpRoutine _pumpRoutine;
private LoadLockVentRoutine _ventRoutine;
private int _paramContinuePumpTime;
private int _paramLeakCheckTime;
private double _beginPressure;
private double _pumpBasePressure;
private double _pumpSwitchPressure;
private int _pumpTimeout;
private int _ventTimeout;
private int _routineTimeOut;
private double _leakSpec;
private int _purgeCount;
private double _beginTime;
private int _calTimes; //第几次计算LeakCheck的值(每60秒计算一次)
private double _ventBasePressure;
private int _pumpDelayTime;
private int _ventDelayTime;
private IoInterLockEx _tmIoInterLock;
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
public LoadLockLeakCheckRoutine(ModuleName module)
{
Module = module.ToString();
Name = "LeakCheck";
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
_pumpRoutine = new LoadLockPumpRoutine(module);
_ventRoutine = new LoadLockVentRoutine(module);
}
internal void Init(int pumpTime, int leakCheckTime)
{
_paramContinuePumpTime = pumpTime;
_paramLeakCheckTime = leakCheckTime;
}
internal void Init()
{
_paramContinuePumpTime = SC.GetValue<int>("LoadLock.LeakCheck.PumpDelayTime");
_paramLeakCheckTime = SC.GetValue<int>("LoadLock.LeakCheck.LeakCheckDelayTime");
}
public override Result Start(params object[] objs)
{
Reset();
_swTimer.Restart();
_pumpRoutine.Init();
_ventRoutine.Init();
string reason;
if (!LoadLockDevice.SetFastVentValve(false, out reason) || !LoadLockDevice.SetSlowVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
bool isAtmMode = SC.GetValue<bool>("System.IsATMMode");
_pumpSwitchPressure = SC.GetValue<double>("LoadLock.Pump.SlowFastPumpSwitchPressure");
_pumpBasePressure = SC.GetValue<double>("LoadLock.LeakCheck.PumpBasePressure");
_ventBasePressure = SC.GetValue<double>("LoadLock.LeakCheck.VentBasePressure");
_routineTimeOut = SC.GetValue<int>("LoadLock.LeakCheck.RoutineTimeOut");
_leakSpec = SC.GetValue<double>("LoadLock.LeakCheck.LeakSpec");
_purgeCount= SC.GetValue<int>("LoadLock.LeakCheck.CyclePurgeCount");
_pumpTimeout = SC.GetValue<int>("LoadLock.Pump.RoutineTimeOut");
_ventTimeout = SC.GetValue<int>("LoadLock.Vent.RoutineTimeOut");
_pumpDelayTime = SC.GetValue<int>("LoadLock.Pump.PumpDelayTime");
_ventDelayTime = SC.GetValue<int>("LoadLock.Vent.VentDelayTime");
if (isAtmMode)
{
EV.PostInfoLog(Module, $"system in atm mode, {Module} pump skipped");
return Result.DONE;
}
if (!LoadLockDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not leakCheck, lid is open");
return Result.FAIL;
}
if (!TMDevice.SetFastPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"can not leakCheck, TM fast pump value can not close");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleName.LoadLock))
{
EV.PostAlarmLog(Module, $"Can not leakCheck, slit valve is open");
return Result.FAIL;
}
if (!_tmIoInterLock.SetLLLeakCheckRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not LeakCheck,{reason}");
return Result.FAIL;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
Loop((int)RoutineStep.StartLoop, _purgeCount);
SlowPump((int)RoutineStep.SlowPumpP, _pumpSwitchPressure, _pumpTimeout);
FastPump((int)RoutineStep.FastPumpP, _pumpBasePressure, _pumpTimeout);
TimeDelay((int)RoutineStep.PumpDelayP, _pumpDelayTime);
CloseFastPumpValve((int)RoutineStep.CloseFastValveP);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValveP);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
SlowVent((int)RoutineStep.SlowVentV, _ventBasePressure, _ventTimeout);
TimeDelay((int)RoutineStep.VentDelayV, _ventDelayTime);
CloseVentValveAndWait((int)RoutineStep.CloseFastVentValveV);
TimeDelay((int)RoutineStep.TimeDelay2, 1);
EndLoop((int)RoutineStep.StopLoop);
SlowPump((int)RoutineStep.SlowPump, _pumpSwitchPressure, _pumpTimeout);
FastPump((int)RoutineStep.FastPump, _pumpBasePressure, _pumpTimeout);
TimeDelay((int)RoutineStep.PumpDelay, _paramContinuePumpTime);
CloseFastPumpValve((int)RoutineStep.CloseFastValve);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
DoLeakCheck((int)RoutineStep.DoLeakCheck, _paramLeakCheckTime);
//CalcLeackCheckPerMinute(_paramLeakCheckTime);
TimeDelay((int)RoutineStep.DoLeakCheckDelay, _paramLeakCheckTime);
CalcLeakCheck((int)RoutineStep.CalcLeakCheck, _paramLeakCheckTime);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoLLLeakCheckRoutineRunning = false;
_swTimer.Stop();
return Result.DONE;
}
public override void Abort()
{
Notify($"{Module} leak check aborted");
_tmIoInterLock.DoLLLeakCheckRoutineRunning = false;
_swTimer.Stop();
LeakCheckDataRecorder.Add((int)_swTimer.ElapsedMilliseconds / 1000, _beginPressure, TMDevice.ChamberPressure, 0, Result.FAIL.ToString(), "", Module);
base.Abort();
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
public void DoLeakCheck(int id, double time)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Keep pressure for {time} seconds");
_beginTime = _swTimer.ElapsedMilliseconds;
_beginPressure = LoadLockDevice.ChamberPressure;
_calTimes = 1;
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CalcLeackCheckPerMinute(int time)
{
//大于LeakCheck时间,
if ((int)((_swTimer.ElapsedMilliseconds - _beginTime) / 1000) >= time)
{
int leakSecond = (int)((_swTimer.ElapsedMilliseconds - _beginTime) / 1000);
double endPressure = LoadLockDevice.ChamberPressure;
double leakSpan = endPressure - _beginPressure;
double leakRate = (endPressure - _beginPressure) / (leakSecond / 60.0);
if (leakRate > _leakSpec)
{
LeakCheckDataRecorder.Add(time, (int)_beginPressure, (int)endPressure, leakRate, Result.FAIL.ToString(), Module, Module);
EV.PostInfoLog(Module, $"Leak check result: end at {DateTime.Now.ToString("HH:mm:ss")}, start: {_beginPressure:F2}mbar, end: {endPressure:F2}mbar, using {time} seconds, leak rate: {leakRate:F2}");
}
else
{
LeakCheckDataRecorder.Add(time, (int)_beginPressure, (int)endPressure, leakRate, Result.Succeed.ToString(), Module, Module);
EV.PostInfoLog(Module, $"Leak check result: end at {DateTime.Now.ToString("HH:mm:ss")}, start: {_beginPressure:F2}mbar, end: {endPressure:F2}mbar, using {time} seconds, leak rate: {leakRate:F2}");
}
}
else
{
if ((int)((_swTimer.ElapsedMilliseconds - _beginTime) / 1000) >= 60 * _calTimes)
{
_calTimes++;
int leakSecond = (int)((_swTimer.ElapsedMilliseconds - _beginTime) / 1000);
double endPressure = LoadLockDevice.ChamberPressure;
double leakSpan = endPressure - _beginPressure;
double leakRate = (endPressure - _beginPressure) / (leakSecond / 60.0);
if (leakRate > _leakSpec)
{
EV.PostInfoLog(Module, $"Leak check Failed Count {_calTimes - 1}: using {leakSecond} seconds, leak rate: {leakRate:F2} ,Rate over {_leakSpec}");
throw (new RoutineFaildException());
}
EV.PostInfoLog(Module, $"Leak check Count {_calTimes - 1}: using {leakSecond} seconds, leak rate: {leakRate:F2}");
}
throw (new RoutineBreakException());
}
}
public void CalcLeakCheck(int id, int time)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
double endPressure = LoadLockDevice.ChamberPressure ; //
double leakSpan = endPressure - _beginPressure;
double leakRate = (endPressure - _beginPressure) / (time / 60.0);
if (leakRate > _leakSpec)
{
LeakCheckDataRecorder.Add(time, _beginPressure, endPressure, leakRate, Result.FAIL.ToString(), "", Module);
EV.PostInfoLog(Module,$"{Module} leakcheck result: end at {DateTime.Now.ToString("HH:mm:ss")}, start: {_beginPressure:F2} mbar, end: {endPressure:F2} mbar, using {time} seconds, leak rate: {leakRate:F2}");
return false;
}
else
{
LeakCheckDataRecorder.Add(time, _beginPressure, endPressure, leakRate, Result.Succeed.ToString(), "", Module);
EV.PostInfoLog(Module,$"{Module} leakcheck result: end at {DateTime.Now.ToString("HH:mm:ss")}, start: {_beginPressure:F2} mbar, end: {endPressure:F2} mbar, using {time} seconds, leak rate: {leakRate:F2}");
return true;
}
});
}
}
}
@@ -0,0 +1,64 @@
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.LLs.Routines
{
public class LoadLockLiftRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
LiftMove
}
private bool _pinUp;
private int _liftMoveTimeOut = 30;
public LoadLockLiftRoutine()
{
Name = "Lift Move";
}
public void Init(bool isUp)
{
_pinUp = isUp;
}
public override Result Start(params object[] objs)
{
Reset();
_liftMoveTimeOut = SC.GetValue<int>("LoadLock.LiftMoveTimeOut");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
LiftMove((int)RoutineStep.LiftMove, _pinUp, _liftMoveTimeOut);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
}
}
@@ -0,0 +1,152 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.LLs.Routines
{
public class LoadLockPrepareTransferRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
CheckForelinePressure,
RequestPump,
RequestPumpDelay,
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
Delay,
SlowVent,
CloseSlowVentValve,
TimeDelay1,
TimeDelay2,
TimeDelay3,
StartLoop,
EndLoop,
}
private double _pumpSwitchPressure = 100;
private int _slowPumpTimeout = 100;
private int _fastPumpTimeout = 100;
private int _slowVentTimeout = 100;
private double _targetPressure;
private double _llVacPressure = 0;
private double _balancePressureDiff = 0;
private double _pumpBasePressure = 0;
private int _pumpDelayTime;
public LoadLockPrepareTransferRoutine(ModuleName module)
{
Module = module.ToString();
Name = "PrepareTransfer";
}
public override Result Start(params object[] objs)
{
Reset();
_targetPressure = SC.GetValue<double>("TM.PressureBalance.BalancePressure");
_llVacPressure = SC.GetValue<double>("LoadLock.VacuumPressureBase");
_balancePressureDiff = SC.GetValue<double>("TM.PressureBalance.BalanceMaxDiffPressure");
_pumpSwitchPressure = SC.GetValue<double>("LoadLock.Pump.SlowFastPumpSwitchPressure");
_pumpBasePressure = SC.GetValue<double>("LoadLock.Purge.PumpBasePressure");
_slowPumpTimeout = SC.GetValue<int>("LoadLock.Pump.SlowPumpTimeout");
_fastPumpTimeout = SC.GetValue<int>("LoadLock.Pump.FastPumpTimeout");
_slowVentTimeout = SC.GetValue<int>("LoadLock.Vent.SlowVentTimeout");
_pumpDelayTime = SC.GetValue<int>("LoadLock.Purge.PumpDelayTime");
//PrepareTrasfer需要把压力调到VacuumBasePressure以下
if (_targetPressure > _llVacPressure)
{
_targetPressure = _llVacPressure;
}
string reason;
if (!LoadLockDevice.SetFastVentValve(false, out reason) || !LoadLockDevice.SetSlowVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (!LoadLockDevice.SetFastPumpValve(false, out reason) || !LoadLockDevice.SetSlowPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
bool isAtmMode = SC.GetValue<bool>("System.IsATMMode");
//决定TargetPressure
if (isAtmMode)
{
_targetPressure = SC.GetValue<double>("LoadLock.Vent.VentBasePressure");
}
if (!LoadLockDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not pump, door is open");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(LoadLockDevice.Module)))
{
EV.PostAlarmLog(Module, $"LoadLock Can not servo to pressure, slit valve is open");
return Result.FAIL;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
TimeDelay((int)RoutineStep.TimeDelay1, 1);
SlowPump((int)RoutineStep.SlowPump, _pumpSwitchPressure, _slowPumpTimeout);
FastPump((int)RoutineStep.FastPump, _pumpBasePressure, _fastPumpTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, _pumpDelayTime);
CloseFastPumpValve((int)RoutineStep.CloseFastValve);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
TimeDelay((int)RoutineStep.TimeDelay3, 1);
SlowVent((int)RoutineStep.SlowVent, _targetPressure - 5 ,_slowVentTimeout);
CloseVentValveAndWait((int)RoutineStep.CloseSlowVentValve);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
LoadLockDevice.SetSlowPumpValve(false, out _);
LoadLockDevice.SetFastPumpValve(false, out _);
}
}
}
@@ -0,0 +1,192 @@
using System.Diagnostics;
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 SicModules.Devices;
namespace SicModules.LLs.Routines
{
public class LoadLockPumpRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
CheckForelinePressure,
RequestPump,
RequestPumpDelay,
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
Delay,
TimeDelay1,
}
private double _pumpBasePressure=0;
private double _forelineBasePressure;
private double _pumpSwitchPressure;
private int _waitForelineTimeout;
private int _slowPumpTimeout;
private int _fastPumpTimeout;
private int _pumpDelayTime = 5;
private int _routineTimeOut;
private IoInterLockEx _tmIoInterLock;
private bool _useSettingValue;
private Stopwatch _swTimer = new Stopwatch();
public LoadLockPumpRoutine(ModuleName module )
{
Module = module.ToString();
Name = "Pump";
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
}
public void Init()
{
_useSettingValue = false;
}
public void Init(double basePressure, int pumpDelayTime)
{
_pumpBasePressure = basePressure;
_pumpDelayTime = pumpDelayTime;
_useSettingValue = true;
}
public override Result Start(params object[] objs)
{
Reset();
string reason;
if (!LoadLockDevice.SetFastVentValve(false, out reason) || !LoadLockDevice.SetSlowVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
bool isAtmMode = SC.GetValue<bool>("System.IsATMMode");
_forelineBasePressure = SC.GetValue<double>("LoadLock.ForelinePressureBase");
_pumpSwitchPressure = SC.GetValue<double>("LoadLock.Pump.SlowFastPumpSwitchPressure");
_waitForelineTimeout = SC.GetValue<int>("LoadLock.WaitForelinePressureTimeout");
_slowPumpTimeout = SC.GetValue<int>("LoadLock.Pump.SlowPumpTimeout");
_fastPumpTimeout = SC.GetValue<int>("LoadLock.Pump.FastPumpTimeout");
_routineTimeOut = SC.GetValue<int>("LoadLock.Pump.RoutineTimeOut");
if (!_useSettingValue)
{
_pumpBasePressure = SC.GetValue<double>("LoadLock.Pump.PumpBasePressure");
_pumpDelayTime = SC.GetValue<int>("LoadLock.Pump.PumpDelayTime");
}
if (!TMDevice.SetFastPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"can not pump, TM fast pump value can not close");
return Result.FAIL;
}
if (isAtmMode)
{
EV.PostInfoLog(Module, $"system in atm mode, {LoadLockDevice.Module} pump skipped");
return Result.DONE;
}
if (SC.ContainsItem("LoadLock.RunPumpRoutineEventBelowBasePressure") && !SC.GetValue<bool>("LoadLock.RunPumpRoutineEventBelowBasePressure"))
{
if (LoadLockDevice.ChamberPressure < _pumpBasePressure)
{
EV.PostInfoLog(Module, $"{LoadLockDevice.Module} already under pump base pressure");
return Result.DONE;
}
}
if (!LoadLockDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not pump, lid is open");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(LoadLockDevice.Module)))
{
EV.PostAlarmLog(Module, $"Can not pump, slit valve is open");
return Result.FAIL;
}
if (!TMDevice.SetTmToLLVent(false, out _))
{
EV.PostAlarmLog(Module, $"can not pump,can not close v85!");
}
if (!_tmIoInterLock.SetLLPumpRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not pump,{reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
TimeDelay((int)RoutineStep.RequestPumpDelay, 1);
SlowPump((int)RoutineStep.SlowPump, _pumpSwitchPressure, _slowPumpTimeout);
FastPump((int)RoutineStep.FastPump, _pumpBasePressure, _fastPumpTimeout);
TimeDelay((int)RoutineStep.PumpDelay, _pumpDelayTime);
CloseFastPumpValve((int)RoutineStep.CloseFastValve);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
LoadLockDevice.SetSlowPumpValve(false, out _);
LoadLockDevice.SetFastPumpValve(false, out _);
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoLLPumpDownRoutineRunning = false;
return Result.DONE;
}
public override void Abort()
{
_tmIoInterLock.DoLLPumpDownRoutineRunning = false;
base.Abort();
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
}
}
@@ -0,0 +1,177 @@
using System.Diagnostics;
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 SicModules.Devices;
namespace SicModules.LLs.Routines
{
public class LoadLockPurgeRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
SlowPump,
FastPump,
PumpDelay,
CloseFastValve,
CloseSlowValve,
SlowVent,
FastVent,
VentDelay,
CloseFastVentValve,
CloseSlowVentValve,
StartLoop,
LoopPump,
LoopVent,
StopLoop,
TimeDelay1,
TimeDelay2
}
private int _purgeCount;
private int _routineTimeOut;
private double _pumpSwitchPressure;
private double _pumpBasePressure;
private int _pumpDelayTime;
private int _pumpTimeOut;
private double _ventBasePressure;
private int _ventDelayTime;
private int _ventTimeOut;
private IoInterLockEx _tmIoInterLock;
private Stopwatch _swTimer = new Stopwatch();
public LoadLockPurgeRoutine(ModuleName module)
{
Module = module.ToString();
Name = "Purge";
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
}
public void Init()
{
}
public override Result Start(params object[] objs)
{
Reset();
if (objs.Length ==2 && int.TryParse(objs[0].ToString(), out int purgeCount)&& int.TryParse(objs[1].ToString(), out int pumpDelayTime))
{
_purgeCount = purgeCount;
_pumpDelayTime = pumpDelayTime;
}
else
{
_purgeCount = SC.GetValue<int>("LoadLock.Purge.CyclePurgeCount");
_pumpDelayTime = SC.GetValue<int>("LoadLock.Purge.PumpDelayTime");
}
_routineTimeOut = SC.GetValue<int>("LoadLock.Purge.RoutineTimeOut");
_pumpSwitchPressure = SC.GetValue<double>("LoadLock.Pump.SlowFastPumpSwitchPressure");
_pumpBasePressure = SC.GetValue<double>("LoadLock.Purge.PumpBasePressure");
_pumpTimeOut = SC.GetValue<int>("LoadLock.Purge.PumpTimeOut");
_ventBasePressure = SC.GetValue<double>("LoadLock.Purge.VentBasePressure");
_ventDelayTime = SC.GetValue<int>("LoadLock.Purge.VentDelayTime");
_ventTimeOut = SC.GetValue<int>("LoadLock.Purge.VentTimeOut");
if (!LoadLockDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"can not purge, lid is open");
return Result.FAIL;
}
if (!TMDevice.SetFastPumpValve(false, out string reason))
{
EV.PostAlarmLog(Module, $"can not purge, TM fast pump value can not close");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(LoadLockDevice.Module)))
{
EV.PostAlarmLog(Module, $"Can not purge, slit valve is open");
return Result.FAIL;
}
if (!TMDevice.SetTmToLLVent(false, out _))
{
EV.PostAlarmLog(Module, $"can not vent,can not close v85!");
}
if (!_tmIoInterLock.SetLLPurgeRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not purge,{reason}");
return Result.FAIL;
}
bool isAtmMode = SC.GetValue<bool>("System.IsATMMode");
if (isAtmMode)
{
return Result.DONE;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
if (_purgeCount > 0)
{
Loop((int)RoutineStep.StartLoop, _purgeCount);
SlowPump((int)RoutineStep.SlowPump, _pumpSwitchPressure, _pumpTimeOut);
FastPump((int)RoutineStep.FastPump, _pumpBasePressure, _pumpTimeOut);
TimeDelay((int)RoutineStep.PumpDelay, _pumpDelayTime);
CloseFastPumpValve((int)RoutineStep.CloseFastValve);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
SlowVent((int)RoutineStep.SlowVent, _ventBasePressure, _ventTimeOut);
CloseVentValveAndWait((int)RoutineStep.CloseSlowVentValve);
TimeDelay((int)RoutineStep.VentDelay, _ventDelayTime);
EndLoop((int)RoutineStep.StopLoop);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoLLCyclePurgeRoutineRunning = false;
return Result.DONE;
}
public override void Abort()
{
_tmIoInterLock.DoLLCyclePurgeRoutineRunning = false;
base.Abort();
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
}
}
@@ -0,0 +1,160 @@
using System;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.LLs.Routines
{
public class LoadLockServoToRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
CheckForelinePressure,
RequestPump,
RequestPumpDelay,
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
Delay,
SlowVent,
CloseSlowVentValve,
TimeDelay1,
TimeDelay2,
}
private double _pumpSwitchPressure;
private int _slowPumpTimeout=100;
private int _fastPumpTimeout=100;
private int _slowVentTimeout = 100;
private bool _useSettingValue;
private double _targetPressure;
private bool _needPump = false;
public LoadLockServoToRoutine(ModuleName module)
{
Module = module.ToString();
Name = "LoadLockServoTo";
}
public void Init(double pressure)
{
_targetPressure = pressure;
_useSettingValue = true;
}
public override Result Start(params object[] objs)
{
Reset();
if (!_useSettingValue)
{
_targetPressure = SC.GetConfigItem("TM.PressureBalance.BalancePressure").DoubleValue;
}
_pumpSwitchPressure = SC.GetValue<double>("LoadLock.Pump.SlowFastPumpSwitchPressure");
_slowVentTimeout = SC.GetValue<int>("LoadLock.Vent.RoutineTimeOut");
string reason;
if (!LoadLockDevice.SetFastVentValve(false, out reason) || !LoadLockDevice.SetSlowVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (!LoadLockDevice.SetFastPumpValve(false, out reason) || !LoadLockDevice.SetSlowPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
bool isAtmMode = SC.GetValue<bool>("System.IsATMMode");
if (isAtmMode)
{
EV.PostInfoLog(Module, $"system in atm mode, {Module} pump skipped");
return Result.DONE;
}
if (!LoadLockDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not pump, door is open");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(Module)))
{
EV.PostAlarmLog(Module, $"LoadLock Can not servo to pressure, slit valve is open");
return Result.FAIL;
}
if (Math.Abs(_targetPressure - LoadLockDevice.ChamberPressure) < SC.GetConfigItem("TM.PressureBalance.BalanceMaxDiffPressure").DoubleValue && LoadLockDevice.CheckVacuum())
{
return Result.DONE;
}
_needPump = LoadLockDevice.ChamberPressure > _targetPressure;
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
TimeDelay((int)RoutineStep.TimeDelay1, 1);
if (_needPump)
{
//需要调节的压力低于打开快抽的压力
if (_targetPressure < _pumpSwitchPressure)
{
SlowPump((int)RoutineStep.SlowPump, _pumpSwitchPressure, _slowPumpTimeout);
FastPump((int)RoutineStep.FastPump, _targetPressure, _fastPumpTimeout);
//TimeDelay((int)RoutineStep.TimeDelay2, 5);
CloseFastPumpValve((int)RoutineStep.CloseFastValve);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
}
else
{
SlowPump((int)RoutineStep.SlowPump, _targetPressure, _slowPumpTimeout);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
}
}
else
{
SlowVent((int)RoutineStep.SlowVent, _targetPressure, _slowVentTimeout);
CloseVentValveAndWait((int)RoutineStep.CloseSlowVentValve);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
}
}
@@ -0,0 +1,13 @@
namespace SicModules.LLs.Routines
{
public class LoadLockTrayAlignerRoutine:LoadLockBaseRoutine
{
/* 托盘对准
*
*/
public LoadLockTrayAlignerRoutine()
{
Name = "Tray Aligner";
}
}
}
@@ -0,0 +1,74 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Routine;
namespace SicModules.LLs.Routines
{
public class LoadLockTrayClawRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
ClawMove,
}
private IoClaw _llTrayClaw = null;
private bool _clamp;
public LoadLockTrayClawRoutine()
{
Name = "Lift Move";
_llTrayClaw = DEVICE.GetDevice<IoClaw>($"{Module}.LLTrayClaw");
}
public void Init(bool isClamp)
{
_clamp = isClamp;
}
public override Result Start(params object[] objs)
{
Reset();
if (_clamp && _llTrayClaw.State == ClawStateEnum.Clamp)
{
return Result.DONE;
}
else if (!_clamp && _llTrayClaw.State == ClawStateEnum.Open)
{
return Result.DONE;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//先动夹爪在动Lift
ClawMove((int)RoutineStep.ClawMove, _llTrayClaw, _clamp, 15);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
}
}
@@ -0,0 +1,161 @@
using System.Diagnostics;
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 SicModules.Devices;
namespace SicModules.LLs.Routines
{
public class LoadLockVentRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
SlowVent,
FastVent,
VentDelay,
CloseSlowVentValve,
CloseFastVentValve,
CloseValveDelay,
}
private double _ventBasePressure;
private int _slowVentTimeout;
private int _ventDelayTime;
private int _routineTimeOut;
private IoInterLockEx _tmIoInterLock;
private bool _useSettingValue;
private Stopwatch _swTimer = new Stopwatch();
public LoadLockVentRoutine(ModuleName module)
{
Module = module.ToString();
Name = "Vent";
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
}
public void Init()
{
_useSettingValue = false;
}
public void Init(double basePressure, int ventDelayTime)
{
_ventBasePressure = basePressure;
_ventDelayTime = ventDelayTime;
_useSettingValue = true;
}
public override Result Start(params object[] objs)
{
Reset();
string reason;
if (LoadLockDevice.CheckAtm())
{
EV.PostInfoLog(Module, $"{LoadLockDevice.Module} in atm, vent skipped");
return Result.DONE;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(LoadLockDevice.Module)))
{
EV.PostAlarmLog(Module, $"can not vent, slit valve is open");
return Result.FAIL;
}
if (!LoadLockDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"can not vent, lid is open");
return Result.FAIL;
}
if (!LoadLockDevice.SetFastPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"can not vent, TM fast pump value can not close");
return Result.FAIL;
}
if (!LoadLockDevice.SetFastPumpValve(false, out reason)
|| !LoadLockDevice.SetSlowPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (!TMDevice.SetTmToLLVent(false, out _))
{
EV.PostAlarmLog(Module, $"can not vent,can not close v85!");
}
if (!_tmIoInterLock.SetLLVentRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not vent,{reason}");
return Result.FAIL;
}
_slowVentTimeout = SC.GetValue<int>("LoadLock.Vent.SlowVentTimeout");
if (!_useSettingValue)
{
_ventBasePressure = SC.GetValue<double>("LoadLock.Vent.VentBasePressure");
_ventDelayTime = SC.GetValue<int>("LoadLock.Vent.VentDelayTime");
}
_routineTimeOut = SC.GetValue<int>("LoadLock.Vent.RoutineTimeOut");
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
SlowVent((int)RoutineStep.SlowVent, _ventBasePressure, _slowVentTimeout);
TimeDelay((int)RoutineStep.VentDelay, _ventDelayTime);
CloseVentValveAndWait((int)RoutineStep.CloseSlowVentValve);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
LoadLockDevice.SetSlowVentValve(false, out _);
LoadLockDevice.SetFastVentValve(false, out _);
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoLLVentUpRoutineRunning = false;
return Result.DONE;
}
public override void Abort()
{
_tmIoInterLock.DoLLVentUpRoutineRunning = false;
base.Abort();
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
}
}
@@ -0,0 +1,75 @@
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.LLs.Routines
{
public class LoadRotationHomeOffsetRoutine : LoadLockBaseRoutine
{
enum RoutineStep
{
MoveRelativeHome,
TimeDelay,
WaitMoveDone,
MoveHomeOffset,
TimeDelay2,
WaitMoveDone2,
}
private float _homeOffset;
public LoadRotationHomeOffsetRoutine()
{
Name = "Home";
}
public override Result Start(params object[] objs)
{
Reset();
_homeOffset = (float)SC.GetConfigItem($"LoadLock.LoadRotation.HomeOffset").DoubleValue;
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (SC.GetValue<bool>($"System.IsSimulatorMode"))
{
return Result.DONE;
}
MoveRelativeHome((int)RoutineStep.MoveRelativeHome, 10);
TimeDelay((int)RoutineStep.TimeDelay, 3);
WaitLoadRotationDone((int)RoutineStep.WaitMoveDone, 60);
//取消Offset
//MoveLoadRotationHomeOffset((int)RoutineStep.MoveHomeOffset, _homeOffset, 10);
//TimeDelay((int)RoutineStep.TimeDelay2, 1);
//WaitLoadRotationDone((int)RoutineStep.WaitMoveDone2, 60);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
base.Abort();
}
}
}
@@ -0,0 +1,84 @@
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.LLs.Routines
{
public class LoadSeparateRoutine : LoadLockBaseRoutine
{
/*
* 1、Load伺服到传盘压力
2、夹爪打开
3、顶升晶圆
4、夹爪闭合
5、顶升缩回
*
*/
enum RoutineStep
{
ClawOpen,
LiftUp,
Clawing,
LiftDown,
TimeDelay1,
LoadRotationHome,
WaitMoveDone,
}
private int _clawMoveTimeOut = 30;
private int _liftMoveTimeOut = 30;
private int _loadRatationMoveTimeout = 30;
public LoadSeparateRoutine(ModuleName module)
{
Name = "Separate";
Module = module.ToString();
}
public override Result Start(params object[] objs)
{
Reset();
_liftMoveTimeOut = SC.GetValue<int>("LoadLock.LiftMoveTimeOut");
_clawMoveTimeOut = SC.GetValue<int>("LoadLock.ClawMoveTimeOut");
_loadRatationMoveTimeout = SC.GetValue<int>("LoadLock.LoadRotation.RotationTimeOut");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//LoadRotation先回原点位置
MoveHomePos((int)RoutineStep.LoadRotationHome);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
WaitLoadRotationDone((int)RoutineStep.WaitMoveDone, _loadRatationMoveTimeout);
LiftMove((int)RoutineStep.LiftUp, true, _liftMoveTimeOut);
ClawMove((int)RoutineStep.ClawOpen, WaferClaw, false, _clawMoveTimeOut);
ClawMove((int)RoutineStep.Clawing, WaferClaw, true, _clawMoveTimeOut);
LiftMove((int)RoutineStep.LiftDown, false, _liftMoveTimeOut);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
}
}
+302
View File
@@ -0,0 +1,302 @@
using System;
using System.Xml;
using Aitex.Core.Common;
using Aitex.Core.RT.DataCenter;
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.OperationCenter;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Gem;
using MECF.Framework.Common.Schedulers;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using SicModules.Devices;
namespace SicModules.LLs
{
public class SicLoadLock : LoadLock
{
private IoLift4 _lock;
private IoClaw _waferClaw;
private IoClaw _trayClaw;
private IoSensor _lid;
private IoValve _ventValve;
private IoValve _slowPumpValve;
private IoValve _fastPumpValve;
private IoSensor _LLWaferPlaced;
private IoSensor _LLTrayPlaed;
private IoValve _loadBanlance_V85;
private IoPressureMeter3 _chamberGuage;
private IoSlitValve _LeftDoor;
private IoSlitValve _RightDoor;
private IoSlitValve _VacDoor;
private double _balancePressureDiff = 0;
private IoLoadRotation _IoLoadRotation;
private DeviceTimer _timerJobDone = new DeviceTimer();
private R_TRIG _trayReceived = new R_TRIG();
private R_TRIG _trayRemoved = new R_TRIG();
public override double ChamberPressure
{
get
{
return _chamberGuage.Value;
}
}
public bool JobDone { get; set; }
public bool LidClosed
{
get
{
return CheckLidClose();
}
}
public SicLoadLock(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");
}
public override bool Initialize()
{
_slowPumpValve = DEVICE.GetDevice<IoValve>("TM.LoadSlowPump");
_fastPumpValve = DEVICE.GetDevice<IoValve>("TM.LoadFastPump");
_ventValve = DEVICE.GetDevice<IoValve>("TM.LoadVent");
_loadBanlance_V85 = DEVICE.GetDevice<IoValve>("TM.TMLoadBanlance");
_lid = DEVICE.GetDevice<IoSensor>("LoadLock.LLLidClosed");
_lock = DEVICE.GetDevice<IoLift4>("LoadLock.LoadLidLock");
_waferClaw= DEVICE.GetDevice<IoClaw>("LoadLock.LLWaferClaw");
_trayClaw = DEVICE.GetDevice<IoClaw>("LoadLock.LLTrayClaw");
_LLWaferPlaced = DEVICE.GetDevice<IoSensor>("TM.LLWaferPlaced");
_LLTrayPlaed = DEVICE.GetDevice<IoSensor>("TM.LLTrayPresence");
_chamberGuage = DEVICE.GetDevice<IoPressureMeter3>("TM.LLPressure");
_VacDoor = DEVICE.GetDevice<IoSlitValve>("TM.LoadLockDoor");
_LeftDoor = DEVICE.GetDevice<IoSlitValve>("EFEM.LoadLockLSideDoor");
_RightDoor = DEVICE.GetDevice<IoSlitValve>("EFEM.LoadLockRSideDoor");
_balancePressureDiff = SC.GetValue<double>("TM.PressureBalance.BalanceMaxDiffPressure");
_IoLoadRotation = DEVICE.GetDevice<IoLoadRotation>("Load.Rotation");
DATA.Subscribe($"{Name}.JobDone", () => JobDone);
return base.Initialize();
}
public override bool CheckRotationState()
{
return !_IoLoadRotation.IsServoError && !_IoLoadRotation.IsServoBusy && _IoLoadRotation.IsServoOn;
}
public override bool CheckAtm()
{
return _chamberGuage.Value >= SC.GetValue<double>("LoadLock.AtmPressureBase");
}
public override bool CheckTransferPressure()
{
return Math.Abs(SC.GetValue<double>("LoadLock.VacuumPressureBase") - _chamberGuage.Value) < _balancePressureDiff;
}
public override bool CheckVacuum()
{
return _chamberGuage.Value <= SC.GetValue<double>("LoadLock.VacuumPressureBase");
}
public override bool CheckIsPumping()
{
return _slowPumpValve.Status || _fastPumpValve.Status;
}
public override bool CheckLidClose()
{
return _lid.Value == true;
}
public override bool CheckLidOpen()
{
return _lid.Value != true;
}
public override bool SetLift(bool isUp, out string reason)
{
if (isUp)
{
return _lock.MoveUp(out reason);
}
else
{
return _lock.MoveDown(out reason);
}
}
public override bool CheckLiftDown()
{
return _lock.IsDown;
}
public override bool CheckLiftUp()
{
return _lock.IsUp;
}
public override bool CheckTrayClamped()
{
return _trayClaw.IsClamp;
}
public override bool CheckTrayUnClamped()
{
return _trayClaw.IsUnClamp;
}
public override bool SetTrayClamped(bool clamp, out string reason)
{
return _trayClaw.SetValue(clamp,out reason);
}
public override bool CheckWaferClamped()
{
return _waferClaw.IsClamp;
}
public override bool CheckWaferUnClamped()
{
return _waferClaw.IsUnClamp;
}
public override bool SetWaferClamped(bool clamp, out string reason)
{
return _waferClaw.SetValue(clamp, out reason);
}
public override bool CheckWaferPlaced()
{
return _LLWaferPlaced.Value;
}
public override bool CheckTrayPlaced()
{
return _LLTrayPlaed.Value;
}
public override bool SetSlowPumpValve(bool isOpen, out string reason)
{
return _slowPumpValve.TurnValve(isOpen, out reason);
}
public override bool SetFastPumpValve(bool isOpen, out string reason)
{
return _fastPumpValve.TurnValve(isOpen, out reason);
}
public override bool SetFastVentValve(bool isOpen, out string reason)
{
return _ventValve.TurnValve(isOpen, out reason);
}
public override bool CheckSlowVentValve(bool isOpen)
{
return _ventValve.Status == isOpen;
}
public override bool SetSlowVentValve(bool isOpen, out string reason)
{
return _ventValve.TurnValve(isOpen, out reason);
}
public bool CheckSlitValveClosed()
{
return _VacDoor.IsClose;
}
public override bool CheckEnableTransfer(EnumTransferType type)
{
return CheckLiftUp() || CheckLiftDown();
}
public override void Monitor()
{
//增加过冲关闭Vent阀门
if (_chamberGuage.FeedBack >= SC.GetValue<double>("LoadLock.VentMaxPressure"))
{
if (_ventValve.Status)
{
SetFastVentValve(false, out string reason);
}
}
//设置JobDone状态,3秒后恢复为false
if (_timerJobDone.IsTimeout())
{
JobDone = false;
_timerJobDone.Stop();
}
_trayReceived.CLK = _LLTrayPlaed.Value;
if(_trayReceived.Q)
{
//Tray到达事件
GemManager.Instance.Equipment?.TriggerEvent("MaterialReceived");
}
_trayRemoved.CLK = !_LLTrayPlaed.Value;
if (_trayRemoved.Q)
{
//Tray离开事件
GemManager.Instance.Equipment?.TriggerEvent("MaterialRemoved");
}
}
public override void Reset()
{
}
public void SetJobDoneStatus()
{
//EV.PostInfoLog(Module, "Set LoadLock Job Done!");
OP.DoOperation("System.AlertJobDone", ModuleName.LoadLock.ToString(), 0);
JobDone = true;
_timerJobDone.Start(3 * 1000);
}
public override void AutoCreatWafer()
{
if (_LLTrayPlaed.Value)
{
if (!WaferManager.Instance.CheckHasTray(ModuleName.LoadLock, 0))
{
if (WaferManager.Instance.CheckHasWafer(ModuleName.LoadLock, 0))
{
WaferManager.Instance.CreateWafer(ModuleName.LoadLock, 0,WaferStatus.Normal);
}
else
{
WaferManager.Instance.CreateTray(ModuleName.LoadLock, 0);
}
}
}
}
}
}