首次上传

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,291 @@
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.IOCore;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
namespace SicPM2.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, PM2Module 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,510 @@
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.IOCore;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
namespace SicPM2.Routines
{
public class PMChamberMoveBodyRoutine : PMBaseRoutine
{
public IoChamberMoveBody _ioChamberMoveBody;
public IoGasConnector _ioGasConnector;
public IoLid _ioSHLid;
public IoLidSwing _ioSHSwing;
public IoLid _ioMiddleLid;
public IoLidSwing _ioMiddleSwing;
private PM2Module _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,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay0
}
public PMChamberMoveBodyRoutine(ModuleName module, PM2Module 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);
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
//SetIoValueByName((int)RoutineStep.StepSetTv75, "V75", true, 2);
//SetIoValueByName((int)RoutineStep.CloseTv76, "V76", false, 2);
}
}
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());
}
}
}
}
+459
View File
@@ -0,0 +1,459 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.IOCore;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMCleanRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
VentPumpClose_1,
VentPumpOpen,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetM1to16,
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,
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,
SetTVPressMode,
SetTv1,
SetM2toM40,
SetV31,
SetV32,
SetV35V36,
SetV65,
WaitTv1,
SetTVPositionMode,
SetTVPositionMode_1,
SetTVPositionMax,
SetTVPositionMax_1,
SetTVPressMode1,
SetTVPressMode2,
SetM2TOM40Default,
SetM2toM40_1,
SetMfc27to40Default,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
WaitPmPressureUp1,
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 PM2Module _pm1Module;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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 double _throttleFinalPressure = 300;//蝶阀最终调整对的压力
private int _pmCleanTime = 20;
private Stopwatch _swTimer = new Stopwatch();
public PMCleanRoutine(ModuleName module, PM2Module pm1) : base(module, pm1)
{
moduleName = module;
_pm1Module = pm1;
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");
_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);
//打开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);
//设置所有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, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottlePressureAndWaitSetPoint((int)RoutineStep.SetTv1, _IoThrottle, _pressureMin, _pmPressureMaxDiff, _throttleTimeout);
//M2、M9、M15、M19-M40 MFC 5s ramp 到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 5);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pressureMin, _pmPressureMaxDiff, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
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);
////开V94,V96需等到腔体压力大于950
//WaitPMPressureAndSetMfcSpecial((int)RoutineStep.WaitPmPressureUp1, 950, _throttleTimeout);
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
//循环开始
Loop((int)RoutineStep.StartLoop, _pressureLoopCount);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2TOM40Default, MfcGroupName.M2toM40, 3);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode1, _IoThrottle, 5);
//使用动态流量伺服到300mbar
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Uping);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureUp, _IoThrottle, _pressureMax);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _pressureMax, _pmPressureMaxDiff, _pressureMaxTimeout);
TimeDelay((int)RoutineStep.TimeDelay6, _pressureMaxDelay);
//M2、M9、M15、M19-M40 MFC 3s ramp 0
SetMfcByGroup((int)RoutineStep.SetM2toM40_1, MfcGroupName.M2toM40, 0, 3);
//伺服到0mbar
SetThrottlePressureAndWait((int)RoutineStep.SetPressureDown, _IoThrottle, _pressureMin, _pmPressureMaxDiff, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay7, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode_1, _IoThrottle, _throttleTimeout);
SetThrottleSetPositionNoWait((int)RoutineStep.SetTVPositionMax_1, _IoThrottle, 100, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay8, _pressureMinDelay);
EndLoop((int)RoutineStep.EndLoop);
//M27-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfc27to40Default, MfcGroupName.M27toM40, 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,362 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMExchangeMoRoutine : PMBaseRoutine
{
private enum RoutineStep
{
SetGroupE,
SetGroupK,
SetM7,
SetM8,
SetM11,
SetPc2,
OpenV73,
CloseV73,
SetGroup1,
SetGroup11,
SetGroup2,
SetGroup3,
SetGroup4,
SetGroup5,
SetGroup6,
StartLoop,
EndLoop,
SetM7Default,
SetM8Default,
SetPc2Default,
SetM11Default,
SetGroupV25,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
}
private bool _isTCS = false; //标记是TMA换源还是TCS换源
private PM2Module _pm1Module;
private ModuleName moduleName;
private IoInterLock _pmIoInterLock;
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _loopCount;
private double _OpenTime = 10;
private double _CLoseTime = 10;
private int _routineTimeOut;
//默认为TMA换源参数
private int mfc7Or10 = 7;
private int mfc8Or12 = 8;
private int mfc11 = 11;
private int pc2Or3 = 2;
private List<string> _lstGroupV73 = new List<string>() { "V73" };
private List<string> _lstGroupV50 = new List<string>() { "V50" };
private List<string> _lstGroupV48 = new List<string>() { "V48" };
private List<string> _lstGroupV49 = new List<string>() { "V49" };
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" };
private Stopwatch _swTimer = new Stopwatch();
public PMExchangeMoRoutine(ModuleName module, PM2Module pm1) : base(module, pm1)
{
moduleName = module;
_pm1Module = pm1;
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 (_pm1Module.V69.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V69 should be Closed");
return Result.FAIL;
}
if (_pm1Module.V72.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V72 should be Closed");
return Result.FAIL;
}
if (_pm1Module.V74.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V74 should be Closed");
return Result.FAIL;
}
if (_pm1Module.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;
mfc8Or12 = 12;
pc2Or3 = 3;
_lstGroup1 = new List<string>() { "V50"};
_lstGroup2 = new List<string>() { "V48" };
_lstGroup3 = new List<string>() { "V49" };
}
else
{
mfc7Or10 = 7;
mfc8Or12 = 8;
pc2Or3 = 2;
_lstGroup1 = new List<string>() { "V46" };
_lstGroup2 = new List<string>() { "V43" };
_lstGroup3 = new List<string>() { "V45" };
}
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
{
if (SC.GetValue<bool>("System.IsATMMode"))
{
return Result.DONE;
}
CheckRoutineTimeOut();
// 关闭E组和K组的阀门
SetIoValueByGroup((int)RoutineStep.SetGroupE, IoGroupName.E, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueOpenCloseTimeout);
SetIoValueByGroup((int)RoutineStep.SetGroupV25, IoGroupName.V25, true, _IoValueOpenCloseTimeout);
//设定M7,M8 80%,PC2设定Max
SetMfcValueByPercent((int)RoutineStep.SetM7, mfc7Or10, 80);
SetMfcValueByPercent((int)RoutineStep.SetM8, mfc8Or12, 80);
if (_isTCS)
{
SetMfcValueByPercent((int)RoutineStep.SetM11, mfc11, 80);
}
SetPCValueByPercent((int)RoutineStep.SetPc2, pc2Or3, 100);
//打开V73,V46,V46s,保持30s
SetIoValueByList((int)RoutineStep.OpenV73, _lstGroupV73, true, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.SetGroup11, _lstGroup1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 30);
//Loop
Loop((int)RoutineStep.StartLoop, _loopCount);
SetIoValueByList((int)RoutineStep.SetGroup1, _lstGroup1, false, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.SetGroup2, _lstGroup2, true, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.SetGroup3, _lstGroup3, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, _OpenTime);
//SetIoValueByList((int)RoutineStep.SetGroup4, _lstGroup3, false, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.SetGroup5, _lstGroup2, false, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.SetGroup6, _lstGroup1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay3, _CLoseTime);
EndLoop((int)RoutineStep.EndLoop);
//关闭V73,V46,V46s
SetIoValueByList((int)RoutineStep.SetGroup6, _lstGroup1, false, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.CloseV73, _lstGroupV73, false, _IoValueOpenCloseTimeout);
SetMfcValueToDefaultByID((int)RoutineStep.SetM7Default, mfc7Or10);
SetMfcValueToDefaultByID((int)RoutineStep.SetM8Default, mfc8Or12);
if (_isTCS)
{
SetMfcValueToDefaultByID((int)RoutineStep.SetM11Default, mfc11);
}
SetPcToDefault((int)RoutineStep.SetPc2Default, 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();
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);
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());
}
}
}
private void SetIoValueByList(int id, List<string> lstIo, bool close, int timeout)
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
_pm1Module.SetIoValue(lstIo, close);
return true;
}, () =>
{
return _pm1Module.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 };
_pm1Module.SetMfcModelToNormal(lst);
_pm1Module.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, () =>
{
_pm1Module.SetMfcModelToNormal(new List<int> { mfcID });
_pm1Module.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, () =>
{
_pm1Module.SetPcModelToNormal(new List<int> { pcID });
_pm1Module.SetPCValueByPercent(pcID, percent);
return true;
});
if (ret.Item1)
{
if (ret.Item2 == Result.FAIL)
{
throw (new RoutineFaildException());
}
else
throw (new RoutineBreakException());
}
}
}
}
+109
View File
@@ -0,0 +1,109 @@
using System;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
namespace SicPM2.Routines
{
public class PMHomeRoutine : PMBaseRoutine
{
enum RoutineStep
{
Home,
}
private int _timeout;
public PMHomeRoutine(ModuleName module, PM2Module 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,564 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
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 System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.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,
OpenFinal2,
CloseFinal2,
SetMfcFinal2,
SetEPV1,
SetEPV2,
SetTvMode,
SetTVEnable,
SetTVPressMode,
SetTv1,
WaitTv1,
SetM2toM40,
SetTVPositionMode,
SetTVPositionMode_1,
SetTVPositionMax,
SetTVPositionMax_1,
SetTVPressMode1,
SetM2TOM40Default,
SetM2toM40_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,
CloseGasIn1,
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;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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, PM2Module 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);
//打开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.M2toM26, 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
SetThrottlePressureAndWaitSetPoint((int)RoutineStep.SetTv1, _IoThrottle, _pressureMin, _pmPressureMaxDiff, _throttleTimeout);
//M2、M9、M15、M19-M40 MFC 3s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40, 0, 3);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pressureMin, _pmPressureMaxDiff, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay8, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
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);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode1, _IoThrottle, 5);
//使用动态流量伺服到300mbar
SetPressureUpOrDown((int)RoutineStep.SetPressUpOrDown1, PressureUpOrDown.Uping);
SetThrottleToTargetAndNoWait((int)RoutineStep.SetPressureUp, _IoThrottle, _pressureMax);
WaitThrottleToPressureAndSetMfcSpecial((int)RoutineStep.WaitPressureUp, _IoThrottle, _pressureMax, _pmPressureMaxDiff, _pressureMaxTimeout);
TimeDelay((int)RoutineStep.TimeDelay10, _pressureMaxDelay);
//M2、M9、M15、M19-M40 MFC 3s ramp 0
SetMfcByGroup((int)RoutineStep.SetM2toM40_1, MfcGroupName.M2toM40, 0, 3);
//伺服到0mbar
SetThrottlePressureAndWait((int)RoutineStep.SetPressureDown, _IoThrottle, _pressureMin, _pmPressureMaxDiff, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay11,3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode_1, _IoThrottle, _throttleTimeout);
SetThrottleSetPositionNoWait((int)RoutineStep.SetTVPositionMax_1, _IoThrottle, 100, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay12, _pressureMinDelay);
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;
}
});
}
}
}
@@ -0,0 +1,352 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.IOCore;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
namespace SicPM2.Routines
{
public class PMPcCalibrationRoutine : PMBaseRoutine
{
private PM2Module _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>();
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, PM2Module 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();
_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);
}
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,368 @@
using Aitex.Core.RT.Device;
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 MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Servo.NAIS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static SicPM2.PM2Module;
namespace SicPM2.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 float _psuHeatMode = 0;
//private float _psuPowerRef = 0;
private float _psuL1Ratio = 0;
private float _psuL2Ratio = 0;
private float _psuL3Ratio = 0;
private bool _scrHeatEnable = false; //是否启用SCR 加热
private float _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 NAISServo servo;
public PMPostTransferRoutine(ModuleName module, PM2Module 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 = (float)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 = (float)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");
_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, 5);
if (!hasWafer)
{
SetConfinementRingUpAndWait((int)RoutineStep.SetServoUp, 30);
}
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.ServoState = ServoStates.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.ServoState = ServoStates.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,372 @@
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Device;
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.Servo.NAIS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
using static SicPM2.PM2Module;
using Aitex.Core.RT.Device.Devices;
namespace SicPM2.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, PM2Module 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.ServoState = ServoStates.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.ServoState = ServoStates.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, PM2Module 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.ServoState = ServoStates.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, PM2Module 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.ServoState = ServoStates.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,173 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMProcessAbortRoutine : PMBaseRoutine
{
private enum RoutineStep
{
HeatEnable,
SetPSURatio,
SetSCRRatio,
SetRotation,
SetM2toM40,
SetM1to16,
SetPC,
SetV32,
SetV35V36,
SetV68,
SetV65,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupK,
SetGroupD,
SetGroupG,
VentPumpClose,
SetGroupV25,
TimeDelay1,
TimeDelay2,
}
private int _heatTimeOut = 5;
private int _mfc1to16RampTime = 30;
private int _mfc2to40RampTime = 30;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
private int _IoValueOpenCloseTimeout = 10;
private int _routineTimeOut = 10;
private Stopwatch _swTimer = new Stopwatch();
public PMProcessAbortRoutine(ModuleName module, PM2Module 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);
//设定功率为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);
//M1 - M16 MFC 30s ramp 到 default 值(M2、M9、M15除外)
SetMfcToDefaultByGroup((int)RoutineStep.SetM1to16, MfcGroupName.M1to16, _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);
//打开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();
}
}
}
+272
View File
@@ -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 SicPM2.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 )
{
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, EnumWaferProcessStatus.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, EnumWaferProcessStatus.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, EnumWaferProcessStatus.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());
}
}
}
}
+271
View File
@@ -0,0 +1,271 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMPumpRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetGroupJ,
SetM1to16,
SetPC,
SetGroupI, //V87-96
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,
SetTVPositionMode,
SetTVPositionMax,
CloseM32M35M37,
CloseM36,
CloseM38,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
}
private PM2Module _pm1Module;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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 _EPV2OpenDelayTime = 9;
private Stopwatch _swTimer = new Stopwatch();
public PMPumpRoutine(ModuleName module, PM2Module 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");
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);
//打开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);
//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);
//打开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
SetThrottlePressureAndWaitSetPoint((int)RoutineStep.SetTv1, _IoThrottle, _pumpBasePressure, _pmPressureMaxDiff, _throttleTimeout);
//M2、M9、M15、M19-M40 MFC 3s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2to40, MfcGroupName.M2toM40, 0, 3);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pumpBasePressure, _pmPressureMaxDiff,_throttleTimeout);
//蝶阀设置为位置模式,开度设置为最大
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());
}
}
}
}
}
+489
View File
@@ -0,0 +1,489 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMPurgeRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
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,
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,
SetTVCloseMode2,
CLoseTvvvv,
SetEPVVV2,
CLoseEPV1,
CheckPM1000,
WaitPressUpTo1000,
WaitPressUpTo1020,
SetPressUpOrDown1,
SetPressUpOrDown2,
SetMfc28to40Special,
WaitPmPressureUp,
SetMfc27to40Default,
SetV75,
SetV76,
SetV31,
SetV32,
SetV35V36,
SetV65,
SetV751,
SetV761,
SetM2toM40,
SetM2toM40_1,
SetM2TOM40Default,
SetV92V93V95,
SetV94,
SetV96,
SetV68,
SetM32M35M37,
SetM36,
SetM38,
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 PM2Module _pm1Module;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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 _EPV12TimeSapn = 10;
private int _waitChamberTo1000TimeOut = 300; //等待腔体压力上升到1000的超时时间
private bool _needFinalValveOpen = false;
private Stopwatch _swTimer = new Stopwatch();
public PMPurgeRoutine(ModuleName module, PM2Module pm1) : base(module, pm1)
{
moduleName = module;
_pm1Module = pm1;
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");
_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");
//_routineTimeOut = SC.GetValue<int>($"PM.{Module}.Purge.RoutineTimeOut");
_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);
//打开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);
//设置所有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, _IoThrottle, 5);
//设置蝶阀为压力模式
SetThrottleToPressModeAndWait((int)RoutineStep.SetTVPressMode, _IoThrottle, 5);
//伺服压力设定值到0mbar
SetThrottlePressureAndWaitSetPoint((int)RoutineStep.SetTv1, _IoThrottle, _pumpBasePressure, _pmPressureMaxDiff, _throttleTimeout);
//M2、M9、M15、M19-M40 MFC 5s ramp 到0
SetMfcByGroup((int)RoutineStep.SetM2toM40, MfcGroupName.M2toM40,0, 5);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _pumpBasePressure, _pmPressureMaxDiff, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode, _IoThrottle, _throttleTimeout);
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);
////开V94,V96需等到腔体压力大于950
//WaitPMPressureAndSetMfcSpecial((int)RoutineStep.WaitPmPressureUp1, 950, _throttleTimeout);
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay5, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
//循环开始
Loop((int)RoutineStep.StartLoop, _pressureLoopCount);
//M2、M9、M15、M19-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetM2TOM40Default, MfcGroupName.M2toM40, 3);
//设置蝶阀为压力模式
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);
//M2、M9、M15、M19-M40 MFC 3s ramp 0
SetMfcByGroup((int)RoutineStep.SetM2toM40_1, MfcGroupName.M2toM40, 0, 3);
//伺服到0mbar
SetThrottlePressureAndWait((int)RoutineStep.SetPressureDown, _IoThrottle, _pumpBasePressure, _pmPressureMaxDiff, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay7, 3);
//蝶阀设置为位置模式,开度设置为最大
SetThrottleToPositionMode((int)RoutineStep.SetTVPositionMode_1, _IoThrottle, _throttleTimeout);
SetThrottleSetPositionNoWait((int)RoutineStep.SetTVPositionMax_1, _IoThrottle, 100, _throttleTimeout);
TimeDelay((int)RoutineStep.TimeDelay8, _pressureMinDelay);
EndLoop((int)RoutineStep.EndLoop);
//M2,M9,M15,M19-M26 3s ramp 到0
SetMfcByGroup((int)RoutineStep.SetM291519to26_1, MfcGroupName.M2toM26, 0,3);
//M27-M40 MFC 3s ramp 到 default 值
SetMfcToDefaultByGroup((int)RoutineStep.SetMfc27to40Default, MfcGroupName.M27toM40, 3);
//关闭J阀门
SetIoValueByGroup((int)RoutineStep.CloseGroupJ, IoGroupName.J, false, _IoValueOpenCloseTimeout);
//关闭先关蝶阀,再EPV2
SetThrottleToCloseMode((int)RoutineStep.SetTVCloseMode2, _IoThrottle, 8);
SetThrottleDisable((int)RoutineStep.CLoseTvvvv, _IoThrottle, 8);
TimeDelay((int)RoutineStep.TimeDelay9, 1);
SetIoValueByGroup((int)RoutineStep.SetEPVVV2, IoGroupName.EPV2, false, _IoValueOpenCloseTimeout);
//等待反应腔压力到达1020
NotifyInfo((int)RoutineStep.Notify1, $"Wait pm pressure to {_ventBasePressure} mbar!");
WaitChamberPressUpTo((int)RoutineStep.WaitPressUpTo1000, _ventBasePressure, _waitChamberTo1000TimeOut);
if (_needFinalValveOpen)
{
//打开Final1阀
SetIoValueByGroup((int)RoutineStep.IsOpenFinal1, IoGroupName.Final1WithOutV94, true, _IoValueOpenCloseTimeout);
//打开Final2阀
SetIoValueByGroup((int)RoutineStep.IsOpenFinal2, IoGroupName.Final2, true, _IoValueOpenCloseTimeout);
}
else
{
//关闭Final1阀
SetIoValueByGroup((int)RoutineStep.IsCloseFinal1, IoGroupName.Final1WithOutV94, false, _IoValueOpenCloseTimeout);
//关闭Final2阀
SetIoValueByGroup((int)RoutineStep.IsCloseFinal2, IoGroupName.Final2, 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,141 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
namespace SicPM2.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 PM2Module _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, PM2Module 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,56 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
namespace SicPM2.Routines
{
public class PMStopHeatEnableRoutine : PMBaseRoutine
{
enum RoutineStep
{
SetPSUDisable,
SetSCRDisable,
}
private int _heatTimeOut = 5;
public PMStopHeatEnableRoutine(ModuleName module, PM2Module 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,300 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMToAtmIdleRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
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,
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;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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, PM2Module pm1) : base(module, pm1)
{
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);
//打开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-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);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 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.TimeDelay3, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, 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);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
//等待反应腔压力大于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,211 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
namespace SicPM2.Routines
{
public class PMToIsolationRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetM1to16,
SetM2toM40,
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,
CloseM32M35M37,
CloseM36,
CloseM38,
CloseGasIn1,
CloseFinanl1,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay14,
TimeDelay18,
TimeDelayForEPV1,
}
private PM2Module _pm1Module;
private IoThrottleValve2 _IoThrottle;
private List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
private int _rotationCloseTimeout = 20; //旋转停止超时
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _heatTimeOut = 5; //Heat关闭等待Di反馈超时时间
public PMToIsolationRoutine(ModuleName module, PM2Module 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);
//打开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);
//关闭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,457 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.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,
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,
SetEPV1,
SetEPV2,
SetEPV11,
SetEPV22,
SetTvModeToPress,
SetMfc28to40Special,
SetMfc28to40Default,
SetPressUpOrDown1,
SetPressureDown,
EnableRotation,
EnableHeater,
SetRotation1,
SetTC1Mode,
SetTC1Ratio,
SetTC1RatioTo0,
SetTC1Ref,
SetTC2Mode,
SetTC2Ratio,
SetTC2RatioTo0,
SetTC2Ref,
EnableTC1,
EnableTC2,
CloseTC1,
CloseTC2,
SetFinal1ToDefault,
SetFinal1To0,
SetFinal2ToDefault,
SetFinal2To0,
CheckFinal1Open,
CheckFinal2Open,
CheckTvOpen,
SetRotation2,
WaitRotation1,
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;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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 float _psuHeatMode = 0;
//private float _psuPowerRef = 0;
private float _psuL1Ratio = 0;
private float _psuL2Ratio = 0;
private float _psuL3Ratio = 0;
private bool _scrHeatEnable = false; //是否启用SCR 加热
private float _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, PM2Module 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;
}
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 = (float)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 = (float)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);
//打开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);
//设置所有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阀对应的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.TimeDelay2, 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.TimeDelay3, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, 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
//WaitPmPressureUPto((int)RoutineStep.WaitPmPressureUp1, 950, _throttleTimeout);
SetIoValueByGroup((int)RoutineStep.SetV94, IoGroupName.V94, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
//设置蝶阀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, 300);
}
catch (RoutineBreakException)
{
return Result.RUN;
}
catch (RoutineFaildException)
{
return Result.FAIL;
}
_pmInterLock.SetPMProcessIdleRunning(false, out string 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();
}
}
}
+272
View File
@@ -0,0 +1,272 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMVacIdleRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetGroupJ,
SetM1to16,
SetPC,
SetGroupI, //V87-96
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,
SetTVPositionMode,
SetTVPositionMax,
CloseM32M35M37,
CloseM36,
CloseM38,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
TimeDelay12,
TimeDelay13,
TimeDelay14,
}
private PM2Module _pm1Module;
private IoThrottleValve2 _IoThrottle;
private IoInterLock _pmIoInterLock;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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 _EPV2OpenDelayTime = 9;
private Stopwatch _swTimer = new Stopwatch();
public PMVacIdleRoutine(ModuleName module, PM2Module 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");
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);
//打开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);
//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);
//打开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
SetThrottlePressureAndWaitSetPoint((int)RoutineStep.SetTv1, _IoThrottle, _vacPumpBasePressure, _pmPressureMaxDiff, _throttleTimeout);
//M2、M9、M15、M19-M40 MFC 3s ramp到0
SetMfcByGroup((int)RoutineStep.SetM2to40, MfcGroupName.M2toM40, 0, 3);
//等待腔体压力Pump到设定值
WaitChamberPressDownTo((int)RoutineStep.WaitTv1, _vacPumpBasePressure, _pmPressureMaxDiff, _throttleTimeout);
//蝶阀设置为位置模式,开度设置为最大
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());
}
}
}
}
}
+300
View File
@@ -0,0 +1,300 @@
using Aitex.Core.RT.Device;
using Aitex.Core.RT.Device.Devices;
using Aitex.Core.RT.Device.Unit;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SicPM2.Routines
{
public class PMVentRoutine : PMBaseRoutine
{
private enum RoutineStep
{
RotationEnable,
HeatEnable,
VentPumpClose,
ArSupply,
SetGroupA,
SetGroupB,
SetGroupC,
SetGroupE,
SetGroupF,
SetGroupH,
SetGroupD,
SetGroupG,
SetGroupK,
SetMFCMode,
SetPCMode,
SetM1to16,
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,
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;
List<int> _lstPcList = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
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, PM2Module pm1) : base(module, pm1)
{
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);
//打开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-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);
//打开V68
SetIoValueByGroup((int)RoutineStep.SetV68, IoGroupName.GasIn1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, 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.TimeDelay3, 3);
SetIoValueByGroup((int)RoutineStep.SetV92V93V95, IoGroupName.V92V93V95, 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);
TimeDelay((int)RoutineStep.TimeDelay4, 3);
SetIoValueByGroup((int)RoutineStep.SetV96, IoGroupName.V96, true, _IoValueOpenCloseTimeout);
//等待反应腔压力到达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());
}
}
}
}
}