LoaderTiltAxisInterLock.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Log;
  4. using MECF.Framework.Common.Utilities;
  5. using CyberX8_RT.Devices.AXIS;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using MECF.Framework.Common.Equipment;
  12. using Aitex.Core.Util;
  13. using CyberX8_RT.Modules;
  14. namespace CyberX8_RT.Devices.Loader
  15. {
  16. public class LoaderTiltAxisInterLock : IAxisInterLock
  17. {
  18. #region 内部变量
  19. private JetAxisBase _axis;
  20. #endregion
  21. #region 属性
  22. /// <summary>
  23. /// 模块名称
  24. /// </summary>
  25. public string Module { get { return _axis.Module; } }
  26. /// <summary>
  27. /// 子模块名称
  28. /// </summary>
  29. public string Name { get { return _axis.Name; } }
  30. #endregion
  31. /// <summary>
  32. /// 构造函数
  33. /// </summary>
  34. /// <param name="Module"></param>
  35. /// <param name="name"></param>
  36. public LoaderTiltAxisInterLock(JetAxisBase axis)
  37. {
  38. _axis = axis;
  39. }
  40. /// <summary>
  41. /// GotoPosition条件检验
  42. /// </summary>
  43. /// <param name="station"></param>
  44. /// <returns></returns>
  45. /// <exception cref="NotImplementedException"></exception>
  46. public bool CheckGotoPosition(string station)
  47. {
  48. if (!_axis.IsHomed)
  49. {
  50. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is not home, Cannot execute GotoSavedPosition");
  51. return false;
  52. }
  53. if (!_axis.IsSwitchOn)
  54. {
  55. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is switch off, Cannot execute GotoSavedPosition");
  56. return false;
  57. }
  58. if (_axis.IsRun)
  59. {
  60. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is running, Cannot execute GotoSavedPosition");
  61. return false;
  62. }
  63. //判断puf的rotation是否在home/flip/robot位置上
  64. if (ModuleHelper.IsInstalled(ModuleName.PUF1))
  65. {
  66. JetAxisBase puf1RotationAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Rotation");
  67. if (puf1RotationAxis != null)
  68. {
  69. if (puf1RotationAxis.IsRun) //puf rotation正在运动返回false
  70. {
  71. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} is running, Cannot execute GotoSavedPosition");
  72. return false;
  73. }
  74. double puf1RotationPosition = puf1RotationAxis.MotionData.MotorPosition;
  75. if (puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Home")
  76. || puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Flip")
  77. || puf1RotationAxis.CheckPositionIsInStation(puf1RotationPosition, "Robot"))
  78. {
  79. //校验通过,不执行操作
  80. }
  81. else
  82. {
  83. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} {puf1RotationPosition} is not in Home/flip/Robot station, Cannot execute GotoSavedPosition");
  84. return false;
  85. }
  86. } //puf rotation为空返回false
  87. else
  88. {
  89. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} is null, Cannot execute GotoSavedPosition");
  90. return false;
  91. }
  92. }
  93. //判断shuttle是否在out位上
  94. JetAxisBase shuttleAxis = null;
  95. double shuttleAxisPosition = 0;
  96. if (Name == "TiltA")
  97. {
  98. shuttleAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.ShuttleA");
  99. if (shuttleAxis != null)
  100. {
  101. if (shuttleAxis.IsRun) //shuttle正在运动返回false
  102. {
  103. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module}.ShuttleA is running, Cannot execute GotoSavedPosition");
  104. return false;
  105. }
  106. shuttleAxisPosition = shuttleAxis.MotionData.MotorPosition;
  107. if (!shuttleAxis.CheckPositionIsInStation(shuttleAxisPosition, $"OUT{shuttleAxis.WaferSize.ToString()}"))
  108. {
  109. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module}.ShuttleA is not in out station, Cannot execute GotoSavedPosition");
  110. return false;
  111. }
  112. }
  113. else //shuttle为空返回false
  114. {
  115. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module}.ShuttleA is null, Cannot execute GotoSavedPosition");
  116. return false;
  117. }
  118. }
  119. else
  120. {
  121. shuttleAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.ShuttleB");
  122. if (shuttleAxis != null)
  123. {
  124. if (shuttleAxis.IsRun) //shuttle正在运动返回false
  125. {
  126. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module}.ShuttleB is running, Cannot execute GotoSavedPosition");
  127. return false;
  128. }
  129. shuttleAxisPosition = shuttleAxis.MotionData.MotorPosition;
  130. if (!shuttleAxis.CheckPositionIsInStation(shuttleAxisPosition, $"OUT{shuttleAxis.WaferSize.ToString()}"))
  131. {
  132. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module}.ShuttleB is not in out station, Cannot execute GotoSavedPosition");
  133. return false;
  134. }
  135. }
  136. else //shuttle为空返回false
  137. {
  138. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Module}.ShuttleB is null, Cannot execute GotoSavedPosition");
  139. return false;
  140. }
  141. }
  142. return true;
  143. }
  144. }
  145. }