GasFlowRoutine.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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(JetPM 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. Reset();
  30. // open process final valve and flow
  31. Notify("Open valve and flow mfc");
  32. _chamber.OpenValve(ValveType.GasFinal, true);
  33. int i = 0;
  34. foreach (object o in objs)
  35. {
  36. _mfcSetPoint[i++] = (double)o;
  37. }
  38. _gasStatus = true;
  39. Reset();
  40. return Runner.Start(Module, Name);
  41. }
  42. public RState Monitor()
  43. {
  44. Runner.Run((int)GasStep.kStartGas, FlowMfc, CheckRange, _delay_1s)
  45. .End((int)GasStep.kEnd, NullFun, _delay_50ms);
  46. return Runner.Status;
  47. }
  48. public void Abort()
  49. {
  50. StopFlow();
  51. }
  52. public bool FlowMfc()
  53. {
  54. for (int index = 0; index < _mfcSetPoint.Length; index++)
  55. {
  56. _chamber.FlowGas(index, _mfcSetPoint[index]);
  57. }
  58. return true;
  59. }
  60. private bool CheckRange()
  61. {
  62. if (_chamber.HasGasOutOfRange)
  63. {
  64. Stop("流气率越界");
  65. _gasStatus = false;
  66. return false;
  67. }
  68. return true;
  69. }
  70. public void StopFlow()
  71. {
  72. Notify("Close valve and stop to flow MFC");
  73. _chamber.OpenValve(ValveType.GasFinal, false);
  74. _chamber.StopAllGases();
  75. }
  76. }
  77. }