LLPickRoutine.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 Venus_Core;
  6. namespace Venus_RT.Modules.PMs
  7. {
  8. class LLPickRoutine : PMRoutineBase, IRoutine
  9. {
  10. private enum LLPickStep
  11. {
  12. kPrepareTransfer,
  13. kExtend,
  14. kPinUp,
  15. kRetract,
  16. kPostTransfer,
  17. kVentLoadLock,
  18. }
  19. private readonly LoadLockVentRoutine _loadLockVentRoutine;
  20. private int _prepareTransferTimeout = 120;
  21. private int _transferWaferTimeout = 120;
  22. private bool _isATMMode = false;
  23. public LLPickRoutine(JetPM chamber, LoadLockVentRoutine ventRoutine) : base(chamber)
  24. {
  25. Name = "PickWafer";
  26. _loadLockVentRoutine = ventRoutine;
  27. }
  28. public RState Start(params object[] objs)
  29. {
  30. _prepareTransferTimeout = SC.GetValue<int>($"{Module}.PrepareTransferTimeout");
  31. _transferWaferTimeout = SC.GetValue<int>($"{Module}.TransferWaferTimeout");
  32. _isATMMode = SC.GetValue<bool>("System.IsATMMode");
  33. if (_isATMMode)
  34. {
  35. if (!_chamber.IsATM || !_chamber.IsATMLoadlock)
  36. {
  37. Stop("腔体非大气状态,请先执行充气动作");
  38. return RState.Failed;
  39. }
  40. }
  41. else
  42. {
  43. if (!_chamber.IsVAC || !_chamber.IsVACLoadLock)
  44. {
  45. Stop("腔体非真空状态,请先执行抽真空动作");
  46. return RState.Failed;
  47. }
  48. }
  49. _chamber.OpenValve(ValveType.FastPump, false);
  50. _chamber.OpenValve(ValveType.LoadlockPumping, false);
  51. Reset();
  52. return Runner.Start(Module, Name);
  53. }
  54. public RState Monitor()
  55. {
  56. Runner.Run((int)LLPickStep.kPrepareTransfer, PrepareTransfer, IsPrepareReady, _prepareTransferTimeout * 1000)
  57. .Run((int)LLPickStep.kExtend, _chamber.ExtendWafer, () => { return _chamber.IsLoadlockArmExtend; }, _transferWaferTimeout * 1000)
  58. .Run((int)LLPickStep.kPinUp, SetLiftPinDown, () => { return _chamber.CheckLiftDown(); })
  59. .Run((int)LLPickStep.kRetract, _chamber.RetractWafer, () => { return _chamber.IsLoadlockArmRetract; }, _transferWaferTimeout * 1000)
  60. .Run((int)LLPickStep.kPostTransfer, PostTransfer, IsPostTransferReady, _prepareTransferTimeout * 1000)
  61. .End((int)LLPickStep.kVentLoadLock, VentLoadLock, IsVentDone);
  62. return Runner.Status;
  63. }
  64. private bool PrepareTransfer()
  65. {
  66. _chamber.SetLiftPin(MovementPosition.Up, out _);
  67. _chamber.SetSlitDoor(true, out _);
  68. return true;
  69. }
  70. private bool IsPrepareReady()
  71. {
  72. return _chamber.CheckLiftUp() && _chamber.CheckSlitDoorOpen();
  73. }
  74. private bool PostTransfer()
  75. {
  76. _chamber.SetSlitDoor(false, out _);
  77. return true;
  78. }
  79. private bool IsPostTransferReady()
  80. {
  81. return _chamber.CheckLiftDown() && _chamber.CheckSlitDoorClose();
  82. }
  83. private bool SetLiftPinDown()
  84. {
  85. return _chamber.SetLiftPin(MovementPosition.Down, out _);
  86. }
  87. private bool VentLoadLock()
  88. {
  89. if (!_isATMMode)
  90. {
  91. return _loadLockVentRoutine.Start() == RState.Running;
  92. }
  93. else
  94. return true;
  95. }
  96. private bool IsVentDone()
  97. {
  98. RState ret = _loadLockVentRoutine.Monitor();
  99. if (ret == RState.Failed || ret == RState.Timeout)
  100. {
  101. Runner.Stop("Vent Failed");
  102. return false;
  103. }
  104. return ret == RState.End;
  105. }
  106. public void Abort()
  107. {
  108. }
  109. }
  110. }