重新整理Routine和仿真

This commit is contained in:
hanqiangqiang
2026-06-10 15:41:00 +08:00
parent 9588fe0121
commit a11d2b154d
22 changed files with 1227 additions and 1053 deletions
@@ -3,11 +3,11 @@ using System.Diagnostics;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
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 SicModules.PMs.Routines.Base;
using static Aitex.Core.RT.Device.PmDevices.DicMode;
namespace SicModules.PMs.Routines
{
@@ -38,6 +38,7 @@ namespace SicModules.PMs.Routines
SetPCMode,
SetM1to16,
SetM17M18,
SetPC,
SetGroupJ,
SetM2toM40,
@@ -53,7 +54,7 @@ namespace SicModules.PMs.Routines
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetM2toM26,
SetM291519to26,
SetTVCloseMode,
SetTvPositionToZero,
@@ -84,11 +85,12 @@ namespace SicModules.PMs.Routines
SetV25,
SetV76,
SetV75,
SetV30,
SetV31,
SetV32,
SetV35V36,
SetV65,
SetV103,
SetV105,
SetEPV1,
SetEPV2,
@@ -128,11 +130,11 @@ namespace SicModules.PMs.Routines
CheckEpv2Open,
CheckEpv1Open,
SetV93V95,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM35M37,
SetM32M35M37,
SetM36,
SetM38,
WaitPmPressureUp1,
@@ -165,7 +167,6 @@ namespace SicModules.PMs.Routines
private IoThrottleValve2 _IoThrottle;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
@@ -205,16 +206,24 @@ namespace SicModules.PMs.Routines
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
if (!PmDevice.CheckSlitValveClose())
{
EV.PostAlarmLog(Module, $"can not run ProcessIdle, {Module} SlitValve Opened");
return Result.FAIL;
}
//if (!_pmInterLock.SetPMProcessIdleRunning(true, out string reason))
//{
// EV.PostAlarmLog(Module, $"can not run ProcessIdle, {reason}");
// return Result.FAIL;
//}
if (!_pmInterLock.SetPMProcessIdleRunning(true, out string reason))
/*
* 2025-07-16
* 执行ProcessIdle Routine需禁用MFC报警;报警只在保持ProcessIdle状态时生效。
* 这个DO原本用来指示正在执行Routine,现在改为指示PM维持在ProcessIdle状态。
* 只有维持在ProcessIdle状态时,才会启用MFC报警监测。
*
* PM状态机ProcessIdle状态进入和退出时分别设置DOProcessIdleRunning为true和false,因此进入当前Routine时,
* DOProcessIdleRunning有可能为1,需要强制设置为0;当前Routine执行完毕后再将这个DO设置为1,表示已进入ProcessIdle状态。
*/
if (!_pmInterLock.SetPMProcessIdleRunning(false, out var reason))
{
EV.PostAlarmLog(Module, $"can not run ProcessIdle, {reason}");
return Result.FAIL;
LOG.Error($"Failed to set DOProcessIdle to false due to {reason}");
}
if (!PmDevice.CheckHeadHeaterEnable(true))
@@ -256,7 +265,7 @@ namespace SicModules.PMs.Routines
_scrHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.SCRHeaterEnable");
_scrHeatMode = (int)SC.GetValue<int>($"PM.{Module}.ProcessIdle.SCRHeaterMode");
_scrHeatMode = SC.GetValue<int>($"PM.{Module}.ProcessIdle.SCRHeaterMode");
_scrL1Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRUpperRatio");
_scrL2Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRMiddleRatio");
_scrL3Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRLowerRatio");
@@ -279,20 +288,22 @@ namespace SicModules.PMs.Routines
{
CheckRoutineTimeOut();
//1 关闭V76,打开V75
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//2 旋转停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
//旋转停止
//SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//3 打开V30,打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV30, IoGroupName.V30, true, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//4 打开V35,打开V36
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
@@ -314,62 +325,59 @@ namespace SicModules.PMs.Routines
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//5 M1-M16设定为default值(M2、M9、M15除外)
//M1-M16设定为default值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, 0);
SetMfcToDefaultByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, 0);
//设置所有PC到默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//6 M2、M9、M15、M19-M40、M41-M45 5s ramp到default值
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM45, 0, 5);
////M2、M9、M15、M19-M40 MFC 5s ramp 到0
//SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM42, 0, 5);
//7 打开EPV2
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 3);
//8 打开Final2阀
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.OpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
//9 Final2阀对应的MFC 3s Ramp到Default值
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
//10 打开V93(ChamberPurge.Final)、V95(ConfinementRing.Final);等待3S
SetIoValueByGroup((int)RoutineStep.SetV93V95, IoGroupName.V93V95, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
//11 M35、M37依次设定3S ramp 到default值 ; 等待3S
SetMfcToDefaultByGroup((int)RoutineStep.SetM35M37, MfcGroupName.M35M37, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM32M35M37, MfcGroupName.M32M35M37, 3);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.V68, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//12 打开V94(RotationUpPurge.Final)、M36设定5S ramp 到default值;等待3S
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36, MfcGroupName.M36, 5);
TimeDelay((int)RoutineStep.TimeDelay3, 3);
//打开V96(HeaterWF.Final); M38依次设定5S ramp 到default值
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38, MfcGroupName.M38, 5);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
//13 打开J Valves
//打开J Valves
SetIoValueByGroup((int)RoutineStep.SetGroupJOpen, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//设置M2,M9,M15,M19-M26 M43、M44、M45 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2toM26, MfcGroupName.M2toM26M43M44M45, 3);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM26, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable, _IoThrottle, 5);
//14 设置蝶阀为压力模式
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到1050mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTV, _IoThrottle, 1050);
//15 打开V72
SetIoValueByGroup((int)RoutineStep.SetV72, IoGroupName.V72, true, _IoValueOpenCloseTimeout);
//打开V72
SetIoValueByGroup((int)RoutineStep.SetV72, IoGroupName.VentPump, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 1);
//关闭V25
@@ -381,7 +389,7 @@ namespace SicModules.PMs.Routines
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.SetTVto300, _IoThrottle, _throttleFinalPressure, _pmPressureMaxDiff, _throttleTimeout);
//TimeDelay((int)RoutineStep.TimeDelay8, 3);
//16 转速Enable,加热Enable, 电流功率可配置
//转速Enable,加热Enable, 电流功率可配置
EnableRotation((int)RoutineStep.EnableRotation, 5);
SetRotationValveAndNoWait((int)RoutineStep.SetRotation1, _rotationSpeed);
@@ -418,7 +426,7 @@ namespace SicModules.PMs.Routines
SetSCREnable((int)RoutineStep.CloseTC2, false, 5);
}
WaitRotationValve((int)RoutineStep.WaitRotation1, _rotationSpeed, true, _rotationSpeed * 3);
WaitRotationValve((int)RoutineStep.WaitRotation1, _rotationSpeed, true, _rotationSpeed / 2);
}
catch (RoutineBreakException)
@@ -430,7 +438,13 @@ namespace SicModules.PMs.Routines
return Result.FAIL;
}
_pmInterLock.SetPMProcessIdleRunning(false, out string reason);
// _pmInterLock.SetPMProcessIdleRunning(false, out string reason);
if (!_pmInterLock.SetPMProcessIdleRunning(true, out string reason))
{
LOG.Error($"Failed to set DOProcessIdle to true due to {reason}");
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();