MoS2/App/Modules/SicModules/PMs/Routines/PMProcessAbortRoutine.cs

157 lines
5.3 KiB
C#
Raw Normal View History

2026-08-04 18:19:29 +08:00
using Aitex.Core.RT.Device.Devices;
2026-06-15 10:56:30 +08:00
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
2026-08-04 18:19:29 +08:00
using System;
using System.Collections.Generic;
using System.Diagnostics;
2026-06-15 10:56:30 +08:00
namespace SicModules.PMs.Routines
{
public class PMProcessAbortRoutine : PMBaseRoutine
{
private enum RoutineStep
{
HeatEnable,
SetPSUMode,
SetSCRMode,
SetPSURatio,
SetSCRRatio,
SetRotation,
2026-08-04 18:19:29 +08:00
SetM18toM40,
2026-06-15 10:56:30 +08:00
SetM17M18,
2026-08-04 18:19:29 +08:00
SetM1toM17,
2026-06-15 10:56:30 +08:00
SetM5M21,
SetPC,
SetV32,
SetV35V36,
SetV68,
SetV65,
2026-08-24 14:03:35 +08:00
SetGroupA,
2026-06-15 10:56:30 +08:00
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupK,
SetGroupD,
SetGroupG,
VentPumpClose,
SetGroupV25,
SetV34,
SetV100,
TimeDelay1,
2026-08-04 18:19:29 +08:00
TimeDelay2,
SetGroupJ
2026-06-15 10:56:30 +08:00
}
private int _heatTimeOut = 5;
private int _mfc1to16RampTime = 30;
private int _mfc2to40RampTime = 30;
private int _IoValueOpenCloseTimeout = 10;
private int _routineTimeOut = 10;
private Stopwatch _swTimer = new Stopwatch();
public PMProcessAbortRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "ProcessAbort";
}
public override Result Start(params object[] objs)
{
Reset();
_mfc1to16RampTime = SC.GetValue<int>($"PM.{Module}.ProcessIdle.MFC1to16RampTime");
_mfc2to40RampTime = SC.GetValue<int>($"PM.{Module}.ProcessIdle.MFC19to40RampTime");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RoutineTimeOut");
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//CheckRoutineTimeOut();
2026-08-04 18:19:29 +08:00
//停止加热、停止旋转
2026-06-15 10:56:30 +08:00
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValveAndNoWait((int)RoutineStep.SetRotation, 0);
2026-08-04 18:19:29 +08:00
//2、 M18-M40除 M30\M34\M39 MFC 30s ramp 到 default 值(时间可配置)
SetMfcToDefaultByGroup((int)RoutineStep.SetM18toM40, MfcGroupName.M18toM40No303439, _mfc2to40RampTime);
2026-06-15 10:56:30 +08:00
2026-08-04 18:19:29 +08:00
//3、 M1-M17 MFC 30s ramp 到 default 值(时间可配置) 所有 PC 设定为 default 值PC1-PC9
SetMfcToDefaultByGroup((int)RoutineStep.SetM1toM17, MfcGroupName.M1toM17, _mfc1to16RampTime);
2026-06-15 10:56:30 +08:00
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//等待MFC等流量
TimeDelay((int)RoutineStep.TimeDelay1, Math.Max(_mfc2to40RampTime, _mfc1to16RampTime));
2026-08-04 18:19:29 +08:00
//4、打开 V32(N2.Supply
2026-06-15 10:56:30 +08:00
SetIoValueByGroupNoWait((int)RoutineStep.SetV32, IoGroupName.V32, true);
2026-08-04 18:19:29 +08:00
//5、 打开 V35(H2N2.Line1)、 V36(H2N2.Line2),关闭 B/C/E/F/H/KValves,打开 D/G Valves打开 J valve。
2026-06-15 10:56:30 +08:00
SetIoValueByGroupNoWait((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupB, IoGroupName.B, false);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupC, IoGroupName.C, false);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupE, IoGroupName.E, false);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupF, IoGroupName.F, false);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupH, IoGroupName.H, false);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupK, IoGroupName.K, false);
2026-08-24 14:03:35 +08:00
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupA, IoGroupName.A, true);
2026-06-15 10:56:30 +08:00
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupD, IoGroupName.D, true);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupG, IoGroupName.G, true);
2026-08-04 18:19:29 +08:00
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupJ, IoGroupName.V65, true);
2026-06-15 10:56:30 +08:00
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
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 override void Abort()
{
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetHeaterStopRamp();
PmDevice.SetRotationStopRamp();
base.Abort();
}
}
}