GasFlowRoutine.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using Aitex.Core.Common.DeviceData;
  3. using Aitex.Core.RT.Event;
  4. using Aitex.Core.RT.Routine;
  5. using Aitex.Core.RT.SCCore;
  6. using JetVirgoPM.Devices;
  7. namespace JetVirgoPM.PMs.Routines
  8. {
  9. class GasFlowRoutine : PMRoutineBase, IStepRoutine
  10. {
  11. private enum RoutineStep
  12. {
  13. CheckPressure,
  14. StartFlow,
  15. StopFlow,
  16. CheckStable,
  17. End,
  18. };
  19. public bool _gasStatus = false;
  20. private double _pressureAlarmRange;
  21. private double _pressureAlarmTime;
  22. //private double _gasFlowAlarmRange;
  23. //private double _gasFlowAlarmTime;
  24. private double[] _mfcSetPoint = new double[6];
  25. public GasFlowRoutine(JetDualPM chamber) : base(chamber)
  26. {
  27. Name = "Flow gas";
  28. bUINotify = true;
  29. }
  30. public RState Start(params object[] objs)
  31. {
  32. if (!_chamber.IsFastPumpOpened)
  33. {
  34. StopFlow2();
  35. Stop("Pump 阀没有打开");
  36. return RState.Failed;
  37. }
  38. Reset();
  39. _pressureAlarmRange = SC.GetValue<double>($"{Module}.GasFlowPressureAlarmRange");
  40. _pressureAlarmTime = SC.GetValue<double>($"{Module}.GasFlowPressureAlarmTime");
  41. // open process final valve and flow
  42. Notify("Open valve and flow mfc");
  43. if(!_chamber.IsPlus)
  44. _chamber.OpenValve(ValveType.PURGE, true);
  45. _chamber.OpenValve(ValveType.PROCESS, true);
  46. int i = 0;
  47. foreach (object o in objs)
  48. {
  49. _mfcSetPoint[i++] = (double)o;
  50. }
  51. FlowMfc2((int)RoutineStep.StartFlow, _mfcSetPoint);
  52. _gasStatus = true;
  53. return Runner.Start(_chamber.Module.ToString(), Name);
  54. }
  55. public RState Monitor()
  56. {
  57. if (_chamber.HasGasOutOfRange)
  58. {
  59. Stop("流气率越界");
  60. _gasStatus = false;
  61. return RState.Failed;
  62. }
  63. Runner.End(RoutineStep.End, EndFunc, _delay_50ms);
  64. return Runner.Status;
  65. }
  66. public void FlowMfc2(int id, double[] mfcValues)
  67. {
  68. string reason = string.Empty;
  69. for (int index = 0; index < mfcValues.Length; index++)
  70. {
  71. _chamber.FlowGas(index, mfcValues[index]);
  72. }
  73. }
  74. public void StopFlow2()
  75. {
  76. Notify("Close valve and stop to flow MFC");
  77. _chamber.OpenValve(ValveType.PURGE, false);
  78. _chamber.OpenValve(ValveType.PROCESS, false);
  79. _chamber.StopAllGases();
  80. }
  81. public override void Abort()
  82. {
  83. this.StopFlow2();
  84. _gasStatus = false;
  85. }
  86. }
  87. }