2022-11-08 15:59:23 +08:00
|
|
|
|
using System;
|
|
|
|
|
using Aitex.Core.RT.Event;
|
2022-09-19 09:16:33 +08:00
|
|
|
|
using Aitex.Core.RT.Routine;
|
|
|
|
|
using Aitex.Core.RT.SCCore;
|
2022-11-08 15:59:23 +08:00
|
|
|
|
using Aitex.Sorter.Common;
|
2022-09-19 09:16:33 +08:00
|
|
|
|
using MECF.Framework.Common.Equipment;
|
2022-11-08 15:59:23 +08:00
|
|
|
|
using MECF.Framework.Common.Schedulers;
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-09-29 17:33:25 +08:00
|
|
|
|
namespace Mainframe.UnLoads.Routines
|
2022-09-19 09:16:33 +08:00
|
|
|
|
{
|
|
|
|
|
public class UnLoadPrepareTransferRoutine : UnLoadBaseRoutine
|
|
|
|
|
{
|
|
|
|
|
enum RoutineStep
|
|
|
|
|
{
|
|
|
|
|
CheckForelinePressure,
|
|
|
|
|
RequestPump,
|
|
|
|
|
RequestPumpDelay,
|
|
|
|
|
SlowPump,
|
|
|
|
|
CloseSlowValve,
|
|
|
|
|
FastPump,
|
|
|
|
|
PumpDelay,
|
|
|
|
|
CloseFastValve,
|
|
|
|
|
Delay,
|
|
|
|
|
SlowVent,
|
|
|
|
|
CloseSlowVentValve,
|
2022-11-02 23:47:56 +08:00
|
|
|
|
StartLoop,
|
|
|
|
|
EndLoop,
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
|
|
|
|
TimeDelay1,
|
|
|
|
|
TimeDelay2,
|
2022-11-14 16:42:44 +08:00
|
|
|
|
TimeDelay3,
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
2022-11-02 23:47:56 +08:00
|
|
|
|
|
|
|
|
|
private int _purgeCount;
|
2022-09-19 09:16:33 +08:00
|
|
|
|
private int _pumpDelayTime;
|
|
|
|
|
|
|
|
|
|
public UnLoadPrepareTransferRoutine()
|
|
|
|
|
{
|
|
|
|
|
Module = ModuleName.UnLoad.ToString();
|
|
|
|
|
Name = "PrepareTransfer";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Result Start(params object[] objs)
|
|
|
|
|
{
|
2022-11-08 15:59:23 +08:00
|
|
|
|
// See methods PrepareTransfer() of SicRT\Equipments\Schedulers\SchedulerUnLoad.cs for details.
|
|
|
|
|
// objs[0]: ModuleName robot
|
|
|
|
|
// objs[1]: Hand blade
|
|
|
|
|
// objs[2]: targetSlot
|
|
|
|
|
// objs[3]: EnumTransferType transferType
|
|
|
|
|
|
|
|
|
|
// Validate the arguments.
|
|
|
|
|
//if (objs == null || objs.Length != 4 || (objs[0] is ModuleName moduleName) == false || (objs[3] is EnumTransferType transferType) == false)
|
|
|
|
|
//{
|
|
|
|
|
// EV.PostAlarmLog(Module, $"Arguments of routine {nameof(UnLoadPrepareTransferRoutine)} are incorrect.");
|
|
|
|
|
// return Result.FAIL;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
Reset();
|
2022-09-19 09:16:33 +08:00
|
|
|
|
_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;
|
2022-11-18 15:07:11 +08:00
|
|
|
|
LockPump2(out reason);
|
|
|
|
|
|
2022-09-19 09:16:33 +08:00
|
|
|
|
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
|
|
|
|
|
{
|
2022-11-08 15:59:23 +08:00
|
|
|
|
//if (_purgeCount > 0)
|
|
|
|
|
//{
|
|
|
|
|
// Loop((int)RoutineStep.StartLoop, _purgeCount);
|
2022-11-02 23:47:56 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
TimeDelay((int)RoutineStep.TimeDelay1, 1);
|
2022-11-02 23:47:56 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
SlowPump((int)RoutineStep.SlowPump, _pumpSwitchPressure, _slowPumpTimeout);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
FastPump((int)RoutineStep.FastPump, _pumpBasePressure, _fastPumpTimeout);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
TimeDelay((int)RoutineStep.TimeDelay2, _pumpDelayTime);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
CloseFastPumpValve((int)RoutineStep.CloseFastValve);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
CloseSlowPumpValve((int)RoutineStep.CloseSlowValve);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-11-14 16:42:44 +08:00
|
|
|
|
// 模拟器运行时由于以上动作刷新DI不及时导致触发Interlock,增加一些延时
|
|
|
|
|
//TODO IoValue类中检查相关DI状态。
|
|
|
|
|
TimeDelay((int)RoutineStep.TimeDelay3, 2);
|
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
SlowVent((int)RoutineStep.SlowVent, _targetPressure - 5, _slowVentTimeout);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
2022-11-08 15:59:23 +08:00
|
|
|
|
CloseVentValve((int)RoutineStep.CloseSlowVentValve);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
catch (RoutineBreakException)
|
|
|
|
|
{
|
|
|
|
|
return Result.RUN;
|
|
|
|
|
}
|
|
|
|
|
catch (RoutineFaildException)
|
|
|
|
|
{
|
2022-11-18 15:07:11 +08:00
|
|
|
|
UnlockPump2();
|
2022-09-19 09:16:33 +08:00
|
|
|
|
return Result.FAIL;
|
|
|
|
|
}
|
2022-11-18 15:07:11 +08:00
|
|
|
|
|
|
|
|
|
UnlockPump2();
|
|
|
|
|
|
2022-09-19 09:16:33 +08:00
|
|
|
|
Notify("Finished");
|
|
|
|
|
|
|
|
|
|
return Result.DONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Abort()
|
|
|
|
|
{
|
|
|
|
|
UnLoadDevice.SetSlowPumpValve(false, out _);
|
|
|
|
|
UnLoadDevice.SetFastPumpValve(false, out _);
|
2022-11-18 15:07:11 +08:00
|
|
|
|
UnlockPump2();
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|