GasFlowRoutine.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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;
  17. private ValveType[] vlvs;
  18. public GasFlowRoutine(JetPMBase chamber) : base(chamber)
  19. {
  20. Name = "Gas Flow";
  21. switch (chamber.ChamberType)
  22. {
  23. case JetChamber.VenusSE:
  24. _mfcSetPoint = new double[12];
  25. vlvs = new ValveType[] {
  26. ValveType.PV11, ValveType.PV21, ValveType.PV31,
  27. ValveType.PV41, ValveType.PV51, ValveType.PV61,
  28. ValveType.PV71, ValveType.PV81, ValveType.PV91,
  29. ValveType.PVA1, ValveType.PVB1, ValveType.PVC1
  30. };
  31. break;
  32. default:
  33. _mfcSetPoint = new double[8];
  34. vlvs = new ValveType[] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41 };
  35. break;
  36. }
  37. }
  38. public RState Start(params object[] objs)
  39. {
  40. //if (!_chamber.IsFastPumpOpened)
  41. //{
  42. // StopFlow();
  43. // Stop("Pump 阀没有打开");
  44. // return RState.Failed;
  45. //}
  46. if(!CheckTurboPump())
  47. {
  48. return RState.Failed;
  49. }
  50. if(_chamber.GetPVPosition() <= 0)
  51. {
  52. Stop("钟摆阀没有打开");
  53. return RState.Failed;
  54. }
  55. Reset();
  56. // open process final valve and flow
  57. Notify("Open valve and flow mfc");
  58. _chamber.OpenValve(ValveType.GasFinal, true);
  59. int i = 0;
  60. foreach (object o in objs)
  61. {
  62. _mfcSetPoint[i++] = (double)o;
  63. }
  64. _gasStatus = true;
  65. Reset();
  66. return Runner.Start(Module, Name);
  67. }
  68. public RState Monitor()
  69. {
  70. Runner.Run(GasStep.kStartGas, FlowMfc, CheckRange, 6000000)
  71. .End(GasStep.kEnd, NullFun, _delay_50ms);
  72. return Runner.Status;
  73. }
  74. public void Abort()
  75. {
  76. StopFlow();
  77. }
  78. public bool FlowMfc()
  79. {
  80. for (int index = 0; index < _mfcSetPoint.Length; index++)
  81. {
  82. if (_mfcSetPoint[index] > 0)
  83. OpenPVNVlv(index, true);
  84. _chamber.FlowGas(index, _mfcSetPoint[index]);
  85. }
  86. return true;
  87. }
  88. private void OpenPVNVlv(int mfcIndex, bool on)
  89. {
  90. if (mfcIndex < vlvs.Length)
  91. {
  92. _chamber.OpenValve(vlvs[mfcIndex], on);
  93. }
  94. }
  95. private bool CheckRange()
  96. {
  97. if (_chamber.HasGasOutOfRange)
  98. {
  99. Stop("流气率越界");
  100. _gasStatus = false;
  101. return true;
  102. }
  103. return false;
  104. }
  105. public void StopFlow()
  106. {
  107. Notify("Close valve and stop to flow MFC");
  108. _chamber.OpenValve(ValveType.GasFinal, false);
  109. _chamber.StopAllGases();
  110. for (int i = 0; i < vlvs.Length; i++)
  111. {
  112. OpenPVNVlv(i, false);
  113. }
  114. }
  115. }
  116. }