首次上传

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,286 @@
using System;
using System.Diagnostics;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMButttomSectionMoveRoutine : PMBaseRoutine
{
//public IoGasConnector _ioGasConnector;
//public IoLid _ioButtomLid;
//public IoLidSwing _ioButtomSwing;
//public IoBottomSection _ioButtomSection;
int _timeoutLid = 10;
int _timeoutSwing = 10;
int _timeoutGasConnector = 10;
int _timeoutButtomSection = 10;
private bool _Open = true;
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
enum RoutineStep
{
RoutineStep0,
RoutineStep1,
RoutineStep2,
RoutineStep3,
RoutineStep4,
RoutineStep5,
RoutineStep6,
RoutineStep7,
RoutineStep8,
RoutineStep9,
RoutineStep10,
RoutineStepTime1,
RoutineStepTime2,
RoutineStepTime3,
RoutineStepTime4,
RoutineStepTime5,
}
public PMButttomSectionMoveRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "MoveBottom";
//_ioGasConnector = DEVICE.GetDevice<IoGasConnector>($"{pm.Name}.{"GasConnector"}");
//_ioButtomLid = DEVICE.GetDevice<IoLid>($"{pm.Name}.{"BottomLid"}");
//_ioButtomSwing = DEVICE.GetDevice<IoLidSwing>($"{pm.Name}.{"BottomLidSwing"}");
//_ioButtomSection = DEVICE.GetDevice<IoBottomSection>($"{pm.Name}.{"BottomSection"}");
//_timeoutLid = SC.GetValue<int>("PM.Motion.LidTimeout");
//_timeoutSwing = SC.GetValue<int>("PM.Motion.LidSwingTimeout");
//_timeoutGasConnector = SC.GetValue<int>("PM.Motion.GasConnectorTimeout");
//_timeoutButtomSection = SC.GetValue<int>("PM.Motion.ButtomSectionUpTimeout");
}
internal void Init(params object[] objs)
{
_Open = Boolean.Parse(objs[0].ToString());
}
public override Result Start(params object[] objs)
{
_swTimer.Restart();
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
return Result.DONE;
//GasConnectorLoosen((int)RoutineStep.RoutineStep0, true, _timeoutGasConnector);
//if (_Open)
//{
// CheckLidTighten((int)RoutineStep.RoutineStep2, _ioButtomLid, "Bottom", false, _timeoutLid);
// CheckLidSwingLock((int)RoutineStep.RoutineStep1, _ioButtomSwing, "BottomSwing", false, _timeoutSwing);
// TimeDelay((int)RoutineStep.RoutineStep3, 1);
// CheckButtomSectionUpDown((int)RoutineStep.RoutineStep4, _ioButtomSection, true, _timeoutButtomSection);
//}
//else
//{
// TimeDelay((int)RoutineStep.RoutineStep3, 1);
// CheckButtomSectionUpDown((int)RoutineStep.RoutineStep4, _ioButtomSection, false, _timeoutButtomSection);
// CheckLidSwingLock((int)RoutineStep.RoutineStep1, _ioButtomSwing, "BottomSwing", true, _timeoutSwing);
// CheckLidTighten((int)RoutineStep.RoutineStep2, _ioButtomLid, "Bottom", true, _timeoutLid);
//}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
if (ex.Message == "Timeout")
{
Notify("Timeout");
}
return Result.FAIL;
}
_swTimer.Stop();
Notify("Finished");
return Result.DONE;
}
//protected void GasConnectorLoosen(int id, bool isLock, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Run GasConnector Tighten");
// if (!_ioGasConnector.SetGasConnector(true, out string reason))
// {
// return false;
// }
// return true;
// }, () =>
// {
// return isLock ? _ioGasConnector.GasConnectorTightenFeedback == true : _ioGasConnector.GasConnectorLoosenFeedback == true;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT)
// {
// throw (new RoutineFaildException("Timeout"));
// }
// else
// {
// throw (new RoutineBreakException());
// }
// }
//}
protected void CheckLidTighten(int id, IoLid cLid, string strLidName, bool isTighten, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify(isTighten ? $"Run {strLidName} Tighten" : $"Run {strLidName} Loosen");
if (!cLid.SetLid(!isTighten, out string reason))
{
return false;
}
return true;
}, () =>
{
return isTighten ? cLid.TightenFaceback == true : cLid.LoosenFaceback == true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException("Timeout"));
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void CheckLidSwingLock(int id, IoLidSwing cLidSwing, string strLidName, bool isLock, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify(isLock ? $"Run {strLidName} SwingLock" : $"Run {strLidName} SwingUnLock");
if (!cLidSwing.SetLidSwing(isLock, out string reason))
{
return false;
}
return true;
}, () =>
{
return isLock ? cLidSwing.LidLockFaceback == true : cLidSwing.LidUnlockFaceback == true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException("Timeout"));
}
else
{
throw (new RoutineBreakException());
}
}
}
//protected void CheckButtomSectionUpDown(int id, IoBottomSection cSection, bool toDown, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// if (toDown)
// {
// Notify( $"Run BottomSection Down");
// if (!cSection.MoveDown(out string reason))
// {
// return false;
// }
// }
// else
// {
// Notify($"Run BottomSection Up");
// if (!cSection.MoveUp(out string reason))
// {
// return false;
// }
// }
// return true;
// }, () =>
// {
// return toDown ? cSection.DownFaceback == true : cSection.UpFaceback == true;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT)
// {
// throw (new RoutineFaildException("Timeout"));
// }
// else
// {
// throw (new RoutineBreakException());
// }
// }
//}
public override void Abort()
{
base.Abort();
}
}
}
@@ -0,0 +1,513 @@
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 MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMChamberMoveBodyRoutine : PMBaseRoutine
{
public IoChamberMoveBody _ioChamberMoveBody;
public IoGasConnector _ioGasConnector;
public IoLid _ioSHLid;
public IoLidSwing _ioSHSwing;
public IoLid _ioMiddleLid;
public IoLidSwing _ioMiddleSwing;
private PMModule _pm1Module;
private string _moveBodyGroup;
private bool _Open = true;
int _timeoutLid = 10;
int _timeoutSwing = 10;
int _timeoutGasConnector = 10;
private bool IsShOpen = false;
private bool IsTopOpen = false;
private bool IsMiddleOpen = false;
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
enum RoutineStep
{
StepSetTv76,
StepSetTv75,
RoutineStep0,
RoutineStep1,
RoutineStep2,
RoutineStep3,
RoutineStep4,
RoutineStep5,
RoutineStep6,
RoutineStep7,
RoutineStep8,
RoutineStep9,
RoutineStep10,
RoutineStep11,
RoutineStep12,
RoutineStep13,
RoutineStep14,
RoutineStepTime1,
RoutineStepTime2,
RoutineStepTime3,
RoutineStepTime4,
RoutineStepTime5,
CloseTv76,
CloseTv75,
WaitSensorOpen,
TimeDelay0,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
}
public PMChamberMoveBodyRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "MoveBody";
_pm1Module = pm1;
_ioChamberMoveBody = DEVICE.GetDevice<IoChamberMoveBody>($"{pm1.Name}.{"ChamberMoveBody"}");
_ioGasConnector = DEVICE.GetDevice<IoGasConnector>($"{pm1.Name}.{"GasConnector"}");
_ioSHLid = DEVICE.GetDevice<IoLid>($"{pm1.Name}.{"SHLid"}");
_ioSHSwing = DEVICE.GetDevice<IoLidSwing>($"{pm1.Name}.{"SHLidSwing"}");
_ioMiddleLid = DEVICE.GetDevice<IoLid>($"{pm1.Name}.{"MiddleLid"}");
_ioMiddleSwing = DEVICE.GetDevice<IoLidSwing>($"{pm1.Name}.{"MiddleLidSwing"}");
_timeoutLid = 10;
_timeoutSwing = 10;
_timeoutGasConnector = 10;
}
private object ParseScNode(string v1, object node, string v2, string v3)
{
throw new NotImplementedException();
}
internal void Init(params object[] objs)
{
_moveBodyGroup = objs[0].ToString().ToUpper();
_Open = Boolean.Parse(objs[1].ToString());
}
public override Result Start(params object[] objs)
{
if (PmDevice.SensorPMATMSW.Value)
{
EV.PostWarningLog(Module, "PM is not at ATM State(DI-9 PMATMSW),do not open Cham!");
return Result.FAIL;
}
if (!_ioChamberMoveBody.DownFaceback)
{
EV.PostWarningLog(Module, "Chamber must in Down position!");
return Result.FAIL;
}
if (!_ioChamberMoveBody.FrontFaceback)
{
EV.PostWarningLog(Module, "Chamber must in Front position!");
return Result.FAIL;
}
if (_pm1Module._pmInterLock != null && !_pm1Module._pmInterLock.DoLidOpenRoutineSucceed && _Open) // 不限制close do-172
{
EV.PostWarningLog(Module, "DO-172 DO_PurgeRoutineSucceed must be on!");
return Result.FAIL;
}
if (PmDevice.PSU2.AllHeatEnable)
{
EV.PostWarningLog(Module, "HeatEnable must be off!");
return Result.FAIL;
}
if (_ioSHLid.LoosenFaceback)
{
IsShOpen = true;
IsTopOpen = false;
IsMiddleOpen = false;
}
else if (_ioMiddleLid.LoosenFaceback)
{
IsShOpen = false;
IsTopOpen = false;
IsMiddleOpen = true;
}
_swTimer.Restart();
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//开启V76
SetIoValueByName((int)RoutineStep.CloseTv75, "V75", false, 2);
TimeDelay((int)RoutineStep.TimeDelay5, 2);
SetIoValueByName((int)RoutineStep.StepSetTv76, "V76", true, 2);
TimeDelay((int)RoutineStep.TimeDelay0, 2);
////等待DOR.PressATM.SW 为1
//WaitSensorOpenClose((int)RoutineStep.WaitSensorOpen, _pmModule.SensorDORPressATMSW, true);
GasConnectorTighten((int)RoutineStep.RoutineStep0, false, _timeoutGasConnector);
TimeDelay((int)RoutineStep.TimeDelay1, 2);
if (_Open)
{
if (_moveBodyGroup.Contains("MID"))
{
CheckLidTighten((int)RoutineStep.RoutineStep9, _ioMiddleLid, "MiddleLid", false, _timeoutLid);
TimeDelay((int)RoutineStep.TimeDelay2, 2);
CheckLidSwingLock((int)RoutineStep.RoutineStep10, _ioMiddleSwing, "MiddleLid", false, _timeoutSwing);
}
else
{
CheckLidTighten((int)RoutineStep.RoutineStep9, _ioSHLid, "SHLid", false, _timeoutLid);
TimeDelay((int)RoutineStep.TimeDelay2, 2);
CheckLidSwingLock((int)RoutineStep.RoutineStep10, _ioSHSwing, "SHLid", false, _timeoutSwing);
}
TimeDelay((int)RoutineStep.RoutineStepTime2, 2);
}
else
{
if (IsShOpen)
{
CheckLidSwingLock((int)RoutineStep.RoutineStep4, _ioSHSwing, "SHLid", true, _timeoutSwing);
TimeDelay((int)RoutineStep.TimeDelay2, 2);
CheckLidTighten((int)RoutineStep.RoutineStep1, _ioSHLid, "SHLid", true, _timeoutLid);
}
else if (IsMiddleOpen)
{
CheckLidSwingLock((int)RoutineStep.RoutineStep6, _ioMiddleSwing, "MiddleLid", true, _timeoutSwing);
TimeDelay((int)RoutineStep.TimeDelay2, 2);
CheckLidTighten((int)RoutineStep.RoutineStep3, _ioMiddleLid, "MiddleLid", true, _timeoutLid);
}
GasConnectorTighten((int)RoutineStep.RoutineStep9, true, _timeoutGasConnector);
//关闭V76
TimeDelay((int)RoutineStep.TimeDelay3, 3);
SetIoValueByName((int)RoutineStep.CloseTv76, "V76", false, 2);
SetIoValueByName((int)RoutineStep.StepSetTv75, "V75", true, 2);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
if (ex.Message == "Timeout")
{
Notify("Timeout");
}
return Result.FAIL;
}
_swTimer.Stop();
Notify("Finished");
return Result.DONE;
}
protected void GasConnectorTighten(int id, bool isLock, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
if(isLock)
{
Notify($"Run GasConnector Tighten");
}
else
{
Notify($"Run GasConnector Loosen");
}
if (!_ioGasConnector.SetGasConnector(isLock, out string reason))
{
return false;
}
return true;
}, () =>
{
return _ioGasConnector.GasConnectorTightenFeedback == isLock && _ioGasConnector.GasConnectorLoosenFeedback == !isLock;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException("Timeout"));
}
else
{
throw (new RoutineBreakException());
}
}
}
//protected void CheckChamberMoveFowardEnd(int id, bool moveend, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify(moveend ? $"Run ChamberMoveBody Move End" : $"Run ChamberMoveBody Move Foward");
// if (!_ioChamberMoveBody.MoveForwardEnd(moveend, out string reason))
// {
// return false;
// }
// return true;
// }, () =>
// {
// return moveend ? _ioChamberMoveBody.EndFaceback == true : _ioChamberMoveBody.FrontFaceback == true;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT)
// {
// throw (new RoutineFaildException("Timeout"));
// }
// else
// {
// throw (new RoutineBreakException());
// }
// }
//}
//protected void CheckChamberMoveBodyUp(int id, bool moveup, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify(moveup ? $"Run ChamberMoveBody Move UP" : $"Run ChamberMoveBody Move Down");
// if (!_ioChamberMoveBody.MoveUpDown(moveup, out string reason))
// {
// return false;
// }
// return true;
// }, () =>
// {
// return moveup ? _ioChamberMoveBody.UpFaceback == true : _ioChamberMoveBody.DownFaceback == true;
// }, timeout * 1000);
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT)
// {
// throw (new RoutineFaildException("Timeout"));
// }
// else
// {
// throw (new RoutineBreakException());
// }
// }
//}
//protected void CheckChamberMoveLatch(int id, bool isLatch, int timeout)
//{
// Tuple<bool, Result> ret = Execute(id, () =>
// {
// Notify(isLatch ? $"Run ChamberMoveBody UpLatch(true)" : $"Run ChamberMoveBody UpLatch(false)");
// if (!_ioChamberMoveBody.SetUpBrake(isLatch, out string reason))
// {
// return false;
// }
// return true;
// });
// if (ret.Item1)
// {
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else if (ret.Item2 == Result.TIMEOUT)
// {
// throw (new RoutineFaildException("Timeout"));
// }
// else
// {
// throw (new RoutineBreakException());
// }
// }
//}
protected void CheckLidTighten(int id, IoLid cLid,string strLidName, bool isTighten, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify(isTighten ? $"Run {strLidName} Tighten" : $"Run {strLidName} Loosen");
if (!cLid.SetLid(!isTighten, out string reason))
{
return false;
}
return true;
}, () =>
{
return cLid.TightenFaceback == isTighten && cLid.LoosenFaceback == !isTighten;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException("Timeout"));
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void CheckLidSwingLock(int id, IoLidSwing cLidSwing, string strLidName, bool isLock, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify(isLock ? $"Run {strLidName} SwingLock" : $"Run {strLidName} SwingUnLock");
if (!cLidSwing.SetLidSwing(isLock, out string reason))
{
return false;
}
return true;
}, () =>
{
return cLidSwing.LidLockFaceback == isLock && cLidSwing.LidUnlockFaceback == !isLock;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException("Timeout"));
}
else
{
throw (new RoutineBreakException());
}
}
}
/// <summary>
/// 等待Sensor状态变化
/// </summary>
/// <param name="id"></param>
/// <param name="ioSensor"></param>
/// <param name="open"></param>
protected void WaitSensorOpenClose(int id,IoSensor ioSensor,bool open)
{
Tuple<bool, Result> ret = Wait(id, () =>
{
return ioSensor.Value == open;
}, 10 * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Wait {ioSensor.Name} timeout, over 10 seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void SetIoValueByName(int id, string ioName, bool close, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify((close ? "Open" : "Close") + $"{ioName} value");
_pm1Module.SetIoValue(new System.Collections.Generic.List<string> { ioName }, close);
return true;
}, () =>
{
return _pm1Module.CheckIoValue(new System.Collections.Generic.List<string> { ioName }, close);
},
timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop((close ? "Open" : "Close") + $"{ioName} value timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,474 @@
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMCleanRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
VentPumpClose_1,
VentPumpOpen,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetM1to16,
SetM17M18,
SetPC,
SetGroupJ,
SetGroupJ_1,
SetM291519to38,
SetGasOut,
SetTv,
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetMfc19to26,
SetTVCloseMode,
SetTvPositionToZero,
SetGasIn2,
SetGroupJOpen,
SetM291519to26,
OpenFinal2,
SetMfcFinal2,
SetEPV1,
SetEPV2,
SetEPV2_1,
SetEPV2_2,
SetEPV2_3,
SetTvMode,
RoutinePre,
V27Open,
V27Close,
PressureTo1050,
SetPressureUp,
SetPressureUp1,
SetPressureUp2,
SetPressureDown,
PressureToMax,
PressureToMin,
SetPressUpOrDown1,
SetPressUpOrDown2,
WaitPressureDown,
WaitPressureUp,
SetMFCMode,
SetPCMode,
WaitPmTo1050,
SetTvOpen,
SetTvModeToPress,
SetEPV22,
SetV76,
SetV75,
SetTVto300,
CheckPM1000,
SetMfc28to40Special,
WaitPressUpTo1000,
SetMfc28to40Default,
SetPC567Close,
SetPC567Mode,
SetPC567Default,
OpenEPV2,
WaitV27Open,
SetTvTo1150,
WaitPressUpTo20,
SetMfc28to31To0,
WaitPressUpTo0,
SetMfc28to31ToDefault,
WaitPressDownTo20,
CheckPMPt21000,
SetPressureDown1,
SetMfc28to31Default1,
CheckFinal1Open,
SetGroupV25,
CloseGroupV25,
SetM39,
CheckEPV1Open1,
CheckEPV2Open1,
CheckTVOpen1,
CheckEPV1Open2,
SetTVEnable_1,
SetTVEnable_2,
SetTVPressMode,
SetTv1,
SetM2toM40,
SetM18,
SetV31,
SetV32,
SetV35V36,
SetV65,
WaitTv1,
SetTVPositionMode,
SetTVPositionMode_1,
SetTVPositionMax,
SetTVPositionMax_1,
SetTVPressMode1,
SetTVPressMode2,
SetM2TOM40Default,
SetM2toM40_1,
SetMfc2to40Default,
SetM18Default,
SetM18_1,
SetM18_2,
SetV92V93V95,
SetV94,
SetV96,
SetV103,
SetV105,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
WaitPmPressureUp1,
SetTVCloseMode1,
CLoseTV1,
StartLoop,
EndLoop,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay18,
TimeDelay20,
TimeDelay21,
TimeDelay22,
Notify1,
Notify2,
Notify3,
Notify4,
}
private ModuleName moduleName;
private PMModule _pmModule;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout = 20; //旋转停止超时
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private int _pressureMaxDelay = 10; //到低压保持时间(采用固定值10s)
private int _pressureMinDelay = 10; //到高压保持时间(采用固定值10s)
private double _pressureMax; //Loop压力上限可设置600-800)
private double _pressureMin; //Loop压力下限可设置 0-400)
private int _pressureMinTimeout;
private int _pressureMaxTimeout;
private int _pressureLoopCount; //Loop次数
private int _IoValueOpenCloseTimeout = 10; //开关阀门超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private int _ventTimeout;
private int _pumpTimeout;
private double _throttleFinalPressure = 300;//蝶阀最终调整对的压力
private int _pmCleanTime = 20;
private Stopwatch _swTimer = new Stopwatch();
public PMCleanRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
moduleName = module;
_pmModule = pm;
Name = "Clean";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_ventTimeout = SC.GetValue<int>($"PM.{Module}.Clean.VentTimeout");
_pumpTimeout = SC.GetValue<int>($"PM.{Module}.Clean.PumpTimeout");
_pressureLoopCount = SC.GetValue<int>($"PM.{Module}.Clean.CycleCleanCount");
_pressureMin = SC.GetValue<double>($"PM.{Module}.Clean.PumpBasePressure");
_pressureMinDelay = SC.GetValue<int>($"PM.{Module}.Clean.PumpDelayTime");
_pressureMinTimeout = SC.GetValue<int>($"PM.{Module}.Clean.PumpTimeout");
_pressureMax = SC.GetValue<double>($"PM.{Module}.Clean.VentBasePressure");
_pressureMaxDelay = SC.GetValue<int>($"PM.{Module}.Clean.VentDelayTime");
_pressureMaxTimeout = SC.GetValue<int>($"PM.{Module}.Clean.VentTimeout");
_pmCleanTime = SC.GetValue<int>($"PM.{Module}.Clean.CleanTime");
_throttleFinalPressure = SC.GetValue<double>($"PM.{Module}.Clean.FinalPressure");
//Purge Succeed 清掉
_pmIoInterLock.DoLidOpenRoutineSucceed = false;
_pmIoInterLock.DoLidCloseRoutineSucceed = false;
if (!_pmIoInterLock.SetPMCleanRoutineRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Clean,{reason}");
return Result.FAIL;
}
_checkPMPt2Over1000 = false;
_checkPMPressureOver1000 = false;
_finalOpen = false;
currentPressureUpOrDown = PressureUpOrDown.None;
_swTimer.Restart();
Notify($"Start LoopCount:{_pressureLoopCount}");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//打开J阀门
SetIoValueByGroup((int)RoutineStep.SetGroupJ, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//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);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM26, 3);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable_1, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTv1, _IoThrottle, _pressureMin);
//M2、M9、M15、M19-M40 MFC 5s ramp 到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 5);
SetMfcByGroup((int)RoutineStep.SetM18, MfcGroupName.M18, 0, 5);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pressureMin, _pumpTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay11, 3);
SetThrottleSetPosition((int)RoutineStep.SetTVPositionMax, _IoThrottle, 100, _throttleTimeout);
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.OpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay3, 1);
//打开V92,V93和V95,再打开V94,在打开V96
SetMfcToDefaultByGroup((int)RoutineStep.SetM32M35M37, MfcGroupName.M32M35M37, 1);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36, MfcGroupName.M36, 1);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38, MfcGroupName.M38, 1);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, true, _IoValueOpenCloseTimeout);
//循环开始
Loop((int)RoutineStep.StartLoop, _pressureLoopCount);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2TOM40Default, MfcGroupName.M2toM40, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM18Default, MfcGroupName.M18, 3);
//先关蝶阀,再关闭EPV2
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode1, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.CLoseTV1, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay5, 1);
SetIoValueByGroup((int)RoutineStep.SetEPV2_1, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Uping);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _pressureMax, _ventTimeout);
TimeDelay((int)RoutineStep.TimeDelay6, _pressureMaxDelay);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2_2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay7, 1);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable_2, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode1, _IoThrottle, 5);
//M2、M9、M15、M19-M40 MFC 3s ramp 0
SetMfcByGroup((int)RoutineStep.SetM2toM40_1, MfcGroupName.M2toM40, 0, 3);
SetMfcByGroup((int)RoutineStep.SetM18_1, MfcGroupName.M18, 0, 3);
//伺服到0mbar
SetThrottlePressureAndWait((int)RoutineStep.SetPressureDown, _IoThrottle, _pressureMin, _pumpTimeout);
EndLoop((int)RoutineStep.EndLoop);
//M27-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfc2to40Default, MfcGroupName.M2toM40, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM18_2, MfcGroupName.M18, 3);
//打开J阀门
SetIoValueByGroup((int)RoutineStep.SetGroupJ_1, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//打开V72,关闭V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose_1, IoGroupName.VentPump, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.CloseGroupV25, IoGroupName.V25, false, _IoValueOpenCloseTimeout);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode2, _IoThrottle, 5);
//压力伺服到300mbar
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown2, PressureUpOrDown.Uping);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureUp2, _IoThrottle, _throttleFinalPressure);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.SetTVto300, _IoThrottle, _throttleFinalPressure, _pmPressureMaxDiff, _throttleTimeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
SetRoutineRuningDo();
SetRoutineSuccessedDo();
return Result.DONE;
}
public override void Abort()
{
SetRoutineRuningDo();
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
base.Abort();
}
private void SetRoutineRuningDo()
{
_pmIoInterLock.DoLidCloseRoutineRunning = false;
}
private void SetRoutineSuccessedDo()
{
_pmIoInterLock.SetLidClosedRoutineSucceed(true, out string reason);
_pmIoInterLock.DoLidOpenRoutineSucceed = false;
}
//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,348 @@
using System;
using System.Collections.Generic;
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.Common.Fsm;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMExchangeMoRoutine : PMBaseRoutine
{
private enum RoutineStep
{
SetGroupK,
SetM7Or10,
SetM8Or11,
SetM21,
OpenV73,
StartLoop,
OpenGroup1,
CloseGroup2,
OpenGroup3,
CloseGroup3,
OpenGroup2,
CloseGroup1,
EndLoop,
CloseGroup3_2,
CloseGroup2_2,
OpenGroup1_2,
CloseV73,
SetM7Or10_2,
SetM8Or11_2,
SetPC2Or3,
TimeDelay1,
TimeDelay2,
}
private bool _isTCS = false; //标记是TMA换源还是TCS换源
private PMModule _pmModule;
private ModuleName moduleName;
private IoInterLock _pmIoInterLock;
private int _IoValueTimeout = 2; //开关超时时间
private int _loopCount;
private int _routineTimeOut;
private double _OpenTime = 10;
private double _CLoseTime = 10;
//默认为TMA换源参数
private int mfc7Or10 = 7;
private int mfc8Or11 = 8;
private int pc2Or3 = 2;
private List<string> _lstGroupV73 = new List<string>() { "V73" };
private List<string> _lstGroup1 = new List<string>() { "V49" };
private List<string> _lstGroup2 = new List<string>() { "V48", "V48s" };
private List<string> _lstGroup3 = new List<string>() { "V50", "V50s" };
private Stopwatch _swTimer = new Stopwatch();
public PMExchangeMoRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
moduleName = module;
_pmModule = pm;
Name = "MoExchange";
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public void Init(string moName)
{
if (moName.ToUpper().Contains("TCS"))
{
_isTCS = true;
}
else
{
_isTCS = false;
}
}
public override Result Start(params object[] objs)
{
Reset();
if (_pmModule.V69.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V69 should be Closed");
return Result.FAIL;
}
if (_pmModule.V72.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V72 should be Closed");
return Result.FAIL;
}
if (_pmModule.V74.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V74 should be Closed");
return Result.FAIL;
}
if (_pmModule.EPV2.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,EPV2 should be Closed");
return Result.FAIL;
}
_loopCount = SC.GetValue<int>($"PM.{Module}.MoExchange.CycleCount");
_OpenTime = SC.GetValue<int>($"PM.{Module}.MoExchange.PumpTime");
_CLoseTime = SC.GetValue<int>($"PM.{Module}.MoExchange.VentTime");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.MoExchange.RoutineTimeOut");
//设置TCS换源参数
if (_isTCS)
{
mfc7Or10 = 10;
mfc8Or11 = 11;
pc2Or3 = 3;
_lstGroup1 = new List<string>() { "V49" };
_lstGroup2 = new List<string>() { "V48", "V48s" };
_lstGroup3 = new List<string>() { "V50", "V50s" };
}
else
{
mfc7Or10 = 7;
mfc8Or11 = 8;
pc2Or3 = 2;
_lstGroup1 = new List<string>() { "V45" };
_lstGroup2 = new List<string>() { "V43", "V43s" };
_lstGroup3 = new List<string>() { "V46", "V46s" };
}
if (!_pmIoInterLock.SetPMExchangeMoRoutineRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,{reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭K阀组
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueTimeout);
//设定M7,M8 80%,PC2设定Max
SetMfcValueByPercent((int)RoutineStep.SetM7Or10, mfc7Or10, 80);
SetMfcValueByPercent((int)RoutineStep.SetM21, 21, 80);
SetMfcValueByPercent((int)RoutineStep.SetM8Or11, mfc8Or11, 80);
//打开V73
SetIoValueByList((int)RoutineStep.OpenV73, _lstGroupV73, true, _IoValueTimeout);
//循环开始
Loop((int)RoutineStep.StartLoop, _loopCount);
//打开Group1
SetIoValueByList((int)RoutineStep.OpenGroup1, _lstGroup1, true, _IoValueTimeout);
//关闭Group2
SetIoValueByList((int)RoutineStep.CloseGroup2, _lstGroup2, false, _IoValueTimeout);
//打开Group3
SetIoValueByList((int)RoutineStep.OpenGroup3, _lstGroup3, true, _IoValueTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, _OpenTime);
//关闭Group3
SetIoValueByList((int)RoutineStep.CloseGroup3, _lstGroup3, false, _IoValueTimeout);
//打开Group2
SetIoValueByList((int)RoutineStep.OpenGroup2, _lstGroup2, true, _IoValueTimeout);
//关闭Group1
SetIoValueByList((int)RoutineStep.CloseGroup1, _lstGroup1, false, _IoValueTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, _CLoseTime);
EndLoop((int)RoutineStep.EndLoop);
//关闭Group3
SetIoValueByList((int)RoutineStep.CloseGroup3_2, _lstGroup3, false, _IoValueTimeout);
//关闭Group2
SetIoValueByList((int)RoutineStep.CloseGroup2_2, _lstGroup2, false, _IoValueTimeout);
//打开Group1
SetIoValueByList((int)RoutineStep.OpenGroup1_2, _lstGroup1, true, _IoValueTimeout);
//关闭V73
SetIoValueByList((int)RoutineStep.CloseV73, _lstGroupV73, true, _IoValueTimeout);
//设定M7,M8/M10,M11到默认值
SetMfcValueToDefaultByID((int)RoutineStep.SetM7Or10_2, mfc7Or10);
SetMfcValueToDefaultByID((int)RoutineStep.SetM8Or11_2, mfc8Or11);
//设置PC2/PC3到默认值
SetPcToDefault((int)RoutineStep.SetPC2Or3, new List<int> { pc2Or3 });
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
SetRoutineRuningDo();
return Result.DONE;
}
private void SetRoutineRuningDo()
{
_pmIoInterLock.DoExchangeMoRoutineRunning = false;
}
public override void Abort()
{
SetRoutineRuningDo();
_pmModule.SetIoValue(_lstGroup2, false);
_pmModule.SetIoValue(_lstGroup3, false);
_pmModule.SetMfcValueToDefault(new List<int> { mfc7Or10 });
_pmModule.SetMfcValueToDefault(new List<int> { mfc8Or11 });
_pmModule.SetPCValueToDefault(new List<int> { pc2Or3 });
base.Abort();
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
Notify($"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
private void SetIoValueByList(int id, List<string> lstIo, bool close, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
_pmModule.SetIoValue(lstIo, close);
return true;
}, () =>
{
return _pmModule.CheckIoValue(lstIo, close);
},
timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void SetMfcValueToDefaultByID(int id, int mfcID)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
List<int> lst = new List<int> { mfcID };
_pmModule.SetMfcModelToNormal(lst);
_pmModule.SetMfcValueToDefault(lst);
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void SetMfcValueByPercent(int id, int mfcID, double percent)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
_pmModule.SetMfcModelToNormal(new List<int> { mfcID });
_pmModule.SetMfcValueByPercent(mfcID, percent);
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void SetPCValueByPercent(int id, int pcID, double percent)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
_pmModule.SetPcModelToNormal(new List<int> { pcID });
_pmModule.SetPCValueByPercent(pcID, percent);
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,109 @@
using System;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMHomeRoutine : PMBaseRoutine
{
enum RoutineStep
{
Home,
}
private int _timeout;
public PMHomeRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "Home";
}
public Result Init( )
{
return Result.DONE;
}
public override Result Start(params object[] objs)
{
Reset();
_timeout = SC.GetValue<int>("PM.HomeTimeout");
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (PmDevice != null && PmDevice.IsInstalled)
{
Home((int)RoutineStep.Home, PmDevice, _timeout);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
}
public void Home(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm.Name} home");
//pm.Home();
return true;
}, () =>
{
if (pm.IsError)
{
return null;
}
return true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"{pm.Name} error");
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,582 @@
using System;
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMLeakCheckRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
SetPC,
SetGroupJ,
SetM291519to38,
SetGasOut,
SetTv,
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetMfc19to26,
SetTVCloseMode,
SetTvPositionToZero,
SetGasIn2,
SetGroupJOpen,
SetM291519to26,
SetM17M18,
OpenFinal2,
CloseFinal2,
SetMfcFinal2,
SetEPV1,
SetEPV2,
SetTvMode,
SetTVEnable,
SetTVPressMode,
SetTv1,
WaitTv1,
SetM2toM40,
SetM18,
SetTVPositionMode,
SetTVPositionMode_1,
SetTVPositionMax,
SetTVPositionMax_1,
SetTVPressMode1,
SetM2TOM40Default,
SetM2toM40_1,
SetM18Default,
SetM18_1,
SetTvOpen,
SetTvModeToPress,
SetTVtoCurrent,
RoutinePre,
SetPressureUp,
SetPressureDown,
WaitPressureDown,
WaitPressureUp,
VentPumpOpen,
PressureToMax,
PressureToMin,
StartLoop,
EndLoop,
SetMfc28to31,
SetReactorPress,
CloseFinanl1,
CloseFinanl2,
CloseEPV2,
SetTVCloseMode2,
CLoseTvvvv,
SetEPVVV2,
CLoseEPV1,
CheckPM1000,
WaitPressUpTo1000,
WaitPressUpTo1020,
SetPressUpOrDown1,
SetPressUpOrDown2,
SetMfc28to40Special,
WaitPmPressureUp,
SetMfc28to40Default,
SetV75,
SetV76,
SetV751,
SetV761,
SetPC567Close,
SetPC567Mode,
SetPC567Default,
OpenEPV2,
WaitPressUpTo20,
SetMfc291519to38,
WaitPressUpTo0,
SetMfc291519to38ToDefault,
WaitPressDownTo20,
SetPmPressureTo20,
CloseMfcFinal1,
CloseMfcFinal2,
CloseMfc2915,
CheckFinal1Open,
DoLeakCheck,
CalcLeakCheck,
SetTVClose,
CloseTV,
CloseV27,
CloseV28,
CloseV69,
CloseV70,
SetGroupV25,
SetV31,
SetV32,
SetV35V36,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
CloseM32M35M37,
CloseM36,
CloseM38,
SetV103,
SetV105,
CloseGasIn1,
SetTVCloseMode1,
CLoseTV1,
SetEPV2_1,
SetEPV2_2,
SetTVEnable_2,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
TimeDelay15,
TimeDelay16,
TimeDelay17,
}
enum LeakCheckType
{
ChamberOnly,
ChamberAndGasline,
ChamberAndGaslineToFacility,
}
private ModuleName moduleName;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private double _pressureMax; //Loop压力上限可设置600-800)
private double _pressureMin; //Loop压力下限可设置 0-400)
private int _pressureLoopCount; //Loop次数
private int _pressureMinDelay;
private int _pressureMaxDelay;
private int _pressureMinTimeout;
private int _pressureMaxTimeout;
private int _IoValueOpenCloseTimeout = 10; //开关阀门超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private int _paramContinuePumpTime;
private int _paramLeakCheckTime;
private double _beginPressure;
private double _beginTime;
private int _calTimes; //第几次计算LeakCheck的值(每60秒计算一次)
private double _leakSpec;
private int _routineTimeOut;
//private int _EPV2OpenDelayTime = 9;
private bool _useSettingValue = false;
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
public PMLeakCheckRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "Leak Check";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
}
internal void Init(int pumpTime, int leakCheckTime)
{
_paramContinuePumpTime = pumpTime;
_paramLeakCheckTime = leakCheckTime;
_useSettingValue = true;
}
internal void Init()
{
_useSettingValue = false;
}
public override Result Start(params object[] objs)
{
Reset();
_swTimer.Restart();
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_pressureLoopCount = SC.GetValue<int>($"PM.{Module}.LeakCheck.CyclePurgeCount");
_pressureMin = SC.GetValue<double>($"PM.{Module}.LeakCheck.PumpBasePressure");
_pressureMinDelay = SC.GetValue<int>($"PM.{Module}.LeakCheck.PumpDelayTime");
_pressureMinTimeout = SC.GetValue<int>($"PM.{Module}.LeakCheck.PumpTimeout");
_pressureMax = SC.GetValue<double>($"PM.{Module}.LeakCheck.VentBasePressure");
_pressureMaxDelay = SC.GetValue<int>($"PM.{Module}.LeakCheck.VentDelayTime");
_pressureMaxTimeout = SC.GetValue<int>($"PM.{Module}.LeakCheck.VentTimeout");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.LeakCheck.RoutineTimeOut");
//_EPV2OpenDelayTime = SC.GetValue<int>($"PM.{Module}.TimeDelayAlterEPV2Open");
if (!_useSettingValue)
{
_paramContinuePumpTime = SC.GetValue<int>($"PM.{Module}.LeakCheck.ContinuePumpTime");
_paramLeakCheckTime = SC.GetValue<int>($"PM.{Module}.LeakCheck.LeakCheckDelayTime");
}
_leakSpec = SC.GetValue<double>($"PM.{Module}.LeakCheck.LeakSpec");
if (!PmDevice.SetIOValueByGroup(IoGroupName.V70, false))
{
EV.PostAlarmLog(Module, "Can not close V70-1");
return Result.FAIL;
}
Notify($"Start LoopCount:{_pressureLoopCount}");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//M1-M16设定为default值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, 0);
//设置所有PC到默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM40, 3);//组改变,.M2toM26改变为->M2toM40,防止MFC不在正常状态
SetMfcToDefaultByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, 3);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//打开J阀门
SetIoValueByGroup((int)RoutineStep.SetGroupJ, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTv1, _IoThrottle, _pressureMin);
//M2、M9、M15、M19-M40 MFC 3s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 3);
SetMfcByGroup((int)RoutineStep.SetM18, MfcGroupName.M18, 0, 3);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pressureMin, _pressureMinTimeout);
TimeDelay((int)RoutineStep.TimeDelay8, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay11, 3);
SetThrottleSetPosition((int)RoutineStep.SetTVPositionMax, _IoThrottle, 100, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay9, 3);
//循环开始
Loop((int)RoutineStep.StartLoop, _pressureLoopCount);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2TOM40Default, MfcGroupName.M2toM40, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM18Default, MfcGroupName.M18, 3);
//先关蝶阀,再关闭EPV2
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode1, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.CLoseTV1, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay5, 1);
SetIoValueByGroup((int)RoutineStep.SetEPV2_1, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Uping);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _pressureMax, _pressureMaxTimeout);
TimeDelay((int)RoutineStep.TimeDelay6, _pressureMaxDelay);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2_2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay7, 1);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable_2, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode1, _IoThrottle, 5);
//M2、M9、M15、M19-M40 MFC 3s ramp 0
SetMfcByGroup((int)RoutineStep.SetM2toM40_1, MfcGroupName.M2toM40, 0, 3);
SetMfcByGroup((int)RoutineStep.SetM18_1, MfcGroupName.M18, 0, 3);
//伺服到0mbar
SetThrottlePressureAndWait((int)RoutineStep.SetPressureDown, _IoThrottle, _pressureMin, _pressureMinTimeout);
EndLoop((int)RoutineStep.EndLoop);
//依次关闭Final1
SetIoValueByGroup((int)RoutineStep.CloseGasIn1, IoGroupName.GasIn1, false, _IoValueOpenCloseTimeout);
Delay((int)RoutineStep.TimeDelay13, 5);
//关闭M32,M35,M36,M37,M38
SetMfcByGroup((int)RoutineStep.CloseM32M35M37, MfcGroupName.M32M35M37, 0, 5);
SetMfcByGroup((int)RoutineStep.CloseM36, MfcGroupName.M36, 0, 5);
SetMfcByGroup((int)RoutineStep.CloseM38, MfcGroupName.M38, 0, 5);
Delay((int)RoutineStep.TimeDelay14, 5);
//关闭Final1阀
SetIoValueByGroup((int)RoutineStep.CloseFinanl1, IoGroupName.Final1, false, _IoValueOpenCloseTimeout);
//关闭Final2
SetIoValueByGroup((int)RoutineStep.CloseFinal2, IoGroupName.Final2, false, _IoValueOpenCloseTimeout);
//延时
TimeDelay((int)RoutineStep.TimeDelay15, _paramContinuePumpTime);
//先关蝶阀,再关闭EPV2
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode2, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.CLoseTvvvv, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay16, 1);
SetIoValueByGroup((int)RoutineStep.SetEPVVV2, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
//计算漏率
DoLeakCheck((int)RoutineStep.DoLeakCheck, _paramLeakCheckTime);
TimeDelay((int)RoutineStep.TimeDelay17, _paramLeakCheckTime);
CalcLeakCheck((int)RoutineStep.CalcLeakCheck, _paramLeakCheckTime);
//CalcLeackCheckPerMinute(_paramLeakCheckTime);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
_swTimer.Stop();
return Result.DONE;
}
public override void Abort()
{
//Stop($"{Module} leak check aborted");
_swTimer.Stop();
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
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 DoLeakCheck(int id, double time)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Keep pressure for {time} seconds");
_beginTime = _swTimer.ElapsedMilliseconds;
//_beginPressure = PmDevice.ChamberPressure;
_beginPressure = PmDevice._ioThrottleValve.PressureFeedback;
_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 = PmDevice.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 = PmDevice.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 = PmDevice.ChamberPressure;
double endPressure = PmDevice._ioThrottleValve.PressureFeedback;
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);
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);
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;
}
});
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,358 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMPcCalibrationRoutine : PMBaseRoutine
{
private PMModule _pm1Module;
public double pc4FB1;
public double pc4FB2;
public double pc4FB3;
public double pc5FB1;
public double pc6FB2;
public double pc7FB3;
public List<double> pc4FeedBack = new List<double>();
public List<double> pc5FeedBack = new List<double>();
public List<double> pc6FeedBack = new List<double>();
public List<double> pc7FeedBack = new List<double>();
public List<double> pc8FeedBack = new List<double>();
public List<double> pc9FeedBack = new List<double>();
private Stopwatch _swTimer = new Stopwatch();
public int ElapsedTime
{
get { return _swTimer.IsRunning ? (int)(_swTimer.ElapsedMilliseconds / 1000) : 0; }
}
enum RoutineStep
{
SetCloseV41,
SetOpenV42,
SetCloseV55,
SetOpenV56,
SetCloseV59,
SetOpenV60,
SetPC4Mode,
TimeDelay1,
SetPC4Default,
TimeDelay2,
SetOpenV41,
SetPC5Close,
TimeDelay3,
SetClose2V41,
SetPC5Mode,
TimeDelay4,
SetPC5Default,
TimeDelay5,
SetOpenV55,
SetPC6Close,
TimeDelay6,
SetClose2V55,
SetPC6Mode,
TimeDelay7,
SetPC6Default,
TimeDelay8,
SetOpenV59,
SetPC7Close,
TimeDelay9,
SetClose2V59,
SetPC7Mode,
TimeDelay10,
SetPC7Default,
GetPC45FeedBack,
SetPC5Offset,
GetPC46FeedBack,
SetPC6Offset,
GetPC47FeedBack,
SetPC7Offset
}
public PMPcCalibrationRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "PcCalibration";
_pm1Module = pm1;
}
public override Result Start(params object[] objs)
{
_swTimer.Restart();
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//CloseV41
SetIoValueByName((int)RoutineStep.SetCloseV41, "V41", false, 2);
//OpenV42
SetIoValueByName((int)RoutineStep.SetOpenV42, "V42", true, 2);
//CloseV55
SetIoValueByName((int)RoutineStep.SetCloseV55, "V55", false, 2);
//OpenV56
SetIoValueByName((int)RoutineStep.SetOpenV56, "V56", true, 2);
//CloseV59
SetIoValueByName((int)RoutineStep.SetCloseV59, "V59", false, 2);
//OpenV60
SetIoValueByName((int)RoutineStep.SetOpenV60, "V60", true, 2);
//PC4设置为默认值
SetPcModeToNormal((int)RoutineStep.SetPC4Mode, new List<int> { 4 });
TimeDelay((int)RoutineStep.TimeDelay1, 1);
SetPcToDefault((int)RoutineStep.SetPC4Default, new List<int> { 4 });
//等待2S
TimeDelay((int)RoutineStep.TimeDelay2, 2);
//OpenV41
SetIoValueByName((int)RoutineStep.SetOpenV41, "V41", true, 2);
//ClosePC5
SetPcModel((int)RoutineStep.SetPC5Close, new List<int> { 5 }, Aitex.Core.Common.DeviceData.PcCtrlMode.Close);
//等待5S
TimeDelay((int)RoutineStep.TimeDelay3, 5);
//计算10s PC4 PC5 反馈值平均数
GetPCFeedBackByName((int)RoutineStep.GetPC45FeedBack, "Pressure5", 12);
SetPcOffsetToConfig((int)RoutineStep.SetPC5Offset, "Pressure5");
//CloseV41 2
SetIoValueByName((int)RoutineStep.SetClose2V41, "V41", false, 2);
//PC5设置为默认值
SetPcModeToNormal((int)RoutineStep.SetPC5Mode, new List<int> { 5 });
TimeDelay((int)RoutineStep.TimeDelay4, 1);
SetPcToDefault((int)RoutineStep.SetPC5Default, new List<int> { 5 });
//等待2S
TimeDelay((int)RoutineStep.TimeDelay5, 2);
//OpenV55
SetIoValueByName((int)RoutineStep.SetOpenV55, "V55", true, 2);
//ClosePC6
SetPcModel((int)RoutineStep.SetPC6Close, new List<int> { 6 }, Aitex.Core.Common.DeviceData.PcCtrlMode.Close);
//等待5S
TimeDelay((int)RoutineStep.TimeDelay6, 5);
//计算10s PC4 PC6 反馈值平均数
GetPCFeedBackByName((int)RoutineStep.GetPC46FeedBack, "Pressure6", 12);
SetPcOffsetToConfig((int)RoutineStep.SetPC6Offset, "Pressure6");
//CloseV55 2
SetIoValueByName((int)RoutineStep.SetClose2V55, "V55", false, 2);
//PC6设置为默认值
SetPcModeToNormal((int)RoutineStep.SetPC6Mode, new List<int> { 6 });
TimeDelay((int)RoutineStep.TimeDelay7, 1);
SetPcToDefault((int)RoutineStep.SetPC6Default, new List<int> { 6 });
//等待2S
TimeDelay((int)RoutineStep.TimeDelay8, 2);
//OpenV59
SetIoValueByName((int)RoutineStep.SetOpenV59, "V59", true, 2);
//ClosePC7
SetPcModel((int)RoutineStep.SetPC7Close, new List<int> { 7 }, Aitex.Core.Common.DeviceData.PcCtrlMode.Close);
//等待5S
TimeDelay((int)RoutineStep.TimeDelay9, 5);
//计算10s PC4 PC6 反馈值平均数
GetPCFeedBackByName((int)RoutineStep.GetPC47FeedBack, "Pressure7", 12);
SetPcOffsetToConfig((int)RoutineStep.SetPC7Offset, "Pressure7");
//CloseV59 2
SetIoValueByName((int)RoutineStep.SetClose2V59, "V59", false, 2);
//PC7设置为默认值
SetPcModeToNormal((int)RoutineStep.SetPC7Mode, new List<int> { 7 });
TimeDelay((int)RoutineStep.TimeDelay10, 1);
SetPcToDefault((int)RoutineStep.SetPC7Default, new List<int> { 7 });
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException ex)
{
if (ex.Message == "Timeout")
{
Notify("Timeout");
}
return Result.FAIL;
}
_swTimer.Stop();
Notify("Finished");
return Result.DONE;
}
protected void SetIoValueByName(int id, string ioName, bool close, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify((close ? "Open" : "Close") + $"{ioName} value");
_pm1Module.SetIoValue(new System.Collections.Generic.List<string> { ioName }, close);
return true;
}, () =>
{
return _pm1Module.CheckIoValue(new System.Collections.Generic.List<string> { ioName }, close);
},
timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop((close ? "Open" : "Close") + $"{ioName} value timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
protected void GetPCFeedBackByName(int id, string ioName, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
pc4FeedBack.Clear();
pc5FeedBack.Clear();
pc6FeedBack.Clear();
pc7FeedBack.Clear();
pc8FeedBack.Clear();
pc9FeedBack.Clear();
_swTimer.Restart();
Notify($"Get {ioName} FeedBack 10s");
return true;
}, () =>
{
pc4FeedBack.Add(PmDevice.Pressure4.FeedBack);
if (ioName == "Pressure5")
{
pc5FeedBack.Add(PmDevice.Pressure5.FeedBack);
}
else if(ioName == "Pressure6")
{
pc6FeedBack.Add(PmDevice.Pressure6.FeedBack);
}
else if (ioName == "Pressure7")
{
pc7FeedBack.Add(PmDevice.Pressure7.FeedBack);
}
else if (ioName == "Pressure8")
{
pc8FeedBack.Add(PmDevice.Pressure8.FeedBack);
}
else if (ioName == "Pressure9")
{
pc9FeedBack.Add(PmDevice.Pressure9.FeedBack);
}
return ElapsedTime>=10;
},
timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
throw (new RoutineFaildException("Timeout"));
}
else
throw (new RoutineBreakException());
}
}
protected void SetPcOffsetToConfig(int id, string ioName)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
_swTimer.Stop();
double average = 0;
if (ioName == "Pressure5")
{
pc4FB1 = pc4FeedBack.Average();
pc5FB1 = pc5FeedBack.Average();
average = Convert.ToDouble((pc5FB1 - pc4FB1).ToString("0.00")) ;
Notify($"PC4FeedBack average: {pc4FB1.ToString("0.00")} , PC5FeedBack average: {pc5FB1.ToString("0.00")}");
//SC.SetItemValue($"PM.{Module}.PC5Offset", average);
}
else if (ioName == "Pressure6")
{
pc4FB2 = pc4FeedBack.Average();
pc6FB2 = pc6FeedBack.Average();
average = Convert.ToDouble((pc6FB2 - pc4FB2).ToString("0.00"));
Notify($"PC4FeedBack average: {pc4FB2.ToString("0.00")} , PC6FeedBack average: {pc6FB2.ToString("0.00")}");
//SC.SetItemValue($"PM.{Module}.PC6Offset", average);
}
else if (ioName == "Pressure7")
{
pc4FB3 = pc4FeedBack.Average();
pc7FB3 = pc7FeedBack.Average();
average = Convert.ToDouble((pc7FB3 - pc4FB3).ToString("0.00"));
Notify($"PC4FeedBack average: {pc4FB3.ToString("0.00")} , PC7FeedBack average: {pc7FB3.ToString("0.00")}");
//SC.SetItemValue($"PM.{Module}.PC7Offset", average);
}
Notify($"Set {ioName} offset {average} to config");
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,365 @@
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
class PMPostTransferRoutine : PMBaseRoutine
{
enum RoutineStep
{
SetUpLimit,
SetBlockOn,
Delay,
WaitStatusCorrect,
SetBlockOff,
EnableRotation,
EnableHeater,
SetRotation1,
WaitRotation1,
SetTC1Mode,
SetTC1Ratio,
SetTC1Ref,
SetTC2Mode,
SetTC2Ratio,
SetTC2Ref,
SetChamberPressure,
EnableTC1,
EnableTC2,
SetServoUp,
SetScrReset,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
TimeDelay15
}
bool hasWafer;
//private int _timeout;
private int _rotationSpeed = 60;
private bool _psuHeatEnable = false; //是否启用PSU 加热
private int _psuHeatMode = 0;
//private float _psuPowerRef = 0;
private float _psuL1Ratio = 0;
private float _psuL2Ratio = 0;
private float _psuL3Ratio = 0;
private bool _scrHeatEnable = false; //是否启用SCR 加热
private int _scrHeatMode = 0;
//private float _scrPowerRef = 0;
private float _scrL1Ratio = 0;
private float _scrL2Ratio = 0;
private float _scrL3Ratio = 0;
private double _targetPressure;
private PMServoToPressure _pmServoToPressure;
private bool _needEnableHeat = true;
private int _servoUpDelay;
//private NAISServo servo;
public PMPostTransferRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "Post Transfer Routine";
_pmServoToPressure = new PMServoToPressure(module, pm1);
}
public void Init(bool needEnableHeat)
{
_needEnableHeat = needEnableHeat;
}
public void Init(float basePressure, int ventDelayTime)
{
}
public override Result Start(params object[] objs)
{
//servo = DEVICE.GetDevice<NAISServo>($"{Module}.NAISServo");
//_timeout = SC.GetValue<int>($"NAISServo.UpTimeout");
_rotationSpeed = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RotationSpeed");
_psuHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.PSUHeaterEnable");
_psuHeatMode = SC.GetValue<int>($"PM.{Module}.ProcessIdle.PSUHeaterMode");
//_psuPowerRef = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUPowerRef");
_psuL1Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUInnerRatio");
_psuL2Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUMiddleRatio");
_psuL3Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUOuterRatio");
_scrHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.SCRHeaterEnable");
_scrHeatMode = SC.GetValue<int>($"PM.{Module}.ProcessIdle.SCRHeaterMode");
//_scrPowerRef = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.SCRPowerRef");
_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");
_targetPressure = SC.GetValue<double>($"PM.{Module}.ProcessIdle.FinalPressure");
_servoUpDelay = SC.GetValue<int>($"PM.{Module}.PreProcess.ServoBeforeUpDelay");
_pmServoToPressure.Init(_targetPressure);
hasWafer = WaferManager.Instance.CheckHasWafer(Module, 0);
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
EnableRotation((int)RoutineStep.EnableRotation, 5);
SetRotationValveAndNoWait((int)RoutineStep.SetRotation1, _rotationSpeed);
TimeDelay((int)RoutineStep.TimeDelay1, _servoUpDelay);
SetConfinementRingUpAndWait((int)RoutineStep.SetServoUp, 30);
ExecuteRoutine((int)RoutineStep.SetChamberPressure, _pmServoToPressure);
TimeDelay((int)RoutineStep.TimeDelay8, 1);
if (_psuHeatEnable && _needEnableHeat)
{
SetPSUEnable((int)RoutineStep.EnableTC1, true, 5);
SetPSUHeatMode((int)RoutineStep.SetTC1Mode, _psuHeatMode);
TimeDelay((int)RoutineStep.TimeDelay9, 1);
SetPSUHeatRatio((int)RoutineStep.SetTC1Ratio, _psuL1Ratio, _psuL2Ratio, _psuL3Ratio);
}
if (_scrHeatEnable && _needEnableHeat)
{
SetSCRReset((int)RoutineStep.SetScrReset);
TimeDelay((int)RoutineStep.TimeDelay10, 1);
SetSCREnable((int)RoutineStep.EnableTC2, true, 5);
SetSCRHeatMode((int)RoutineStep.SetTC2Mode, _scrHeatMode);
TimeDelay((int)RoutineStep.TimeDelay11, 1);
SetSCRHeatRatio((int)RoutineStep.SetTC2Ratio, _scrL1Ratio, _scrL2Ratio, _scrL3Ratio);
}
WaitRotationValve((int)RoutineStep.WaitRotation1, _rotationSpeed, true, _rotationSpeed / 2);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
//private void ServoUpLimit(int id, PMModuleBase pm, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Run {pm.Name} set Block No High.");
// //if (!servo.SetBlockNoHigh())
// //{
// // Stop(reason);
// // return false;
// //}
// servo.SetBlockNoHigh();
// return true;
// }, () =>
// {
// if (servo.AlarmStatus)
// {
// Stop($"{pm.Name} Servo in error State.");
// return null;
// }
// if (!servo.IsBusy)
// 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($"{pm.Name} prepare vent timeout, over {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
//private void ServoBlockOn(int id, PMModuleBase pm, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Run {pm.Name} set Stb On.");
// //if (!servo.SetBlockNoHigh())
// //{
// // Stop(reason);
// // return false;
// //}
// servo.SetStbOn();
// return true;
// }, () =>
// {
// if (servo.AlarmStatus)
// {
// Stop($"{pm.Name} Servo in error State.");
// return null;
// }
// if (!servo.IsBusy)
// {
// PMDevice.ServoStatus = ServoStatus.Uping;
// 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($"{pm.Name} prepare vent timeout, over {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
//private void ServoBlockOff(int id, PMModuleBase pm, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Run {pm.Name} set Stb Off.");
// //if (!servo.SetBlockNoHigh())
// //{
// // Stop(reason);
// // return false;
// //}
// servo.SetStbOff();
// return true;
// }, () =>
// {
// if (servo.AlarmStatus)
// {
// Stop($"{pm.Name} Servo in error State.");
// return null;
// }
// if (!servo.IsBusy)
// 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($"{pm.Name} prepare vent timeout, over {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
//private void WaitStatusCorrect(int id, PMModule pm, int timeout)
//{
// Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
// {
// Notify($"Run {pm.Name} Wait, Wait Status Correct");
// return true;
// }, () =>
// {
// if (servo.AlarmStatus)
// {
// Stop($"{pm.Name} Servo in error State error");
// return null;
// }
// if ((!servo.MotorBusy && servo.PositionComplete) && pm.ConfinementRing.IsUp)
// {
// PMDevice.ServoStatus = ServoStatus.Up;
// 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($"{pm.Name} vent timeout, over {timeout} seconds");
// throw (new RoutineFaildException());
// }
// else
// throw (new RoutineBreakException());
// }
//}
public override void Abort()
{
if (!PmDevice.StopVent(out string reason))
{
EV.PostWarningLog(Module, reason);
}
Stop("aborted");
}
}
}
@@ -0,0 +1,368 @@
using System;
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.PMs;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Servo.NAIS;
using SicModules.PMs.Routines.Base;
using static SicModules.PMs.PMModule;
namespace SicModules.PMs.Routines
{
class PMPrepareTransferRoutine : PMBaseRoutine
{
enum RoutineStep
{
SetDownLimit,
SetBlockOn,
Delay,
WaitStatusCorrect,
SetBlockOff,
RotationEnable,
HeatEnable,
SetPSUDisable,
SetSCRDisable,
WaitTempBelow900,
}
//private int _timeout;
private int _rotationCloseTimeout = 100; //旋转停止超时
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private bool _preTransferPSUEnable = false;
private bool _preTransferSCREnable = false;
private IoInterLock _pmIoInterLock;
private NAISServo servo;
public PMPrepareTransferRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "Servo Down";
servo = DEVICE.GetDevice<NAISServo>($"{Module}.NAISServo");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
//_timeout = SC.GetValue<int>($"NAISServo.DownTimeout");
}
public override Result Start(params object[] objs)
{
_preTransferPSUEnable = SC.GetValue<bool>($"PM.{Module}.PreTransferPSUEnable");
_preTransferSCREnable = SC.GetValue<bool>($"PM.{Module}.PreTransferSCREnable");
//if (PmDevice.CheckServoAlarm())
//{
// EV.PostWarningLog(Module, "can not up,confinementring is error.");
// return Result.FAIL;
//}
//if (PmDevice.CheckServoIsBusy())
//{
// EV.PostWarningLog(Module, "can not vent,confinementring is busy.");
// return Result.FAIL;
//}
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (!_preTransferPSUEnable)
{
SetPSUEnable((int)RoutineStep.SetPSUDisable, false, _heatTimeOut);
}
if (!_preTransferSCREnable)
{
SetSCREnable((int)RoutineStep.SetSCRDisable, false, _heatTimeOut);
}
SetRotationValve((int)RoutineStep.RotationEnable, 0, false, _rotationCloseTimeout);
//if (!_preTransferPSUEnable )
//{
// WaitTempratureBelow900((int)RoutineStep.WaitTempBelow900,600);
//}
if (SC.GetValue<bool>($"System.IsSimulatorMode"))
{
PmDevice.ServoStatus = ServoState.Down;
return Result.DONE;
}
//ServoDownLimit((int)RoutineStep.SetDownLimit, PMDevice, _timeout);
//ServoBlockOn((int)RoutineStep.SetBlockOn, PMDevice, _timeout);
//TimeDelay((int)RoutineStep.Delay, 2);
//WaitStatusCorrect((int)RoutineStep.WaitStatusCorrect, PMDevice, _timeout);
//ServoBlockOff((int)RoutineStep.SetBlockOff, PMDevice, _timeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
private void ServoDownLimit(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm.Name} set Block No Low.");
servo.SetBlockNoLow();
return true;
}, () =>
{
if (servo.AlarmStatus)
{
Stop($"{pm.Name} error");
return null;
}
if (!servo.IsBusy)
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($"{pm.Name}set Block No Low timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void ServoBlockOn(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm.Name} set Stb On.");
servo.SetStbOn();
return true;
}, () =>
{
if (servo.AlarmStatus)
{
Stop($"{pm.Name} Servo in error State");
return null;
}
if (!servo.IsBusy)
{
PmDevice.ServoStatus = ServoState.Downing;
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($"{pm.Name}set Stb On timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void ServoBlockOff(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm.Name} set Stb Off.");
servo.SetStbOff();
return true;
}, () =>
{
if (servo.AlarmStatus)
{
Stop($"{pm.Name} Servo in error State");
return null;
}
if (!servo.IsBusy)
{
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($"{pm.Name} set Stb Off timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void QueryStatusCorrect(int id, PMModule pm1, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm1.Name} Wait, Query Status Correct");
servo.Query();
return true;
}, () =>
{
if (servo.AlarmStatus)
{
Stop($"{pm1.Name} error");
return null;
}
if ((!servo.MotorBusy && servo.PositionComplete) && pm1.ConfinementRing.RingDownSensor)
{
PmDevice.ServoStatus = ServoState.Down;
return true;
}
else
{
servo.Query();
}
return false;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"{pm1.Name} Wait Status Correct timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void WaitStatusCorrect(int id, PMModule pm1, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm1.Name} Wait, Wait Status Correct");
return true;
}, () =>
{
if (servo.AlarmStatus)
{
Stop($"{pm1.Name} Servo in error State");
return null;
}
if ((!servo.MotorBusy && servo.PositionComplete) && pm1.ConfinementRing.RingDownSensor)
{
PmDevice.ServoStatus = ServoState.Down;
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($"{pm1.Name} Wait Status Correct timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
private void WaitTempratureBelow900(int id,int timeout)
{
Tuple<bool, Result> ret = Wait(id, () =>
{
if (_pmIoInterLock != null)
{
return _pmIoInterLock.DiHeaterTempBelow900CSW;
}
else
{
return true;
}
},
timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Wait PM Temprature below 900 timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public override void Abort()
{
if (!PmDevice.StopVent(out string reason))
{
EV.PostWarningLog(Module, reason);
}
Stop("aborted");
}
}
}
@@ -0,0 +1,185 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
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;
namespace SicModules.PMs.Routines
{
public class PMProcessAbortRoutine : PMBaseRoutine
{
private enum RoutineStep
{
HeatEnable,
SetPSUMode,
SetSCRMode,
SetPSURatio,
SetSCRRatio,
SetRotation,
SetM2toM40,
SetM17M18,
SetM1to16,
SetM5M21,
SetPC,
SetV32,
SetV35V36,
SetV68,
SetV65,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupK,
SetGroupD,
SetGroupG,
VentPumpClose,
SetGroupV25,
SetV34,
SetV100,
TimeDelay1,
TimeDelay2,
}
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();
//停止加热
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
//设置模式为Power
SetPSUHeatMode((int)RoutineStep.SetPSUMode, 0);
SetSCRHeatMode((int)RoutineStep.SetSCRMode, 0);
//设定功率为0
SetPSUHeatRatio((int)RoutineStep.SetPSURatio, 0, 0, 0);
SetSCRHeatRatio((int)RoutineStep.SetSCRRatio, 0, 0, 0);
//停止旋转
SetRotationValveAndNoWait((int)RoutineStep.SetRotation, 0);
//M2、M9、M15、M19-M40 MFC 30s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, _mfc2to40RampTime);
SetMfcToDefaultByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, _mfc2to40RampTime);
//M1 - M16 MFC 30s ramp 到 default 值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, _mfc1to16RampTime);
//M5 M2130s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM5M21, MfcGroupName.M5M21, _mfc1to16RampTime);
//所有PC设定为默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//等待MFC等流量
TimeDelay((int)RoutineStep.TimeDelay1, Math.Max(_mfc2to40RampTime, _mfc1to16RampTime));
//打开V32
SetIoValueByGroupNoWait((int)RoutineStep.SetV32, IoGroupName.V32, true);
//打开V35,打开V36
SetIoValueByGroupNoWait((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true);
//关闭B/C/E/F/H/K 阀门
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);
SetIoValueByGroupNoWait((int)RoutineStep.SetV34, IoGroupName.V34, false);
SetIoValueByGroupNoWait((int)RoutineStep.SetV100, IoGroupName.V100, false);
//打开D/G 阀门
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupD, IoGroupName.D, true);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupG, IoGroupName.G, true);
////打开V65
//SetIoValueByGroupNoWait((int)RoutineStep.SetV65, IoGroupName.V65, true);
//打开V68
SetIoValueByGroupNoWait((int)RoutineStep.SetV68, IoGroupName.GasIn1, true);
//关闭V72,打开V25
SetIoValueByGroupNoWait((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false);
TimeDelay((int)RoutineStep.TimeDelay2, 2);
SetIoValueByGroupNoWait((int)RoutineStep.SetGroupV25, IoGroupName.V25, true);
}
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();
}
}
}
@@ -0,0 +1,272 @@
using System;
using Aitex.Core.Common;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.RecipeCenter;
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.PMs;
namespace SicModules.PMs.Routines
{
public class PMProcessRoutine : ModuleRoutine, IRoutine
{
enum RoutineStep
{
Process,
NoteInProcess,
WaitProcess,
NoteProcessComplete,
NoteProcessFailed,
}
private int _timeout;
private PM _pm;
private IoInterLock _pmIoInterLock;
private string _paramRecipeName;
private bool _paramIsCleanRecipe;
private bool _paramWithWafer;
private string _recipeContent;
// private Guid _guidProcess;
public PMProcessRoutine(ModuleName module ): base(module.ToString())
{
Module = module.ToString();
Name = "Process";
_pm = DEVICE.GetDevice<PM>(Module);
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public Result Init(string recipeName, bool isClean, bool withWafer)
{
_paramRecipeName = recipeName;
_paramIsCleanRecipe = isClean;
_paramWithWafer = withWafer;
return Result.DONE;
}
public Result Start(params object[] objs)
{
Reset();
if (_paramWithWafer && !WaferManager.Instance.CheckHasWafer(_pm.Module, 0))
{
EV.PostWarningLog(Module, $"can not run process, No wafer at {Module}");
return Result.FAIL;
}
if (!_paramWithWafer && WaferManager.Instance.CheckHasWafer(_pm.Module, 0))
{
EV.PostWarningLog(Module, $"can not run waferless process, Has wafer at {Module}");
return Result.FAIL;
}
if (string.IsNullOrEmpty(_paramRecipeName))
{
EV.PostWarningLog(Module, $"can not run process, recipe name is empty");
return Result.FAIL;
}
_recipeContent = RecipeFileManager.Instance.LoadRecipe(Module, _paramRecipeName, false);
if (string.IsNullOrEmpty(_recipeContent))
{
EV.PostWarningLog(Module, $"can not run process, load recipe {_paramRecipeName} failed");
return Result.FAIL;
}
//_guidProcess = Guid.NewGuid();
if (!_pmIoInterLock.SetPMProcessRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Purge,{reason}");
return Result.FAIL;
}
_timeout = SC.GetValue<int>("PM.ProcessTimeout");
Notify("Start");
return Result.RUN;
}
public Result Monitor()
{
try
{
Process((int)RoutineStep.Process, _pm, _paramRecipeName, _recipeContent, _timeout);
NoteInProcess((int) RoutineStep.NoteInProcess, _pm.Module, 0);
WaitProcess((int)RoutineStep.WaitProcess, _pm,_timeout);
NoteProcessComplete((int)RoutineStep.NoteProcessComplete, _pm.Module, 0);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
NoteProcessFailed((int) RoutineStep.NoteProcessFailed, _pm.Module, 0);
return Result.FAIL;
}
Notify("Finished");
SetRoutineRuningDo();
return Result.DONE;
}
public void Abort()
{
SetRoutineRuningDo();
}
private void SetRoutineRuningDo()
{
_pmIoInterLock.DoProcessRunning = false;
}
protected void NoteInProcess(int id, string module, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {module} start");
ModuleName mod = ModuleHelper.Converter(module);
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.InProcess);
WaferManager.Instance.GetWafer(mod, slot).TrayProcessCount--;
// _pm.OnProcessStart(_guidProcess.ToString(), _paramRecipeName);
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
protected void NoteProcessFailed(int id, string module, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {module} failed");
ModuleName mod = ModuleHelper.Converter(module);
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.Failed);
// _pm.OnProcessEnd(_guidProcess.ToString(), "Failed");
return true;
});
//if (ret.Item1)
//{
// throw (new RoutineBreakException());
//}
}
protected void NoteProcessComplete(int id, string module, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {module} completed");
ModuleName mod = ModuleHelper.Converter(module);
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.Completed);
//_pm.OnProcessEnd(_guidProcess.ToString(), "Completed");
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
public void Process(int id, PM pm , string recipeName, string recipeContent, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Run {pm.Name} recipe {recipeName}");
pm.StartProcess(recipeName, recipeContent, _paramIsCleanRecipe);
return true;
}, () => {
if (pm.IsError)
{
return null;
}
return true;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"{pm.Name} error");
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"{pm.Name} run process timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
public void WaitProcess(int id, PM pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
return true;
}, () =>
{
if (pm.IsError)
{
return null;
}
return pm.IsIdle;
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop($"{pm.Name} error");
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT) //timeout
{
Stop($"{pm.Name} run process timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
@@ -0,0 +1,284 @@
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMPumpRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetGroupJ,
SetM1to16,
SetM17M18,
SetPC,
SetGroupI, //V87-96
SetM18,
SetM2to40,
SetM2to40_1,
MfcAll,
SetGasOut,
SetTv,
SetTv1,
WaitTv1,
SetGasIn1, //V65,V67,V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetGasIn2,
SetGroupJOpen,
OpenFinal2,
SetMfcFinal2,
PumpDownTimeout,
SetTvMode,
SetEPV1,
SetEPV2,
SetTVEnable,
SetTVPressMode,
SetTvPositionToZero,
SetMFCMode,
SetPCMode,
SetTvOpen,
SetTvModeToPress,
SetTVto1050,
OpenGasIn1,
CloseGasIn1,
CloseFinanl1,
CloseFinanl2,
SetGroupV38,
SetV76,
SetV75,
SetGroupV25,
SetV31,
SetV32,
SetV35V36,
SetV87V97,
SetV65,
SetV103,
SetV105,
SetTVPositionMode,
SetTVPositionMax,
CloseM32M35M37,
CloseM36,
CloseM38,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
}
private PMModule _pm1Module;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private double _pumpBasePressure;
private int _routineTimeOut;
private int _pumpTimeOut;
private Stopwatch _swTimer = new Stopwatch();
public PMPumpRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
_pm1Module = pm1;
Name = "PumpDown";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_pumpBasePressure = SC.GetValue<double>($"PM.{Module}.Pump.PumpBasePressure");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.Pump.RoutineTimeOut");
_pumpTimeOut = SC.GetValue<int>($"PM.{Module}.Pump.PumpTimeOut");
if (!_pmIoInterLock.SetPMPumpRoutineRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Pump,{reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//M1-M16设定为default值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, 0);
SetMfcToDefaultByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, 0);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2to40_1, MfcGroupName.M2toM40, 3);
//设置所有PC到默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//打开V68
SetIoValueByGroup((int)RoutineStep.OpenGasIn1, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//打开J阀门
SetIoValueByGroup((int)RoutineStep.SetGroupJ, IoGroupName.J, true, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTv1, _IoThrottle, _pumpBasePressure);
//M2、M9、M15、M19-M40 MFC 3s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2to40, MfcGroupName.M2toM40, 0, 3);
SetMfcByGroup((int)RoutineStep.SetM18, MfcGroupName.M18, 0, 3);
//关闭V87 V97
SetIoValueByGroup((int)RoutineStep.SetV87V97, IoGroupName.V87V97, false, _IoValueOpenCloseTimeout);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pumpBasePressure, _pumpTimeOut);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
SetThrottleSetPosition((int)RoutineStep.SetTVPositionMax, _IoThrottle, 100, _throttleTimeout);
_pmIoInterLock.SetPMPumpRoutineRunning(false, out _);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
return Result.DONE;
}
public override void Abort()
{
_pmIoInterLock.SetPMPumpRoutineRunning(false, out _);
PmDevice.SetRotationServo(0, 0);
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,537 @@
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMPurgeRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
SetM17M18,
SetPC,
SetGroupJ,
CloseGroupJ,
SetM291519to38,
SetGasOut,
SetTv,
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetMfc19to26,
SetTVCloseMode,
SetTvPositionToZero,
SetGasIn2,
SetGroupJOpen,
SetM291519to26,
SetM291519to26_1,
OpenFinal2,
IsOpenFinal1,
IsOpenFinal2,
IsCloseFinal1,
IsCloseFinal2,
SetMfcFinal2,
SetEPV1,
SetEPV2,
SetTvMode,
SetTVEnable_1,
SetTVEnable_2,
SetTVPressMode,
SetTVPressMode1,
SetTv1,
WaitTv1,
SetTVPositionMode,
SetTVPositionMode_1,
SetTVPositionMax,
SetTVPositionMax_1,
SetTvOpen,
SetTvModeToPress,
SetTVtoCurrent,
RoutinePre,
SetPressureUp,
SetPressureDown,
WaitPressureDown,
WaitPressureUp,
VentPumpOpen,
PressureToMax,
PressureToMin,
StartLoop,
EndLoop,
SetMfc28to31,
SetReactorPress,
CloseFinanl1,
CloseFinanl2,
CloseEPV2,
SetTVCloseMode1,
SetTVCloseMode2,
CLoseTvvvv,
CLoseTV1,
CLoseTV2,
SetEPV2_1,
SetEPV2_2,
SetEPV2_3,
CLoseEPV1,
CheckPM1000,
WaitPressUpTo1000,
WaitPressUpTo1020,
SetPressUpOrDown1,
SetPressUpOrDown2,
SetMfc28to40Special,
WaitPmPressureUp,
SetMfc27to40Default,
SetV75,
SetV76,
SetV31,
SetV32,
SetV35V36,
SetV65,
SetV751,
SetV761,
SetV103,
SetV105,
SetM2toM40,
SetM2toM40_1,
SetM2TOM40Default,
SetM18,
SetM18_1,
SetM18_2,
SetM18Default,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
SetM36_1,
SetM38_1,
SetV111_1,
SetV111_2,
SetPC567Close,
SetPC567Mode,
SetPC567Default,
OpenEPV2,
WaitPressUpTo20,
SetMfc291519to38,
WaitPressUpTo0,
SetMfc291519to38ToDefault,
WaitPressDownTo20,
SetPmPressureTo20,
CloseMfcFinal1,
CloseMfcFinal2,
CloseMfc2915,
CheckFinal1Open,
SetGroupV25,
Mfc36,
SetM39,
CloseMfc1to16, CloseMfc2to26, CloseJ,
CheckTVOpen1,
CheckTVOpen2,
CheckEPV1Open1,
CheckEPV2Open1,
CheckEPV2Open2,
CloseM32M35M37,
CloseM36,
CloseM38,
CloseGasIn1,
WaitPmPressureUp1,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay14,
TimeDelay18,
TimeDelay19,
TimeDelay20,
TimeDelay21,
TimeDelay22,
Notify1,
Notify2
}
private ModuleName moduleName;
private PMModule _pmModule;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private int _EPV2OpenTimeDelay = 10;
private double _ventBasePressure;
private double _pumpBasePressure;
private int _pressureLoopCount; //Loop次数
private int _pressureMinDelay;
private int _pressureMaxDelay;
private int _pressureMinTimeout;
private int _pressureMaxTimeout;
private int _IoValueOpenCloseTimeout = 10; //开关阀门超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private int _ventTimeout;
private int _pumpTimeout;
private int _EPV12TimeSapn = 10;
private int _waitPressureTimeout = 600; //等待腔体压力上升到950的超时时间
private bool _needFinalValveOpen = false;
private Stopwatch _swTimer = new Stopwatch();
public PMPurgeRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
moduleName = module;
_pmModule = pm;
Name = "Purge";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_ventTimeout = SC.GetValue<int>($"PM.{Module}.Purge.VentTimeout");
_pumpTimeout = SC.GetValue<int>($"PM.{Module}.Purge.PumpTimeout");
_pressureLoopCount = SC.GetValue<int>($"PM.{Module}.Purge.CyclePurgeCount");
_pumpBasePressure = SC.GetValue<double>($"PM.{Module}.Purge.PumpBasePressure");
_pressureMinDelay = SC.GetValue<int>($"PM.{Module}.Purge.PumpDelayTime");
_pressureMinTimeout = SC.GetValue<int>($"PM.{Module}.Purge.PumpTimeout");
_ventBasePressure = SC.GetValue<double>($"PM.{Module}.Purge.VentBasePressure");
_pressureMaxDelay = SC.GetValue<int>($"PM.{Module}.Purge.VentDelayTime");
_pressureMaxTimeout = SC.GetValue<int>($"PM.{Module}.Purge.VentTimeout");
_waitPressureTimeout = SC.GetValue<int>($"PM.{Module}.Purge.WaitPressureTimeout");
_needFinalValveOpen = SC.GetValue<bool>($"PM.{Module}.Purge.NeedFinalValveOpen");
//Clean succeed 清掉
_pmIoInterLock.DoLidCloseRoutineSucceed = false;
_pmIoInterLock.DoLidOpenRoutineSucceed = false;
if (!_pmIoInterLock.SetPMPurgeRoutineRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Purge,{reason}");
return Result.FAIL;
}
currentPressureUpOrDown = PressureUpOrDown.None;
_finalOpen = false;
_swTimer.Restart();
Notify($"Start LoopCount:{_pressureLoopCount}");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//打开J阀门
SetIoValueByGroup((int)RoutineStep.SetGroupJ, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//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);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM26, 3);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable_1, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTv1, _IoThrottle, _pumpBasePressure);
//M2、M9、M15、M19-M40 MFC 5s ramp 到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 5);
SetMfcByGroup((int)RoutineStep.SetM18, MfcGroupName.M18, 0, 5);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pumpBasePressure, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay11, 3);
SetThrottleSetPosition((int)RoutineStep.SetTVPositionMax, _IoThrottle, 100, _throttleTimeout);
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.OpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay3, 1);
//打开V92,V93和V95,再打开V94,在打开V96
SetMfcToDefaultByGroup((int)RoutineStep.SetM32M35M37, MfcGroupName.M32M35M37, 1);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36, MfcGroupName.M36, 1);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38, MfcGroupName.M38, 1);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, true, _IoValueOpenCloseTimeout);
//循环开始
Loop((int)RoutineStep.StartLoop, _pressureLoopCount);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2TOM40Default, MfcGroupName.M2toM40, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM18Default, MfcGroupName.M18, 3);
//先关蝶阀,再关闭EPV2
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode1, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.CLoseTV1, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay5, 1);
SetIoValueByGroup((int)RoutineStep.SetEPV2_1, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Uping);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _ventBasePressure, _ventTimeout);
////设置蝶阀为压力模式
//SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode1, _IoThrottle, 5);
////使用动态流量伺服到300mbar
//SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Uping);
//SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureUp, _IoThrottle, _ventBasePressure);
//WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _ventBasePressure, _pmPressureMaxDiff, _pressureMaxTimeout);
TimeDelay((int)RoutineStep.TimeDelay6, _pressureMaxDelay);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2_2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay7, 1);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable_2, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode1, _IoThrottle, 5);
//M2、M9、M15、M19-M40 MFC 3s ramp 0
SetMfcByGroup((int)RoutineStep.SetM2toM40_1, MfcGroupName.M2toM40, 0, 3);
SetMfcByGroup((int)RoutineStep.SetM18_1, MfcGroupName.M18, 0, 3);
//伺服到0mbar
SetThrottlePressureAndWait((int)RoutineStep.SetPressureDown, _IoThrottle, _pumpBasePressure, _pumpTimeout);
//TimeDelay((int)RoutineStep.TimeDelay8, 3);
////蝶阀设置为位置模式,开度设置为最大
//SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode_1, _IoThrottle, _throttleTimeout);
//SetThrottleSetPositionNoWait((int)RoutineStep.SetTVPositionMax_1, _IoThrottle, 100, _throttleTimeout);
//TimeDelay((int)RoutineStep.TimeDelay9, _pressureMinDelay);
EndLoop((int)RoutineStep.EndLoop);
//M2,M9,M15,M19-M26 3s ramp 到0
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26_1, MfcGroupName.M2toM26, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM18_2, MfcGroupName.M18, 3);
//M27-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfc27to40Default, MfcGroupName.M27toM40, 3);
//关闭J阀门
SetIoValueByGroup((int)RoutineStep.CloseGroupJ, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//关闭先关蝶阀,再EPV2
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode2, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.CLoseTV2, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay10, 1);
SetIoValueByGroup((int)RoutineStep.SetEPV2_3, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
//等待反应腔压力到达950
NotifyInfo((int)RoutineStep.Notify1, $"Wait pm pressure to 950 mbar!");
WaitChamberPressUpTo((int)RoutineStep.WaitPressUpTo1000, 950, _waitPressureTimeout);
if (_needFinalValveOpen)
{
//打开Final1阀
SetIoValueByGroup((int)RoutineStep.IsOpenFinal1, IoGroupName.Final1, true, _IoValueOpenCloseTimeout);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.IsOpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36_1, MfcGroupName.M36, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38_1, MfcGroupName.M38, 3);
SetIoValueByGroup((int)RoutineStep.SetV111_1, IoGroupName.V111, true, _IoValueOpenCloseTimeout);
}
else
{
//关闭Final1阀
SetIoValueByGroup((int)RoutineStep.IsCloseFinal1, IoGroupName.Final1, false, _IoValueOpenCloseTimeout);
//关闭Final2阀
SetIoValueByGroup((int)RoutineStep.IsCloseFinal2, IoGroupName.Final2, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV111_2, IoGroupName.V111, false, _IoValueOpenCloseTimeout);
}
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
SetRoutineSuccessedDo();
return Result.DONE;
}
public override void Abort()
{
_pmIoInterLock.DoLidOpenRoutineRunning = false;
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
base.Abort();
}
private void SetRoutineSuccessedDo()
{
_pmIoInterLock.DoLidOpenRoutineRunning = false;
_pmIoInterLock.SetLidOpenRoutineSucceed(true, out string reason);
_pmIoInterLock.DoLidCloseRoutineSucceed = false;
}
//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,140 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMServoToPressure : PMBaseRoutine
{
enum RoutineStep
{
RotationEnable,
HeatEnable,
SetM1to16,
SetM19to38,
TimeDelayForMFC,
SetTvOpen,
SetTvMode,
SetTVto1050,
TimeDelayForTV,
SetPressUpOrDown2,
SetPressureUp,
WaitPressureUp,
SetTvPressure,
SetEPV22,
TimeDelay5,
}
private ModuleName moduleName;
private PMModule _pm1Module;
private IoThrottleValve2 _IoThrottle;
private double _throTagertPressure; //蝶阀目标压力
private double _throttleRate; //蝶阀调节速率
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
//private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
//private int _rotationCloseTimeout = 20; //旋转停止超时
//private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
//private int _EPV2OpenDelayTime = 9;
private bool _isEPV2Open = false;
private bool _isBTVOpen = false;
public PMServoToPressure(ModuleName module, PMModule pm1) : base(module, pm1)
{
moduleName = module;
_pm1Module = pm1;
Name = "Servo To Pressure";
}
public void Init(double targetPressure)
{
_throTagertPressure = targetPressure;
}
public override Result Start(params object[] objs)
{
Reset();
//_throTagertPressure = SC.GetValue<double>($"TM.PressureBalance.BalancePressure");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
//_EPV2OpenDelayTime = SC.GetValue<int>($"PM.{Module}.TimeDelayAlterEPV2Open");
currentPressureUpOrDown = PressureUpOrDown.None;
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_isEPV2Open = _pm1Module.EPV2.Status;
_isBTVOpen = _IoThrottle.TVValveEnable;
if(Math.Abs(_throTagertPressure - _pm1Module.GetChamberPressure()) <= _pmPressureMaxDiff)
{
return Result.DONE;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
if (SC.GetValue<bool>("System.IsATMMode"))
{
return Result.DONE;
}
if (!_isEPV2Open)
{
SetIoValueByGroup((int)RoutineStep.SetEPV22, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 2);
}
if (!_isBTVOpen)
{
SetThrottleEnableAndWait((int)RoutineStep.SetTvOpen, _IoThrottle, 10);
SetThrottleToPressModeAndWait((int)RoutineStep.SetTvMode, _IoThrottle, 10);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTVto1050, _IoThrottle, 1050);
TimeDelay((int)RoutineStep.TimeDelayForTV, 2);
}
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown2,PressureUpOrDown.Dowing);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureUp, _IoThrottle, _throTagertPressure);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _throTagertPressure, _pmPressureMaxDiff, _throttleTimeout);
SetThrottlePressureAndWait((int)RoutineStep.SetTvPressure, _IoThrottle, _throTagertPressure, _pmPressureMaxDiff, _throttleTimeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
base.Abort();
}
}
}
@@ -0,0 +1,54 @@
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMStopHeatEnableRoutine : PMBaseRoutine
{
enum RoutineStep
{
SetPSUDisable,
SetSCRDisable,
}
private int _heatTimeOut = 5;
public PMStopHeatEnableRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "StopEnable";
}
public override Result Start(params object[] objs)
{
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
SetPSUEnable((int)RoutineStep.SetPSUDisable, false, _heatTimeOut);
SetSCREnable((int)RoutineStep.SetSCRDisable, false, _heatTimeOut);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
}
}
@@ -0,0 +1,304 @@
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMToAtmIdleRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
SetM17M18,
SetM2toM40,
SetPC,
SetM291519to38,
SetGroupJ,
SetM19to38,
SetGasOut,
SetTv,
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetMfc19to26,
SetTVCloseMode,
SetTvPositionToZero,
CheckPM1000,
SetGasIn2,
SetGroupJOpen,
SetM291519to26,
OpenFinal2,
SetMfcFinal2,
WaitPmPressureUp,
WaitPmPressureUp1,
SetEPV1,
SetEPV2,
SetTvMode,
SetEPVV1,
SetMfc28to40Special,
SetMfc28to40Default,
SetPC567Close,
SetPC567Mode,
SetPC567Default,
CheckFinal1Open,
SetV76,
SetV75,
SetV31,
SetV32,
SetV35V36,
SetGroupV25,
SetV103,
SetV105,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay18,
TimeDelay20,
TimeDelay21,
TimeDelay22,
Notify1,
}
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private int _waitPMPressureUpTimeout = 300; //等待反应腔压力到达1000的超时时间
private int _routineTimeOut;
private double _ventBasePressure;
private Stopwatch _swTimer = new Stopwatch();
public PMToAtmIdleRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
Module = module.ToString();
Name = "AtmIdle";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.Vent.RoutineTimeOut");
_ventBasePressure = SC.GetValue<double>($"PM.{Module}.Vent.VentBasePressure");
_waitPMPressureUpTimeout = SC.GetValue<int>($"PM.{Module}.Vent.VentTimeout");
if (!_pmIoInterLock.SetPMAtmIdleRountingRunning(true, out var reason))
{
EV.PostAlarmLog(Module, $"can not run ToATMIdle, {reason}");
return Result.FAIL;
}
currentPressureUpOrDown = PressureUpOrDown.None;
_swTimer.Restart();
_finalOpen = false;
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//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);
//M2、M9、M15、M19-M40 MFC 3s ramp 到默认值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 3);
//关闭蝶阀
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.SetTvPositionToZero, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
//关闭EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
//打开A 组阀
SetIoValueByGroup((int)RoutineStep.SetGroupA, IoGroupName.A, true, _IoValueOpenCloseTimeout);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.OpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM32M35M37, MfcGroupName.M32M35M37, 3);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//打开J Valves
SetIoValueByGroup((int)RoutineStep.SetGroupJOpen, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM26, 3);
//开V94,V96需等到腔体压力大于950
WaitPMPressureAndSetMfcSpecial((int)RoutineStep.WaitPmPressureUp1, 950, _waitPMPressureUpTimeout);
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36, MfcGroupName.M36, 5);
TimeDelay((int)RoutineStep.TimeDelay3, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38, MfcGroupName.M38, 5);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
//等待反应腔压力大于1000
NotifyInfo((int)RoutineStep.Notify1, $"Wait pm pressure to {_ventBasePressure} mbar!");
WaitPMPressureAndSetMfcSpecial((int)RoutineStep.WaitPmPressureUp, _ventBasePressure, _waitPMPressureUpTimeout);
//设置M28,M29,M31,M40 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfc28to40Default, MfcGroupName.M28293140, 3);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
_pmIoInterLock.SetPMAtmIdleRountingRunning(false, out var reason);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
return Result.DONE;
}
public override void Abort()
{
_pmIoInterLock.SetPMAtmIdleRountingRunning(false, out var reason);
_pmIoInterLock.SetPMVentRoutineRunning(false, out _);
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
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,214 @@
using System.Collections.Generic;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMToIsolationRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetM1to16,
SetM2toM40,
SetM17M18,
SetPC,
SetGroupI, //V87-96
SetM19to38,
CloseFinal1,
CloseFinal2,
CloseEPV2,
SetGasOut,
SetTv,
SetGasIn1, //V65,V67,V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetM19to26,
SetGasIn2,
SetGroupJOpen,
OpenFinal2,
SetMfcFinal2,
SetEPV1,
SetEPV2,
SetTVCloseMode,
SetTvPositionToZero,
SetMFCMode,
SetPCMode,
SetV76,
SetV75,
SetV31,
SetV32,
SetV35V36,
SetGroupV25,
SetV65,
CloseV68,
SetV103,
SetV105,
CloseM32M35M37,
CloseM36,
CloseM38,
CloseGasIn1,
CloseFinanl1,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay14,
TimeDelay18,
TimeDelayForEPV1,
}
private PMModule _pm1Module;
private IoThrottleValve2 _IoThrottle;
private int _rotationCloseTimeout = 20; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
public PMToIsolationRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
_pm1Module = pm1;
Name = "Isolation";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
}
public override Result Start(params object[] objs)
{
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, 0, false, _rotationCloseTimeout);
//关闭V72
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
//关闭V68
SetIoValueByGroup((int)RoutineStep.CloseV68, IoGroupName.V68, false, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//M1-M16设定为default值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, 0);
//设置所有PC到默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//M2、M9、M15、M19-M40 MFC 5s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 5);
SetMfcByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, 0, 5);
//关闭Final1阀
SetIoValueByGroup((int)RoutineStep.CloseFinal1, IoGroupName.Final1, false, _IoValueOpenCloseTimeout);
//关闭Final2
SetIoValueByGroup((int)RoutineStep.CloseFinal2, IoGroupName.Final2, false, _IoValueOpenCloseTimeout);
//关闭蝶阀
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.SetTvPositionToZero, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
//关闭EPV2
SetIoValueByGroup((int)RoutineStep.CloseEPV2, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Isolation Finished");
return Result.DONE;
}
public override void Abort()
{
PmDevice.SetRotationServo(0, 0);
base.Abort();
}
}
}
@@ -0,0 +1,479 @@
using System.Collections.Generic;
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;
namespace SicModules.PMs.Routines
{
public class PMToProcessIdleRoutine : PMBaseRoutine
{
private enum RoutineStep
{
ConfinementServoOn,
RotationServoOn,
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
OpenH2Valve,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
SetM17M18,
SetPC,
SetGroupJ,
SetM2toM40,
SetPC567Close,
SetPC567Default,
SetPC567Mode,
SetGasOut,
SetTv,
SetM291519to38,
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetM291519to26,
SetTVCloseMode,
SetTvPositionToZero,
CheckPM1000,
SetGasIn2,
SetGroupJOpen,
CloseFinal2,
OpenFinal2,
SetMfcFinal2,
WaitPmPressureUp,
WaitPmPressureUp1020,
SetTvOpen,
SetTVEnable,
SetTVPressMode,
SetTV,
SetTvMode,
SetTVto1050,
SetTVto300,
WaitTvTo300,
CheckPmVac,
CheckPmAtm,
CheckV72Open,
SetV72,
SetV25,
SetV76,
SetV75,
SetV31,
SetV32,
SetV35V36,
SetV65,
SetV103,
SetV105,
SetEPV1,
SetEPV2,
SetEPV11,
SetEPV22,
SetTvModeToPress,
SetMfc28to40Special,
SetMfc28to40Default,
SetPressUpOrDown1,
SetPressureDown,
EnableRotation,
EnableHeater,
SetRotation1,
WaitRotation1,
SetTC1Mode,
SetTC1Ratio,
SetTC1RatioTo0,
SetTC1Ref,
SetTC2Mode,
SetTC2Ratio,
SetTC2RatioTo0,
SetTC2Ref,
EnableTC1,
EnableTC2,
CloseTC1,
CloseTC2,
SetFinal1ToDefault,
SetFinal1To0,
SetFinal2ToDefault,
SetFinal2To0,
CheckFinal1Open,
CheckFinal2Open,
CheckTvOpen,
SetRotation2,
SetGroupV25,
SetScrReset,
CheckEpv2Open,
CheckEpv1Open,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
WaitPmPressureUp1,
DelayV25,
TimeDelay0,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
TimeDelay15,
TimeDelay16,
TimeDelay20,
TimeDelay21,
TimeDelay22,
Notify1,
Notify2
}
private IoThrottleValve2 _IoThrottle;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private double _throttleFinalPressure = 300;//蝶阀最终调整对的压力
private bool _psuHeatEnable = false; //是否启用PSU 加热
private int _psuHeatMode = 0;
//private float _psuPowerRef = 0;
private float _psuL1Ratio = 0;
private float _psuL2Ratio = 0;
private float _psuL3Ratio = 0;
private bool _scrHeatEnable = false; //是否启用SCR 加热
private int _scrHeatMode = 0;
//private float _scrPowerRef = 0;
private float _scrL1Ratio = 0;
private float _scrL2Ratio = 0;
private float _scrL3Ratio = 0;
private int _rotationSpeed = 60;
private int _routineTimeOut;
private Stopwatch _swTimer = new Stopwatch();
private IoInterLock _pmInterLock;
public PMToProcessIdleRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
Module = module.ToString();
Name = "ProcessIdle";
}
public override Result Start(params object[] objs)
{
Reset();
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
//if (!_pmInterLock.SetPMProcessIdleRunning(true, out string reason))
//{
// EV.PostAlarmLog(Module, $"can not run ProcessIdle, {reason}");
// return Result.FAIL;
//}
/*
* 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))
{
LOG.Error($"Failed to set DOProcessIdle to false due to {reason}");
}
if (!PmDevice.CheckHeadHeaterEnable(true))
{
EV.PostAlarmLog(Module, $"Should set HeatEnable on first!");
return Result.FAIL;
}
//检查隔热罩状态
if (PmDevice.ConfinementRing.RingServoError || PmDevice.ConfinementRing.RingIsBusy ||
!PmDevice.ConfinementRing.RingServoOn)
{
EV.PostAlarmLog(Module, $"ConfinementRing State abnormal,please check");
return Result.FAIL;
}
////检查磁流体状态
//if(!PmDevice._sicServo.ServoReady)
//{
// EV.PostAlarmLog(Module, $"NAIS Servo State abnormal,please check");
// return Result.FAIL;
//}
_v72IsOpen = false;
_checkPMPressureOver1000 = false;
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_rotationSpeed = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RotationSpeed");
_throttleFinalPressure = SC.GetValue<double>($"PM.{Module}.ProcessIdle.FinalPressure");
_psuHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.PSUHeaterEnable");
_psuHeatMode = SC.GetValue<int>($"PM.{Module}.ProcessIdle.PSUHeaterMode");
_psuL1Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUInnerRatio");
_psuL2Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUMiddleRatio");
_psuL3Ratio = (float)SC.GetValue<double>($"PM.{Module}.ProcessIdle.PSUOuterRatio");
_scrHeatEnable = SC.GetValue<bool>($"PM.{Module}.ProcessIdle.SCRHeaterEnable");
_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");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.ProcessIdle.RoutineTimeOut");
_finalOpen = false;
_isTvOpen = false;
currentPressureUpOrDown = PressureUpOrDown.None;
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止
//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);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//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);
////M2、M9、M15、M19-M40 MFC 5s ramp 到0
//SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 5);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 3);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.OpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM32M35M37, MfcGroupName.M32M35M37, 3);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36, MfcGroupName.M36, 5);
TimeDelay((int)RoutineStep.TimeDelay3, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38, MfcGroupName.M38, 5);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
//打开J Valves
SetIoValueByGroup((int)RoutineStep.SetGroupJOpen, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM26, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到1050mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTV, _IoThrottle, 1050);
//打开V72
SetIoValueByGroup((int)RoutineStep.SetV72, IoGroupName.VentPump, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 1);
//关闭V25
SetIoValueByGroup((int)RoutineStep.SetV25, IoGroupName.V25, false, _IoValueOpenCloseTimeout);
//蝶阀调整到300
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Dowing);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureDown, _IoThrottle, _throttleFinalPressure);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.SetTVto300, _IoThrottle, _throttleFinalPressure, _pmPressureMaxDiff, _throttleTimeout);
//TimeDelay((int)RoutineStep.TimeDelay8, 3);
//转速Enable,加热Enable, 电流功率可配置
EnableRotation((int)RoutineStep.EnableRotation, 5);
SetRotationValveAndNoWait((int)RoutineStep.SetRotation1, _rotationSpeed);
if (_psuHeatEnable)
{
//打开PSU加热
SetPSUEnable((int)RoutineStep.EnableTC1, true, 5);
SetPSUHeatMode((int)RoutineStep.SetTC1Mode, _psuHeatMode);
TimeDelay((int)RoutineStep.TimeDelay6, 1);
SetPSUHeatRatio((int)RoutineStep.SetTC1Ratio, _psuL1Ratio, _psuL2Ratio, _psuL3Ratio);
}
else
{
//关闭PSU加热
SetPSUHeatRatio((int)RoutineStep.SetTC1RatioTo0, 0, 0, 0);
SetPSUEnable((int)RoutineStep.CloseTC1, false, 5);
}
if (_scrHeatEnable)
{
//打开SCR加热
SetSCRReset((int)RoutineStep.SetScrReset);
TimeDelay((int)RoutineStep.TimeDelay7, 1);
SetSCREnable((int)RoutineStep.EnableTC2, true, 5);
SetSCRHeatMode((int)RoutineStep.SetTC2Mode, _scrHeatMode);
TimeDelay((int)RoutineStep.TimeDelay8, 1);
SetSCRHeatRatio((int)RoutineStep.SetTC2Ratio, _scrL1Ratio, _scrL2Ratio, _scrL3Ratio);
}
else
{
//关闭SCR加热
SetSCRHeatRatio((int)RoutineStep.SetTC2RatioTo0, 0, 0, 0);
SetSCREnable((int)RoutineStep.CloseTC2, false, 5);
}
WaitRotationValve((int)RoutineStep.WaitRotation1, _rotationSpeed, true, _rotationSpeed / 2);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
// _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();
return Result.DONE;
}
private void CheckRoutineTimeOut()
{
if (_routineTimeOut > 10)
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
Notify($"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
}
public override void Abort()
{
_pmInterLock.SetPMProcessIdleRunning(false, out string reason);
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetHeaterStopRamp();
PmDevice.SetRotationStopRamp();
PmDevice.SetRotationServo(0, 0);
base.Abort();
}
}
}
@@ -0,0 +1,286 @@
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMVacIdleRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetGroupJ,
SetM1to16,
SetM17M18,
SetPC,
SetGroupI, //V87-96
SetM18,
SetM2to40,
SetM2to40_1,
MfcAll,
SetGasOut,
SetTv,
SetTv1,
WaitTv1,
SetGasIn1, //V65,V67,V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetGasIn2,
SetGroupJOpen,
OpenFinal2,
SetMfcFinal2,
PumpDownTimeout,
SetTvMode,
SetEPV1,
SetEPV2,
SetTVEnable,
SetTVPressMode,
SetTvPositionToZero,
SetMFCMode,
SetPCMode,
SetTvOpen,
SetTvModeToPress,
SetTVto1050,
OpenGasIn1,
SetV65,
CloseGasIn1,
CloseFinanl1,
CloseFinanl2,
SetGroupV38,
SetV76,
SetV75,
SetGroupV25,
SetV31,
SetV32,
SetV35V36,
SetV87V97,
SetV103,
SetV105,
SetTVPositionMode,
SetTVPositionMax,
CloseM32M35M37,
CloseM36,
CloseM38,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
}
private PMModule _pm1Module;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private double _pmPressureMaxDiff; //蝶阀与目标压力的差值范围(认为调整到位了)
private int _throttleTimeout; //蝶阀调整到指定压力的超时时间
private double _vacPumpBasePressure;
private int _routineTimeOut;
private int _pumpTimeOut;
private Stopwatch _swTimer = new Stopwatch();
public PMVacIdleRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
_pm1Module = pm1;
Name = "VacIdle";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
_throttleTimeout = SC.GetValue<int>($"PM.{Module}.ThrottlePressureTimeout");
_vacPumpBasePressure = SC.GetValue<double>($"PM.{Module}.Pump.PumpBasePressure");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.Pump.RoutineTimeOut");
_pumpTimeOut = SC.GetValue<int>($"PM.{Module}.Pump.PumpTimeOut");
if (!_pmIoInterLock.SetPMVacIdleRountingRunning(true, out var reason))
{
EV.PostAlarmLog(Module, $"can not run VACIdle, {reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//M1-M16设定为default值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, 0);
SetMfcToDefaultByGroup((int)RoutineStep.SetM17M18, MfcGroupName.M17M18, 0);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2to40_1, MfcGroupName.M2toM40, 3);
//设置所有PC到默认值
SetPcToDefault((int)RoutineStep.SetPC, _lstPcList);
//打开V68
SetIoValueByGroup((int)RoutineStep.OpenGasIn1, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//打开J阀门
SetIoValueByGroup((int)RoutineStep.SetGroupJ, IoGroupName.J, true, _IoValueOpenCloseTimeout);
////打开V65
//SetIoValueByGroup((int)RoutineStep.SetV65, IoGroupName.V65, true, _IoValueOpenCloseTimeout);
//打开EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 3);
//设置蝶阀Enable
SetThrottleEnableAndWait((int)RoutineStep.SetTVEnable, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottleToTargetAndNoWait((int)RoutineStep.SetTv1, _IoThrottle, _vacPumpBasePressure);
//M2、M9、M15、M19-M40 MFC 3s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2to40, MfcGroupName.M2toM40, 0, 3);
SetMfcByGroup((int)RoutineStep.SetM18, MfcGroupName.M18, 0, 3);
//关闭V87 V97
SetIoValueByGroup((int)RoutineStep.SetV87V97, IoGroupName.V87V97, false, _IoValueOpenCloseTimeout);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _vacPumpBasePressure, _pumpTimeOut);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
SetThrottleSetPosition((int)RoutineStep.SetTVPositionMax, _IoThrottle, 100, _throttleTimeout);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
_pmIoInterLock.SetPMVacIdleRountingRunning(false, out string reason);
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
return Result.DONE;
}
public override void Abort()
{
_pmIoInterLock.SetPMVacIdleRountingRunning(false, out string reason);
_pmIoInterLock.SetPMPumpRoutineRunning(false, out _);
PmDevice.SetRotationServo(0, 0);
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,308 @@
using System.Collections.Generic;
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 SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
{
public class PMVentRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
SetM17M18,
SetM2toM40,
SetPC,
SetM291519to38,
SetGroupJ,
SetM19to38,
SetGasOut,
SetTv,
SetGasIn1, //V68
OpenFinal1, //V91-96
SetMfcFinal1, //M32-38
SetMfc19to26,
SetTVCloseMode,
SetTvPositionToZero,
CheckPM1000,
SetGasIn2,
SetGroupJOpen,
SetM291519to26,
OpenFinal2,
SetMfcFinal2,
WaitPmPressureUp,
WaitPmPressureUp1,
SetEPV1,
SetEPV2,
SetTvMode,
SetEPVV1,
SetMfc28to40Special,
SetMfc28to40Default,
SetPC567Close,
SetPC567Mode,
SetPC567Default,
CheckFinal1Open,
SetV76,
SetV75,
SetV31,
SetV32,
SetV35V36,
SetV103,
SetV105,
SetGroupV25,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay18,
TimeDelay20,
TimeDelay21,
TimeDelay22,
Notify1,
}
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
private int _rotationCheckSpeed = 0; //设置旋转速度为0后检查是否转速低于此数值
private int _rotationCloseTimeout; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
private int _waitPMPressureUpTimeout = 300; //等待反应腔压力到达1000的超时时间
private int _routineTimeOut;
private double _ventBasePressure;
private Stopwatch _swTimer = new Stopwatch();
public PMVentRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
Module = module.ToString();
Name = "Vent";
_IoThrottle = DEVICE.GetDevice<IoThrottleValve2>($"{Module}.TV");
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public override Result Start(params object[] objs)
{
Reset();
_rotationCloseTimeout = SC.GetValue<int>($"PM.{Module}.RotationCloseTimeout");
_routineTimeOut = SC.GetValue<int>($"PM.{Module}.Vent.RoutineTimeOut");
_ventBasePressure = SC.GetValue<double>($"PM.{Module}.Vent.VentBasePressure");
_waitPMPressureUpTimeout = SC.GetValue<int>($"PM.{Module}.Vent.VentTimeout");
currentPressureUpOrDown = PressureUpOrDown.None;
_swTimer.Restart();
_finalOpen = false;
if (!_pmIoInterLock.SetPMVentRoutineRunning(true, out string reason))
{
EV.PostAlarmLog(Module, $"can not Vent,{reason}");
return Result.FAIL;
}
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
CheckRoutineTimeOut();
//关闭V76,打开V75
SetIoValueByGroup((int)RoutineStep.SetV76, IoGroupName.V76, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV75, IoGroupName.V75, true, _IoValueOpenCloseTimeout);
//旋转停止,加热停止
SetHeatEnable((int)RoutineStep.HeatEnable, false, _heatTimeOut);
SetRotationValve((int)RoutineStep.RotationEnable, _rotationCheckSpeed, false, _rotationCloseTimeout);
//关闭V72,打开V25
SetIoValueByGroup((int)RoutineStep.VentPumpClose, IoGroupName.VentPump, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//打开V103,关闭V105
SetIoValueByGroup((int)RoutineStep.SetV103, IoGroupName.V103, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV105, IoGroupName.V105, false, _IoValueOpenCloseTimeout);
//打开V31,打开V32
SetIoValueByGroup((int)RoutineStep.SetV31, IoGroupName.V31, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetV32, IoGroupName.V32, true, _IoValueOpenCloseTimeout);
//打开V35,打开V36
SetIoValueByGroup((int)RoutineStep.SetV35V36, IoGroupName.V35V36, true, _IoValueOpenCloseTimeout);
//关闭B/C/E/F/H/K 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupB, IoGroupName.B, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupC, IoGroupName.C, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupF, IoGroupName.F, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupH, IoGroupName.H, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
//打开D/G 阀门
SetIoValueByGroup((int)RoutineStep.SetGroupD, IoGroupName.D, true, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupG, IoGroupName.G, true, _IoValueOpenCloseTimeout);
//设置MFC和PC的模式
SetMfcModeToNormalByGroup((int)RoutineStep.SetMFCMode, MfcGroupName.All);
SetPcModeToNormal((int)RoutineStep.SetPCMode, _lstPcList);
//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);
//M2、M9、M15、M19-M40 MFC 3s ramp 到默认值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 3);
//关闭蝶阀
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.SetTvPositionToZero, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay1, 1);
//关闭EPV2
SetIoValueByGroup((int)RoutineStep.SetEPV2, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
//打开A 组阀
SetIoValueByGroup((int)RoutineStep.SetGroupA, IoGroupName.A, true, _IoValueOpenCloseTimeout);
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.OpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
//Final2阀对应的MFC 3s Ramp到Default值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfcFinal2, MfcGroupName.Final2, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
SetMfcToDefaultByGroup((int)RoutineStep.SetM32M35M37, MfcGroupName.M32M35M37, 3);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
//打开J Valves
SetIoValueByGroup((int)RoutineStep.SetGroupJOpen, IoGroupName.J, true, _IoValueOpenCloseTimeout);
//设置M2,M9,M15,M19-M26 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM291519to26, MfcGroupName.M2toM26, 3);
//开V94,V96需等到腔体压力大于950
WaitPMPressureAndSetMfcSpecial((int)RoutineStep.WaitPmPressureUp1, 950, _waitPMPressureUpTimeout);
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM36, MfcGroupName.M36, 5);
TimeDelay((int)RoutineStep.TimeDelay3, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
SetMfcToDefaultByGroup((int)RoutineStep.SetM38, MfcGroupName.M38, 5);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
//等待反应腔压力到达1020
NotifyInfo((int)RoutineStep.Notify1, $"Wait pm pressure to {_ventBasePressure} mbar!");
WaitPMPressureAndSetMfcSpecial((int)RoutineStep.WaitPmPressureUp, _ventBasePressure, _waitPMPressureUpTimeout); //等待反应腔压力大于1000
//设置M28,M29,M31,M40 3s ramp 到default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfc28to40Default, MfcGroupName.M28293140, 3);
_pmIoInterLock.SetPMVentRoutineRunning(false, out _);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify($"Finished ! Elapsed time: {(int)(_swTimer.ElapsedMilliseconds / 1000)} s");
_swTimer.Stop();
return Result.DONE;
}
public override void Abort()
{
_pmIoInterLock.SetPMVentRoutineRunning(false, out _);
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
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,946 @@
using System;
using System.Collections.Generic;
using Aitex.Core.Common;
using Aitex.Core.Common.DeviceData;
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.OperationCenter;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.MECF.Framework.Common.RecipeCenter.Recipe;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.SubstrateTrackings;
using SicModules.PMs.RecipeExecutions;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines.Recipe
{
public enum RecipeContinueMode
{
None,
WaferReturnAndJobStop,
RecipeCompleted,
StepContinue,
StepRestart,
RecipeRestart,
NextStep,
}
public enum RoutineType
{
DefaultRoutine,
AtmRoutine,
VacRoutine,
ProcessIdleRoutine,
PumpRoutine,
VentRoutine,
PurgeRoutine,
CleanRoutine,
ExchangeMORoutine,
IsolationRoutine,
LeakCheckRoutine,
AbortRoutine
}
public partial class PMMacroRoutine : PMBaseRoutine
{
enum RoutineStep
{
WaitProcess,
}
enum RecipeRunningState
{
Error,
RecipeCompleted,
ExecStep,
TimeWait,
ConditionWait,
StepCompleted,
Paused,
}
private object _recipeLocker = new object();
private RecipeRunningState _state = RecipeRunningState.ExecStep;
private RecipeRunningState _pausedState = RecipeRunningState.ExecStep;
private DeviceTimer _estimatedTimeCalcTimer = new DeviceTimer();//用于定时计算工艺程序估计的结束时间
private double _curStepElpasedTimeBeforePaused;
private double _curStepElpasedTimeBeforePaused2;
//前序所有步总的时间
private double _preStepTotalTime;
public RecipeContinueMode ContinueAction { get; set; }
public DateTime _recipeStartTime
{
get;
private set;
}
public string CurrentRecipeContent { get; private set; }
private int _currentStepNumber;
private int _dummyStepCount;
public int CurStepTotalLoopCount
{
get;
private set;
}
public double CurStepTotalTime
{
get
{
if (PmDevice.RecipeRunningInfo.RecipeStepList == null || PmDevice.RecipeRunningInfo.RecipeStepList.Count == 0 || _state == RecipeRunningState.RecipeCompleted || _state == RecipeRunningState.Error)
return 0;
return PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime * 1000;
}
}
public int CurrentLoopCount
{
get;
private set;
}
public int CurStartLoopStep;
private DeviceTimer _stepTimer = new DeviceTimer();
private DeviceTimer _stepTimer2 = new DeviceTimer();
private DeviceTimer _recipeTimer = new DeviceTimer();
public bool IsPaused
{
private set;
get;
}
private double CurStepLeftTime
{
get
{
return _stepTimer.GetTotalTime() - _stepTimer.GetElapseTime();
}
}
public double EstimatedTotalLeftTime
{
get;
private set;
}
private RecipeDBCallback _dbCallback;
private Fdc _fdc;
private int _currentStepIndex = 99;
private IoInterLock _pmInterLock;
private string _recipeName;
private RoutineType _routineType;
#region Parse
private bool _isPSUHeaterJumpMode;
private bool _isSCRHeaterJumpMode;
private bool _isMFCJumpMode;
#endregion
public PMMacroRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "Routine";
_dbCallback = new RecipeDBCallback();
_fdc = new Fdc(Module);
_pmInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
public void Init(string recipeName, RoutineType routineType = RoutineType.DefaultRoutine)
{
_recipeName = recipeName;
_routineType = routineType;
}
public bool SetRoutineRunning(bool eValue,out string reason)
{
reason = string.Empty;
if(_routineType == RoutineType.ProcessIdleRoutine)
{
if (!_pmInterLock.SetPMProcessIdleRunning(eValue, out reason))
{
return false;
}
}
else if (_routineType == RoutineType.CleanRoutine)
{
if (!_pmInterLock.SetPMCleanRoutineRunning(eValue, out reason))
{
return false;
}
}
else if (_routineType == RoutineType.PurgeRoutine)
{
if (!_pmInterLock.SetPMPurgeRoutineRunning(eValue, out reason))
{
return false;
}
}
else if (_routineType == RoutineType.PumpRoutine)
{
if (!_pmInterLock.SetPMPumpRoutineRunning(eValue, out reason))
{
return false;
}
}
else if (_routineType == RoutineType.VentRoutine)
{
if (!_pmInterLock.SetPMVentRoutineRunning(eValue, out reason))
{
return false;
}
}
else if (_routineType == RoutineType.ExchangeMORoutine)
{
if (!_pmInterLock.SetPMExchangeMoRoutineRunning(eValue, out reason))
{
return false;
}
}
else if (_routineType == RoutineType.VacRoutine)
{
}
else if (_routineType == RoutineType.AtmRoutine)
{
}
else
{
if (!_pmInterLock.SetPMProcessRunning(eValue, out reason))
{
return false;
}
}
return true;
}
public override Result Start(params object[] param)
{
Reset();
//解析Recipe
if (!RecipeParser.Parse(_recipeName, Module, out var recipeHead, out var recipeSteps, out string reason))
{
Stop($"Load recipe {_recipeName} failed, {reason}");
return Result.FAIL;
}
if(!SetRoutineRunning(true,out reason))
{
EV.PostAlarmLog(Module, $"can not run Routine, {reason}");
return Result.FAIL;
}
if (_routineType == RoutineType.PurgeRoutine)
{
_pmInterLock.DoLidCloseRoutineSucceed = false;
}
else if (_routineType == RoutineType.CleanRoutine)
{
_pmInterLock.DoLidOpenRoutineSucceed = false;
}
//先打开加热
PmDevice.SetHeatEnable(true);
_currentStepIndex = 99;
//设置当前Step/当前循环步/当前总循环步为0
_currentStepNumber = 0;
CurStartLoopStep = 0;
CurrentLoopCount = CurrentLoopCount = 0;
_preStepTotalTime = 0;
_dummyStepCount = 0;
_estimatedTimeCalcTimer.Start(1000);
PmDevice.RecipeRunningInfo.RecipeName = _recipeName;
PmDevice.RecipeRunningInfo.Head = recipeHead;
PmDevice.RecipeRunningInfo.RecipeStepList = recipeSteps;
PmDevice.RecipeRunningInfo.InnerId = Guid.NewGuid();
PmDevice.RecipeRunningInfo.BeginTime = DateTime.Now;
PmDevice.RecipeRunningInfo.TotalTime = CalcRecipeTime();
_state = RecipeRunningState.ExecStep;
_recipeTimer.Start(int.MaxValue);
_dbCallback.RecipeStart(PmDevice.Module, 0, PmDevice.RecipeRunningInfo.InnerId.ToString(), PmDevice.RecipeRunningInfo.RecipeName);
_dbCallback.RecipeUpdateStatus(PmDevice.RecipeRunningInfo.InnerId.ToString(), "InProcess");
WaferManager.Instance.UpdateWaferProcessStatus(ModuleHelper.Converter(Module), 0, WaferProcessStatus.InProcess);
_fdc.Reset();
Notify($"Start");
return Result.RUN;
}
public override Result Monitor()
{
if (!PmDevice.CheckEnableRunProcess(out string reason))
{
EV.PostAlarmLog(Module, reason);
return Result.FAIL;
}
MonitorRecipeEndTime();
MonitorRecipeRunInfo();
lock (_recipeLocker)
{
try
{
switch (_state)
{
case RecipeRunningState.ExecStep:
{
PmDevice.ResetToleranceChecker();
if (ContinueAction != RecipeContinueMode.StepContinue)
{
_curStepElpasedTimeBeforePaused = 0;
_curStepElpasedTimeBeforePaused2 = 0;
}
ContinueAction = RecipeContinueMode.None;
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsLoopStartStep)
{
CurStartLoopStep = _currentStepNumber;
CurStepTotalLoopCount = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].LoopCount;
}
_stepTimer.Start(PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime * 1000 - _curStepElpasedTimeBeforePaused);
if (!_stepTimer2.IsIdle())
{
_curStepElpasedTimeBeforePaused2 += _stepTimer2.GetElapseTime();
_stepTimer2.Stop();
}
_stepTimer2.Start(int.MaxValue);
Notify($"Running step {_currentStepNumber + 1} : {PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName}");
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsDummyStep)
{
_dummyStepCount++;
}
//执行工艺程序命令
foreach (var recipeCmd in PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands.Keys)
{
if (recipeCmd == "SusHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd] == "Jump")
_isPSUHeaterJumpMode = true;
else
_isPSUHeaterJumpMode = false;
continue;
}
if (recipeCmd == "WWHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd] == "Jump")
_isSCRHeaterJumpMode = true;
else
_isSCRHeaterJumpMode = false;
continue;
}
if (recipeCmd == "FlowSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd] == "Jump")
_isMFCJumpMode = true;
else
_isMFCJumpMode = false;
continue;
}
if (IsCmdSkip(recipeCmd)) // 不是注册的方法,需要跳过
continue;
if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd]))
{
EV.PostAlarmLog(Module, $"Can not execute {recipeCmd}, {reason}");
return Result.FAIL;
}
else
{
int time = (int)PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime * 1000;
if (recipeCmd.StartsWith("TC1") && _isPSUHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("TC2") && _isSCRHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("Mfc") && recipeCmd.EndsWith(".Ramp") && !PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsDummyStep)
{
if (_isMFCJumpMode)
{
time = 1;
}
}
if ((recipeCmd == "TV.SetPressure"
|| recipeCmd == "PMServo.SetActualSpeed"
|| recipeCmd.StartsWith("Pressure") && recipeCmd.EndsWith(".Ramp")
|| recipeCmd.StartsWith("Mfc") && recipeCmd.EndsWith(".Ramp"))
&& !PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsDummyStep)
{
if (_currentStepNumber >= 1)
{
int previousStepNumber = _currentStepNumber - 1;
if (PmDevice.RecipeRunningInfo.RecipeStepList[previousStepNumber].IsDummyStep)
previousStepNumber = _currentStepNumber - 2;
if (PmDevice.RecipeRunningInfo.RecipeStepList[previousStepNumber].RecipeCommands.ContainsKey(recipeCmd))
{
string previousValue = PmDevice.RecipeRunningInfo.RecipeStepList[previousStepNumber].RecipeCommands[recipeCmd];
string currentValue = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd];
if (previousValue == currentValue)
{
time = 1;
}
}
}
}
if (recipeCmd.EndsWith(AITValveOperation.GVTurnValve)) // 阀门
{
OP.DoOperation($"{Module}.{recipeCmd}", PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd]);
}
else
{
OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands[recipeCmd]);
}
}
}
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].EndBy == EnumEndByCondition.ByTime)
_state = RecipeRunningState.TimeWait;
else
_state = RecipeRunningState.ConditionWait;
_dbCallback.RecipeStepStart(PmDevice.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName, (float)PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime);
_fdc.Start(PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands);
}
break;
case RecipeRunningState.TimeWait:
{
if (IsPaused)
{
_state = RecipeRunningState.Paused;
}
if (_stepTimer.IsTimeout())
{
_state = RecipeRunningState.StepCompleted;
}
}
break;
case RecipeRunningState.ConditionWait:
{
//如果暂停,则进入暂停状态
if (IsPaused)
{
_state = RecipeRunningState.Paused;
}
//设置的压力
double.TryParse(PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].RecipeCommands["TV.SetPressure"], out double setPressure);
//实时反馈的压力
double feedBackPressure = DEVICE.GetDevice<IoPressure>($"{Module}.PT1").FeedBack;
double _pmPressureMaxDiff = SC.GetValue<double>($"PM.{Module}.ThrottlePressureMaxDiff");
if(Math.Abs(setPressure - feedBackPressure) <= _pmPressureMaxDiff)
{
_state = RecipeRunningState.StepCompleted;
}
}
break;
case RecipeRunningState.Paused:
PmDevice.PauseRecipe(out reason);
if (!_stepTimer.IsIdle())
{
_curStepElpasedTimeBeforePaused += _stepTimer.GetElapseTime();
_stepTimer.Stop();
}
switch (ContinueAction)
{
case RecipeContinueMode.None:
break;
case RecipeContinueMode.WaferReturnAndJobStop:
//Singleton<RouteManager>.Instance.CheckToPostMessage((int)RouteManager.MSG.StopJob);
_state = RecipeRunningState.Error;
break;
case RecipeContinueMode.RecipeCompleted:
_state = RecipeRunningState.RecipeCompleted;
break;
case RecipeContinueMode.StepContinue:
_state = RecipeRunningState.ExecStep;
break;
case RecipeContinueMode.StepRestart:
_state = RecipeRunningState.ExecStep;
break;
case RecipeContinueMode.RecipeRestart:
_currentStepNumber = 0;
_state = RecipeRunningState.ExecStep;
break;
case RecipeContinueMode.NextStep:
_state = RecipeRunningState.StepCompleted;
break;
}
break;
case RecipeRunningState.StepCompleted:
{
_preStepTotalTime += CurStepTotalTime/1000;
//放在前面,stepnumber后面会被更新
_stepTimer2.Stop();
_dbCallback.RecipeStepEnd(PmDevice.RecipeRunningInfo.InnerId.ToString(), _currentStepNumber, _fdc.DataList);
_fdc.Stop();
if (PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].IsLoopEndStep)
{
CurrentLoopCount++;
if (CurrentLoopCount >= CurStepTotalLoopCount)
{
CurrentLoopCount = CurStepTotalLoopCount = 0;
CurStartLoopStep = 0;
_currentStepNumber++;
}
else
{
_currentStepNumber = CurStartLoopStep;
}
}
else
{
_currentStepNumber++;
}
//判断最后一步是否执行完
if (_currentStepNumber >= PmDevice.RecipeRunningInfo.RecipeStepList.Count)
{
_currentStepNumber = PmDevice.RecipeRunningInfo.RecipeStepList.Count - 1;
_state = RecipeRunningState.RecipeCompleted;
}
else
{
_state = RecipeRunningState.ExecStep;
}
}
break;
case RecipeRunningState.RecipeCompleted:
{
_recipeTimer.Stop();
if (!SetRoutineRunning(false, out reason))
{
EV.PostAlarmLog(Module, $"can not run Process, {reason}");
return Result.FAIL;
}
//设置Succeed状态
if(_routineType == RoutineType.PurgeRoutine)
{
_pmInterLock.SetLidOpenRoutineSucceed(true, out reason);
}
else if (_routineType == RoutineType.CleanRoutine)
{
_pmInterLock.SetLidClosedRoutineSucceed(true, out reason);
}
//设置当前Step/当前循环步/当前总循环步为0
_currentStepNumber = 0;
CurStartLoopStep = 0;
CurrentLoopCount = CurrentLoopCount = 0;
Notify("Finished");
return Result.DONE;
}
case RecipeRunningState.Error:
{
if (!SetRoutineRunning(false, out reason))
{
EV.PostAlarmLog(Module, $"can not run Process, {reason}");
return Result.FAIL;
}
return Result.DONE;
}
default:
break;
}
}
catch (Exception ex)
{
PmDevice.SetHeaterStopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationStopRamp();
if (!SetRoutineRunning(false, out reason))
{
EV.PostAlarmLog(Module, $"can not run Process, {reason}");
return Result.FAIL;
}
LOG.Write(ex);
return Result.FAIL;
}
}
return Result.RUN;
}
private void MonitorRecipeRunInfo()
{
PmDevice.RecipeRunningInfo.StepNumber = _currentStepNumber + 1 - _dummyStepCount; //CurStepNum start from 0, ignore dummy step
PmDevice.RecipeRunningInfo.StepName = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepName;
PmDevice.RecipeRunningInfo.StepTime = PmDevice.RecipeRunningInfo.RecipeStepList[_currentStepNumber].StepTime;
PmDevice.RecipeRunningInfo.StepElapseTime = _stepTimer.IsIdle() ? _curStepElpasedTimeBeforePaused / 1000 : (_stepTimer.GetElapseTime() + _curStepElpasedTimeBeforePaused) / 1000;
PmDevice.RecipeRunningInfo.TotalElapseTime = CalcElapseRecipeTime();
PmDevice.RecipeRunningInfo.StepElapseTime2 = _stepTimer2.IsIdle() ? _curStepElpasedTimeBeforePaused2 / 1000 : (_stepTimer2.GetElapseTime() + _curStepElpasedTimeBeforePaused2) / 1000;
PmDevice.RecipeRunningInfo.TotalElapseTime2 = _recipeTimer.GetElapseTime() / 1000;
if (_currentStepIndex != PmDevice.RecipeRunningInfo.StepNumber)
{
Notify($"Start Recipe: Step:{PmDevice.RecipeRunningInfo.StepNumber} Name:{PmDevice.RecipeRunningInfo.StepName} ");
_currentStepIndex = PmDevice.RecipeRunningInfo.StepNumber;
}
}
public override void Abort()
{
_state = RecipeRunningState.RecipeCompleted;
_dbCallback.RecipeFailed(PmDevice.RecipeRunningInfo.InnerId.ToString());
_fdc.Stop();
PmDevice.RecipeRunningInfo.StepName = string.Empty;
PmDevice.RecipeRunningInfo.StepNumber = 0;
PmDevice.RecipeRunningInfo.StepTime = 0;
PmDevice.RecipeRunningInfo.StepElapseTime = 0;
PmDevice.RecipeRunningInfo.TotalTime = 0;
PmDevice.RecipeRunningInfo.TotalElapseTime = 0;
if (!SetRoutineRunning(false, out string reason))
{
EV.PostAlarmLog(Module, $"can not run Process, {reason}");
}
//根据Routine类型执行Abort
SetRoutineAbort();
base.Abort();
}
private List<string> _lstGroup1 = new List<string>() { "V46", "V46s", "V73" };
private List<string> _lstGroup2 = new List<string>() { "V46", "V46s" };
private List<string> _lstGroup3 = new List<string>() { "V43", "V43s", "V45" };
//默认为TMA换源参数
private int mfc7Or10 = 7;
private int mfc8Or12 = 8;
private int mfc11 = 11;
private int pc2Or3 = 2;
public void SetRoutineAbort()
{
if (_routineType == RoutineType.ProcessIdleRoutine)
{
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetHeaterStopRamp();
PmDevice.SetRotationStopRamp();
PmDevice.SetRotationServo(0, 0);
}
else if (_routineType == RoutineType.CleanRoutine)
{
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
}
else if (_routineType == RoutineType.PurgeRoutine)
{
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
}
else if (_routineType == RoutineType.PumpRoutine)
{
PmDevice.SetRotationServo(0, 0);
}
else if (_routineType == RoutineType.VentRoutine)
{
PmDevice._ioThrottleValve.StopRamp();
PmDevice.SetMfcStopRamp(PmDevice.GetMfcListByGroupName(MfcGroupName.All));
PmDevice.SetRotationServo(0, 0);
}
else if (_routineType == RoutineType.ExchangeMORoutine)
{
PmDevice.SetIoValue(_lstGroup1, false);
PmDevice.SetIoValue(_lstGroup2, false);
PmDevice.SetMfcValueToDefault(new List<int> { mfc7Or10 });
PmDevice.SetMfcValueToDefault(new List<int> { mfc8Or12 });
PmDevice.SetMfcValueToDefault(new List<int> { mfc11 });
PmDevice.SetPCValueToDefault(new List<int> { pc2Or3 });
PmDevice.SetRotationServo(0, 0);
}
else if (_routineType == RoutineType.VacRoutine)
{
PmDevice.SetRotationServo(0, 0);
}
}
public void ExitProcess()
{
if (_state == RecipeRunningState.RecipeCompleted)
{
_dbCallback.RecipeComplete(PmDevice.RecipeRunningInfo.InnerId.ToString());
_fdc.Stop();
}
else
{
_dbCallback.RecipeFailed(PmDevice.RecipeRunningInfo.InnerId.ToString());
_fdc.Stop();
}
}
public void PauseRecipe()
{
if (_state != RecipeRunningState.TimeWait && _state != RecipeRunningState.ConditionWait)
return;
if (!IsPaused)
{
IsPaused = true;
_pausedState = _state;
_state = RecipeRunningState.Paused;
}
}
public void SkipCurrentRecipeStep()
{
if (_state == RecipeRunningState.ConditionWait || _state == RecipeRunningState.TimeWait)
{
_state = RecipeRunningState.StepCompleted;
}
}
protected int CalcRecipeTime()
{
double total = 0;
for (int i = 0; i < PmDevice.RecipeRunningInfo.RecipeStepList.Count; i++)
{
if (!PmDevice.RecipeRunningInfo.RecipeStepList[i].IsDummyStep) // 不统计虚拟Step的时间
{
int loopTimes = PmDevice.RecipeRunningInfo.RecipeStepList[i].LoopCount == 0 ? 1 : PmDevice.RecipeRunningInfo.RecipeStepList[i].LoopCount;
total += PmDevice.RecipeRunningInfo.RecipeStepList[i].StepTime * loopTimes;
}
}
return (int)total;
}
protected int CalcElapseRecipeTime()
{
double total = 0;
//for (int i = 0; i < _currentStepNumber; i++)
//{
// if (!PMDevice.RecipeRunningInfo.RecipeStepList[i].IsDummyStep) // 不统计虚拟Step的时间
// {
// total += PMDevice.RecipeRunningInfo.RecipeStepList[i].StepTime;
// }
//}
total = _preStepTotalTime;
total += PmDevice.RecipeRunningInfo.StepElapseTime;
return (int)total;
}
protected void MonitorRecipeEndTime()
{
try
{
if (!_estimatedTimeCalcTimer.IsTimeout())
return;
_estimatedTimeCalcTimer.Start(1000);
EstimatedTotalLeftTime = 0;
if (_state == RecipeRunningState.RecipeCompleted)
return;
if (!(_currentStepNumber >= 0 && _currentStepNumber <= PmDevice.RecipeRunningInfo.RecipeStepList.Count - 1))
return;
if (CurStepLeftTime > 0)
{
EstimatedTotalLeftTime = CurStepLeftTime;
}
int nextBegin = _currentStepNumber;
bool IsInLoop = false;
int iNum1 = 0;
int iNum2 = 0;
//int j=i;
for (int j = _currentStepNumber; j < PmDevice.RecipeRunningInfo.RecipeStepList.Count; j++)
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[j].IsLoopEndStep)
{
iNum2 = j;
IsInLoop = true;
break;
}
else if (j > _currentStepNumber && PmDevice.RecipeRunningInfo.RecipeStepList[j].IsLoopStartStep)
{
IsInLoop = false;
break;
}
}
if (IsInLoop)
{
iNum1 = _currentStepNumber;
for (int j = _currentStepNumber; j >= 0; j--)
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[j].IsLoopStartStep)
{
iNum1 = j;
break;
}
}
for (int j = _currentStepNumber + 1; j <= iNum2; j++)
{
EstimatedTotalLeftTime += PmDevice.RecipeRunningInfo.RecipeStepList[j].StepTime * 1000 * (PmDevice.RecipeRunningInfo.RecipeStepList[iNum1].LoopCount - CurrentLoopCount + 1);
}
for (int j = iNum1; j <= _currentStepNumber; j++)
{
EstimatedTotalLeftTime += PmDevice.RecipeRunningInfo.RecipeStepList[j].StepTime * 1000 * (PmDevice.RecipeRunningInfo.RecipeStepList[iNum1].LoopCount - CurrentLoopCount);
}
nextBegin = iNum2 + 1;
}
else
{
nextBegin++;
}
for (int j = nextBegin; j < PmDevice.RecipeRunningInfo.RecipeStepList.Count; j++)
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[j].IsLoopStartStep)
{
//j=i;
iNum1 = j;
iNum2 = j + 1;
double lr1 = 0;
for (int m = j; m < PmDevice.RecipeRunningInfo.RecipeStepList.Count; m++)
{
lr1 += PmDevice.RecipeRunningInfo.RecipeStepList[m].StepTime * 1000;
if (PmDevice.RecipeRunningInfo.RecipeStepList[m].IsLoopEndStep)
{
iNum2 = m;
break;
}
}
EstimatedTotalLeftTime += lr1 * PmDevice.RecipeRunningInfo.RecipeStepList[iNum1].LoopCount;
j = iNum2;
}
else
{
EstimatedTotalLeftTime += PmDevice.RecipeRunningInfo.RecipeStepList[j].StepTime * 1000;
}
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
public void SetContinue(string continueMode)
{
switch (continueMode)
{
case "Step continue":
ContinueAction = RecipeContinueMode.StepContinue;
break;
case "Step restart":
ContinueAction = RecipeContinueMode.StepRestart;
break;
case "Next step":
ContinueAction = RecipeContinueMode.NextStep;
break;
case "Recipe restart":
ContinueAction = RecipeContinueMode.RecipeRestart;
break;
case "Recipe complete":
ContinueAction = RecipeContinueMode.RecipeCompleted;
break;
case "Wafer return and job stop":
ContinueAction = RecipeContinueMode.WaferReturnAndJobStop;
break;
}
IsPaused = false;
PmDevice.ResetToleranceChecker();
}
}
}
@@ -0,0 +1,54 @@
using Aitex.Core.RT.Routine;
using MECF.Framework.Common.Equipment;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines.Recipe
{
public class PostPMMacroRoutine : PMBaseRoutine
{
enum RoutineStep
{
}
public PostPMMacroRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "PostPMMacro";
}
public override Result Start(params object[] objs)
{
Reset();
Notify("Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
Notify("Finished");
return Result.DONE;
}
public override void Abort()
{
PmDevice.AbortRunProcess(out string reason);
}
}
}
@@ -0,0 +1,508 @@
using System;
using System.Collections.Generic;
using Aitex.Core.Common;
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.OperationCenter;
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.PMs;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines.Recipe
{
public class PrePMMacroRoutine : PMBaseRoutine
{
public enum RoutineStep
{
SetServoUp,
SetChamberPressure,
EnableRotation,
OpenH2Valve,
EnableHeater,
PcCalibartion,
RunStepOne,
Wait,
CheckCondition,
}
private string _recipeName;
private bool _isCleanRecipe;
private bool _withWafer;
private Guid _guidProcess;
private bool _isDryRun;
private bool _isPSUHeaterJumpMode;
private bool _isSCRHeaterJumpMode;
private bool _isMFCJumpMode;
private int _delayTimeRamp;
private double _targetPressure;
private IoInterLock _pmInterLock;
private PMServoToPressure _pmServoToPressure;
private PMPcCalibrationRoutine _pmPcCalibrationRoutine;
public PrePMMacroRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
{
Module = module.ToString();
Name = "PrePMMacro";
_pmInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
_pmServoToPressure = new PMServoToPressure(module, pm1);
_pmPcCalibrationRoutine = new PMPcCalibrationRoutine(module, pm1);
}
public void Init(string recipeName, bool isClean, bool withWafer)
{
_recipeName = recipeName;
_isCleanRecipe = isClean;
_withWafer = withWafer;
}
public override Result Start(params object[] objs)
{
Reset();
if (!RecipeParser.Parse(_recipeName, Module, out var recipeHead, out var recipeSteps, out string reason))
{
Stop($"Load recipe {_recipeName} failed, {reason}");
return Result.FAIL;
}
if (!_withWafer && WaferManager.Instance.CheckHasWafer(PmDevice.Module, 0))
{
EV.PostWarningLog(Module, $"can not run waferless process, Has wafer at {Module}");
return Result.FAIL;
}
if (_withWafer && !WaferManager.Instance.CheckHasWafer(PmDevice.Module, 0))
{
EV.PostWarningLog(Module, $"can not run process, no wafer at {Module}");
return Result.FAIL;
}
if (!PmDevice.Pump.IsOn || PmDevice.Pump.IsError)
{
EV.PostWarningLog(Module, $"can not run process, pump state is not correct");
return Result.FAIL;
}
//Recipe Routine先打开加热
PmDevice.SetHeatEnable(true);
//if (!PMDevice._ioThrottleValve.TVValveEnable)
//{
// EV.PostWarningLog(Module, $"can not run process, TV is not enable");
// return Result.FAIL;
//}
//if (PMDevice._ioThrottleValve.ControlModeFeedback != PressureCtrlMode.TVPressureCtrl)
//{
// EV.PostWarningLog(Module, $"can not run process, TV is not Pressure Ctrol Mode");
// return Result.FAIL;
//}
//if (!PMDevice.CheckIOValueByGroup(IoGroupName.I, true))
//{
// EV.PostAlarmLog(Module, $"can not run process,I valves is not open!");
// return Result.FAIL;
//}
//if (!PMDevice.CheckIOValueByGroup(IoGroupName.E, false))
//{
// EV.PostAlarmLog(Module, $"can not run process,E valves is not closed!");
// return Result.FAIL;
//}
//if (!PMDevice.CheckIOValueByGroup(IoGroupName.K, false))
//{
// EV.PostAlarmLog(Module, $"can not run process,K valves is not closed!");
// return Result.FAIL;
//}
//if (!PMDevice.CheckIOValueByGroup(IoGroupName.VentPump, true))
//{
// EV.PostAlarmLog(Module, $"can not run process,V72 is not open!");
// return Result.FAIL;
//}
//if (!PMDevice.PSU1.AllHeatEnable)
//{
// EV.PostAlarmLog(Module, $"can not run process,Heater is disable!");
// return Result.FAIL;
//}
if (!_pmInterLock.SetPMPreProcessRunning(true, out reason))
{
EV.PostAlarmLog(Module, $"can not run preProcess, {reason}");
return Result.FAIL;
}
_isDryRun = SC.GetValue<bool>($"PM.{Module}.DryRun.IsDryRun");
_delayTimeRamp = SC.GetValue<int>($"PM.{Module}.PreProcess.RampDelayTime");
_targetPressure = SC.GetValue<double>($"PM.{Module}.PreProcess.ChamberPressure");
_pmServoToPressure.Init(_targetPressure);
_guidProcess = Guid.NewGuid();
PmDevice.RecipeRunningInfo.RecipeName = _recipeName;
PmDevice.RecipeRunningInfo.Head = recipeHead;
PmDevice.RecipeRunningInfo.RecipeStepList = recipeSteps;
Notify($"Start");
return Result.RUN;
}
public override Result Monitor()
{
try
{
//
// ExecuteRoutine((int)RoutineStep.SetChamberPressure, _pmServoToPressure);
//
// EnableRotation((int)RoutineStep.EnableRotation, 5);
//
// OpenH2Valve((int)RoutineStep.OpenH2Valve, PMDevice, 2);
//
// EnableHeater((int)RoutineStep.EnableHeater, PMDevice, 5);
//ExecuteRoutine((int)RoutineStep.PcCalibartion, _pmPcCalibrationRoutine);
//NoteInProcess((int)Routine.NoteInProcess,0);
//if (_isSlitDoorOpened)
//ExecuteRoutine((int)Routine.CloseSlitValve, _closeSlitValveRoutine);
//关闭所有阀门
// CloseAllValves((int)Routine.CloseAllVavle, 10);
//if (!_isATMMode)
//{
// // ExecuteRoutine((int)Routine.Pump, _pumptRoutine);
// //SetThrottlePressureControlMode((int)Routine.SetThrottlePressureControlMode, _throttleValve);
//}
//End((int)Routine.End, "Preprocess finished");
//NoteProcessComplete((int)Routine.NoteProcessComplete, 0);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
//NoteProcessFailed((int)Routine.NoteProcessFailed);
return Result.FAIL;
}
catch (Exception ex)
{
LOG.Write(ex, String.Format("Preprocess Monitor has exception"));
throw (ex);
}
_pmInterLock.SetPMPreProcessRunning(false, out string reason);
Notify("Finished");
return Result.DONE;
}
protected void EnableHeater(int id, PMModuleBase pm, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
Notify($"Set {pm.Name} Heater Enable");
if (!pm.EnableHeater(true, out string reason))
{
Stop($"Set {pm.Name} Heater Enable failed, {reason}");
return false;
}
return true;
}, () =>
{
return pm.CheckHeaterEnable();
}, timeout * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
if (ret.Item2 == Result.TIMEOUT)
{
Stop($"Set {pm.Name} Heater Enable timeout, over {timeout} seconds");
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void RunStepOne(int id, PMModuleBase pm, int delayTime)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Run {pm.Name} recipe step one");
string reason = string.Empty;
//执行工艺程序命令
foreach (var recipeCmd in PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands.Keys)
{
if (recipeCmd == "SusHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd] == "Jump")
_isPSUHeaterJumpMode = true;
else
_isPSUHeaterJumpMode = false;
continue;
}
if (recipeCmd == "WWHeaterSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd] == "Jump")
_isSCRHeaterJumpMode = true;
else
_isSCRHeaterJumpMode = false;
continue;
}
if (recipeCmd == "FlowSetMode")
{
if (PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd] == "Jump")
_isMFCJumpMode = true;
else
_isMFCJumpMode = false;
continue;
}
if (IsCmdSkip(recipeCmd))
continue;
if (!OP.CanDoOperation($"{Module}.{recipeCmd}", out reason, PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]))
{
Stop($"Can not execute {recipeCmd}, {reason}");
return false;
}
else
{
int time = delayTime * 1000;
if (recipeCmd.StartsWith("TC1") && _isPSUHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("TC2") && _isSCRHeaterJumpMode)
{
time = 1;
}
if (recipeCmd.StartsWith("Mfc") && recipeCmd.EndsWith(".Ramp") && _isMFCJumpMode)
{
time = 1;
}
//if (recipeCmd == "Pressure5.Ramp")
//{
// double pc5Pressure = Convert.ToDouble(PMDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]) + _pc5Offset;
// OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, pc5Pressure.ToString());
//}
//else if (recipeCmd == "Pressure6.Ramp")
//{
// double pc6Pressure = Convert.ToDouble(PMDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]) + _pc6Offset;
// OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, pc6Pressure.ToString());
//}
//else if (recipeCmd == "Pressure7.Ramp")
//{
// double pc7Pressure = Convert.ToDouble(PMDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]) + _pc7Offset;
// OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, pc7Pressure.ToString());
//}
//else
{
OP.DoOperation($"{Module}.{recipeCmd}", out string reason1, time, PmDevice.RecipeRunningInfo.RecipeStepList[0].RecipeCommands[recipeCmd]);
}
}
}
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
public void Wait(int id, string stepName, int delayTime)
{
Tuple<bool, Result> ret = Delay(id, () =>
{
Notify($"Wait for {delayTime} seconds");
_stepSpan = new TimeSpan(0, 0, 0, (int)delayTime);
_stepStartTime = DateTime.Now;
_stepName = stepName;
return true;
}, delayTime * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void CheckCondition(int id, PMModuleBase pm, Dictionary<string, string> recipeCommands)
{
//Tuple<bool, Result> ret = Execute(id, () =>
//{
// Notify($"Run {pm.Name} check condition");
// if (!pm.CheckPreProcessCondition(recipeCommands, out string reason))
// {
// Stop(reason);
// return false;
// }
// return true;
//});
//if (ret.Item1)
//{
// if (ret.Item2 == Result.FAIL)
// {
// throw (new RoutineFaildException());
// }
// else
// {
// throw (new RoutineBreakException());
// }
//}
string reason = String.Empty;
Tuple<bool, Result> ret = Wait(id, () =>
{
if (!pm.CheckPreProcessCondition(recipeCommands, out reason))
{
return false;
}
return true;
}, 60 * 1000);
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
Stop(reason);
throw (new RoutineFaildException());
}
else if (ret.Item2 == Result.TIMEOUT)
{
Stop(reason);
throw (new RoutineFaildException());
}
else
{
throw (new RoutineBreakException());
}
}
}
protected void NoteInProcess(int id, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {ModuleName.PM1} start");
ModuleName mod = ModuleName.PM1;
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.InProcess);
//_pm.OnProcessStart(_guidProcess.ToString(), _recipeName, false);
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
protected void NoteProcessComplete(int id, int slot)
{
Tuple<bool, Result> ret = Execute(id, () =>
{
Notify($"Update process information, process in {ModuleName.PM1} completed");
ModuleName mod = ModuleName.PM1;
WaferManager.Instance.UpdateWaferProcessStatus(mod, slot, WaferProcessStatus.Completed);
return true;
});
if (ret.Item1)
{
throw (new RoutineBreakException());
}
}
public void Exit()
{
}
public override void Abort()
{
_pmInterLock.SetPMPreProcessRunning(false, out string reason);
PmDevice.AbortRunProcess(out reason);
//_pm.StopAllGasFlow(out string reason);
//_pm.SetPowerOnOff(false, out reason);
//_pm.SetPower(0, false);
//_pm.CloseValvesForPumping(out reason);
//_executor.RecipeRunningInfo.Step = 0;
//_executor.RecipeRunningInfo.ElapsedTime = 0;
}
}
}
@@ -0,0 +1,252 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using Aitex.Common.Util;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Device.PmDevices;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.RecipeCenter;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.MECF.Framework.Common.RecipeCenter.Recipe;
using SicModules.PMs.RecipeExecutions;
using static Aitex.Core.RT.Device.PmDevices.DicMode;
namespace SicModules.PMs.Routines.Recipe
{
public class RecipeParser
{
public static bool Parse(string recipeFile, string module, out RecipeHead recipeHead, out List<RecipeStepInfo> recipeData, out string reason)
{
reason = string.Empty;
recipeHead = new RecipeHead();
recipeData = new List<RecipeStepInfo>();
string content = RecipeFileManager.Instance.LoadRecipe("", recipeFile, false);
string chamberType = SC.GetConfigItem($"{module}.ChamberType")?.StringValue;
if (string.IsNullOrEmpty(content))
{
reason = $"{recipeFile} is not a valid recipe file";
return false;
}
try
{
//获取工艺程序文件中允许的命令字符串列表
//目的:如果工艺程序文件中含有规定之外的命令,则被禁止执行
HashSet<string> recipeAllowedCommands = new HashSet<string>();
XmlDocument rcpFormatDoc = new XmlDocument();
string recipeSchema = PathManager.GetCfgDir() + @"\Recipe\Sic\Routine\RecipeFormat.xml";
rcpFormatDoc.Load(recipeSchema);
XmlNodeList rcpItemNodeList = rcpFormatDoc.SelectNodes("/Aitex/TableRecipeFormat/Catalog/Group/Step");
foreach (XmlElement item in rcpItemNodeList)
recipeAllowedCommands.Add(item.Attributes["ControlName"].Value);
//获取工艺程序文件中所有步的内容
XmlDocument rcpDataDoc = new XmlDocument();
rcpDataDoc.LoadXml(content);
XmlNode nodeModule = rcpDataDoc.SelectSingleNode($"/Aitex/TableRecipeData/Module[@Name='{module}']");
if (nodeModule == null)
{
reason = $"Recipe file does not contains step content for {module}";
return false;
}
XmlElement nodeConfig = nodeModule.SelectSingleNode($"Config") as XmlElement;
recipeHead.ProcessPurgeCount = (nodeConfig != null && nodeConfig.HasAttribute("StepNo")) ? nodeConfig.Attributes["StepNo"].Value : "";
XmlNodeList stepNodeList = nodeModule.SelectNodes($"Step");
for (int i = 0; i < stepNodeList.Count; i++)
{
var recipeStep = new RecipeStepInfo();
recipeData.Add(recipeStep);
XmlElement stepNode = stepNodeList[i] as XmlElement;
Dictionary<string, string> dic = new Dictionary<string, string>();
//遍历Step节点
foreach (XmlAttribute att in stepNode.Attributes)
{
if (recipeAllowedCommands.Contains(att.Name))
{
dic.Add(att.Name, att.Value);
}
}
//遍历Step子节点中所有的attribute属性节点
foreach (XmlElement subStepNode in stepNode.ChildNodes)
{
foreach (XmlAttribute att in subStepNode.Attributes)
{
if (recipeAllowedCommands.Contains(att.Name))
{
dic.Add(att.Name, att.Value);
}
}
//遍历Step子节点的子节点中所有的attribute属性节点
foreach (XmlElement subsubStepNode in subStepNode.ChildNodes)
{
foreach (XmlAttribute att in subsubStepNode.Attributes)
{
if (recipeAllowedCommands.Contains(att.Name))
{
dic.Add(att.Name, att.Value);
}
}
}
}
#region Modify dic
recipeStep.StepName = dic["Name"];
recipeStep.StepTime = Convert.ToDouble(dic["Time"]);
recipeStep.StepUid = dic["StepUid"];
//转换成enum
recipeStep.EndBy = (EnumEndByCondition)Enum.Parse(typeof(EnumEndByCondition),dic["EndBy"]);
recipeStep.LoopCount = 0;
recipeStep.IsLoopStartStep = false;
recipeStep.IsLoopEndStep = false;
//recipeStep.IsLoopStartStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop x\d+\s*$").Success;
//recipeStep.IsLoopEndStep = System.Text.RegularExpressions.Regex.Match(loopStr, @"Loop x\d+\s* End$").Success;
//if (recipeStep.IsLoopStartStep)
// recipeStep.LoopCount = Convert.ToInt32(loopStr.Replace("Loop x", string.Empty));
//else
// recipeStep.LoopCount = 0;
int.TryParse(dic["LoopTimes"], out var x);
recipeStep.LoopCount = x;
if (dic.ContainsKey("LoopStart"))
{
bool.TryParse(dic["LoopStart"], out var x2);
recipeStep.IsLoopStartStep = x2;
}
if (dic.ContainsKey("LoopEnd"))
{
bool.TryParse(dic["LoopEnd"], out var x3);
recipeStep.IsLoopEndStep = x3;
}
//特殊处理
if (dic.ContainsKey("V33.GVTurnValve"))
{
if (dic["V33.GVTurnValve"] == "H2")
{
dic["V33.GVTurnValve"] = "True";
}
else if (dic["V33.GVTurnValve"] == "Ar")
{
dic["V33.GVTurnValve"] = "False";
}
}
if (dic.ContainsKey("V64.GVTurnValve"))
{
if (dic["V64.GVTurnValve"] == "H2")
{
dic["V64.GVTurnValve"] = "True";
}
else if (dic["V64.GVTurnValve"] == "Close")
{
dic["V64.GVTurnValve"] = "False";
}
}
if (dic.ContainsKey("V65.GVTurnValve"))
{
if (dic["V65.GVTurnValve"] == "Ar")
{
dic["V65.GVTurnValve"] = "True";
}
else if (dic["V65.GVTurnValve"] == "Close")
{
dic["V65.GVTurnValve"] = "False";
}
}
if (dic.ContainsKey("V68.GVTurnValve"))
{
if (dic["V68.GVTurnValve"] == "Ar")
{
dic["V68.GVTurnValve"] = "True";
}
else if (dic["V68.GVTurnValve"] == "Close")
{
dic["V68.GVTurnValve"] = "False";
}
}
dic = dic.ToDictionary(k => k.Key, v => v.Value == "Open" ? "True" : (v.Value == "Close" ? "False" : v.Value)); // 阀门
dic = dic.ToDictionary(k => k.Key, v => v.Value == "Enable" ? "True" : (v.Value == "Disable" ? "False" : v.Value)); // Enable
// 蝶阀
if (dic["TV.SetMode"] == "Position")
{
dic["TV.SetMode"] = PressureCtrlMode.TVPositionCtrl.ToString();
}
else if (dic["TV.SetMode"] == "Pressure")
{
dic["TV.SetMode"] = PressureCtrlMode.TVPressureCtrl.ToString();
}
else if (dic["TV.SetMode"] == "Close")
{
dic["TV.SetMode"] = PressureCtrlMode.TVClose.ToString();
}
else
{
dic["TV.SetMode"] = "Hold";
}
// PSU and SCR
var PSUControlMode = (HeatStrategy)Enum.Parse(typeof(HeatStrategy), dic["TC1.SetHeaterMode"]);
var SCRControlMode = (HeatStrategy)Enum.Parse(typeof(HeatStrategy), dic["TC2.SetHeaterMode2"]);
dic["TC1.SetHeaterMode"] = ((int)PSUControlMode).ToString();
dic["TC2.SetHeaterMode2"] = ((int)SCRControlMode).ToString();
if (PSUControlMode == HeatStrategy.Power)
{
dic.Remove("TC1.SetL1TargetSP");
dic.Remove("TC1.SetL2TargetSP");
dic.Remove("TC1.SetL3TargetSP");
}
if (SCRControlMode == HeatStrategy.Power)
{
dic.Remove("TC2.SetL3TargetSP");
}
dic.Remove("StepNo");
dic.Remove("Name");
dic.Remove("EndBy");
dic.Remove("Time");
//移除Loop相关
dic.Remove("LoopStart");
dic.Remove("LoopEnd");
dic.Remove("LoopTimes");
foreach (string key in dic.Keys)
{
if(dic[key] != "Hold" && dic[key] !="Hold")
{
recipeStep.RecipeCommands.Add(key, dic[key]);
}
}
#endregion
}
}
catch (Exception ex)
{
LOG.Write(ex);
reason = $"Recipe file content not valid, {recipeFile}, {ex.Message}";
return false;
}
return true;
}
}
}