StartPumpRoutine.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. return Runner.Start(_chamber.Module.ToString(), Name);
  44. }
  45. catch
  46. {
  47. return RState.Failed;
  48. }
  49. }
  50. public RState Monitor()
  51. {
  52. Runner.Run(StartPumpSequence.kCheckForelinePressure, HOFs.Apply(Foreline, (uint)_chamberForelinePressureThreshold), HOFs.Apply(CheckForeline, (uint)_chamberForelinePressureThreshold), _chamberForelinePressureTimeout * 1000)
  53. .End(StartPumpSequence.kEnd, EndFunc, _delay_0s);
  54. return Runner.Status;
  55. }
  56. public override void Abort()
  57. {
  58. _chamber.CloseValves();
  59. _chamber.StartPump(false);
  60. }
  61. }
  62. }