LoaderTiltAxisInterLock.cs 5.5 KB

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