LoaderTiltAxisInterLock.cs 6.4 KB

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