GasFlowRoutine.cs 3.6 KB

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