PufRotationAxisInterLock.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Log;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.Utilities;
  6. using CyberX8_RT.Devices.AXIS;
  7. using CyberX8_RT.Devices.Loader;
  8. using CyberX8_RT.Devices.TransPorter;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. namespace CyberX8_RT.Devices.PUF
  15. {
  16. public class PufRotationAxisInterLock : IAxisInterLock
  17. {
  18. #region 常量
  19. private const string IS_DOOR_OPENED = "IsDoorOpened";
  20. #endregion
  21. #region 内部变量
  22. private JetAxisBase _loaderTransporterGantryAxis;
  23. private JetAxisBase _axis;
  24. #endregion
  25. #region 属性
  26. /// <summary>
  27. /// 模块名称
  28. /// </summary>
  29. public string Module { get { return _axis.Module; } }
  30. /// <summary>
  31. /// 子模块名称
  32. /// </summary>
  33. public string Name { get { return _axis.Name; } }
  34. #endregion
  35. /// <summary>
  36. /// 构造函数
  37. /// </summary>
  38. /// <param name="Module"></param>
  39. /// <param name="name"></param>
  40. public PufRotationAxisInterLock(JetAxisBase axis)
  41. {
  42. _axis = axis;
  43. }
  44. /// <summary>
  45. /// 加载LoaderTransporter Gantry轴
  46. /// </summary>
  47. private void GetLoaderTransporterGantryAxis()
  48. {
  49. if(_loaderTransporterGantryAxis==null)
  50. {
  51. _loaderTransporterGantryAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.Transporter2}.Gantry");
  52. }
  53. }
  54. /// <summary>
  55. /// GotoPosition检验条件
  56. /// </summary>
  57. /// <param name="station"></param>
  58. /// <returns></returns>
  59. /// <exception cref="NotImplementedException"></exception>
  60. public bool CheckGotoPosition(string station)
  61. {
  62. if (!_axis.IsHomed)
  63. {
  64. LOG.WriteLog(eEvent.ERROR_PUF_NOT_HOME, $"{Module}.{Name}", "axis is not homed, Cannot execute GotoSavedPosition");
  65. return false;
  66. }
  67. if (!AxisManager.Instance.CheckModuleAxisSwitchOn(Module, Name))
  68. {
  69. return false;
  70. }
  71. JetAxisBase flipAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Flip");
  72. if (flipAxis.Status==CyberX8_Core.RState.Running)
  73. {
  74. LOG.WriteLog(eEvent.ERROR_PUF_OTHERAXIS_RUNNING, $"{Module}.{Name}", "flip status is running, Cannot execute GotoSavedPosition");
  75. return false;
  76. }
  77. double flipPosition = flipAxis.MotionData.MotorPosition;
  78. if (flipAxis.CheckPositionIsEmpty(flipPosition))
  79. {
  80. LOG.WriteLog(eEvent.ERROR_PUF_OTHER_AXIS_EMPTY, $"{Module}.{Name}", "flip station is empty, Cannot execute GotoSavedPosition");
  81. return false;
  82. }
  83. bool loaderInstalled = ModuleHelper.IsInstalled(ModuleName.Loader1);
  84. JetAxisBase loaderRotationAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.Loader1}.Rotation");
  85. double loaderRotationPosition = loaderInstalled?loaderRotationAxis.MotionData.MotorPosition:0;
  86. bool loaderTransporterInstalled = ModuleHelper.IsInstalled(ModuleName.Transporter2);
  87. if(loaderTransporterInstalled)
  88. {
  89. GetLoaderTransporterGantryAxis();
  90. }
  91. if(station.EndsWith("HOME")||station.EndsWith("Flip")||station.EndsWith("ROBOT"))
  92. {
  93. return true;
  94. }
  95. if (!loaderInstalled)
  96. {
  97. return true;
  98. }
  99. if (loaderRotationAxis == null || loaderRotationAxis.CheckPositionIsEmpty(loaderRotationPosition))
  100. {
  101. LOG.WriteLog(eEvent.ERROR_PUF_OTHER_AXIS_EMPTY, $"{Module}.{Name}", $"loader rotation axis {loaderRotationPosition} is empty, Cannot execute GotoSavedPosition");
  102. return false;
  103. }
  104. bool isInLOADA = loaderRotationAxis.CheckPositionInStationIgnoreWaferSize(loaderRotationPosition, "LOADA");
  105. bool isInLOADB = loaderRotationAxis.CheckPositionInStationIgnoreWaferSize(loaderRotationPosition, "LOADB");
  106. if (!isInLOADA&&!isInLOADB)//loader1 rotation轴不在LOADA或LOADB
  107. {
  108. LOG.WriteLog(eEvent.ERROR_PUF_OTHER_AXIS_STATION, $"{Module}.{Name}", $"load rotation {loaderRotationPosition} is not in LOADA and LOADB");
  109. return false;
  110. }
  111. string side = isInLOADA ? "A" : "B";
  112. JetAxisBase shuttleAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.Loader1}.Shuttle{side}");
  113. double shuttlePosition = shuttleAxis.MotionData.MotorPosition;
  114. if(!shuttleAxis.CheckPositionInStationIgnoreWaferSize(shuttlePosition, "OUT"))
  115. {
  116. LOG.WriteLog(eEvent.ERROR_PUF_OTHER_AXIS_STATION, $"{Module}.{Name}", $"load shuttle{side} {shuttlePosition} is not in OUT");
  117. return false;
  118. }
  119. JetAxisBase tiltAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.Loader1}.Tilt{side}");
  120. double tiltPosition = tiltAxis.MotionData.MotorPosition;
  121. if (!tiltAxis.CheckPositionIsInStation(tiltPosition, "HORI"))
  122. {
  123. LOG.WriteLog(eEvent.ERROR_PUF_OTHER_AXIS_STATION, $"{Module}.{Name}", $"load tilt{side} {tiltPosition} is not in HORI");
  124. return false;
  125. }
  126. PufVacuum _pufVacuum = DEVICE.GetDevice<PufVacuum>($"{Module}.Vacuum");
  127. if (_pufVacuum.Chuck)
  128. {
  129. LOG.WriteLog(eEvent.ERROR_PUF_CHUCK_ON, $"{Module}.{Name}", "Chuck is on");
  130. return false;
  131. }
  132. if (_pufVacuum.SideAChuckOut)
  133. {
  134. LOG.WriteLog(eEvent.ERROR_PUF_SIDEA_CHUCK_OUT_ON, $"{Module}.{Name}", "SideA Chuck out is on");
  135. return false;
  136. }
  137. if (_pufVacuum.SideBChuckOut)
  138. {
  139. LOG.WriteLog(eEvent.ERROR_PUF_SIDEA_CHUCK_OUT_ON, $"{Module}.{Name}", "SideB Chuck out is on");
  140. return false;
  141. }
  142. if (!_pufVacuum.SideAChuckIn)
  143. {
  144. LOG.WriteLog(eEvent.ERROR_PUF_SIDEA_CHUCK_IN_OFF, $"{Module}.{Name}", "SideA Chuck in is off");
  145. return false;
  146. }
  147. if (!_pufVacuum.SideBChuckIn)
  148. {
  149. LOG.WriteLog(eEvent.ERROR_PUF_SIDEA_CHUCK_IN_OFF, $"{Module}.{Name}", "SideB Chuck in is off");
  150. return false;
  151. }
  152. return true;
  153. }
  154. }
  155. }