LLPickRoutine.cs 4.6 KB

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