首次上传

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
@@ -0,0 +1,409 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.EFEM;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.UnLoad;
using SicModules.Devices;
using SicModules.EFEMs;
using SicModules.TMs;
namespace SicModules.UnLoads.Routines
{
public class UnLoadBaseRoutine : ModuleRoutine, IRoutine
{
protected UnLoad UnLoadDevice
{
get { return _unLoad; }
}
protected TM TMDevice
{
get { return _tm; }
}
protected EFEM EFEMDevice
{
get { return _efem; }
}
protected IoClaw WaferClaw
{
get { return _ulWaferCyShuttle; }
}
protected IoLift4 Lift
{
get { return _ulLift; }
}
protected IoInterLockEx TmIoInterLock
{
get { return _tmIoInterLock; }
}
private UnLoad _unLoad = null;
private TM _tm = null;
private EFEM _efem = null;
private IoClaw _ulWaferCyShuttle;
private IoLift4 _ulLift;
private IoInterLockEx _tmIoInterLock;
public UnLoadBaseRoutine() : base(ModuleName.UnLoad.ToString())
{
Module = ModuleName.UnLoad.ToString();
_unLoad = DEVICE.GetDevice<SicUnLoad>($"{Module}.{Module}");
_tm = DEVICE.GetDevice<SicTM>($"{ModuleName.System}.{ModuleName.TM}");
_efem= DEVICE.GetDevice<SicEFEM>($"{ModuleName.EFEM}.{ModuleName.EFEM}");
_ulWaferCyShuttle= DEVICE.GetDevice<IoClaw>($"{Module}.UnLoadWaferClaw");
_ulLift = DEVICE.GetDevice<IoLift4>($"{Module}.UnLoadLift");
_tmIoInterLock = DEVICE.GetDevice<IoInterLockEx>("TM.IoInterLock");
}
public virtual void Abort()
{
UnLoadDevice.SetFastVentValve(false, out _);
UnLoadDevice.SetSlowPumpValve(false, out _);
UnLoadDevice.SetFastPumpValve(false, out _);
TmIoInterLock.SetUnloadVentRoutineRunning(false, out _);
TmIoInterLock.SetUnloadPumpRoutineRunning(false, out _);
TmIoInterLock.SetUnloadLeakCheckRoutineRunning(false, out _);
TmIoInterLock.SetUnloadPurgeRoutineRunning(false, out _);
}
public virtual Result Monitor()
{
return Result.DONE;
}
public virtual Result Start(params object[] objs)
{
return Result.RUN;
}
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 ClawMove(int id, IoClaw _claw, bool up, int timeout)
{
string note = up ? "Clawing" : "Opening";
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set {Module} {note}");
if (!_claw.SetValue(up, out string reason))
{
Stop($"Set {Module} {note} failed:" + reason);
return false;
}
return true;
}, () =>
{
return _claw.State == (up ? 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 SlowPump(int id, double switchPressure, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Open {UnLoadDevice.Name} slow pump valve to {switchPressure} mbar");
if (!UnLoadDevice.SetSlowPumpValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return UnLoadDevice.ChamberPressure <= switchPressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
UnLoadDevice.SetSlowPumpValve(false, out string _);
Stop($"{UnLoadDevice.Name} 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 {UnLoadDevice.Name} fast pump valve to {basePressure} mbar");
if (!UnLoadDevice.SetFastPumpValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return UnLoadDevice.ChamberPressure <= basePressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
UnLoadDevice.SetSlowPumpValve(false, out string _);
UnLoadDevice.SetFastPumpValve(false, out string _);
Stop($"{UnLoadDevice.Name} 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 {UnLoadDevice.Name} slow pump valve");
if (!UnLoadDevice.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 {UnLoadDevice.Name} fast pump valve");
if (!UnLoadDevice.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 {UnLoadDevice.Name} slow vent valve to {switchPressure} mbar");
if (!UnLoadDevice.SetSlowVentValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return UnLoadDevice.ChamberPressure >= switchPressure;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
UnLoadDevice.SetSlowVentValve(false, out string _);
Stop($"{UnLoadDevice.Name} 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 (!UnLoadDevice.SetSlowVentValve(true, out string reason))
{
Stop(reason);
return false;
}
return true;
}, () =>
{
return UnLoadDevice.ChamberPressure >= switchPressure - pressureDiff;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
UnLoadDevice.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 CloseVentValve(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close {UnLoadDevice.Name} slow vent valve");
if (!UnLoadDevice.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());
}
}
}
}
@@ -0,0 +1,73 @@
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.UnLoads.Routines
{
public class UnLoadClawRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
LiftMove,
ClawMove,
}
private bool _llCalw;
private int _clawMoveTimeOut = 30;
public UnLoadClawRoutine()
{
Name = "UnLoad Claw";
}
public void Init(bool isClaw)
{
_llCalw = isClaw;
}
public override Result Start(params object[] objs)
{
Reset();
if ((_llCalw && WaferClaw.State == ClawStateEnum.Clamp) || (!_llCalw && WaferClaw.State == ClawStateEnum.Open))
{
return Result.DONE;
}
_clawMoveTimeOut = SC.GetValue<int>("UnLoad.ClawMoveTimeOut");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//先动夹爪在动Lift
ClawMove((int)RoutineStep.ClawMove, WaferClaw, _llCalw, _clawMoveTimeOut);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
}
}
@@ -0,0 +1,78 @@
using Aitex.Core.RT.Routine;
using Aitex.Core.Util;
namespace SicModules.UnLoads.Routines
{
public class UnLoadCoolingRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
TimeDealy
}
private DeviceTimer _dt = new DeviceTimer();
private int _coolingTime;
public UnLoadCoolingRoutine()
{
Name = "UnLoad Cooling";
}
public void Init(int coolingTime)
{
_coolingTime = coolingTime;
}
public override Result Start(params object[] objs)
{
Reset();
_dt.Start(0);
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
Delay((int)RoutineStep.TimeDealy, _coolingTime);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
_dt.Stop();
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
if (!_dt.IsIdle())
{
_dt.Stop();
}
base.Abort();
}
public int GetRemainedTime()
{
if (!_dt.IsIdle())
{
int coolingRemain = _coolingTime - (int)(_dt.GetElapseTime() / 1000);
return coolingRemain >= 0 ? coolingRemain : 0;
}
return 0;
}
}
}
@@ -0,0 +1,145 @@
using System;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.UnLoads.Routines
{
public class UnLoadHomeRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
CloseV78,
CloseV122,
CloseV123
}
private int _homeTimeout;
public UnLoadHomeRoutine()
{
Module = ModuleName.UnLoad.ToString();
Name = "Home";
}
public override Result Start(params object[] objs)
{
Reset();
_homeTimeout = SC.GetValue<int>("UnLoad.HomeTimeout");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CloseVent((int)RoutineStep.CloseV78);
CloseFastPump((int)RoutineStep.CloseV122);
CloseSlowPump((int)RoutineStep.CloseV123);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
LOG.Error(ex.ToString());
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public void CloseVent(int id)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Close Load vent valve");
if (!UnLoadDevice.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 (!UnLoadDevice.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 (!UnLoadDevice.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,291 @@
using System;
using System.Diagnostics;
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;
namespace SicModules.UnLoads.Routines
{
public class UnLoadLeakCheckRoutine : UnLoadBaseRoutine
{
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 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 _pumpBasePressure1;
private double _ventBasePressure1;
private int _pumpDelayTime;
private int _ventDelayTime;
private double _beginTime;
private int _calTimes; //第几次计算LeakCheck的值(每60秒计算一次)
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
public UnLoadLeakCheckRoutine()
{
Module = ModuleName.UnLoad.ToString();
Name = "LeakCheck";
}
internal void Init(int pumpTime, int leakCheckTime)
{
_paramContinuePumpTime = pumpTime;
_paramLeakCheckTime = leakCheckTime;
}
internal void Init()
{
_paramContinuePumpTime = SC.GetValue<int>("UnLoad.LeakCheck.PumpDelayTime");
_paramLeakCheckTime = SC.GetValue<int>("UnLoad.LeakCheck.LeakCheckDelayTime");
}
public override Result Start(params object[] objs)
{
Reset();
_swTimer.Restart();
string reason;
if (!UnLoadDevice.SetFastVentValve(false, out reason) || !UnLoadDevice.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>("UnLoad.Pump.SlowFastPumpSwitchPressure");
_pumpBasePressure = SC.GetValue<double>("UnLoad.Pump.PumpBasePressure");
_routineTimeOut = SC.GetValue<int>("UnLoad.LeakCheck.RoutineTimeOut");
_leakSpec = SC.GetValue<double>("UnLoad.LeakCheck.LeakSpec");
_purgeCount = SC.GetValue<int>("UnLoad.LeakCheck.CyclePurgeCount");
_pumpTimeout = SC.GetValue<int>("UnLoad.LeakCheck.PumpTimeout");
_ventTimeout = SC.GetValue<int>("UnLoad.LeakCheck.VentTimeout");
_pumpDelayTime = SC.GetValue<int>("UnLoad.LeakCheck.LoopPumpDelayTime");
_ventDelayTime = SC.GetValue<int>("UnLoad.LeakCheck.LoopVentDelayTime");
_pumpBasePressure1 = SC.GetValue<double>("UnLoad.Pump.PumpBasePressure");
_ventBasePressure1 = SC.GetValue<double>("UnLoad.Vent.VentBasePressure");
if (isAtmMode)
{
EV.PostInfoLog(Module, $"system in atm mode, {Module} pump skipped");
return Result.DONE;
}
if (!UnLoadDevice.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.SetUnloadLeakCheckRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not LeakCheck,{reason}");
return Result.FAIL;
}
_swTimer.Restart();
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, _pumpBasePressure1, _pumpTimeout);
TimeDelay((int)RoutineStep.PumpDelayP, _pumpDelayTime);
CloseFastPumpValve((int)RoutineStep.CloseFastValveP);
CloseSlowPumpValve((int)RoutineStep.CloseSlowValveP);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
SlowVent((int)RoutineStep.SlowVentV, _ventBasePressure1, _ventTimeout);
TimeDelay((int)RoutineStep.VentDelayV, _ventDelayTime);
CloseVentValve((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);
TimeDelay((int)RoutineStep.DoLeakCheckDelay, _paramLeakCheckTime);
//CalcLeackCheckPerMinute(_paramLeakCheckTime);
CalcLeakCheck((int)RoutineStep.CalcLeakCheck, _paramLeakCheckTime);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
UnLoadDevice.SetSlowPumpValve(false, out _);
UnLoadDevice.SetFastPumpValve(false, out _);
return Result.FAIL;
}
TmIoInterLock.SetUnloadLeakCheckRoutineRunning(false, out _);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
return Result.DONE;
}
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 = UnLoadDevice.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 = UnLoadDevice.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 = UnLoadDevice.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 = UnLoadDevice.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,67 @@
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.UnLoads.Routines
{
public class UnLoadLiftRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
LiftMove
}
private bool _pinUp;
private int _liftMoveTimeOut = 30;
public UnLoadLiftRoutine()
{
Name = "UnLoad Lift";
}
public void Init(bool isUp)
{
_pinUp = isUp;
}
public override Result Start(params object[] objs)
{
Reset();
_liftMoveTimeOut = SC.GetValue<int>("UnLoad.LiftMoveTimeOut");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//先动夹爪在动Lift
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.UnLoads.Routines
{
public class UnLoadPrepareTransferRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
CheckForelinePressure,
RequestPump,
RequestPumpDelay,
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
Delay,
SlowVent,
CloseSlowVentValve,
TimeDelay1,
TimeDelay2,
}
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 UnLoadPrepareTransferRoutine()
{
Module = ModuleName.UnLoad.ToString();
Name = "PrepareTransfer";
}
public override Result Start(params object[] objs)
{
Reset();
_targetPressure = SC.GetValue<double>("TM.PressureBalance.BalancePressure");
_llVacPressure = SC.GetValue<double>("UnLoad.VacuumPressureBase");
_pumpBasePressure = SC.GetValue<double>("UnLoad.Purge.PumpBasePressure");
_balancePressureDiff = SC.GetValue<double>("TM.PressureBalance.BalanceMaxDiffPressure");
_pumpSwitchPressure = SC.GetValue<double>("UnLoad.Pump.SlowFastPumpSwitchPressure");
_slowPumpTimeout = SC.GetValue<int>("UnLoad.Pump.SlowPumpTimeout");
_fastPumpTimeout = SC.GetValue<int>("UnLoad.Pump.FastPumpTimeout");
_slowVentTimeout = SC.GetValue<int>("UnLoad.Vent.SlowVentTimeout");
_pumpDelayTime = SC.GetValue<int>("UnLoad.Purge.PumpDelayTime");
//PrepareTrasfer需要把压力调到VacuumBasePressure以下
if (_targetPressure > _llVacPressure)
{
_targetPressure = _llVacPressure;
}
string reason;
if (!UnLoadDevice.SetFastVentValve(false, out reason) || !UnLoadDevice.SetSlowVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (!UnLoadDevice.SetFastPumpValve(false, out reason) || !UnLoadDevice.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, {UnLoadDevice.Module} pump skipped");
return Result.DONE;
}
if (!UnLoadDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not pump, door is open");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(UnLoadDevice.Module)))
{
EV.PostAlarmLog(Module, $"LoadLock Can not servo to pressure, slit valve is open");
return Result.FAIL;
}
//if (Math.Abs(_targetPressure - UnLoadDevice.ChamberPressure) < _balancePressureDiff && UnLoadDevice.CheckVacuum())
//{
// return Result.DONE;
//}
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);
SlowVent((int)RoutineStep.SlowVent, _targetPressure - 5, _slowVentTimeout);
CloseVentValve((int)RoutineStep.CloseSlowVentValve);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
UnLoadDevice.SetSlowPumpValve(false, out _);
UnLoadDevice.SetFastPumpValve(false, out _);
}
}
}
@@ -0,0 +1,186 @@
using System.Diagnostics;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.UnLoads.Routines
{
public class UnLoadPumpRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
CheckForelinePressure,
RequestPump,
RequestPumpDelay,
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
Delay,
TimeDelay1,
}
private double _pumpBasePressure = 0;
private double _pumpSwitchPressure = 100;
private int _slowPumpTimeout;
private int _fastPumpTimeout;
private int _pumpDelayTime= 5;
private int _routineTimeOut;
private bool _useSettingValue;
private Stopwatch _swTimer = new Stopwatch();
public UnLoadPumpRoutine()
{
Module = ModuleName.UnLoad.ToString();
Name = "Pump";
}
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 (!UnLoadDevice.SetFastVentValve(false, out reason) || !UnLoadDevice.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>("UnLoad.Pump.SlowFastPumpSwitchPressure");
_slowPumpTimeout = SC.GetValue<int>("UnLoad.Pump.SlowPumpTimeout");
_fastPumpTimeout = SC.GetValue<int>("UnLoad.Pump.FastPumpTimeout");
_routineTimeOut = SC.GetValue<int>("UnLoad.Pump.RoutineTimeOut");
if (!_useSettingValue)
{
_pumpBasePressure = SC.GetValue<double>("UnLoad.Pump.PumpBasePressure");
_pumpDelayTime = SC.GetValue<int>("UnLoad.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, {Module} pump skipped");
return Result.DONE;
}
if (SC.ContainsItem("UnLoad.RunPumpRoutineEventBelowBasePressure") && !SC.GetValue<bool>("UnLoad.RunPumpRoutineEventBelowBasePressure"))
{
if (UnLoadDevice.ChamberPressure < _pumpBasePressure)
{
EV.PostInfoLog(Module, $"{Module} already under pump base pressure");
return Result.DONE;
}
}
if (!UnLoadDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not pump, lid is open");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleName.UnLoad))
{
EV.PostAlarmLog(Module, $"Can not pump, slit valve is open");
return Result.FAIL;
}
if (!TMDevice.SetTmToUnLoadVent(false, out _))
{
EV.PostAlarmLog(Module, $"can not pump,can not close v85!");
}
if (!EFEMDevice.CheckSlitValveClose(ModuleName.UnLoad,ModuleName.WaferRobot))
{
EV.PostAlarmLog(Module, $"Can not pump, slit valve is open");
return Result.FAIL;
}
if (!TmIoInterLock.SetUnloadPumpRoutineRunning(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();
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)
{
UnLoadDevice.SetSlowPumpValve(false, out _);
UnLoadDevice.SetFastPumpValve(false, out _);
return Result.FAIL;
}
TmIoInterLock.SetUnloadPumpRoutineRunning(false, out _);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
return Result.DONE;
}
public override void Abort()
{
//UnLoadDevice.SetSlowPumpValve(false, out _);
//UnLoadDevice.SetFastPumpValve(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,171 @@
using System.Diagnostics;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.UnLoads.Routines
{
public class UnLoadPurgeRoutine : UnLoadBaseRoutine
{
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 Stopwatch _swTimer = new Stopwatch();
public UnLoadPurgeRoutine()
{
Module = ModuleName.UnLoad.ToString();
Name = "Purge";
}
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>("UnLoad.Purge.CyclePurgeCount");
_pumpDelayTime = SC.GetValue<int>("UnLoad.Purge.PumpDelayTime");
}
_routineTimeOut = SC.GetValue<int>("UnLoad.Purge.RoutineTimeOut");
_pumpSwitchPressure = SC.GetValue<double>("UnLoad.Pump.SlowFastPumpSwitchPressure");
_pumpBasePressure = SC.GetValue<double>("UnLoad.Purge.PumpBasePressure");
_pumpTimeOut = SC.GetValue<int>("UnLoad.Purge.PumpTimeOut");
_ventBasePressure = SC.GetValue<double>("UnLoad.Purge.VentBasePressure");
_ventDelayTime = SC.GetValue<int>("UnLoad.Purge.VentDelayTime");
_ventTimeOut = SC.GetValue<int>("UnLoad.Purge.VentTimeOut");
if (!UnLoadDevice.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(UnLoadDevice.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.SetUnloadPurgeRoutineRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not purge,{reason}");
return Result.FAIL;
}
if (SC.GetValue<bool>("System.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);
CloseVentValve((int)RoutineStep.CloseSlowVentValve);
TimeDelay((int)RoutineStep.VentDelay, _ventDelayTime);
EndLoop((int)RoutineStep.StopLoop);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
TmIoInterLock.SetUnloadPurgeRoutineRunning(false, out _);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
return Result.DONE;
}
public override void Abort()
{
TmIoInterLock.SetUnloadPurgeRoutineRunning(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,76 @@
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
namespace SicModules.UnLoads.Routines
{
public class UnLoadSeparateRoutine : UnLoadBaseRoutine
{
/*
* 1、Unload伺服到传盘压力
2、夹爪打开
3、顶升晶圆
4、夹爪闭合
5、顶升缩回
6、打开闸板阀
7、Robot开始取托盘到TM
8、关闭闸板阀
*
*/
enum RoutineStep
{
ClawOpen,
LiftUp,
Clawing,
LiftDown,
TimeDelay1,
}
private int _clawMoveTimeOut = 30;
private int _liftMoveTimeOut = 30;
public UnLoadSeparateRoutine()
{
Name = "Separate";
}
public override Result Start(params object[] objs)
{
Reset();
_liftMoveTimeOut = SC.GetValue<int>("UnLoad.LiftMoveTimeOut");
_clawMoveTimeOut = SC.GetValue<int>("UnLoad.ClawMoveTimeOut");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
ClawMove((int)RoutineStep.ClawOpen, WaferClaw, false, _clawMoveTimeOut);
LiftMove((int)RoutineStep.LiftUp, true, _liftMoveTimeOut);
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()
{
}
}
}
@@ -0,0 +1,159 @@
using System;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.UnLoads.Routines
{
public class UnLoadServoToRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
CheckForelinePressure,
RequestPump,
RequestPumpDelay,
SlowPump,
CloseSlowValve,
FastPump,
PumpDelay,
CloseFastValve,
Delay,
SlowVent,
CloseSlowVentValve,
TimeDelay1,
}
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 void Init(double pressure)
{
_targetPressure = pressure;
_useSettingValue = true;
}
public UnLoadServoToRoutine(ModuleName module)
{
Module = module.ToString();
Name = "UnLoadServoTo";
}
public override Result Start(params object[] objs)
{
Reset();
if (!_useSettingValue)
{
_targetPressure = SC.GetConfigItem("TM.PressureBalance.BalancePressure").DoubleValue;
}
string reason;
if (!UnLoadDevice.SetFastVentValve(false, out reason) || !UnLoadDevice.SetSlowVentValve(false, out reason))
{
EV.PostAlarmLog(Module, $"Can not turn off valves, {reason}");
return Result.FAIL;
}
if (!UnLoadDevice.SetFastPumpValve(false, out reason) || !UnLoadDevice.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, {UnLoadDevice.Module} pump skipped");
return Result.DONE;
}
if (!UnLoadDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"Can not pump, door is open");
return Result.FAIL;
}
if (!TMDevice.CheckSlitValveClose(ModuleHelper.Converter(UnLoadDevice.Module)))
{
EV.PostAlarmLog(Module, $"LoadLock Can not servo to pressure, slit valve is open");
return Result.FAIL;
}
if (Math.Abs(_targetPressure - UnLoadDevice.ChamberPressure) < SC.GetConfigItem("TM.PressureBalance.BalanceMaxDiffPressure").DoubleValue && UnLoadDevice.CheckVacuum())
{
return Result.DONE;
}
_needPump = UnLoadDevice.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);
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);
CloseVentValve((int)RoutineStep.CloseSlowVentValve);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
UnLoadDevice.SetSlowPumpValve(false, out _);
UnLoadDevice.SetFastPumpValve(false, out _);
}
}
}
@@ -0,0 +1,147 @@
using System.Diagnostics;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicModules.UnLoads.Routines
{
public class UnLoadVentRoutine : UnLoadBaseRoutine
{
enum RoutineStep
{
SlowVent,
FastVent,
VentDelay,
CloseSlowVentValve,
CloseFastVentValve,
CloseValveDelay,
}
private double _ventBasePressure;
private int _slowVentTimeout;
private int _ventDelayTime;
private int _routineTimeOut;
private bool _useSettingValue;
private Stopwatch _swTimer = new Stopwatch();
public UnLoadVentRoutine()
{
Module = ModuleName.UnLoad.ToString();
Name = "Vent";
}
public void Init(double basePressure, int ventDelayTime)
{
_ventBasePressure = basePressure;
_ventDelayTime = ventDelayTime;
_useSettingValue = true;
}
public override Result Start(params object[] objs)
{
Reset();
string reason;
if (UnLoadDevice.CheckAtm())
{
EV.PostInfoLog(Module, $"{UnLoadDevice.Module} in atm, vent skipped");
return Result.DONE;
}
if (!TMDevice.CheckSlitValveClose(ModuleName.UnLoad))
{
EV.PostAlarmLog(Module, $"can not vent, slit valve is open");
return Result.FAIL;
}
if (!UnLoadDevice.CheckLidClose())
{
EV.PostAlarmLog(Module, $"can not vent, lid is open");
return Result.FAIL;
}
if (!TMDevice.SetFastPumpValve(false, out reason))
{
EV.PostAlarmLog(Module, $"can not vent, TM fast pump value can not close");
return Result.FAIL;
}
if (!UnLoadDevice.SetFastPumpValve(false, out reason)
|| !UnLoadDevice.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!");
}
_slowVentTimeout = SC.GetValue<int>("UnLoad.Vent.SlowVentTimeout");
if (!_useSettingValue)
{
_ventBasePressure = SC.GetValue<double>("UnLoad.Vent.VentBasePressure");
_ventDelayTime = SC.GetValue<int>("UnLoad.Vent.VentDelayTime");
}
_routineTimeOut = SC.GetValue<int>("UnLoad.Vent.RoutineTimeOut");
if (!TmIoInterLock.SetUnloadVentRoutineRunning(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();
SlowVent((int)RoutineStep.SlowVent, _ventBasePressure, _slowVentTimeout);
TimeDelay((int)RoutineStep.VentDelay, _ventDelayTime);
CloseVentValve((int)RoutineStep.CloseFastVentValve);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
UnLoadDevice.SetSlowVentValve(false, out _);
UnLoadDevice.SetFastVentValve(false, out _);
return Result.FAIL;
}
TmIoInterLock.SetUnloadVentRoutineRunning(false, out _);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
return Result.DONE;
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
}
}