GasFlowRoutine.cs 3.6 KB

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