PumpDownRoutine.cs 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using Aitex.Core.RT.Event;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using JetVirgoPM.Devices;
  6. using MECF.Framework.Common.Routine;
  7. namespace JetVirgoPM.PMs.Routines
  8. {
  9. class PumpDownRoutine : PMRoutineBase, IStepRoutine
  10. {
  11. private enum PumpSequence
  12. {
  13. kCheckLidSignal,
  14. kCheckSlitDoor,
  15. kCheckDryPumpStatus,
  16. kCloseValves,
  17. kOpenPumpingValve,
  18. kDelay,
  19. kCheckVAC,
  20. kCheckForelinePressure,
  21. kCheckThrottleValveStatus,
  22. kCheckATM,
  23. kOpenSoftPumpValve,
  24. kCloseSoftPumpValve,
  25. kFastPumpValve,
  26. kCloseFastPumpValve,
  27. kCheckChamberPressure,
  28. kCheckVACSignal,
  29. kEnd
  30. }
  31. private int _basePressure;
  32. private int _pumpValveDelay;
  33. private double _pumpTimeLimit;
  34. private readonly uint FORELINE_TARGET = 500;
  35. public PumpDownRoutine(JetDualPM chamber) : base(chamber)
  36. {
  37. Name = "PumpDown";
  38. bUINotify = true;
  39. }
  40. public void Terminate()
  41. {
  42. }
  43. public RState Start(params object[] objs)
  44. {
  45. // 预检查,必须关盖子
  46. if (CheckLid() == RState.Running &&
  47. CheckSlitDoor1() == RState.Running && CheckSlitDoor2() == RState.Running)
  48. //&& CheckDryPump() == RState.Running)
  49. {
  50. Reset();
  51. //关闭所有阀门
  52. _chamber.CloseValves();
  53. //_PressureTrip1 = SC.GetValue<int>($"{Module}.Pump.PressureTrip1") * 1000;
  54. _basePressure = (objs.Length == 1) ? Convert.ToInt32(objs[0]) : SC.GetValue<int>($"{Module}.Pump.PumpBasePressure");
  55. _pumpTimeLimit = SC.GetValue<double>($"{Module}.Pump.PumpTimeLimit");
  56. _pumpValveDelay = SC.GetValue<int>($"{Module}.Pump.PumpValveDelay");
  57. return Runner.Start(_chamber.Module.ToString(), Name);
  58. }
  59. return RState.Failed;
  60. }
  61. public RState Monitor()
  62. {
  63. Runner.Run(PumpSequence.kCheckForelinePressure, HOFs.Apply(Foreline, FORELINE_TARGET), HOFs.Apply(CheckForeline, FORELINE_TARGET), 15*1000)
  64. .Run(PumpSequence.kOpenSoftPumpValve, HOFs.Apply(OpenValve, ValveType.SOFT_PUMP, true), HOFs.Apply(CheckValve, ValveType.SOFT_PUMP, true), _delay_1s)
  65. .Run(PumpSequence.kCheckThrottleValveStatus, FullOpenTV, CheckFullOpenTV, _delay_20s)
  66. .Delay(PumpSequence.kDelay, _pumpValveDelay * 1000)
  67. .Run(PumpSequence.kFastPumpValve, HOFs.Apply(OpenValve, ValveType.FAST_PUMP, true), HOFs.Apply(CheckValve, ValveType.FAST_PUMP, true), _delay_1s)
  68. .Run(PumpSequence.kCloseFastPumpValve, HOFs.Apply(OpenValve, ValveType.SOFT_PUMP, false), HOFs.Apply(CheckValve, ValveType.SOFT_PUMP, false), _delay_1s)
  69. .Run(PumpSequence.kCheckATM, HOFs.Apply(ATM2, false), HOFs.Apply(CheckATM2, false), _delay_30s)
  70. .Run(PumpSequence.kCheckVACSignal, NullFun, CheckVAC, 90*1000)
  71. .Run(PumpSequence.kCheckVAC, HOFs.Apply(WaitPressure, _basePressure, false), HOFs.Apply(CheckPressure, _basePressure, false), (int)_pumpTimeLimit * 1000)
  72. .End(PumpSequence.kEnd, EndFunc, _delay_0s);
  73. return Runner.Status;
  74. }
  75. public override void Abort()
  76. {
  77. _chamber.CloseValves();
  78. }
  79. }
  80. }