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