1.修改MOExchange Routine到最新流程

This commit is contained in:
HCL 2023-06-09 16:56:18 +08:00
parent d68e27c4f3
commit accd89e5f1
2 changed files with 103 additions and 118 deletions

View File

@ -7,6 +7,7 @@ using Aitex.Core.RT.Event;
using Aitex.Core.RT.Routine;
using Aitex.Core.RT.SCCore;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.Fsm;
using SicModules.PMs.Routines.Base;
namespace SicModules.PMs.Routines
@ -15,77 +16,59 @@ namespace SicModules.PMs.Routines
{
private enum RoutineStep
{
SetGroupE,
SetGroupK,
SetM7,
SetM8,
SetM11,
SetPc2,
SetM7Or10,
SetM8Or11,
OpenV73,
CloseV73,
SetGroup1,
SetGroup11,
SetGroup2,
SetGroup3,
SetGroup4,
SetGroup5,
SetGroup6,
StartLoop,
OpenGroup1,
CloseGroup2,
OpenGroup3,
CloseGroup3,
OpenGroup2,
CloseGroup1,
EndLoop,
SetM7Default,
SetM8Default,
SetPc2Default,
SetM11Default,
SetGroupV25,
CloseGroup3_2,
CloseGroup2_2,
OpenGroup1_2,
CloseV73,
SetM7Or10_2,
SetM8Or11_2,
SetPC2Or3,
TimeDelay1,
TimeDelay2,
TimeDelay3,
TimeDelay4,
TimeDelay5,
TimeDelay6,
TimeDelay7,
TimeDelay8,
TimeDelay9,
TimeDelay10,
TimeDelay11,
}
private bool _isTCS = false; //标记是TMA换源还是TCS换源
private PMModule _pm1Module;
private PMModule _pmModule;
private ModuleName moduleName;
private IoInterLock _pmIoInterLock;
private int _IoValueOpenCloseTimeout = 10; //开关超时时间
private int _IoValueTimeout = 2; //开关超时时间
private int _loopCount;
private int _routineTimeOut;
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 mfc8Or11 = 8;
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 List<string> _lstGroupV73 = new List<string>() { "V73" };
private List<string> _lstGroup1 = new List<string>() { "V49" };
private List<string> _lstGroup2 = new List<string>() { "V48", "V48s" };
private List<string> _lstGroup3 = new List<string>() { "V50", "V50s" };
private Stopwatch _swTimer = new Stopwatch();
public PMExchangeMoRoutine(ModuleName module, PMModule pm1) : base(module, pm1)
public PMExchangeMoRoutine(ModuleName module, PMModule pm) : base(module, pm)
{
moduleName = module;
_pm1Module = pm1;
_pmModule = pm;
Name = "MoExchange";
_pmIoInterLock = DEVICE.GetDevice<IoInterLock>($"{Module}.PMInterLock");
}
@ -106,53 +89,52 @@ namespace SicModules.PMs.Routines
{
Reset();
if (_pm1Module.V69.Status)
if (_pmModule.V69.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V69 should be Closed");
return Result.FAIL;
}
if (_pm1Module.V72.Status)
if (_pmModule.V72.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V72 should be Closed");
return Result.FAIL;
}
if (_pm1Module.V74.Status)
if (_pmModule.V74.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,V74 should be Closed");
return Result.FAIL;
}
if (_pm1Module.EPV2.Status)
if (_pmModule.EPV2.Status)
{
EV.PostAlarmLog(Module, $"can not Exchange Mo,EPV2 should be Closed");
return Result.FAIL;
}
_loopCount = SC.GetValue<int>($"PM.{Module}.MoExchange.CycleCount");
_OpenTime= SC.GetValue<int>($"PM.{Module}.MoExchange.PumpTime");
_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;
mfc8Or11 = 11;
pc2Or3 = 3;
_lstGroup1 = new List<string>() { "V50"};
_lstGroup2 = new List<string>() { "V48" };
_lstGroup3 = new List<string>() { "V49" };
_lstGroup1 = new List<string>() { "V49" };
_lstGroup2 = new List<string>() { "V48", "V48s" };
_lstGroup3 = new List<string>() { "V50", "V50s" };
}
else
{
mfc7Or10 = 7;
mfc8Or12 = 8;
mfc8Or11 = 8;
pc2Or3 = 2;
_lstGroup1 = new List<string>() { "V46" };
_lstGroup2 = new List<string>() { "V43" };
_lstGroup3 = new List<string>() { "V45" };
_lstGroup1 = new List<string>() { "V45" };
_lstGroup2 = new List<string>() { "V43", "V43s" };
_lstGroup3 = new List<string>() { "V46", "V46s" };
}
if (!_pmIoInterLock.SetPMExchangeMoRoutineRunning(true, out string reason))
@ -160,6 +142,7 @@ namespace SicModules.PMs.Routines
EV.PostAlarmLog(Module, $"can not Exchange Mo,{reason}");
return Result.FAIL;
}
_swTimer.Restart();
Notify("Start");
return Result.RUN;
@ -170,59 +153,63 @@ namespace SicModules.PMs.Routines
{
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);
//关闭K阀组
SetIoValueByGroup((int)RoutineStep.SetGroupK, IoGroupName.K, false, _IoValueTimeout);
//设定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);
SetMfcValueByPercent((int)RoutineStep.SetM7Or10, mfc7Or10, 80);
SetMfcValueByPercent((int)RoutineStep.SetM8Or11, mfc8Or11, 80);
//打开V73,V46,V46s保持30s
SetIoValueByList((int)RoutineStep.OpenV73, _lstGroupV73, true, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.SetGroup11, _lstGroup1, true, _IoValueOpenCloseTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, 30);
//打开V73
SetIoValueByList((int)RoutineStep.OpenV73, _lstGroupV73, true, _IoValueTimeout);
//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);
//打开Group1
SetIoValueByList((int)RoutineStep.OpenGroup1, _lstGroup1, true, _IoValueTimeout);
//关闭Group2
SetIoValueByList((int)RoutineStep.CloseGroup2, _lstGroup2, false, _IoValueTimeout);
//打开Group3
SetIoValueByList((int)RoutineStep.OpenGroup3, _lstGroup3, true, _IoValueTimeout);
TimeDelay((int)RoutineStep.TimeDelay1, _OpenTime);
//关闭Group3
SetIoValueByList((int)RoutineStep.CloseGroup3, _lstGroup3, false, _IoValueTimeout);
//打开Group2
SetIoValueByList((int)RoutineStep.OpenGroup2, _lstGroup2, true, _IoValueTimeout);
//关闭Group1
SetIoValueByList((int)RoutineStep.CloseGroup1, _lstGroup1, false, _IoValueTimeout);
TimeDelay((int)RoutineStep.TimeDelay2, _CLoseTime);
EndLoop((int)RoutineStep.EndLoop);
//关闭V73,V46,V46s
SetIoValueByList((int)RoutineStep.SetGroup6, _lstGroup1, false, _IoValueOpenCloseTimeout);
SetIoValueByList((int)RoutineStep.CloseV73, _lstGroupV73, false, _IoValueOpenCloseTimeout);
//关闭Group3
SetIoValueByList((int)RoutineStep.CloseGroup3_2, _lstGroup3, false, _IoValueTimeout);
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 });
//关闭Group2
SetIoValueByList((int)RoutineStep.CloseGroup2_2, _lstGroup2, false, _IoValueTimeout);
//打开Group1
SetIoValueByList((int)RoutineStep.OpenGroup1_2, _lstGroup1, true, _IoValueTimeout);
//关闭V73
SetIoValueByList((int)RoutineStep.CloseV73, _lstGroupV73, true, _IoValueTimeout);
//设定M7,M8/M10,M11到默认值
SetMfcValueToDefaultByID((int)RoutineStep.SetM7Or10_2, mfc7Or10);
SetMfcValueToDefaultByID((int)RoutineStep.SetM8Or11_2, mfc8Or11);
//设置PC2/PC3到默认值
SetPcToDefault((int)RoutineStep.SetPC2Or3, new List<int> { pc2Or3 });
}
catch (RoutineBreakException)
{
@ -248,14 +235,11 @@ namespace SicModules.PMs.Routines
{
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);
_pmModule.SetIoValue(_lstGroup2, false);
_pmModule.SetIoValue(_lstGroup3, false);
_pmModule.SetMfcValueToDefault(new List<int> { mfc7Or10 });
_pmModule.SetMfcValueToDefault(new List<int> { mfc8Or11 });
_pmModule.SetPCValueToDefault(new List<int> { pc2Or3 });
base.Abort();
}
private void CheckRoutineTimeOut()
@ -264,7 +248,7 @@ namespace SicModules.PMs.Routines
{
if ((int)(_swTimer.ElapsedMilliseconds / 1000) > _routineTimeOut)
{
EV.PostAlarmLog(Module, $"Routine TimeOut! over {_routineTimeOut} s");
Notify($"Routine TimeOut! over {_routineTimeOut} s");
throw (new RoutineFaildException());
}
}
@ -274,11 +258,11 @@ namespace SicModules.PMs.Routines
{
Tuple<bool, Result> ret = ExecuteAndWait(id, () =>
{
_pm1Module.SetIoValue(lstIo, close);
_pmModule.SetIoValue(lstIo, close);
return true;
}, () =>
{
return _pm1Module.CheckIoValue(lstIo, close);
return _pmModule.CheckIoValue(lstIo, close);
},
timeout * 1000);
@ -302,8 +286,8 @@ namespace SicModules.PMs.Routines
Tuple<bool, Result> ret = Execute(id, () =>
{
List<int> lst = new List<int> { mfcID };
_pm1Module.SetMfcModelToNormal(lst);
_pm1Module.SetMfcValueToDefault(lst);
_pmModule.SetMfcModelToNormal(lst);
_pmModule.SetMfcValueToDefault(lst);
return true;
});
@ -319,12 +303,12 @@ namespace SicModules.PMs.Routines
}
private void SetMfcValueByPercent(int id,int mfcID, double percent)
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);
_pmModule.SetMfcModelToNormal(new List<int> { mfcID });
_pmModule.SetMfcValueByPercent(mfcID, percent);
return true;
});
@ -339,12 +323,12 @@ namespace SicModules.PMs.Routines
}
}
private void SetPCValueByPercent(int id,int pcID,double percent)
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);
_pmModule.SetPcModelToNormal(new List<int> { pcID });
_pmModule.SetPCValueByPercent(pcID, percent);
return true;
});

View File

@ -9,6 +9,7 @@
-
- 新特性
- 1.PreProcess时旋转后延时再升隔热罩改到PostTransfer Routine中
-2.修改MOExchange Routine到最新流程
## Version 1.0.5.15