LLPickRoutine.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. KDelay2s,
  16. kPinUp,
  17. kRetract,
  18. kPostTransfer,
  19. kVentLoadLock,
  20. }
  21. private readonly LoadLockVentRoutine _loadLockVentRoutine;
  22. private int _prepareTransferTimeout = 120;
  23. private int _transferWaferTimeout = 120;
  24. private bool _isATMMode = false;
  25. public LLPickRoutine(JetPMBase chamber, LoadLockVentRoutine ventRoutine) : base(chamber)
  26. {
  27. Name = "PickWafer";
  28. _loadLockVentRoutine = ventRoutine;
  29. }
  30. public RState Start(params object[] objs)
  31. {
  32. _prepareTransferTimeout = SC.GetValue<int>($"{Module}.PrepareTransferTimeout");
  33. _transferWaferTimeout = SC.GetValue<int>($"{Module}.TransferWaferTimeout");
  34. _isATMMode = SC.GetValue<bool>("System.IsATMMode");
  35. if(WaferManager.Instance.CheckNoWafer(ModuleName.PMA, 0))
  36. {
  37. Stop("腔体没有 Wafer,不能执行取片动作");
  38. return RState.Failed;
  39. }
  40. if (WaferManager.Instance.CheckHasWafer(ModuleName.LLA, 0))
  41. {
  42. Stop("Loadlock 里面有片 Wafer,不能执行取片动作");
  43. return RState.Failed;
  44. }
  45. if(WaferManager.Instance.GetWafer(ModuleName.PMA, 0).ChuckState == Aitex.Core.Common.EnumWaferChuckStatus.Chucked)
  46. {
  47. Stop("腔体中Wafer没有 Dechuck,不能执行取片动作");
  48. return RState.Failed;
  49. }
  50. if (_isATMMode)
  51. {
  52. if (!_chamber.IsATM || !_chamber.IsATMLoadlock)
  53. {
  54. Stop("腔体非大气状态,请先执行充气动作");
  55. return RState.Failed;
  56. }
  57. }
  58. else
  59. {
  60. if (!_chamber.IsVAC || !_chamber.IsVACLoadLock)
  61. {
  62. Stop("腔体非真空状态,请先执行抽真空动作");
  63. return RState.Failed;
  64. }
  65. }
  66. _chamber.OpenValve(ValveType.FastPump, false);
  67. _chamber.OpenValve(ValveType.LoadlockPumping, false);
  68. Reset();
  69. return Runner.Start(Module, Name);
  70. }
  71. public RState Monitor()
  72. {
  73. Runner.Run((int)LLPickStep.kPrepareTransfer, PrepareTransfer, IsPrepareReady, _prepareTransferTimeout * 1000)
  74. .Run((int)LLPickStep.kExtend, _chamber.ExtendWafer, () => { return _chamber.IsLoadlockArmExtend; }, _transferWaferTimeout * 1000)
  75. .Delay((int)LLPickStep.KDelay2s,2000)
  76. .Run((int)LLPickStep.kPinUp, SetLiftPinDown, () => { return _chamber.CheckLiftDown(); })
  77. .Run((int)LLPickStep.kRetract, _chamber.RetractWafer, () => { return _chamber.IsLoadlockArmRetract; }, _transferWaferTimeout * 1000)
  78. .Run((int)LLPickStep.kPostTransfer, PostTransfer, IsPostTransferReady, _prepareTransferTimeout * 1000)
  79. .End((int)LLPickStep.kVentLoadLock, VentLoadLock, IsVentDone);
  80. return Runner.Status;
  81. }
  82. private bool PrepareTransfer()
  83. {
  84. _chamber.SetLiftPin(MovementPosition.Up, out _);
  85. _chamber.SetSlitDoor(true, out _);
  86. return true;
  87. }
  88. private bool IsPrepareReady()
  89. {
  90. return _chamber.CheckLiftUp() && _chamber.CheckSlitDoorOpen();
  91. }
  92. private bool PostTransfer()
  93. {
  94. WaferManager.Instance.WaferMoved(ModuleName.PMA, 0, ModuleName.LLA, 0);
  95. _chamber.SetSlitDoor(false, out _);
  96. return true;
  97. }
  98. private bool IsPostTransferReady()
  99. {
  100. return _chamber.CheckLiftDown() && _chamber.CheckSlitDoorClose();
  101. }
  102. private bool SetLiftPinDown()
  103. {
  104. return _chamber.SetLiftPin(MovementPosition.Down, out _);
  105. }
  106. private bool VentLoadLock()
  107. {
  108. //2023/06/08朱让取消
  109. //if (!_isATMMode)
  110. //{
  111. // return _loadLockVentRoutine.Start() == RState.Running;
  112. //}
  113. //else
  114. return true;
  115. }
  116. private bool IsVentDone()
  117. {
  118. //2023/06/08朱让取消
  119. //if(!_isATMMode)
  120. //{
  121. // RState ret = _loadLockVentRoutine.Monitor();
  122. // if (ret == RState.Failed || ret == RState.Timeout)
  123. // {
  124. // Runner.Stop("Vent Failed");
  125. // return false;
  126. // }
  127. // return ret == RState.End;
  128. //}
  129. return true;
  130. }
  131. public void Abort()
  132. {
  133. }
  134. }
  135. }