MFVentRoutine.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 MECF.Framework.Common.Equipment;
  6. using Venus_Core;
  7. namespace Venus_RT.Modules.TM
  8. {
  9. class MFVentRoutine : ModuleRoutineBase, IRoutine
  10. {
  11. private enum VentStep
  12. {
  13. kVenting,
  14. kCloseVentValves,
  15. }
  16. private int _ventingTimeout;
  17. private readonly JetTM _JetTM;
  18. public MFVentRoutine(JetTM jetTM, ModuleName mod) : base(mod)
  19. {
  20. _JetTM = jetTM;
  21. Name = "Vent";
  22. }
  23. public RState Start(params object[] objs)
  24. {
  25. if (_JetTM.CheckLidClosed(Module) &&
  26. _JetTM.CheckPumpValveClosed(Module) &&
  27. _JetTM.CheckPurgeValveClosed(Module))
  28. {
  29. Reset();
  30. _ventingTimeout = SC.GetValue<int>($"{Module}.VentingTimeout") * 1000;
  31. return Runner.Start(Module, Name);
  32. }
  33. return RState.Failed;
  34. }
  35. public RState Monitor()
  36. {
  37. Runner.Run((int)VentStep.kVenting, OpenVentValve, IsPressureReady, _ventingTimeout)
  38. .End((int)VentStep.kCloseVentValves, CloseVentValve, _delay_50ms);
  39. return Runner.Status;
  40. }
  41. private bool OpenVentValve()
  42. {
  43. if(!IsPressureReady())
  44. {
  45. _JetTM.TurnVentValve(Module, true);
  46. }
  47. return true;
  48. }
  49. private bool CloseVentValve()
  50. {
  51. _JetTM.TurnVentValve(Module, false);
  52. return true;
  53. }
  54. private bool IsPressureReady()
  55. {
  56. return _JetTM.IsModuleATM(Module);
  57. }
  58. public void Abort()
  59. {
  60. CloseVentValve();
  61. }
  62. }
  63. }