首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -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()
{
}
}
}