CyclePurgeRoutine.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using JetVirgoPM.Devices;
  4. using MECF.Framework.Common.Routine;
  5. namespace JetVirgoPM.PMs.Routines
  6. {
  7. class CyclePurgeRoutine : PMRoutineBase
  8. {
  9. private enum RoutineStep
  10. {
  11. CheckRfOff,
  12. CheckPumping,
  13. CloseAllValves,
  14. Loop,
  15. Pump,
  16. PumpDelay,
  17. Vent,
  18. VentDelay,
  19. EndLoop,
  20. PumpDefault,
  21. End,
  22. };
  23. // ----------------------------Fields--------------------------
  24. //
  25. private int _purgeCycleCount;
  26. private int _purgeVentPressure;
  27. private int _purgePumpPressure;
  28. private int _purgeVentTimeLimit;
  29. private int _purgePumpTimeLimit;
  30. private int _purgeVentStableTime;
  31. private int _purgePumpStableTime;
  32. // --------------------------Constructor-----------------------
  33. //
  34. public CyclePurgeRoutine(JetDualPM chamber) : base(chamber)
  35. {
  36. Name = "Cycle purge";
  37. bUINotify = true;
  38. }
  39. public RState Start(params object[] objs)
  40. {
  41. if (_chamber.IsGenerator1ON|| _chamber.IsGenerator2ON)
  42. {
  43. Stop("射频必须关闭");
  44. return RState.Failed;
  45. }
  46. if (!_chamber.IsPumpRunning || !_chamber.IsFastPumpOpened)
  47. {
  48. Stop("泵组状态不正确");
  49. return RState.Failed;
  50. }
  51. Reset();
  52. _purgeCycleCount = (int)SC.GetValue<double>($"{Module}.Purge.PurgeCycleCount");
  53. _purgeVentPressure = (int)SC.GetValue<double>($"{Module}.Purge.PurgeVentPressure");
  54. _purgePumpPressure = (int)SC.GetValue<double>($"{Module}.Purge.PurgePumpPressure");
  55. _purgeVentTimeLimit = (int)SC.GetValue<double>($"{Module}.Purge.PurgeVentTimeLimit");
  56. _purgePumpTimeLimit = (int)SC.GetValue<double>($"{Module}.Purge.PurgePumpTimeLimit");
  57. _purgeVentStableTime = (int)SC.GetValue<double>($"{Module}.Purge.PurgeVentStableTime");
  58. _purgePumpStableTime = (int)SC.GetValue<double>($"{Module}.Purge.PurgePumpStableTime");
  59. //关闭所有阀门
  60. _chamber.CloseValves();
  61. return Runner.Start(_chamber.Module.ToString(), Name);
  62. }
  63. public RState Monitor()
  64. {
  65. Runner.LoopStart(RoutineStep.Pump, "腔体 Cycle Purge", _purgeCycleCount, HOFs.Apply(Pump, _purgePumpPressure), HOFs.Apply(CheckPump, _purgePumpPressure, true), _purgePumpTimeLimit * 1000)
  66. .LoopDelay(RoutineStep.PumpDelay, _purgePumpStableTime * 1000)
  67. .LoopRun(RoutineStep.Vent, HOFs.Apply(Vent, _purgeVentPressure), HOFs.Apply(CheckVent, _purgeVentPressure, true), _purgeVentTimeLimit * 1000)
  68. .LoopDelay(RoutineStep.VentDelay, _purgeVentStableTime * 1000)
  69. .LoopEnd(RoutineStep.EndLoop, NullFun, _delay_50ms)
  70. .Run(RoutineStep.PumpDefault, HOFs.Apply(Pump, _purgePumpPressure), HOFs.Apply(CheckPump, _purgePumpPressure, true), _purgePumpTimeLimit * 1000)
  71. .End(RoutineStep.End, EndFunc, _delay_0s);
  72. return Runner.Status;
  73. }
  74. public override void Abort()
  75. {
  76. _chamber.CloseValves();
  77. }
  78. }
  79. }