StartPumpRoutine.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using Aitex.Core.RT.Event;
  2. using Aitex.Core.RT.Routine;
  3. using Aitex.Core.RT.SCCore;
  4. using JetVirgoPM.Devices;
  5. using MECF.Framework.Common.Routine;
  6. namespace JetVirgoPM.PMs.Routines
  7. {
  8. class StartPumpRoutine : PMRoutineBase, IStepRoutine
  9. {
  10. private enum StartPumpSequence
  11. {
  12. kCheckForelinePressure,
  13. kCloseSoftPumpValve,
  14. kFastPumpValve,
  15. kCloseValves,
  16. kEnd
  17. }
  18. private double _chamberForelinePressureThreshold;
  19. private int _chamberForelinePressureTimeout;
  20. public StartPumpRoutine(JetDualPM chamber) : base(chamber)
  21. {
  22. Name = "LaunchPump";
  23. bUINotify = true;
  24. }
  25. public void Terminate()
  26. {
  27. }
  28. public RState Start(params object[] objs)
  29. {
  30. try
  31. {
  32. if (_chamber.IsPumpRunning)
  33. {
  34. Stop("泵已经运行");
  35. return RState.Failed;
  36. }
  37. Reset();
  38. _chamberForelinePressureThreshold = SC.GetValue<double>($"{Module}.DryPump.ChamberForelinePressureThreshold");
  39. _chamberForelinePressureTimeout = SC.GetValue<int>($"{Module}.DryPump.ChamberForelinePressureTimeout");
  40. _chamber.StartPump(true);
  41. _chamber.OpenValve(ValveType.FAST_PUMP, false);
  42. _chamber.OpenValve(ValveType.SOFT_PUMP, false);
  43. EV.PostInfoLog(Module, $"will start pump in {_chamberForelinePressureTimeout}s");
  44. return Runner.Start(_chamber.Module.ToString(), Name);
  45. }
  46. catch
  47. {
  48. return RState.Failed;
  49. }
  50. }
  51. public RState Monitor()
  52. {
  53. Runner.Run(StartPumpSequence.kCheckForelinePressure, HOFs.Apply(Foreline, (uint)_chamberForelinePressureThreshold), HOFs.Apply(CheckForeline, (uint)_chamberForelinePressureThreshold), _chamberForelinePressureTimeout * 1000)
  54. .End(StartPumpSequence.kEnd, EndFunc, _delay_0s);
  55. return Runner.Status;
  56. }
  57. public override void Abort()
  58. {
  59. _chamber.CloseValves();
  60. _chamber.StartPump(false);
  61. }
  62. }
  63. }