VpwManualPrepareRoutine.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.RecipeCenter;
  7. using MECF.Framework.Common.Routine;
  8. using MECF.Framework.Common.SubstrateTrackings;
  9. using PunkHPX8_Core;
  10. using PunkHPX8_RT.Devices.AXIS;
  11. using PunkHPX8_RT.Devices.VpwCell;
  12. using PunkHPX8_RT.Devices.VpwMain;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. namespace PunkHPX8_RT.Modules.VpwCell
  19. {
  20. public class VpwManualPrepareRoutine : RoutineBase, IRoutine
  21. {
  22. private enum PrepareStep
  23. {
  24. CheckPreCondition,
  25. Purge,
  26. WaitPurge,
  27. RotationPositionOffset,
  28. WaitRotation,
  29. CloseDrip,
  30. Delay,
  31. WaitWafer,
  32. ChamberUp,
  33. CloseDrain,
  34. CheckLoopDO,
  35. End
  36. }
  37. #region 内部变量
  38. /// <summary>
  39. /// recipe
  40. /// </summary>
  41. private VpwRecipe _recipe;
  42. /// <summary>
  43. /// 电机
  44. /// </summary>
  45. private JetAxisBase _rotationAxis;
  46. /// <summary>
  47. /// 设备
  48. /// </summary>
  49. private VpwCellDevice _vpwCellDevice;
  50. /// <summary>
  51. /// Main设备
  52. /// </summary>
  53. private VpwMainDevice _mainDevice;
  54. /// <summary>
  55. /// 延迟时间
  56. /// </summary>
  57. private int _putDownAfterDripClose = 2000;
  58. /// <summary>
  59. /// 等待Wafer放入时间
  60. /// </summary>
  61. private int _waitForWaferTime = 300000;
  62. #endregion
  63. /// <summary>
  64. /// 构造函数
  65. /// </summary>
  66. /// <param name="module"></param>
  67. public VpwManualPrepareRoutine(string module) : base(module)
  68. {
  69. }
  70. /// <summary>
  71. /// 中止
  72. /// </summary>
  73. public void Abort()
  74. {
  75. Runner.Stop("Manual abort");
  76. }
  77. /// <summary>
  78. /// 监控
  79. /// </summary>
  80. /// <returns></returns>
  81. public RState Monitor()
  82. {
  83. Runner.Run(PrepareStep.CheckPreCondition,CheckPreCondition,_delay_1ms)
  84. .RunIf(PrepareStep.Purge,_recipe.PurgeEnable,Purge,_delay_1ms)
  85. .WaitWithStopConditionIf(PrepareStep.WaitPurge,_recipe.PurgeEnable,CheckPurgeStatus,CheckPurgeStopStatus)
  86. .Run(PrepareStep.RotationPositionOffset,RotationPositionOffset,_delay_1ms)
  87. .WaitWithStopCondition(PrepareStep.WaitRotation,CheckRotationStatus,CheckRotationStopStatus)
  88. .Run(PrepareStep.CloseDrip,()=>_vpwCellDevice.FlowDripOff(),_delay_1ms)
  89. .Delay(PrepareStep.Delay,_putDownAfterDripClose)
  90. .Wait(PrepareStep.WaitWafer,CheckWaferExsit,_waitForWaferTime)
  91. .Run(PrepareStep.ChamberUp,ChamberUp,CheckChamberClosed)
  92. .Run(PrepareStep.CloseDrain,_vpwCellDevice.DrainValveOff,_delay_1ms)
  93. .Run(PrepareStep.CheckLoopDO,CheckLoopDO,_delay_1ms)
  94. .End(PrepareStep.End,NullFun,_delay_1ms);
  95. return Runner.Status;
  96. }
  97. /// <summary>
  98. /// Purge routine
  99. /// </summary>
  100. /// <returns></returns>
  101. private bool Purge()
  102. {
  103. return true;
  104. }
  105. /// <summary>
  106. /// 检验Purge执行是否结束
  107. /// </summary>
  108. /// <returns></returns>
  109. private bool CheckPurgeStatus()
  110. {
  111. return true;
  112. }
  113. /// <summary>
  114. /// 检验Purger执行是否出现异常
  115. /// </summary>
  116. /// <returns></returns>
  117. private bool CheckPurgeStopStatus()
  118. {
  119. return false;
  120. }
  121. /// <summary>
  122. /// Position运行至offset
  123. /// </summary>
  124. /// <returns></returns>
  125. private bool RotationPositionOffset()
  126. {
  127. bool result= _rotationAxis.PositionStation("ChuckPlaceOffset");
  128. if (!result)
  129. {
  130. NotifyError(eEvent.ERR_VPW, "rotation start position to ChuckPlaceOffset failed", -1);
  131. }
  132. return result;
  133. }
  134. /// <summary>
  135. /// 检验电机是否完成运动
  136. /// </summary>
  137. /// <returns></returns>
  138. private bool CheckRotationStatus()
  139. {
  140. return _rotationAxis.Status == RState.End;
  141. }
  142. /// <summary>
  143. /// 检验电机运动是否出现异常
  144. /// </summary>
  145. /// <returns></returns>
  146. private bool CheckRotationStopStatus()
  147. {
  148. bool result= _rotationAxis.Status == RState.Failed;
  149. if (result)
  150. {
  151. NotifyError(eEvent.ERR_VPW, "rotation position to ChuckPlaceOffset failed", -1);
  152. }
  153. return result;
  154. }
  155. /// <summary>
  156. /// 检验是否存在Wafer
  157. /// </summary>
  158. /// <returns></returns>
  159. private bool CheckWaferExsit()
  160. {
  161. return WaferManager.Instance.CheckHasWafer(Module, 0);
  162. }
  163. /// <summary>
  164. /// chamber up
  165. /// </summary>
  166. /// <returns></returns>
  167. private bool ChamberUp()
  168. {
  169. bool result=_mainDevice.ChamberUp();
  170. if (!result)
  171. {
  172. NotifyError(eEvent.ERR_VPW, "chamber up failed", -1);
  173. }
  174. return result;
  175. }
  176. /// <summary>
  177. /// 检验Chamber是否关闭
  178. /// </summary>
  179. /// <returns></returns>
  180. private bool CheckChamberClosed()
  181. {
  182. return _mainDevice.CommonData.ChamberClosed && !_mainDevice.CommonData.ChamberOpened;
  183. }
  184. /// <summary>
  185. /// Check LoopDO数值
  186. /// </summary>
  187. /// <returns></returns>
  188. private bool CheckLoopDO()
  189. {
  190. double loopDoValue = _vpwCellDevice.LoopDOValue;
  191. bool result = loopDoValue < _recipe.DiwLoopDoSet;
  192. if (!result)
  193. {
  194. NotifyError(eEvent.ERR_VPW, $"LoopDO value {loopDoValue} is less than {_recipe.DiwLoopDoSet}", -1);
  195. }
  196. return result;
  197. }
  198. /// <summary>
  199. /// 启动
  200. /// </summary>
  201. /// <param name="objs"></param>
  202. /// <returns></returns>
  203. public RState Start(params object[] objs)
  204. {
  205. _recipe=(VpwRecipe)objs[0];
  206. _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
  207. _vpwCellDevice = DEVICE.GetDevice<VpwCellDevice>(Module);
  208. _mainDevice = DEVICE.GetDevice<VpwMainDevice>(ModuleName.VPWMain1.ToString());
  209. _putDownAfterDripClose = SC.GetValue<int>($"{Module}.PutDownAfterDripClose");
  210. _waitForWaferTime = SC.GetValue<int>($"{Module}.WaitForWaferTime") * 1000;
  211. return Runner.Start(Module, $"{Module} prepare");
  212. }
  213. /// <summary>
  214. /// 检验前置条件
  215. /// </summary>
  216. /// <returns></returns>
  217. private bool CheckPreCondition()
  218. {
  219. if (!_rotationAxis.IsSwitchOn)
  220. {
  221. NotifyError(eEvent.ERR_VPW,"rotaion is not switch on",-1);
  222. return false;
  223. }
  224. if (!_rotationAxis.IsHomed)
  225. {
  226. NotifyError(eEvent.ERR_VPW, "rotaion is not homed", -1);
  227. return false;
  228. }
  229. return false;
  230. }
  231. /// <summary>
  232. /// 重试
  233. /// </summary>
  234. /// <param name="step"></param>
  235. public RState Retry(int step)
  236. {
  237. if (_recipe == null)
  238. {
  239. NotifyError(eEvent.ERR_RINSE, "recipe is null", -1);
  240. return RState.Failed;
  241. }
  242. List<Enum> preStepIds = new List<Enum>();
  243. return Runner.Retry(PrepareStep.CheckPreCondition, preStepIds, Module, "Prepare Retry");
  244. }
  245. }
  246. }