PMHomeRoutine.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using Aitex.Core.RT.Routine;
  3. using Venus_RT.Devices;
  4. using MECF.Framework.Common.Routine;
  5. using Venus_Core;
  6. using Aitex.Core.RT.SCCore;
  7. namespace Venus_RT.Modules.PMs
  8. {
  9. class PMHomeRoutine : PMRoutineBase, IRoutine
  10. {
  11. enum RoutineStep
  12. {
  13. Home,
  14. End,
  15. }
  16. public PMHomeRoutine(JetPMBase chamber) : base(chamber)
  17. {
  18. Name = "PM Home";
  19. }
  20. public RState Init()
  21. {
  22. return RState.End;
  23. }
  24. public RState Start(params object[] objs)
  25. {
  26. Reset();
  27. if (RtInstance.ConfigType == ConfigType.Kepler2200)
  28. {
  29. SC.SetItemValue($"{Module}.{VenusDevice.PendulumValve}.NoCheck", false);
  30. }
  31. return Runner.Start(Module, Name);
  32. }
  33. public RState Monitor()
  34. {
  35. Runner.Run(RoutineStep.Home, HOFs.WrapAction(_chamber.Home), IsHomed, 50000)
  36. .End(RoutineStep.End, () => { return true; });
  37. return Runner.Status;
  38. }
  39. public void Abort()
  40. {
  41. }
  42. private bool IsHomed()
  43. {
  44. if (_chamber.ChamberType == JetChamber.Kepler2300)
  45. {
  46. return _chamber.IsSlitDoorClosed && _chamber.LiftPinPosition == Venus_Core.MovementPosition.Down;
  47. }
  48. else if (_chamber.ChamberType == JetChamber.Kepler2200A || _chamber.ChamberType == JetChamber.Kepler2200B)
  49. {
  50. return _chamber.HomeIsOK(out string reason);
  51. }
  52. else if (_chamber.ChamberType == JetChamber.VenusSE)
  53. {
  54. return _chamber.IsSlitDoorClosed && _chamber.LiftPinPosition == Venus_Core.MovementPosition.Down;
  55. }
  56. else if (_chamber.ChamberType == JetChamber.VenusDE)
  57. {
  58. return _chamber.IsSlitDoorClosed && _chamber.LiftPinPosition == Venus_Core.MovementPosition.Down && _chamber.IsLinerDoorClosed;
  59. }
  60. return false;
  61. }
  62. }
  63. }