首次上传

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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,70 @@
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.TMs.Routines
{
public class TMHomeRoutine : TMBaseRoutine
{
enum RoutineStep
{
CloseV77,
CloseV80,
TMRobotHome
}
private int _homeTimeout;
private TMRobotHomeRoutine _tmRobotHomeRoutine =
new TMRobotHomeRoutine();
public TMHomeRoutine()
{
Module = "TM";
Name = "Home";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout = SC.GetValue<int>("TM.HomeTimeout");
_tmRobotHomeRoutine = new TMRobotHomeRoutine();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CloseTMVent((int)RoutineStep.CloseV77);
//CloseBufferVent((int)RoutineStep.CloseV80);
ExecuteRoutine((int)RoutineStep.TMRobotHome, _tmRobotHomeRoutine);
}
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,508 @@
using System;
using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
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 MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
using SicModules.Devices;
using SicModules.LLs;
namespace SicModules.TMs.Routines
{
public class TMLeakCheckRoutine : ModuleRoutine, IRoutine
{
enum RoutineStep
{
SlowPump,
FastPump,
VaccumDelay,
PumpDelay,
CloseValves,
CLoseSlowValue,
Delay,
CheckSlitValves,
RunPumpRoutine,
ContinuePump,
ClosePumpValve,
DoLeakCheck,
DoLeakCheckDelay,
CalcLeakCheck,
StartLoop,
LoopVent,
LoopPump,
StopLoop
}
private TMPumpRoutine _pumpRoutine;
private TMVentRoutine _ventRoutine;
private int _paramContinuePumpTime;
private int _paramLeakCheckTime;
private double _beginPressure;
private double _pumpBasePressure;
private double _slowFastPumpSwitchPressure;
private int _slowPumpTimeout;
private int _fastPumpTime;
private int _routineTimeOut;
private double _leakSpec;
private int _purgeCount;
private double _beginTime;
private int _calTimes; //第几次计算LeakCheck的值(每60秒计算一次)
private TM _tm;
private IoSensor _bufferLid;
private IoSensor _tmLid;
private Devices.IoPump _pumpType;
private LoadLock _ll;
private IoSensor _preHeatLid;
private IoInterLockEx _tmIoInterLock;
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
public TMLeakCheckRoutine() : base(ModuleName.TM.ToString())
{
Module = ModuleName.TM.ToString();
Name = "Leak Check";
_tm = DEVICE.GetDevice<TM>($"{ ModuleName.System.ToString()}.{ Module}");
_ll = DEVICE.GetDevice<SicLoadLock>($"LoadLock.LoadLock");
_bufferLid = DEVICE.GetDevice<IoSensor>($"Buffer.BufferLidClosed");
_tmLid = DEVICE.GetDevice<IoSensor>($"TM.TMLidClosed");
_pumpType = DEVICE.GetDevice<Devices.IoPump>($"TM.TMPump1");
_preHeatLid = DEVICE.GetDevice<IoSensor>($"TM.PreHeatStationLidClosed");
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
_pumpRoutine = new TMPumpRoutine();
_ventRoutine = new TMVentRoutine();
}
internal void Init(int pumpTime, int leakCheckTime)
{
_paramContinuePumpTime = pumpTime;
_paramLeakCheckTime = leakCheckTime;
}
internal void Init()
{
_paramContinuePumpTime = SC.GetValue<int>("TM.LeakCheck.PumpDelayTime"); ;
_paramLeakCheckTime = SC.GetValue<int>("TM.LeakCheck.LeakCheckDelayTime"); ;
}
public Result Start(params object[] objs)
{
Reset();
_swTimer.Restart();
_pumpRoutine.Init(SC.GetValue<double>("TM.LeakCheck.PumpBasePressure"), SC.GetValue<int>("TM.LeakCheck.PumpDelayTime"));
_ventRoutine.Init(SC.GetValue<double>("TM.LeakCheck.VentBasePressure"), SC.GetValue<int>("TM.LeakCheck.VentDelayTime"));
string reason;
if (!_tm.SetFastPumpValve(false, out reason) || !_tm.SetFastVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (SC.GetValue<bool>("System.IsATMMode"))
{
EV.PostInfoLog(Module, $"system in atm mode, {_tm.Module} pump skipped");
return Result.DONE;
}
if (SC.ContainsItem("TM.RunPumpRoutineEventBelowBasePressure") && !SC.ContainsItem("TM.RunPumpRoutineEventBelowBasePressure"))
{
if (_tm.ChamberPressure < _pumpBasePressure)
{
EV.PostInfoLog(Module, $"{_tm.Module} already under pump base pressure");
return Result.DONE;
}
}
ModuleName[] modules = new ModuleName[] { ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2 };
foreach (var moduleName in modules)
{
if (!_tm.CheckSlitValveClose(moduleName))
{
EV.PostAlarmLog(Module, $"Can not leakCheck, {moduleName} slit valve not closed");
return Result.FAIL;
}
}
_slowFastPumpSwitchPressure = SC.GetValue<double>("TM.Pump.SlowFastPumpSwitchPressure");
_slowPumpTimeout = SC.GetValue<int>("TM.Pump.PumpSlowTimeout");
_fastPumpTime = SC.GetValue<int>("TM.Pump.FastPumpTimeout");
_pumpBasePressure = SC.GetValue<double>("TM.Pump.PumpBasePressure");
_routineTimeOut = SC.GetValue<int>("TM.LeakCheck.RoutineTimeOut");
_leakSpec = SC.GetValue<double>("TM.LeakCheck.LeakSpec");
_purgeCount = SC.GetValue<int>("TM.LeakCheck.CyclePurgeCount");
if (!_bufferLid.Value)
{
EV.PostAlarmLog(Module, $"Can not leakCheck,Buffer lid is not open");
return Result.FAIL;
}
if (!_tmLid.Value)
{
EV.PostAlarmLog(Module, $"Can not leakCheck,TM lid is not open");
return Result.FAIL;
}
if (_pumpType.IsAlarm)
{
EV.PostAlarmLog(Module, $"can not leakCheck,TM pump alarm");
return Result.FAIL;
}
if (!_pumpType.IsRunning)
{
EV.PostAlarmLog(Module, $"can not leakCheck,TM pump is not running");
return Result.FAIL;
}
if (!_tmIoInterLock.SetTMLeakCheckRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not leakCheck,{reason}");
return Result.FAIL;
}
Notify("Start");
return Result.RUN;
}
public Result Monitor()
{
try
{
CheckRoutineTimeOut();
Loop((int)RoutineStep.StartLoop, _purgeCount);
ExecuteRoutine((int)RoutineStep.LoopPump, _pumpRoutine);
ExecuteRoutine((int)RoutineStep.LoopVent, _ventRoutine);
EndLoop((int)RoutineStep.StopLoop);
OpenSlowPump((int)RoutineStep.SlowPump, _tm, _slowFastPumpSwitchPressure, _slowPumpTimeout);
OpenFastPump((int)RoutineStep.FastPump, _tm, _pumpBasePressure, _fastPumpTime);
TimeDelay((int)RoutineStep.VaccumDelay, _paramContinuePumpTime);
CloseFastPump((int)RoutineStep.CloseValves, _tm);
CloseSlowPump((int)RoutineStep.CLoseSlowValue, _tm);
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.DoTmLeakCheckRoutineRunning = false;
_swTimer.Stop();
return Result.DONE;
}
public void Abort()
{
Stop("Leak check aborted");
_tmIoInterLock.DoTmLeakCheckRoutineRunning = false;
_pumpRoutine.Abort();
_ventRoutine.Abort();
_swTimer.Stop();
LeakCheckDataRecorder.Add((int)_swTimer.ElapsedMilliseconds / 1000, _beginPressure, _tm.ChamberPressure, 0, Result.FAIL.ToString(), "", Module);
}
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 CheckSlitValves(int id, TM tm)
{
Tuple<bool, Result> ret = Check(id, () =>
{
Notify("Check slit valve is all closed");
ModuleName[] modules = new ModuleName[]
{ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2};
foreach (var m in modules)
{
if (!tm.CheckSlitValveClose(m))
{
Stop($"{m} slit valve not closed.");
return false;
}
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
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 = _tm.ChamberPressure;
_calTimes = 1;
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
//Tuple<bool, Result> ret = Delay(id, () =>
// {
// Notify($"Keep pressure for {time} seconds");
// _beginPressure = _tm.ChamberPressure;
// return true;
// }, time * 1000);
//if (ret.Item1)
//{
// if (ret.Item2 == Result.RUN)
// {
// 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 = _tm.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);
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);
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 = _tm.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 = _tm.ChamberPressure;
double leakSpan = endPressure - _beginPressure;
double leakRate = (endPressure - _beginPressure) / (time / 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}");
return false;
}
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}");
return true;
}
});
}
public void OpenSlowPump(int id, TM tm, double basePressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {tm.Name} slow pump valve");
if (!tm.SetSlowPumpValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return tm.ChamberPressure <= basePressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
tm.SetFastPumpValve(false, out string _);
Stop($"{tm.Name} pressure can not pump to {basePressure} in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseSlowPump(int id, TM tm)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close {tm.Name} pump valves");
if (!_tm.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 OpenFastPump(int id, TM tm, double basePressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {tm.Name} pump valve");
if (!tm.SetFastPumpValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return tm.ChamberPressure <= basePressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
tm.SetFastPumpValve(false, out string _);
Stop($"{tm.Name} pressure can not pump to {basePressure} in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void CloseFastPump(int id, TM tm)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close {tm.Name} pump valves");
if (!_tm.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());
}
}
}
}
@@ -0,0 +1,323 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
namespace SicModules.TMs.Routines
{
public class TMPressureBalanceRoutine : TMBaseRoutine
{
enum RoutineStep
{
CheckPressureCondition,
PumpDownToBase,
CloseIsoValve,
OpenTmSlowVent,
VentToSetPoint,
StopVent,
WaitPressureToSetPoint,
SlowPump, FastPump, VaccumDelay, CloseValves, CLoseSlowValue,
CheckNeedVent
}
private TM _tm;
private TMPumpRoutine _pumpDownRoutine;
private ModuleName _paramTarget; //每个模块包含以下三个参数↓
double maxDifferent = 0;
private bool _needMfcVent; //是否需要Vent操作
private double _ventMfcFlow; //MFC在Vent时设置的值
private double _balancePressure; //目标压力值
private int _ventTimeout; //MFC 超时
private int _waitPressureTimeout; //不需要Vent操作时,等待压力平衡时间
private bool _needPumpDown; //执行Routine之前已经是真空则不需要抽真空
private bool _needBalance; //执行Routine之前已经在设定压力值则不需要继续平衡
private double _slowFastPumpSwitchPressure; //慢快抽切换压力
private int _fastPumpTime;
private int _slowPumpTimeout;
private bool isAtmMode = false;
private double _atmPressureBase;
public TMPressureBalanceRoutine()
{
Module = ModuleName.TM.ToString();
Name = "Pressure Balance";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ ModuleName.TM.ToString()}");
_pumpDownRoutine = new TMPumpRoutine();
_paramTarget = ModuleName.System;
}
public void Init(ModuleName target)
{
Name = "Pressure Balance with " + target;
_paramTarget = target;
}
public override Result Start(params object[] objs)
{
if (ModuleHelper.IsPm(_paramTarget))
{
_balancePressure = SC.GetValue<double>($"TM.PressureBalance.BalancePressure") + +SC.GetValue<double>("TM.TMPressureBigThanPM");
}
else
{
_balancePressure = SC.GetValue<double>("TM.PressureBalance.BalancePressure");
}
_ventMfcFlow = SC.GetValue<double>($"TM.PressureBalance.MfcFlow");
_ventTimeout = SC.GetValue<int>("TM.PressureBalance.VentTimeout");
_waitPressureTimeout = SC.GetValue<int>("TM.PressureBalance.WaitPressureAboveSetPointTimeout");
_slowFastPumpSwitchPressure = SC.GetValue<double>("TM.Pump.SlowFastPumpSwitchPressure");
_fastPumpTime = SC.GetValue<int>("TM.Pump.FastPumpTimeout");
_slowPumpTimeout = SC.GetValue<int>("TM.Pump.PumpSlowTimeout");
//_needPumpDown = !_tm.CheckVacuum();
maxDifferent = SC.GetValue<double>("TM.PressureBalance.BalanceMaxDiffPressure");
_atmPressureBase = SC.GetValue<double>("TM.AtmPressureBase");
isAtmMode = SC.GetValue<bool>("System.IsATMMode");
if (isAtmMode)
{
if (_tm.ChamberPressure >= _atmPressureBase)
{
return Result.DONE;
}
else
{
_needPumpDown = false;
_needMfcVent = true;
_balancePressure = _atmPressureBase;
}
}
else
{
if ((Math.Abs(_tm.ChamberPressure - _balancePressure) < maxDifferent) && _balancePressure != 0)
{
return Result.DONE;
}
_needPumpDown = (_tm.ChamberPressure > _balancePressure) || _balancePressure == 0;
_needMfcVent = _balancePressure > 10;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (_needPumpDown)
{
if (_balancePressure < _slowFastPumpSwitchPressure)
{
OpenSlowPump((int)RoutineStep.SlowPump, _tm, _slowFastPumpSwitchPressure, _slowPumpTimeout);
OpenFastPump((int)RoutineStep.FastPump, _tm, _balancePressure, _fastPumpTime);
CloseFastPump((int)RoutineStep.CloseValves, _tm);
CloseSlowPump((int)RoutineStep.CLoseSlowValue, _tm);
}
else
{
OpenSlowPump((int)RoutineStep.SlowPump, _tm, _balancePressure, _slowPumpTimeout);
CloseSlowPump((int)RoutineStep.CLoseSlowValue, _tm);
}
}
CheckNeedVent((int)RoutineStep.CheckNeedVent);
if (_needMfcVent)
{
VentToSetPoint((int)RoutineStep.VentToSetPoint, _tm, _balancePressure, _ventMfcFlow, _ventTimeout);
StopVent((int)RoutineStep.StopVent, _tm, 2);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
_tm.SetSlowVentValve(false, out string reason);
_tm.SetFastVentValve(false, out reason);
_tm.SetSlowPumpValve(false, out reason);
_tm.SetFastPumpValve(false, out reason);
Notify("Aborted");
base.Abort();
}
private void CheckNeedVent(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
if ((Math.Abs(_tm.ChamberPressure - _balancePressure) < maxDifferent) && _balancePressure != 0)
{
_needMfcVent = false;
}
else if (_tm.ChamberPressure < _balancePressure)
{
_needMfcVent = true;
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void OpenTMSlowVent(int id,int delayTime)
{
Tuple<bool, Result> ret = Wait(id, () =>
{
Notify($"Open tm slowVent");
if (!_tm.SetSlowVentValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, delayTime * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void VentToSetPoint(int id, TM tm, double balancePressure, double ventFlow, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"vent to {balancePressure} mbar with {ventFlow} sccm");
if (!_tm.SetSlowVentValve(true, out string reason))
{
Stop(reason);
return false;
}
if (!_tm.SetVentMfc(ventFlow, out reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return _tm.ChamberPressure >= balancePressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"can not vent to {balancePressure} in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void StopVent(int id, TM tm, int delayTime)
{
Tuple<bool, Result> ret = Wait(id, () =>
{
Notify($"stop vent");
if (!_tm.SetSlowVentValve(false, out string reason))
{
Stop(reason);
return false;
}
if (!_tm.SetVentMfc(0, out reason))
{
Stop(reason);
return false;
}
return true;
}, delayTime * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void WaitPressureToSetPoint(int id, TM tm, double pressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Wait pressure above {pressure} mbar");
return true;
}, () =>
{
return tm.ChamberPressure >= pressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"{tm.Name} pressure can not above {pressure} in {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,296 @@
using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using SicModules.Devices;
using SicModules.LLs;
namespace SicModules.TMs.Routines
{
public class TMPumpRoutine : TMBaseRoutine
{
enum RoutineStep
{
//CheckForelinePressure,
//RequestPump,
//StartDelay,
//RequestPumpDelay,
//Pump,
//PumpDelay,
//Delay,
CloseV77,
CloseV80,
SlowPump,
FastPump,
VaccumDelay,
CloseValves,
CLoseSlowValue,
}
//private SicTM _tm;
private IoSensor _bufferLid;
private IoSensor _tmLid;
private Devices.IoPump _pumpType;
private LoadLock _ll;
private IoInterLockEx _tmIoInterLock;
private double _forelineBasePressure;
private double _pumpBasePressure;
private double _slowFastPumpSwitchPressure;
private int _waitForelineTimeout;
private int _slowPumpTimeout;
private int _fastPumpTime;
private int _pumpDelayTime;
private int _routineTimeOut;
private bool _useSettingValue;
private Stopwatch _swTimer = new Stopwatch();
public TMPumpRoutine()
{
Module = ModuleName.TM.ToString();
Name = "Pump";
//_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ Module}");
_ll = DEVICE.GetDevice<SicLoadLock>($"LoadLock.LoadLock");
_bufferLid = DEVICE.GetDevice<IoSensor>($"Buffer.BufferLidClosed");
_tmLid = DEVICE.GetDevice<IoSensor>($"TM.TMLidClosed");
_pumpType = DEVICE.GetDevice<Devices.IoPump>($"TM.TMPump1");
_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();
_forelineBasePressure = SC.GetValue<double>("TM.ForelinePressureBase");
_slowFastPumpSwitchPressure = SC.GetValue<double>("TM.Pump.SlowFastPumpSwitchPressure");
_waitForelineTimeout = SC.GetValue<int>("TM.WaitForelinePressureTimeout");
_slowPumpTimeout = SC.GetValue<int>("TM.Pump.PumpSlowTimeout");
_fastPumpTime = SC.GetValue<int>("TM.Pump.FastPumpTimeout");
_routineTimeOut = SC.GetValue<int>("TM.Pump.RoutineTimeOut");
if (!_useSettingValue)
{
_pumpBasePressure = SC.GetValue<double>("TM.Pump.PumpBasePressure");
_pumpDelayTime = SC.GetValue<int>("TM.Pump.PumpDelayTime");
}
string reason;
if (!TMDevice.SetFastPumpValve(false, out reason) || !TMDevice.SetFastVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (SC.GetValue<bool>("System.IsATMMode"))
{
EV.PostInfoLog(Module, $"system in atm mode, {TMDevice.Module} pump skipped");
return Result.DONE;
}
if (SC.ContainsItem("TM.RunPumpRoutineEventBelowBasePressure") && !SC.GetValue<bool>("TM.RunPumpRoutineEventBelowBasePressure"))
{
if (TMDevice.ChamberPressure < _pumpBasePressure)
{
EV.PostInfoLog(Module, $"{TMDevice.Module} already under pump base pressure");
return Result.DONE;
}
}
ModuleName[] modules = new ModuleName[] { ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2 };
foreach (var moduleName in modules)
{
if (!TMDevice.CheckSlitValveClose(moduleName))
{
EV.PostAlarmLog(Module, $"Can not pump, {moduleName} slit valve not closed");
return Result.FAIL;
}
}
if (!_bufferLid.Value)
{
EV.PostAlarmLog(Module, $"Can not pump,Buffer lid is not closed");
return Result.FAIL;
}
if (!_tmLid.Value)
{
EV.PostAlarmLog(Module, $"Can not pump,TM lid is not closed");
return Result.FAIL;
}
if (_pumpType.IsAlarm)
{
EV.PostAlarmLog(Module, $"can not pump,TM pump alarm");
return Result.FAIL;
}
if (!_pumpType.IsRunning)
{
EV.PostAlarmLog(Module, $"can not pump,TM pump is not running");
return Result.FAIL;
}
if (!TMDevice.SetTmToLLVent(false, out _))
{
EV.PostAlarmLog(Module, $"can not pump,can not close v85!");
}
if (!_tmIoInterLock.SetTMPumpRoutineRunning(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();
//CheckForelinePressure((int)RoutineStep.CheckForelinePressure, _tm, _forelineBasePressure, _waitForelineTimeout);
//关闭V77
CloseTMVent((int)RoutineStep.CloseV77);
//关闭V80
//CloseBufferVent((int)RoutineStep.CloseV80);
//打开V82,等待压力低于200mbar(可配置)
OpenSlowPump((int)RoutineStep.SlowPump, TMDevice, _slowFastPumpSwitchPressure, _slowPumpTimeout);
//打开V81,压力达到0mbar(可配置)
OpenFastPump((int)RoutineStep.FastPump, TMDevice, _pumpBasePressure, _fastPumpTime);
//等待5s(可配置)
TimeDelay((int)RoutineStep.VaccumDelay, _pumpDelayTime);
//关闭
CloseFastPump((int)RoutineStep.CloseValves, TMDevice);
CloseSlowPump((int)RoutineStep.CLoseSlowValue, TMDevice);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
TMDevice.SetFastPumpValve(false, out _);
TMDevice.SetSlowPumpValve(false, out _);
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoTmPumpDownRoutineRunning = false;
return Result.DONE;
}
public override void Abort()
{
_tmIoInterLock.DoTmPumpDownRoutineRunning = false;
//_tm.SetFastPumpValve(false, out _);
//_tm.SetSlowPumpValve(false, out _);
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 CheckPressure(int id, TM tm, double basePressure, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Check {tm.Name} pressure ");
// return true;
// }, () =>
// {
// return tm.ForelinePressure <= basePressure;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT) //timeout
// {
// Stop($"{tm.Name} pressure can not lower than {basePressure} in {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
//public void CheckForelinePressure(int id, TM tm, double basePressure, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Check {tm.Name} foreline pressure ");
// return true;
// }, () =>
// {
// return tm.ForelinePressure <= basePressure;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT) //timeout
// {
// Stop($"{tm.Name} foreline pressure can not lower than {basePressure} in {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
}
}
@@ -0,0 +1,276 @@
using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
using SicModules.Devices;
using SicModules.LLs;
namespace SicModules.TMs.Routines
{
public class TMPurgeRoutine : TMBaseRoutine
{
enum RoutineStep
{
StartLoop,
LoopPump,
LoopVent,
StopLoop,
//Pump
CloseV77,
CloseV80,
SlowPump,
FastPump,
VaccumDelay,
CloseValves,
CLoseSlowValue,
//Vent
CloseV81,
CloseV82,
SetMFC1,
SetMFC2,
OpenSlowVent,
OpenFastVent,
OpenVent,
TimeStayATM,
CloseSlowVent
}
//private TMPumpRoutine _pumpRoutine;
//private TMVentRoutine _ventRoutine;
private TM _tm;
private IoSensor _bufferLid;
private IoSensor _tmLid;
private Devices.IoPump _pumpType;
private LoadLock _ll;
private IoInterLockEx _tmIoInterLock;
private Stopwatch _swTimer = new Stopwatch();
private int _routineTimeOut;
private int _purgeCount;
private double _slowFastPumpSwitchPressure;
private double _pumpDelayTime;
private double _pumpBasePressure;
private int _pumpTimeOut;
private double _ventBasePressure;
private double _slowFastVentSwitchPressure;
private int _ventTimeOut;
private double _mfc60Default1;
private double _mfc60Default2;
private IoMFC _mfc60;
private double _ventDelayTime;
public TMPurgeRoutine()
{
Module = ModuleName.TM.ToString();
Name = "Purge";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ Module}");
_ll = DEVICE.GetDevice<SicLoadLock>($"LoadLock.LoadLock");
_bufferLid = DEVICE.GetDevice<IoSensor>($"Buffer.BufferLidClosed");
_tmLid = DEVICE.GetDevice<IoSensor>($"TM.TMLidClosed");
_pumpType = DEVICE.GetDevice<Devices.IoPump>($"TM.TMPump1");
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
_mfc60 = DEVICE.GetDevice<IoMFC>($"TM.Mfc60");
//_pumpRoutine = new TMPumpRoutine();
//_ventRoutine = new TMVentRoutine();
}
public override Result Start(params object[] objs)
{
Reset();
_purgeCount = SC.GetValue<int>("TM.Purge.CyclePurgeCount");
_routineTimeOut = SC.GetValue<int>("TM.Purge.RoutineTimeOut");
_slowFastPumpSwitchPressure = SC.GetValue<double>("TM.Purge.SlowFastPumpSwitchPressure");
_pumpDelayTime = SC.GetValue<int>("TM.Purge.PumpDelayTime");
_pumpBasePressure = SC.GetValue<double>("TM.Purge.PumpBasePressure");
_pumpTimeOut = SC.GetValue<int>("TM.Purge.PumpTimeOut");
_ventDelayTime = SC.GetValue<int>("TM.Purge.VentDelayTime");
_mfc60Default1 = SC.GetValue<double>("TM.Purge.Mfc60Default1");
_mfc60Default2 = SC.GetValue<double>("TM.Purge.Mfc60Default2");
_slowFastVentSwitchPressure = SC.GetValue<double>("TM.Purge.SlowFastVentSwitchPressure");
_ventTimeOut = SC.GetValue<int>("TM.Purge.VentTimeout");
_ventBasePressure = SC.GetValue<double>("TM.Purge.VentBasePressure");
ModuleName[] modules = new ModuleName[] { ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2 };
foreach (var moduleName in modules)
{
if (!_tm.CheckSlitValveClose(moduleName))
{
EV.PostAlarmLog(Module, $"Can not Purge, {moduleName} slit valve not closed");
return Result.FAIL;
}
}
if (!_bufferLid.Value)
{
EV.PostAlarmLog(Module, $"Can not Purge,Buffer lid is not open");
return Result.FAIL;
}
if (!_tmLid.Value)
{
EV.PostAlarmLog(Module, $"Can not Purge,TM lid is not open");
return Result.FAIL;
}
if (_pumpType.IsAlarm)
{
EV.PostAlarmLog(Module, $"can not Purge,TM pump alarm");
return Result.FAIL;
}
if (!_pumpType.IsRunning)
{
EV.PostAlarmLog(Module, $"can not Purge,TM pump is not running");
return Result.FAIL;
}
if (!_tmIoInterLock.SetTMPurgeRoutineRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Purge,{reason}");
return Result.FAIL;
}
_tmIoInterLock.DoTmCyclePurgeRoutineSuccessed = false;
if (SC.GetValue<bool>("System.IsATMMode"))
{
return Result.DONE;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
Loop((int)RoutineStep.StartLoop, _purgeCount);
//ExecuteRoutine((int)RoutineStep.LoopPump, _pumpRoutine);
//ExecuteRoutine((int)RoutineStep.LoopVent, _ventRoutine);
//先Pump
{
//关闭V77
CloseTMVent((int)RoutineStep.CloseV77);
//关闭V80
//CloseBufferVent((int)RoutineStep.CloseV80);
//打开V82,等待压力低于200mbar(可配置)
OpenSlowPump((int)RoutineStep.SlowPump, _tm, _slowFastPumpSwitchPressure, _pumpTimeOut);
//打开V81,压力达到0mbar(可配置)
OpenFastPump((int)RoutineStep.FastPump, _tm, _pumpBasePressure, _pumpTimeOut);
//等待5s(可配置)
TimeDelay((int)RoutineStep.VaccumDelay, _pumpDelayTime);
//关闭
CloseFastPump((int)RoutineStep.CloseValves, _tm);
CloseSlowPump((int)RoutineStep.CLoseSlowValue, _tm);
}
//再Vent
{
//关闭V81
CloseFastPump((int)RoutineStep.CloseV81);
//关闭V82
CloseSlowPump((int)RoutineStep.CloseV82);
//设定MFC60慢充流量
SetMFCToSetPoint((int)RoutineStep.SetMFC1, _mfc60, _mfc60Default1);
////打开V77,等待压力大于200mbar
//OpenSlowVent((int)RoutineStep.OpenSlowVent, _tm, _slowFastVentSwitchPressure, _slowVentTimeout);
////设定MFC60快充流量
//SetMFCToSetPoint((int)RoutineStep.SetMFC2, _mfc60, _mfc60Default2);
////等待压力大于1020mbar
//OpenFastVent((int)RoutineStep.OpenFastVent, _tm, _ventBasePressure, _fastVentTime);
//充气过程中检查是否到达打开快充流量的条件
OpenVent((int)RoutineStep.OpenVent, _tm, _ventBasePressure, _slowFastVentSwitchPressure, _mfc60Default2, _ventTimeOut);
//等待5s
TimeDelay((int)RoutineStep.TimeStayATM, _ventDelayTime);
//关闭V77
CloseSlowVentValve((int)RoutineStep.CloseSlowVent, _tm);
}
EndLoop((int)RoutineStep.StopLoop);
//关闭V81
CloseFastPump((int)RoutineStep.CloseV81);
//关闭V82
CloseSlowPump((int)RoutineStep.CloseV82);
//关闭V77
CloseSlowVentValve((int)RoutineStep.CloseSlowVent, _tm);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoTmCyclePurgeRoutineRunning = false;
_tmIoInterLock.DoTmCyclePurgeRoutineSuccessed = true;
return Result.DONE;
}
public override void Abort()
{
_tmIoInterLock.DoTmCyclePurgeRoutineRunning = false;
_tmIoInterLock.DoTmCyclePurgeRoutineSuccessed = 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,114 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Schedulers;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
namespace SicModules.TMs.Routines
{
public class TMRobotExtendRoutine : TMBaseRoutine
{
enum RoutineStep
{
WaitOpenSlitValveInterlock,
OpenSlitValve,
CheckBeforeExtend,
Extend,
}
private ModuleName _source;
private int _sourceSlot;
private Hand _hand;
private int _timeout;
private TMSlitValveRoutine _openSlitValveRoutine = new TMSlitValveRoutine();
public TMRobotExtendRoutine()
{
Module = "TMRobot";
Name = "Extend";
}
public void Init(ModuleName source, int sourceSlot, Hand blade)
{
_source = source;
_sourceSlot = sourceSlot;
_hand = blade;
_openSlitValveRoutine.Init(source.ToString(), true);
}
public void Init(ModuleName source, int sourceSlot, int blade)
{
Init(source, sourceSlot, (Hand)blade);
}
public override Result Start(params object[] objs)
{
Reset();
_timeout = SC.GetValue<int>("TMRobot.ExtendTimeout");
if (ModuleHelper.IsLoadLock(_source))
{
LoadLock ll = DEVICE.GetDevice<LoadLock>($"{_source.ToString()}.{_source.ToString()}");
if (!ll.CheckEnableTransfer(EnumTransferType.Extend))
{
EV.PostWarningLog(Module, $"can not extend, {_source} not ready for transfer");
return Result.FAIL;
}
}
if (ModuleHelper.IsPm(_source))
{
PM pm = DEVICE.GetDevice<PM>(_source.ToString());
if (!pm.CheckEnableTransfer(EnumTransferType.Extend, out string reason))
{
EV.PostWarningLog(Module, $"can not extend, {_source} reason");
return Result.FAIL;
}
}
Notify($"Start, extend to {_source} slot {_sourceSlot+1} with {_hand}");
return Result.RUN;
}
public override void Abort()
{
Notify("Abort");
}
public override Result Monitor()
{
try
{
WaitSlitValveOpenInterlock((int)RoutineStep.WaitOpenSlitValveInterlock, TMDevice.GetSlitValve(_source), _timeout);
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _openSlitValveRoutine);
//CheckBeforeExtend((int)RoutineStep.CheckBeforeExtend, _source, _sourceSlot, _hand);
//Extend((int)RoutineStep.Extend, RobotDevice, _source, _sourceSlot, _hand, _timeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finish, extend to {_source} slot {_sourceSlot + 1} with {_hand}");
return Result.DONE;
}
}
}
@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
namespace SicModules.TMs.Routines
{
public class TMRobotGotoRoutine : TMBaseRoutine
{
enum RoutineStep
{
RobotGoto,
}
private ModuleName _source;
private int _sourceSlot;
private RobotArmEnum _blade;
private string _EX;
private string _UP;
private int _timeout;
private TMSlitValveRoutine _closeSlitValveRoutine = new TMSlitValveRoutine();
private double _shutterAndSlitValveMotionInterval;
public TMRobotGotoRoutine()
{
Module = "TMRobot";
Name = "Goto";
}
public void Init(ModuleName source, int sourceSlot, RobotArmEnum blade,string PE,string NE)
{
_source = source;
_sourceSlot = sourceSlot;
_blade = blade;
_EX = PE;
_UP = NE;
}
public void Init(ModuleName source, int sourceSlot, int blade,string EX, string UP)
{
Init(source, sourceSlot, blade == 0 ? RobotArmEnum.Blade1 : RobotArmEnum.Blade2,EX,UP);
}
public override Result Start(params object[] objs)
{
Reset();
if (RobotDevice.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not Goto, TMRobot Is Not IDLE");
return Result.FAIL;
}
_timeout = SC.GetValue<int>("TMRobot.GotoTimeout");
Notify($"Start, goto {_source} slot {_sourceSlot + 1} with {(_blade == RobotArmEnum.Blade1 ? "Blade1" : "Blade2")}");
return Result.RUN;
}
public override void Abort()
{
RobotDevice.Stop();
Notify("Abort");
}
public override Result Monitor()
{
try
{
RobotGoto((int)RoutineStep.RobotGoto, RobotDevice, _source, _sourceSlot, _blade, _timeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
RobotDevice.Stop();
return Result.FAIL;
}
Notify($"Finish, goto {_source} slot {_sourceSlot + 1} with {(_blade == RobotArmEnum.Blade1 ? "Blade1" : "Blade2")}");
return Result.DONE;
}
private void RobotGoto(int id, RobotBaseDevice robot, ModuleName source, int slot, RobotArmEnum hand, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Goto {source} {slot + 1} use {(hand == RobotArmEnum.Blade1 ? "Blade1" : "Blade2")}");
List<object> para = new List<object>() { "GoTo", hand, source, slot, _EX == "EX" ? false : true , _UP == "UP" ? false : true };
if (!robot.GoTo(para.ToArray()))
{
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
return true;
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"Goto failed, error {robot.ErrorCode}");
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop(string.Format("timeout, can not complete in {0} seconds", timeout));
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,254 @@
using System;
using System.Collections.Generic;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
namespace SicModules.TMs.Routines
{
public class TMRobotHomeRoutine : TMBaseRoutine
{
enum RoutineStep
{
SetCommunication,
SetLoadArm1,
SetLoadArm2,
Home,
CheckLoad1,
CheckLoad2,
RequestWaferPresent1,
RequestWaferPresent2,
UpdateWaferInfoByRobotSensor,
}
private int _homeTimeout;
private bool _isPriArmWaferPresent;
private bool _isSecArmWaferPresent;
public TMRobotHomeRoutine()
{
Module = "TMRobot";
Name = "Home";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout = SC.GetValue<int>("TMRobot.HomeTimeout");
_isPriArmWaferPresent = WaferManager.Instance.CheckHasWafer(Module, 0);
_isSecArmWaferPresent = WaferManager.Instance.CheckHasWafer(Module, 1);
RobotDevice.Reset();
Notify("Start");
return Result.RUN;
}
public override void Abort()
{
RobotDevice.Stop();
Notify("Abort");
}
public override Result Monitor()
{
try
{
RobotHome((int)RoutineStep.Home, RobotDevice, _homeTimeout);
RobotCheckLoad((int)RoutineStep.CheckLoad1, RobotDevice, RobotArmEnum.Blade1, _homeTimeout);
RobotRequestWaferPresent((int)RoutineStep.RequestWaferPresent1, RobotDevice, RobotArmEnum.Blade1, _homeTimeout);
UpdateWaferInfoByRobotSensor((int)RoutineStep.UpdateWaferInfoByRobotSensor, RobotDevice);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
RobotDevice.Stop();
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
//public void RobotSetCommunication(int id, RobotBaseDevice robot, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify("Set default communication");
// if (!robot.SetCommunication(out string reason))
// {
// Stop(reason);
// return false;
// }
// return true;
// }, () =>
// {
// if (!robot.Busy)
// {
// 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($"timeout over {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
public void RobotSetLoad(int id, RobotBaseDevice robot, RobotArmEnum hand, bool isWaferPresent, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set default load {hand}");
List<object> parm = new List<object>() { "SetLoad", hand, isWaferPresent };
if (!robot.SetParameters(parm.ToArray()))
{
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
{
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"timeout over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void RobotHome(int id, RobotBaseDevice robot, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify("Execute home");
if (!robot.Home(null))
{
EV.PostAlarmLog(Module, $"Can not home robot");
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
{
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"timeout over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void RobotCheckLoad(int id, RobotBaseDevice robot, RobotArmEnum hand, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify("Check load");
List<object> parm = new List<object>() { "CheckLoad", hand };
if (!robot.ReadParameter(parm.ToArray()))
{
EV.PostAlarmLog(Module, $"Can not check load");
return false;
}
return true;
}, () =>
{
if (robot.IsReady())
{
return true;
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"timeout over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,160 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
namespace SicModules.TMs.Routines
{
public class TMRobotPickAndPlaceRoutine : TMBaseRoutine
{
enum RoutineStep
{
WaitOpenSlitValveInterlock,
OpenSlitValve,
CheckBeforePick,
Pick,
PickLiftMove,
PickExtend,
PickHandoff,
PickHandoffDelay,
PickRetract,
PickUpdateWaferInfoByHandoff,
PickRequestWaferPresent,
PickCheckWaferInfoByRobotSensor,
PickWaitCloseSlitValveInterlock,
PickRequestAWCData,
CheckBeforePlace,
Place,
PlaceLiftMove,
PlaceExtend,
PlaceHandoff,
PlaceHandoffDelay,
PlaceRetract,
PlaceUpdateWaferInfoByHandoff,
PlaceRequestWaferPresent,
PlaceCheckWaferInfoByRobotSensor,
PlaceWaitCloseSlitValveInterlock,
PlaceRequestAWCData,
CloseSlitValve,
PostTransfer,
}
private Hand _pickBlade;
private Hand _placeBlade;
private ModuleName _targetModule;
private int _pickSlot;
private int _placeSlot;
private int _pickTimeout;
private int _placeTimeout;
private int _postTransferTimeout;
private TMSlitValveRoutine _openSlitValveRoutine = new TMSlitValveRoutine();
private TMSlitValveRoutine _closeSlitValveRoutine = new TMSlitValveRoutine();
private bool _requestAWCDataPick;
private bool _requestAWCDataPlace;
public TMRobotPickAndPlaceRoutine()
{
Module = "TMRobot";
Name = "Swap";
}
public void Init(ModuleName targetModule, int pickSlot, int placeSlot, Hand pickBlade, Hand placeBlade)
{
_pickBlade = pickBlade;
_placeBlade = placeBlade;
_targetModule = targetModule;
_pickSlot = pickSlot;
_placeSlot = placeSlot;
_openSlitValveRoutine.Init(targetModule.ToString(), true);
_closeSlitValveRoutine.Init(targetModule.ToString(), false);
}
public override Result Start(params object[] objs)
{
Reset();
_pickTimeout = SC.GetValue<int>("TMRobot.PickTimeout");
_placeTimeout = SC.GetValue<int>("TMRobot.PlaceTimeout");
_postTransferTimeout = SC.GetValue<int>($"{_targetModule}.PostTransferTimeout");
_requestAWCDataPick = SC.GetValue<bool>("System.RequestAWCDataAfterPick");
_requestAWCDataPlace = SC.GetValue<bool>("System.RequestAWCDataAfterPlace");
if (!WaferManager.Instance.CheckNoWafer(ModuleName.TMRobot, (int) _pickBlade))
{
EV.PostWarningLog(Module, $"Can not pick by {_pickBlade}, found wafer on");
return Result.FAIL;
}
if (!WaferManager.Instance.CheckHasWafer(ModuleName.TMRobot, (int)_placeBlade))
{
EV.PostWarningLog(Module, $"Can not place by {_placeBlade}, no wafer on");
return Result.FAIL;
}
if (_pickSlot != _placeSlot)
{
if (!WaferManager.Instance.CheckHasWafer(_targetModule, _pickSlot))
{
EV.PostWarningLog(Module, $"Can not pick from {_targetModule} slot {_pickSlot + 1}, no wafer on");
return Result.FAIL;
}
if (!WaferManager.Instance.CheckNoWafer(_targetModule, _placeSlot))
{
EV.PostWarningLog(Module, $"Can not place to {_targetModule} slot {_placeSlot + 1}, found wafer on");
return Result.FAIL;
}
}
else
{
if (!WaferManager.Instance.CheckHasWafer(_targetModule, _placeSlot))
{
{
EV.PostWarningLog(Module, $"Can not pick&place from {_targetModule} slot {_placeSlot + 1}, no wafer on");
return Result.FAIL;
}
}
}
Notify("Start");
return Result.RUN;
}
public override void Abort()
{
Notify("Abort");
}
public override Result Monitor()
{
try
{
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
}
}
@@ -0,0 +1,297 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
namespace SicModules.TMs.Routines
{
public class TMRobotPickRoutine : TMBaseRoutine
{
enum RoutineStep
{
WaitOpenSlitValveInterlock,
OpenSlitValve,
CheckBeforePick,
PrepareTransfer,
PrepareTransferNotWait,
Pick,
QueryOffset,
Extend,
Handoff,
HandoffDelay,
Retract,
UpdateWaferInfoByHandoff,
RequestWaferPresent,
BeforePickRequestWaferPresent,
AfterPickRequestWaferPresent,
RequestAWCData,
CheckWaferInfoByRobotSensor,
BeforePickCheckWaferInfoByRobotSensor,
AfterPickCheckWaferInfoByRobotSensor,
WaitCloseSlitValveInterlock,
CloseSlitValve,
SetRobortExtendToDo,
ClearRobortExtendToDo,
WaitPMSensor,
PostTransfer,
OpenShutter,
CloseShutter,
Delay1,
Delay2,
VceMoveToSlot,
RobotGotoNotWait,
CheckRobotReady,
CheckTransferPrepared,
SetConfinementRingUp,
TimeDelay1,
TimeDelay2,
TimeDelay20,
TimeDelay50,
}
private ModuleName _target;
private int _targetSlot;
private RobotArmEnum _blade;
private int _pickTimeout;
private bool _autoHand;
private double _shutterAndSlitValveMotionInterval =5;
private bool _isShutterAndSlitValveMotionOneByOne = false;
private bool _requestAWCData;
private SicTM _tm;
private TMSlitValveRoutine _openSlitValveRoutine = new TMSlitValveRoutine();
private TMSlitValveRoutine _closeSlitValveRoutine = new TMSlitValveRoutine();
private bool _pmPostTrasferEnableHeat = true;
public TMRobotPickRoutine()
{
Module = "TMRobot";
Name = "Pick";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ ModuleName.TM.ToString()}");
}
public void Init(ModuleName source, int sourceSlot, RobotArmEnum blade)
{
Init(source, sourceSlot, blade, false);
}
public void Init(ModuleName source, int sourceSlot, int blade)
{
Init(source, sourceSlot, blade == 0 ? RobotArmEnum.Blade1 : RobotArmEnum.Blade2, false);
}
public void Init(ModuleName source, int sourceSlot)
{
Init(source, sourceSlot, RobotArmEnum.Blade1, true);
}
private void Init(ModuleName source, int sourceSlot, RobotArmEnum blade, bool autoHand)
{
_autoHand = autoHand;
_target = source;
_targetSlot = sourceSlot;
_blade = blade;
_openSlitValveRoutine.Init(source.ToString(), true, _pmPostTrasferEnableHeat);
_closeSlitValveRoutine.Init(source.ToString(), false, _pmPostTrasferEnableHeat);
}
public void Init(ModuleName source, int sourceSlot, int blade, bool autoHand, bool pmPostTrasferEnableHeat)
{
_pmPostTrasferEnableHeat = pmPostTrasferEnableHeat;
Init(source, sourceSlot, RobotArmEnum.Blade1, autoHand);
}
public override Result Start(params object[] objs)
{
Reset();
if (RobotDevice.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not pick, TMRobot Is Not IDLE");
return Result.FAIL;
}
_pickTimeout = SC.GetValue<int>("TMRobot.PickTimeout");
//if (ModuleHelper.IsPm(_target))
//{
// _postTransferTimeout = SC.GetValue<int>($"{_target}.PostTransferTimeout");
// _shutterAndSlitValveMotionInterval = SC.GetValue<double>($"{_target}.ShutterAndSlitValveMotionInterval");
// _isShutterAndSlitValveMotionOneByOne = SC.GetValue<bool>($"{_target}.ShutterAndSlitValveMotionOneByOne");
// //CoralPM pm = DEVICE.GetDevice<CoralPM>(_target.ToString());
// if (!pm.PickPlaceCheck(out string reason, false))
// {
// EV.PostWarningLog(Module, $"Can not place, {reason}");
// return Result.FAIL;
// }
//}
_requestAWCData = SC.GetValue<bool>("System.RequestAWCDataAfterPick");
if (!WaferManager.Instance.CheckHasTray(_target, _targetSlot))
{
EV.PostWarningLog(Module, $"Can not pick, No tray at {_target}, {_targetSlot + 1}");
return Result.FAIL;
}
if (_autoHand)
{
if (WaferManager.Instance.CheckNoWafer(Module, 0))
{
_blade = RobotArmEnum.Blade1;
}
else if (WaferManager.Instance.CheckNoWafer(Module, 1))
{
_blade = RobotArmEnum.Blade2;
}
else
{
EV.PostWarningLog(Module, $"Can not pick, Robot both arm has wafer");
return Result.FAIL;
}
}
int slot = _blade == RobotArmEnum.Blade1 ? 0 : 1;
if (!WaferManager.Instance.CheckNoTray(ModuleHelper.Converter(Module), slot))
{
EV.PostWarningLog(Module, $"Can not pick, Robot arm {slot + 1} has tray");
return Result.FAIL;
}
//顶针必须在低位
// if (_target == ModuleName.LoadLock || _target == ModuleName.Load)
// {
// if (!LoadLift.IsDown)
// {
// EV.PostWarningLog(Module, $"Can not place, Load Lift must in down Position!");
// return Result.FAIL;
// }
// }
// else if (_target == ModuleName.UnLoad)
// {
// if (!UnLoadLift.IsDown)
// {
// EV.PostWarningLog(Module, $"Can not place, UnLoad Lift must in down Position!");
// return Result.FAIL;
// }
// }
//Pick之前先,根据Sensor检测是否有盘
if (!SC.GetValue<bool>("System.IsSimulatorMode"))
{
if (ModuleHelper.IsLoadLock(_target) && !SensorLLTrayPresence.Value)
{
EV.PostWarningLog(Module, $"Can not pick, LLTrayPresence sensor check no Tray");
return Result.FAIL;
}
//if (_target==ModuleName.UnLoad && !SensorUnloadWaferPresence.Value)
//{
// EV.PostWarningLog(Module, $"Can not pick,UnloadWaferPresence sensor check no wafer");
// return Result.FAIL;
//}
if (ModuleHelper.IsBuffer(_target)&&_targetSlot==2 && !SensorBufferHighWaferPresence.Value)
{
EV.PostWarningLog(Module, $"Can not pick,BufferHighWaferPresence sensor check no wafer");
return Result.FAIL;
}
if (ModuleHelper.IsBuffer(_target) && _targetSlot == 1 && !SensorBufferMiddleWaferPresence.Value)
{
EV.PostWarningLog(Module, $"Can not pick,BufferMiddleWaferPresence sensor check no wafer");
return Result.FAIL;
}
if (ModuleHelper.IsBuffer(_target) && _targetSlot == 0 && !SensorBufferLowWaferPresence.Value)
{
EV.PostWarningLog(Module, $"Can not pick,BufferLowWaferPresence sensor check no wafer");
return Result.FAIL;
}
}
Notify($"Start, Pick from {_target} slot {_targetSlot + 1}, by {(_blade == RobotArmEnum.Blade1 ? "Blade1" : "Blade2")}");
IsPicking = false;
return Result.RUN;
}
public override void Abort()
{
_tm.CloseAllVentPumpValue();
if (!IsPicking)
{
RobotDevice.Stop();
}
Notify("Abort");
}
public override Result Monitor()
{
try
{
WaitSlitValveOpenInterlock((int)RoutineStep.WaitOpenSlitValveInterlock, TMDevice.GetSlitValve(_target), _pickTimeout);
RobotGotoNotWait((int)RoutineStep.RobotGotoNotWait, RobotDevice, _target, _targetSlot, _blade, _pickTimeout);
if(!ModuleHelper.IsBuffer(_target))
{
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _openSlitValveRoutine);
}
CheckRobotReady((int)RoutineStep.CheckRobotReady, RobotDevice, _pickTimeout);
CheckBeforePick((int)RoutineStep.CheckBeforePick, _target, _targetSlot, _blade);
RobotRequestWaferPresent((int)RoutineStep.BeforePickRequestWaferPresent, RobotDevice, _blade, _pickTimeout);
CheckWaferInfoByRobotRQ((int)RoutineStep.AfterPickCheckWaferInfoByRobotSensor, RobotDevice, _blade, 1000);
WaitPMReadySensor((int)RoutineStep.WaitPMSensor, _target,5);
SetRobortExtendToDO((int)RoutineStep.SetRobortExtendToDo, _target, 2);
CheckRobotReady((int)RoutineStep.CheckRobotReady, RobotDevice, _pickTimeout);
Pick((int)RoutineStep.Pick, RobotDevice, _target, _targetSlot, _blade, _pickTimeout);
IsPicking = false;
TimeDelay((int)RoutineStep.TimeDelay2, 1);
RobotRequestWaferPresent((int)RoutineStep.RequestWaferPresent, RobotDevice, _blade, _pickTimeout);
CheckWaferInfoByRobotRQ((int)RoutineStep.CheckWaferInfoByRobotSensor, RobotDevice, _blade, 1000);
if (_requestAWCData)
{
RobotRequestWaferAWCData((int)RoutineStep.RequestAWCData, RobotDevice, _pickTimeout);
}
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
if (!ModuleHelper.IsBuffer(_target))
{
ExecuteRoutine((int)RoutineStep.CloseSlitValve, _closeSlitValveRoutine);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
RobotDevice.Stop();
return Result.FAIL;
}
Notify($"Finished, Pick from {_target} slot {_targetSlot + 1}, by {_blade}");
return Result.DONE;
}
}
}
@@ -0,0 +1,300 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
using SicModules.LLs.Routines;
namespace SicModules.TMs.Routines
{
public class TMRobotPlaceRoutine : TMBaseRoutine
{
enum RoutineStep
{
WaitOpenSlitValveInterlock,
OpenSlitValve,
CheckBeforePlace,
Place,
PrepareTransfer,
Extend,
Handoff,
HandoffDelay,
Retract,
UpdateWaferInfoByHandoff,
RequestWaferPresent,
BeforePlaceRequestWaferPresent,
AfterPlaceRequestWaferPresent,
CheckWaferInfoByRobotSensor,
BeforePlaceCheckWaferInfoByRobotSensor,
AfterPlaceCheckWaferInfoByRobotSensor,
RequestAWCData,
SetRobortExtendToDo,
ClearRobortExtendToDo,
WaitCloseSlitValveInterlock,
CloseSlitValve,
WaitPMSensor,
PostTransfer,
OpenShutter,
CloseShutter,
Delay1,
Delay2,
VceMoveToSlot,
RobotGotoNotWait,
PrepareTransferNotWait,
CheckRobotReady,
CheckTransferPrepared,
LoadRatation,
TrayClamp,
TrayUnClamp,
TimeDelay1,
TimeDelay2,
TimeDelay3,
SuspectorCheck
}
private ModuleName _target;
private int _targetSlot;
private RobotArmEnum _blade;
private int _placeTimeout;
private int _postTransferTimeout;
private bool _requestAWCData;
private double _shutterAndSlitValveMotionInterval;
private bool _autoHand;
private TMSlitValveRoutine _openSlitValveRoutine = new TMSlitValveRoutine();
private TMSlitValveRoutine _closeSlitValveRoutine = new TMSlitValveRoutine();
//private VCEMoveToSlotRoutine _vceMoveToSlotRoutine;
private LoadRotationHomeOffsetRoutine loadRotationHomeRoutine = new LoadRotationHomeOffsetRoutine();
private LoadLockTrayClawRoutine _trayClamp = new LoadLockTrayClawRoutine();
private LoadLockTrayClawRoutine _trayUnClamp = new LoadLockTrayClawRoutine();
private bool _isShutterAndSlitValveMotionOneByOne;
private SicTM _tm;
public TMRobotPlaceRoutine()
{
Module = "TMRobot";
Name = "Place";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ ModuleName.TM.ToString()}");
}
public void Init(ModuleName target, int targetSlot, RobotArmEnum blade)
{
Init(target, targetSlot, blade, false);
}
public void Init(ModuleName target, int targetSlot, int blade)
{
Init(target, targetSlot, blade == 0 ? RobotArmEnum.Blade1 : RobotArmEnum.Blade2, false);
}
public void Init(ModuleName target, int targetSlot)
{
Init(target, targetSlot, RobotArmEnum.Blade1, true);
}
private void Init(ModuleName target, int targetSlot, RobotArmEnum blade, bool autoHand)
{
_autoHand = autoHand;
_target = target;
_targetSlot = targetSlot;
_blade = blade;
_openSlitValveRoutine.Init(target.ToString(), true);
_closeSlitValveRoutine.Init(target.ToString(), false);
}
public override Result Start(params object[] objs)
{
Reset();
if (RobotDevice.RobotState != RobotStateEnum.Idle)
{
EV.PostWarningLog(Module, $"Can not place, TMRobot Is Not IDLE");
return Result.FAIL;
}
_placeTimeout = SC.GetValue<int>("TMRobot.PlaceTimeout");
_requestAWCData = SC.GetValue<bool>("System.RequestAWCDataAfterPlace");
if (!WaferManager.Instance.CheckNoTray(_target, _targetSlot))
{
EV.PostWarningLog(Module, $"Can not place, should no tray at {_target}, {_targetSlot + 1}");
return Result.FAIL;
}
if (_autoHand)
{
if (WaferManager.Instance.CheckHasWafer(Module, 0))
{
_blade = RobotArmEnum.Blade1;
}
else if (WaferManager.Instance.CheckHasWafer(Module, 1))
{
_blade = RobotArmEnum.Blade2;
}
else
{
EV.PostWarningLog(Module, $"Can not place, Robot both arm no wafer");
return Result.FAIL;
}
}
int slot = _blade == RobotArmEnum.Blade1 ? 0 : 1;
if (WaferManager.Instance.CheckNoTray(ModuleHelper.Converter(Module), slot))
{
EV.PostWarningLog(Module, $"Can not place, Robot arm {slot + 1} no tray");
return Result.FAIL;
}
//顶针必须在低位
// if (_target == ModuleName.LoadLock || _target == ModuleName.Load)
// {
// if (!LoadLift.IsDown)
// {
// EV.PostWarningLog(Module, $"Can not place, Load Lift must in down Position!");
// return Result.FAIL;
// }
// }
// else if (_target == ModuleName.UnLoad)
// {
// if (!UnLoadLift.IsDown)
// {
// EV.PostWarningLog(Module, $"Can not place, UnLoad Lift must in down Position!");
// return Result.FAIL;
// }
// }
//Place之前先,根据Sensor检测是否有盘
if (!SC.GetValue<bool>("System.IsSimulatorMode"))
{
if (_target ==ModuleName.LoadLock&& SensorLLTrayPresence.Value)
{
EV.PostWarningLog(Module, $"Can not place, LLTrayPresence sensor has tray");
return Result.FAIL;
}
//if (_target == ModuleName.UnLoad && SensorUnloadWaferPresence.Value)
//{
// EV.PostWarningLog(Module, $"Can not place, UnloadWaferPresence sensor has wafer");
// return Result.FAIL;
//}
if (ModuleHelper.IsBuffer(_target) && _targetSlot == 2&& SensorBufferHighWaferPresence.Value)
{
EV.PostWarningLog(Module, $"Can not place,BufferHighWaferPresence sensor check has wafer");
return Result.FAIL;
}
if (ModuleHelper.IsBuffer(_target) && _targetSlot == 1&& SensorBufferMiddleWaferPresence.Value)
{
EV.PostWarningLog(Module, $"Can not place,BufferMiddleWaferPresence sensor check has wafer");
return Result.FAIL;
}
if (ModuleHelper.IsBuffer(_target) && _targetSlot == 0&& SensorBufferLowWaferPresence.Value)
{
EV.PostWarningLog(Module, $"Can not place,BufferLowWaferPresence sensor check has wafer");
return Result.FAIL;
}
}
// _trayClamp.Init(true);
// _trayUnClamp.Init(false);
Notify($"Start, Place to {_target} slot {_targetSlot + 1}, by {(_blade == RobotArmEnum.Blade1 ? "Blade1" : "Blade2")}");
return Result.RUN;
}
public override void Abort()
{
_tm.CloseAllVentPumpValue();
if (!IsPicking)
{
RobotDevice.Stop();
}
Notify("Abort");
}
public override Result Monitor()
{
try
{
WaitSlitValveOpenInterlock((int)RoutineStep.WaitOpenSlitValveInterlock, TMDevice.GetSlitValve(_target), _placeTimeout);
RobotGotoNotWait((int)RoutineStep.RobotGotoNotWait, RobotDevice, _target, _targetSlot, _blade, _placeTimeout);
if (!ModuleHelper.IsBuffer(_target))
{
ExecuteRoutine((int)RoutineStep.OpenSlitValve, _openSlitValveRoutine);
}
//如果是PM腔,放盘前检查传感器DI_ReactorSuspectorCheck
//如果有,则不能放盘
if (ModuleHelper.IsPm(_target))
{
CheckReactorSuspector((int)RoutineStep.SuspectorCheck,_target);
}
CheckRobotReady((int)RoutineStep.CheckRobotReady, RobotDevice, _placeTimeout);
CheckBeforePlace((int)RoutineStep.CheckBeforePlace, _target, _targetSlot, _blade);
RobotRequestWaferPresent((int)RoutineStep.BeforePlaceRequestWaferPresent, RobotDevice, _blade, _placeTimeout);
CheckWaferInfoByRobotRQ((int)RoutineStep.BeforePlaceCheckWaferInfoByRobotSensor, RobotDevice, _blade, 10);
WaitPMReadySensor((int)RoutineStep.WaitPMSensor, _target, 5);
SetRobortExtendToDO((int)RoutineStep.SetRobortExtendToDo, _target, 2);
CheckRobotReady((int)RoutineStep.CheckRobotReady, RobotDevice, _placeTimeout);
Place((int)RoutineStep.Place, RobotDevice, _target, _targetSlot, _blade, _placeTimeout);
IsPicking = false;
TimeDelay((int)RoutineStep.TimeDelay1, 1);
RobotRequestWaferPresent((int)RoutineStep.RequestWaferPresent, RobotDevice, _blade, _placeTimeout);
CheckWaferInfoByRobotRQ((int)RoutineStep.CheckWaferInfoByRobotSensor, RobotDevice, _blade, 10);
if (_requestAWCData)
{
RobotRequestWaferAWCData((int)RoutineStep.RequestAWCData, RobotDevice, _placeTimeout);
}
ClearRobortExtendToDO((int)RoutineStep.ClearRobortExtendToDo);
TimeDelay((int)RoutineStep.TimeDelay2, 1);
// if (_target == ModuleName.Load || _target == ModuleName.LoadLock)
// {
// //对中
// ExecuteRoutine((int)RoutineStep.TrayClamp, _trayClamp); //夹爪关闭
// TimeDelay((int)RoutineStep.TimeDelay3, 1);//延迟1s
// ExecuteRoutine((int)RoutineStep.TrayUnClamp, _trayUnClamp); //夹爪打开
// //ExecuteRoutine((int)RoutineStep.LoadRatation, loadRotationHomeRoutine);
// }
if (!ModuleHelper.IsBuffer(_target))
{
ExecuteRoutine((int)RoutineStep.CloseSlitValve, _closeSlitValveRoutine);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
RobotDevice.Stop();
return Result.FAIL;
}
Notify($"Finish, Place to {_target} slot {_targetSlot + 1}, by {_blade}");
return Result.DONE;
}
}
}
@@ -0,0 +1,115 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Schedulers;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
namespace SicModules.TMs.Routines
{
public class TMRobotRetractRoutine : TMBaseRoutine
{
enum RoutineStep
{
CheckBeforeRetract,
Retract,
WaitCloseSlitValveInterlock,
CloseSlitValve,
}
private ModuleName _source;
private int _sourceSlot;
private Hand _blade;
private int _timeout;
private TMSlitValveRoutine _closeSlitValveRoutine = new TMSlitValveRoutine();
public TMRobotRetractRoutine()
{
Module = "TMRobot";
Name = "Retract";
}
public void Init(ModuleName source, int sourceSlot, Hand blade)
{
_source = source;
_sourceSlot = sourceSlot;
_blade = blade;
_closeSlitValveRoutine.Init(source.ToString(), false);
}
public void Init(ModuleName source, int sourceSlot, int blade)
{
Init(source, sourceSlot, (Hand)blade);
}
public override Result Start(params object[] objs)
{
Reset();
_timeout = SC.GetValue<int>("TMRobot.RetractTimeout");
if (ModuleHelper.IsLoadLock(_source))
{
LoadLock ll = DEVICE.GetDevice<LoadLock>($"{_source.ToString()}.{_source.ToString()}");
if (!ll.CheckEnableTransfer(EnumTransferType.Extend))
{
EV.PostWarningLog(Module, $"can not retract, {_source} not ready for transfer");
return Result.FAIL;
}
}
if (ModuleHelper.IsPm(_source))
{
PM pm = DEVICE.GetDevice<PM>(_source.ToString());
if (!pm.CheckEnableTransfer(EnumTransferType.Retract, out string reason))
{
EV.PostWarningLog(Module, $"can not retract, {_source} reason");
return Result.FAIL;
}
}
Notify($"Start, retract from {_source} slot {_sourceSlot + 1} with {_blade}");
return Result.RUN;
}
public override void Abort()
{
Notify("Abort");
}
public override Result Monitor()
{
try
{
// Retract((int)RoutineStep.Retract, RobotDevice, _source, _sourceSlot, _blade, _timeout);
WaitSlitValveCloseInterlock((int)RoutineStep.WaitCloseSlitValveInterlock, TMDevice.GetSlitValve(_source), _timeout);
ExecuteRoutine((int)RoutineStep.CloseSlitValve, _closeSlitValveRoutine);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finish, retract from {_source} slot {_sourceSlot + 1} with {_blade}");
return Result.DONE;
}
}
}
@@ -0,0 +1,102 @@
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;
namespace SicModules.TMs.Routines
{
public class TMServoRoutine : TMBaseRoutine
{
enum RoutineStep
{
ChamberBalance,
OpenTMToLLVent,
CheckPressureCondition,
SetSlitValve,
LLRoutine,
Delay,
Delay1,
CloseTMToLLVent,
PumpDownToBase,
}
private TMPressureBalanceRoutine _balanceRoutine;
private SicTM _tm;
private bool _needPressureBalance;
public TMServoRoutine()
{
Module = ModuleName.TM.ToString();
Name = "ServoPressure";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ ModuleName.TM.ToString()}");
}
public override Result Start(params object[] objs)
{
Reset();
_balanceRoutine = new TMPressureBalanceRoutine();
_balanceRoutine.Init(ModuleName.PM1);
_needPressureBalance = SC.GetValue<bool>("TM.NeedPressureBalance");
ModuleName[] modules = new ModuleName[] { ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2};
foreach (var moduleName in modules)
{
if (!_tm.CheckSlitValveClose(moduleName))
{
EV.PostAlarmLog(Module, $"Can not pump, {moduleName} slit valve not closed");
return Result.FAIL;
}
}
string reason;
if (!_tm.SetFastPumpValve(false, out reason) || !_tm.SetFastVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (SC.GetValue<bool>("System.IsATMMode"))
{
return Result.DONE;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
ExecuteRoutine((int)RoutineStep.ChamberBalance, _balanceRoutine);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
_balanceRoutine.Abort();
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,260 @@
using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Temps.P116PIDTC;
using SicModules.Devices;
using SicModules.LLs;
namespace SicModules.TMs.Routines
{
public class TMVentRoutine : TMBaseRoutine
{
enum RoutineStep
{
CloseTurboPumpValves, //Fast pump, backing valve, iso valve
CloseValveDelay,
TurboPumpOff,
Vent,
VentDelay,
CloseVentValves,
CloseVentValveDelay,
TimeDelay,
OpenV80,
CloseV80,
CloseV81,
CloseV82,
SetMFC1,
SetMFC2,
OpenSlowVent,
OpenFastVent,
OpenVent,
TimeStayATM,
CloseSlowVent
}
private double _ventBasePressure;
private double _slowFastVentSwitchPressure;
private int _ventTimeOut;
private int _ventDelayTime;
private bool _useSettingValue;
private int _routineTimeOut;
private double _bufferMaxTemp;
private SicTM _tm;
private IoSensor _bufferLid;
private IoSensor _tmLid;
private Devices.IoPump _pumpType;
private LoadLock _ll;
private IoSensor _preHeatLid;
private IoMFC _mfc60;
private IoInterLockEx _tmIoInterLock;
private P116PIDTC _p116PIDTC;
private double _mfc60Default1;
private double _mfc60Default2;
private Stopwatch _swTimer = new Stopwatch();
public TMVentRoutine( )
{
Module = ModuleName.TM.ToString();
Name = "Vent";
_tm = DEVICE.GetDevice<SicTM>($"{ ModuleName.System.ToString()}.{ Module}");
_ll = DEVICE.GetDevice<SicLoadLock>($"LoadLock.LoadLock");
_bufferLid = DEVICE.GetDevice<IoSensor>($"Buffer.BufferLidClosed");
_tmLid = DEVICE.GetDevice<IoSensor>($"TM.TMLidClosed");
_pumpType = DEVICE.GetDevice<Devices.IoPump>($"TM.TMPump1");
_preHeatLid = DEVICE.GetDevice<IoSensor>($"TM.PreHeatStationLidClosed");
_mfc60 = DEVICE.GetDevice<IoMFC>($"TM.Mfc60");
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
_p116PIDTC = DEVICE.GetDevice<P116PIDTC>("TM.P116PIDTC");
}
public void Init()
{
_useSettingValue = false;
}
public void Init(double basePressure, int ventDelayTime)
{
_ventBasePressure = basePressure;
_ventDelayTime = ventDelayTime;
_useSettingValue = true;
}
public bool Initalize()
{
return true;
}
public override Result Start(params object[] objs)
{
Reset();
string reason;
if (!_tm.SetSlowPumpValve(false, out reason) || !_tm.SetFastPumpValve(false, out reason) )
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (_tm.CheckAtm())
{
EV.PostInfoLog(Module, $"{_tm.Module} in atm, vent skipped");
return Result.DONE;
}
////Buffer温度超过设定值TM不能Vent
//_bufferMaxTemp = SC.GetValue<double>("TM.Vent.BufferMaxTemp");
//if(_p116PIDTC.fPVInValue >= _bufferMaxTemp)
//{
// EV.PostWarningLog(Module, $"Can not vent, Buffer Temp more than {_bufferMaxTemp}");
// return Result.FAIL;
//}
ModuleName[] modules = new ModuleName[] { ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2 };
foreach (var moduleName in modules)
{
if (!_tm.CheckSlitValveClose(moduleName))
{
EV.PostAlarmLog(Module, $"Can not vent, {moduleName} slit valve not closed");
return Result.FAIL;
}
}
_routineTimeOut = SC.GetValue<int>("TM.Vent.RoutineTimeOut");
_mfc60Default1 = SC.GetValue<double>("TM.Vent.Mfc60Default1");
_mfc60Default2 = SC.GetValue<double>("TM.Vent.Mfc60Default2");
_slowFastVentSwitchPressure = SC.GetValue<double>("TM.Vent.SlowFastVentSwitchPressure");
_ventTimeOut = SC.GetValue<int>("TM.Vent.VentTimeout");
if (!_useSettingValue)
{
_ventBasePressure = SC.GetValue<double>("TM.Vent.VentBasePressure");
_ventDelayTime = SC.GetValue<int>("TM.Vent.VentDelayTime");
}
if (!_bufferLid.Value)
{
EV.PostAlarmLog(Module, $"Can not vent,Buffer lid is not open");
return Result.FAIL;
}
if (!_tmLid.Value)
{
EV.PostAlarmLog(Module, $"Can not vent,TM lid is not open");
return Result.FAIL;
}
if (_pumpType.IsAlarm)
{
EV.PostAlarmLog(Module, $"can not vent,TM pump alarm");
return Result.FAIL;
}
if (!_pumpType.IsRunning)
{
EV.PostAlarmLog(Module, $"can not vent,TM pump is not running");
return Result.FAIL;
}
if (!_tm.SetTmToLLVent(false, out _))
{
EV.PostAlarmLog(Module, $"can not vent,can not close v85!");
}
if (!_tmIoInterLock.SetTMVentRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not vent,{reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V81
CloseFastPump((int)RoutineStep.CloseV81);
//关闭V82
CloseSlowPump((int)RoutineStep.CloseV82);
//设定MFC60慢充流量
SetMFCToSetPoint((int)RoutineStep.SetMFC1, _mfc60, _mfc60Default1);
////打开V77,等待压力大于200mbar
//OpenSlowVent((int)RoutineStep.OpenSlowVent, _tm, _slowFastVentSwitchPressure, _slowVentTimeout);
////设定MFC60快充流量
//SetMFCToSetPoint((int)RoutineStep.SetMFC2, _mfc60, _mfc60Default2);
////等待压力大于1020mbar
//OpenFastVent((int)RoutineStep.OpenFastVent, _tm, _ventBasePressure, _fastVentTime);
//充气过程中检查是否到达打开快充流量的条件
OpenVent((int)RoutineStep.OpenVent, _tm, _ventBasePressure, _slowFastVentSwitchPressure, _mfc60Default2, _ventTimeOut);
//等待5s
TimeDelay((int)RoutineStep.TimeStayATM, _ventDelayTime);
//关闭V77
CloseSlowVentValve((int)RoutineStep.CloseSlowVent, _tm);
//关闭V80
//CloseBufferVent((int)RoutineStep.CloseV80);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
_tm.SetFastVentValve(false, out _);
_tm.SetSlowVentValve(false, out _);
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_tmIoInterLock.DoTmVentUpRoutineRunning = false;
return Result.DONE;
}
public override void Abort()
{
_tmIoInterLock.DoTmVentUpRoutineRunning = false;
//_tm.SetFastVentValve(false, out _);
//_tm.SetSlowVentValve(false, out _);
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,152 @@
using System;
using System.Threading;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadLocks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
namespace SicModules.TMs.Routines
{
public class TMVerifySlitValveRoutine : ModuleRoutine, IRoutine
{
enum RoutineStep
{
VerifySlitValve,
}
private TM _tm;
public TMVerifySlitValveRoutine() : base(ModuleName.TM.ToString())
{
Module = ModuleName.TM.ToString();
Name = "Verify Slit Valve Status";
_tm = DEVICE.GetDevice<TM>($"{ ModuleName.System.ToString()}.{ Module}");
}
public void Init()
{
}
public Result Start(params object[] objs)
{
Reset();
Notify("Start");
return Result.RUN;
}
public Result Monitor()
{
try
{
VerifySlitValve((int)RoutineStep.VerifySlitValve, _tm);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public void Abort()
{
}
public void VerifySlitValve(int id, TM tm)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Check slot valve status {tm.Name}");
ModuleName[] lstModule = new ModuleName[] { ModuleName.LoadLock, ModuleName.PM1, ModuleName.PM2 };
foreach (var moduleName in lstModule)
{
if (_tm.CheckSlitValveOpen(moduleName))
{
if (!CheckPressureCondition(tm, moduleName.ToString(), out string reason))
{
EV.PostWarningLog(Module, $"Can not set {moduleName} slit valve open, {reason}");
continue;
}
if (!_tm.SetSlitValve(moduleName, true, out reason))
{
EV.PostWarningLog(Module, $"Can not set {moduleName} slit valve open, {reason}");
}
}
else
{
if (_tm.CheckSlitValveClose(moduleName))
{
if (!_tm.SetSlitValve(moduleName, false, out string reason))
{
EV.PostWarningLog(Module, $"Can not set {moduleName} slit valve close, {reason}");
}
}
}
Thread.Sleep(500);
}
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
public bool CheckPressureCondition( TM tm, string target, out string reason)
{
reason = string.Empty;
double tmPressure = tm.ChamberPressure;
double targetPressure = 0.0;
if (ModuleHelper.IsLoadLock(target))
{
LoadLock ll = DEVICE.GetDevice<LoadLock>($"{target}.{target}");
targetPressure = ll.ChamberPressure;
}
else if (ModuleHelper.IsPm(target))
{
PM pm = DEVICE.GetDevice<PM>(target);
targetPressure = pm.ChamberPressure;
}
else
{
reason = ($"{target} not define pressure condition");
return false;
}
double maxPressureDiffOpenSlitValve = SC.GetValue<double>("TM.MaxPressureDiffOpenSlitValve");
double pressureDiff = Math.Abs(tmPressure - targetPressure);
if (pressureDiff > maxPressureDiffOpenSlitValve)
{
reason = ($"pressure difference {pressureDiff:F3} between TM and {target} exceed tolerance {maxPressureDiffOpenSlitValve}");
return false;
}
return true;
}
}
}
+522
View File
@@ -0,0 +1,522 @@
using System;
using System.Collections.Generic;
using System.Xml;
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.IOCore;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
namespace SicModules.TMs
{
public class SicTM : TM
{
private Dictionary<ModuleName, bool> _slitValveInstalled = new Dictionary<ModuleName, bool>();
private Dictionary<ModuleName, IoSlitValve> _slitValves = new Dictionary<ModuleName, IoSlitValve>();
private IoValve _ventValveV77;
private IoValve _pumpValveV81;
private IoValve _pumpSlowValveV82;
private IoValve _bufferVentValveV80;
//四个联通阀
private IoValve _tmLoadBanlance_V85;
private IoValve _tmUnLoadBanlance_V124;
private IoValve _tmPMABanlance_V70_1;
//private IoValve _tmPMABanlance_V70_2;
//private IoPressureMeter3 _forelineGuage_PS7;
private IoPressureMeter3 _chamberGuage_TM;
private IoPressureMeter3 _loadLockGuage_PT3;
private IoPressureMeter3 _unLoadGuage;
private IoPressureMeter3 _pm1Pressure2;
private IoPressureMeter3 _pm2Pressure2;
private IoInterLock _tmIoInterLock;
private Aitex.Core.RT.Device.Devices.IoInterLock _pm1InterLock;
private Aitex.Core.RT.Device.Devices.IoInterLock _pm2InterLock;
private IoMFC _tmMfc;
public AIAccessor AILoadLockTempAlarm { get; set; }
public AIAccessor AIBufferTempAlarm { get; set; }
private SCConfigItem _scMaxPressureDiffOpenSlitValve;
private SCConfigItem _scLoadLockWarnTemp;
private SCConfigItem _scBufferWarnTemp;
private R_TRIG _loadLoakTempAlarmTrig = new R_TRIG();
private R_TRIG _bufferTempAlarmTrig = new R_TRIG();
public override double ChamberPressure
{
get
{
return _chamberGuage_TM.Value;
}
}
public double LoadLockPressure
{
get
{
return _loadLockGuage_PT3.Value;
}
}
public double UnLoadPressure
{
get
{
return _unLoadGuage.Value;
}
}
public override double PM1Pressure2
{
get
{
return _pm1Pressure2.Value;
}
}
public override double PM2Pressure2
{
get
{
return _pm2Pressure2.Value;
}
}
//public override double ForelinePressure
//{
// get
// {
// return _forelineGuage_PS7.Value;
// }
//}
public SicTM(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");
AILoadLockTempAlarm = ParseAiNode("aiLLTemp", node, ioModule);
AIBufferTempAlarm = ParseAiNode("aiBufferTemp", node, ioModule);
_scMaxPressureDiffOpenSlitValve = ParseScNode("MaxPressureDiffOpenSlitValve", node, "TM", "TM.MaxPressureDiffOpenSlitValve");
_scLoadLockWarnTemp = ParseScNode("MaxPressureDiffOpenSlitValve", node, "TM", "TM.LoadLockWarnTemp");
_scBufferWarnTemp = ParseScNode("MaxPressureDiffOpenSlitValve", node, "TM", "TM.BufferWarnTemp");
}
public void GetSlitValves(Dictionary<string, object> dict)
{
foreach (var item in _slitValves)
dict[$"SlitValves.{item.Key.ToString()}"] = ((IoSlitValve)item.Value).State;
}
public override IoSlitValve GetSlitValve(ModuleName module)
{
if (_slitValves.ContainsKey(module))
{
return _slitValves[module];
}
return null;
}
public override bool Initialize()
{
_slitValves[ModuleName.PM1] = DEVICE.GetDevice<IoSlitValve>("TM.PM1Door");
_slitValves[ModuleName.PM2] = DEVICE.GetDevice<IoSlitValve>("TM.PM2Door");
_slitValves[ModuleName.UnLoad] = DEVICE.GetDevice<IoSlitValve>("TM.UnLoadDoor");
_slitValves[ModuleName.LoadLock] = DEVICE.GetDevice<IoSlitValve>("TM.LoadLockDoor");
_slitValves[ModuleName.Buffer] = DEVICE.GetDevice<IoSlitValve>("TM.BufferDoor");
_slitValveInstalled[ModuleName.PM1] = SC.GetValue<bool>("TM.PM1SlitValveEnabled");
_slitValveInstalled[ModuleName.PM2] = SC.GetValue<bool>("TM.PM2SlitValveEnabled");
_slitValveInstalled[ModuleName.UnLoad] = SC.GetValue<bool>("TM.UnLoadSlitValveEnabled");
_slitValveInstalled[ModuleName.LoadLock] = SC.GetValue<bool>("TM.LoadLockSlitValveEnabled");
_slitValveInstalled[ModuleName.Buffer] = SC.GetValue<bool>("TM.BufferSlitValveEnabled");
_ventValveV77 = DEVICE.GetDevice<IoValve>("TM.TMVent");
_pumpValveV81 = DEVICE.GetDevice<IoValve>("TM.TMFastPump");
_pumpSlowValveV82 = DEVICE.GetDevice<IoValve>("TM.TMSlowPump");
_tmLoadBanlance_V85 = DEVICE.GetDevice<IoValve>("TM.TMLoadBanlance");
_tmUnLoadBanlance_V124 = DEVICE.GetDevice<IoValve>("TM.TMUnLoadBanlance");
_tmPMABanlance_V70_1 = DEVICE.GetDevice<IoValve>("PM1.V70");
//_tmPMABanlance_V70_2 = DEVICE.GetDevice<IoValve>("TM.TMPMBBanlance");
_bufferVentValveV80 = DEVICE.GetDevice<IoValve>("TM.BufferVent");
_chamberGuage_TM = DEVICE.GetDevice<IoPressureMeter3>("TM.TMPressure");
//_forelineGuage_PS7 = DEVICE.GetDevice<IoPressureMeter3>("TM.ForelinePressure");
_loadLockGuage_PT3 = DEVICE.GetDevice<IoPressureMeter3>("TM.LLPressure");
_unLoadGuage = DEVICE.GetDevice<IoPressureMeter3>("TM.UnLoadPressure");
_pm1Pressure2 = DEVICE.GetDevice<IoPressureMeter3>("TM.PM1Pressure2");
_pm2Pressure2 = DEVICE.GetDevice<IoPressureMeter3>("TM.PM2Pressure2");
_tmMfc = DEVICE.GetDevice<IoMFC>("TM.Mfc60");
_tmIoInterLock = DEVICE.GetDevice<IoInterLock>("TM.IoInterLock");
_pm1InterLock = DEVICE.GetDevice<Aitex.Core.RT.Device.Devices.IoInterLock>("PM1.PMInterLock");
_pm2InterLock = DEVICE.GetDevice<Aitex.Core.RT.Device.Devices.IoInterLock>("PM2.PMInterLock");
return base.Initialize();
}
public override bool CheckAtm()
{
return _chamberGuage_TM.FeedBack >= SC.GetValue<double>("TM.AtmPressureBase");
}
public override bool CheckVacuum()
{
return _chamberGuage_TM.FeedBack <= SC.GetValue<double>("TM.VacuumPressureBase");
}
public override void Monitor()
{
//增加过冲关闭Vent阀门
if (_chamberGuage_TM.FeedBack >= SC.GetValue<double>("TM.VentMaxPressure") &&
SC.GetValue<double>("TM.VentMaxPressure") > SC.GetValue<double>("TM.AtmPressureBase"))
{
if (_ventValveV77.Status)
{
SetFastVentValve(false, out string reason);
}
}
_loadLoakTempAlarmTrig.CLK = AILoadLockTempAlarm != null && AILoadLockTempAlarm.Value >= _scLoadLockWarnTemp.DoubleValue;
if (_loadLoakTempAlarmTrig.Q)
{
EV.PostAlarmLog(Module, $"Waring 10 LoadLock Temp High");
}
_bufferTempAlarmTrig.CLK = AIBufferTempAlarm != null && AIBufferTempAlarm.Value >= _scBufferWarnTemp.DoubleValue;
if (_bufferTempAlarmTrig.Q)
{
EV.PostAlarmLog(Module, $"Waring 11 Buffer Temp High");
}
}
public override void Reset()
{
_loadLoakTempAlarmTrig.RST = true;
_bufferTempAlarmTrig.RST = true;
}
public override bool SetSlitValve(ModuleName module, bool isOpen, out string reason)
{
reason = "";
System.Diagnostics.Debug.Assert(_slitValves.ContainsKey(module), $" {module} has no slit valve");
if (!_slitValveInstalled[module])
{
reason = string.Empty;
return true;
}
string open = isOpen ? "Open" : "Close";
EV.PostInfoLog(Module, $"Set {module} slit valve {open}");
if (module == ModuleName.LoadLock && isOpen == true)
{
if (Math.Abs(_loadLockGuage_PT3.Value - _chamberGuage_TM.Value) > _scMaxPressureDiffOpenSlitValve.DoubleValue)
{
EV.PostAlarmLog(Module, $"Can not set {module} slit valve {open},The pressure difference of {module} and TM is greater than { _scMaxPressureDiffOpenSlitValve.DoubleValue}");
return false;
}
}
//检查InterLock
if (!SC.GetConfigItem("PM.PM1.BypassInterlock").BoolValue && (module == ModuleName.PM1 || module == ModuleName.PMA) )
{
if (!isOpen)
{
if (_pm1InterLock != null && _pm1InterLock.DiChamLidClosed == false)
{
EV.PostAlarmLog(Module, $"Can not set {module} slit valve {open},InterLock check failed [DI-00(PM1)] ");
return false;
}
}
}
if (!SC.GetConfigItem("PM.PM2.BypassInterlock").BoolValue && (module == ModuleName.PM2 || module == ModuleName.PMB))
{
if (!isOpen)
{
if (_pm2InterLock != null && _pm2InterLock.DiChamLidClosed == false)
{
EV.PostAlarmLog(Module, $"Can not set {module} slit valve {open},InterLock check failed [DI-00(PM2)] ");
return false;
}
}
}
return _slitValves[module].SetSlitValve(isOpen, out reason);
}
public override bool CheckSlitValveOpen(ModuleName module)
{
System.Diagnostics.Debug.Assert(_slitValves.ContainsKey(module), $" {module} has no slit valve");
if (!_slitValveInstalled[module])
return false;
return _slitValves[module].IsOpen;
}
public override bool CheckSlitValveClose(ModuleName module)
{
System.Diagnostics.Debug.Assert(_slitValves.ContainsKey(module), $" {module} has no slit valve");
if (!_slitValveInstalled[module])
return true;
return _slitValves[module].IsClose;
}
public override bool SetFastPumpValve(bool isOpen, out string reason)
{
return _pumpValveV81.TurnValve(isOpen, out reason);
}
public override bool SetFastVentValve(bool isOpen, out string reason)
{
return _ventValveV77.TurnValve(isOpen, out reason);
}
public override bool SetSlowVentValve(bool isOpen, out string reason)
{
return _ventValveV77.TurnValve(isOpen, out reason);
}
public override bool SetBufferVentValve(bool isOpen, out string reason)
{
return _bufferVentValveV80.TurnValve(isOpen, out reason);
}
public override bool SetSlowPumpValve(bool isOpen, out string reason)
{
return _pumpSlowValveV82.TurnValve(isOpen, out reason);
}
public bool CheckSlowPumpValve(bool isOpen)
{
if (isOpen)
{
if (!_ventValveV77.Status)
return false;
}
else
{
if (_ventValveV77.Status)
return false;
}
return true;
}
public bool CheckSlowVentValve(bool isOpen)
{
if (isOpen)
{
if (!_ventValveV77.Status)
return false;
}
else
{
if (_ventValveV77.Status)
return false;
}
return true;
}
public bool CloseAllVentPumpValue()
{
_pumpSlowValveV82.TurnValve(false, out string reason);
_pumpValveV81.TurnValve(false, out reason);
_ventValveV77.TurnValve(false, out reason);
_tmLoadBanlance_V85.TurnValve(false, out reason);
_tmPMABanlance_V70_1.TurnValve(false, out reason);
_tmUnLoadBanlance_V124.TurnValve(false, out reason);
return true;
}
public override bool SetTmToLLVent(bool isOpen, out string reason)
{
return _tmLoadBanlance_V85.TurnValve(isOpen, out reason);
}
public override bool SetTmToUnLoadVent(bool isOpen, out string reason)
{
return _tmUnLoadBanlance_V124.TurnValve(isOpen, out reason);
}
public bool SetPIDValve(bool isOpen, out string reason)
{
if (!_ventValveV77.TurnValve(isOpen, out reason))
return false;
//if (!_roughBypassValve.TurnValve(isOpen, out reason))
// return false;
return true;
}
public bool CheckPIDValve(bool isOpen)
{
if (isOpen)
{
if (!_ventValveV77.Status)
return false;
//if (!_roughBypassValve.Status)
// return false;
}
else
{
if (_ventValveV77.Status)
return false;
//if (_roughBypassValve.Status)
// return false;
}
return true;
}
//public override bool SetTurboPumpIsoValve(bool isOpen, out string reason)
//{
// return _turboIsoValve.SetCylinder(isOpen, out reason);
//}
//public override bool SetTurboPumpBackingValve(bool isOpen, out string reason)
//{
// return _turboBackingValve.TurnValve(isOpen, out reason);
//}
//public override bool SetMfcVentValve(bool isOpen, out string reason)
//{
// return _ventValveV77.TurnValve(isOpen, out reason);
// //return _mfcValve.TurnValve(isOpen, out reason);
//}
//public override bool SetAllValves(bool isOpen, out string reason)
//{
// if (!SetTurboPumpBackingValve(isOpen, out reason))
// return false;
// if (!SetTurboPumpIsoValve(isOpen, out reason))
// return false;
// if (!SetFastVentValve(isOpen, out reason))
// return false;
// if (!SetFastPumpValve(isOpen, out reason))
// return false;
// if (!SetMfcVentValve(isOpen, out reason))
// return false;
// reason = string.Empty;
// return true;
//}
//public override bool SetVentMfc(double flow, out string reason)
//{
// // _mfc.Ramp(flow, 0);
// reason = string.Empty;
// return true;
//}
//public override bool SetVentMfcFullFlow(out string reason)
//{
// // _mfc.Ramp(_mfc.Scale, 0);
// reason = string.Empty;
// return true;
//}
//public override bool CheckTurboPumpStable()
//{
// return _turboPump.IsStable;
//}
//public override bool CheckTurboPumpOn()
//{
// return _turboPump.IsOn;
//}
//public override bool CheckTurboPumpOff()
//{
// return !_turboPump.IsOn;
//}
//public override bool CheckTurboPumpError()
//{
// return _turboPump.IsError;
//}
//public override bool TurboPumpOn()
//{
// _turboPump.SetPumpOnOff(true);
// return true;
//}
//public override bool TurboPumpOff()
//{
// _turboPump.SetPumpOnOff(false);
// return true;
//}
//public override bool CheckIsoValveClose()
//{
// return _turboIsoValve.CloseSetPoint && !_turboIsoValve.OpenSetPoint;
//}
//public override bool CheckIsoValveOpen()
//{
// return _turboIsoValve.OpenSetPoint && !_turboIsoValve.CloseSetPoint;
//}
public override bool SetVentMfc(double flow, out string reason)
{
reason = "";
_tmMfc.Ramp(flow, 0);
return true;
}
public override bool SetAllValvesClose(out string reason)
{
reason = string.Empty;
_ventValveV77.TurnValve(false, out reason);
_pumpValveV81.TurnValve(false, out reason);
_pumpSlowValveV82.TurnValve(false, out reason);
//_bufferVentValveV80.TurnValve(false, out reason);
_tmLoadBanlance_V85.TurnValve(false, out reason);
_tmUnLoadBanlance_V124.TurnValve(false, out reason);
_tmPMABanlance_V70_1.TurnValve(false, out reason);
//_tmPMABanlance_V70_2.TurnValve(false, out reason);
return true;
}
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.Xml;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.SiasunPhoenixB;
namespace SicModules.TMs
{
public class SicTMRobot : RobotSiasunPhoenixB
{
private ModuleName _module;
private static bool isSimulator = SC.GetConfigItem("System.IsSimulatorMode").BoolValue;
public SicTMRobot(string module, XmlElement node, string ioModule = "") : base("TMRobot", "TMRobot", "", isSimulator ? "\r" : "\r\n")
{
var attrModule = node.GetAttribute("module");
base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
base.Name = node.GetAttribute("id");
_module = ModuleHelper.Converter(Module);
}
}
}
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
using Aitex.Core.RT.Device;
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Fsm;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
namespace SicModules.TMs
{
public abstract class TMModuleBase : ModuleFsmDevice, ITransferRobot, IModuleDevice
{
private int _slot = 1;
public TMModuleBase(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);
//ITransferRobot
public abstract bool Pick(ModuleName target, Hand blade, int targetSlot, out string reason);
public abstract bool Place(ModuleName target, Hand blade, int targetSlot, out string reason);
public abstract bool PickAndPlace(ModuleName pickTarget, Hand pickHand, int pickSlot, ModuleName placeTarget, Hand placeHand, int placeSlot, out string reason);
public abstract bool Goto(ModuleName target, Hand blade, int targetSlot, out string reason);
}
}