GasFlowRoutine.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using Aitex.Core.RT.Routine;
  2. using Aitex.Core.RT.SCCore;
  3. using Venus_RT.Devices;
  4. using MECF.Framework.Common.Routine;
  5. using Venus_Core;
  6. namespace Venus_RT.Modules.PMs
  7. {
  8. enum GasStep
  9. {
  10. kStartGas,
  11. kEnd,
  12. }
  13. class GasFlowRoutine : PMRoutineBase, IRoutine
  14. {
  15. public bool _gasStatus = false;
  16. private double[] _mfcSetPoint = new double[8];
  17. public GasFlowRoutine(JetPMBase chamber) : base(chamber)
  18. {
  19. Name = "Gas Flow";
  20. }
  21. public RState Start(params object[] objs)
  22. {
  23. //if (!_chamber.IsFastPumpOpened)
  24. //{
  25. // StopFlow();
  26. // Stop("Pump 阀没有打开");
  27. // return RState.Failed;
  28. //}
  29. if(!CheckTurboPump())
  30. {
  31. return RState.Failed;
  32. }
  33. if(_chamber.GetPVPosition() == 0)
  34. {
  35. Stop("钟摆阀没有打开");
  36. return RState.Failed;
  37. }
  38. Reset();
  39. // open process final valve and flow
  40. Notify("Open valve and flow mfc");
  41. _chamber.OpenValve(ValveType.GasFinal, true);
  42. int i = 0;
  43. foreach (object o in objs)
  44. {
  45. _mfcSetPoint[i++] = (double)o;
  46. }
  47. _gasStatus = true;
  48. Reset();
  49. return Runner.Start(Module, Name);
  50. }
  51. public RState Monitor()
  52. {
  53. Runner.Run((int)GasStep.kStartGas, FlowMfc, CheckRange, 6000000)
  54. .End((int)GasStep.kEnd, NullFun, _delay_50ms);
  55. return Runner.Status;
  56. }
  57. public void Abort()
  58. {
  59. StopFlow();
  60. }
  61. public bool FlowMfc()
  62. {
  63. for (int index = 0; index < _mfcSetPoint.Length; index++)
  64. {
  65. if (_mfcSetPoint[index] > 0)
  66. OpenPVNVlv(index, true);
  67. _chamber.FlowGas(index, _mfcSetPoint[index]);
  68. }
  69. return true;
  70. }
  71. private void OpenPVNVlv(int mfcIndex, bool on)
  72. {
  73. ValveType[] vlvs = new ValveType[] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41 };
  74. if (mfcIndex < 4)
  75. {
  76. _chamber.OpenValve(vlvs[mfcIndex], on);
  77. }
  78. }
  79. private bool CheckRange()
  80. {
  81. if (_chamber.HasGasOutOfRange)
  82. {
  83. Stop("流气率越界");
  84. _gasStatus = false;
  85. return true;
  86. }
  87. return false;
  88. }
  89. public void StopFlow()
  90. {
  91. Notify("Close valve and stop to flow MFC");
  92. _chamber.OpenValve(ValveType.GasFinal, false);
  93. _chamber.StopAllGases();
  94. OpenPVNVlv(0, false);
  95. OpenPVNVlv(1, false);
  96. OpenPVNVlv(2, false);
  97. OpenPVNVlv(3, false);
  98. }
  99. }
  100. }