LoaderShuttleAxisInterLock.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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.AXIS.Yaskawa;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. namespace CyberX8_RT.Devices.Loader
  14. {
  15. public class LoaderShuttleAxisInterLock : IAxisInterLock
  16. {
  17. #region 内部变量
  18. private JetAxisBase _axis;
  19. #endregion
  20. #region 属性
  21. /// <summary>
  22. /// 模块名称
  23. /// </summary>
  24. public string Module { get { return _axis.Module ; } }
  25. /// <summary>
  26. /// 子模块名称
  27. /// </summary>
  28. public string Name { get { return _axis.Name; } }
  29. #endregion
  30. #region 内部变量
  31. private LoaderSideDevice _loaderSide = null;
  32. #endregion
  33. /// <summary>
  34. /// 构造函数
  35. /// </summary>
  36. /// <param name="Module"></param>
  37. /// <param name="name"></param>
  38. public LoaderShuttleAxisInterLock(JetAxisBase axis)
  39. {
  40. _axis = axis;
  41. }
  42. /// <summary>
  43. /// 加载LoaderSide对象
  44. /// </summary>
  45. private void GetLoaderSide()
  46. {
  47. if (_loaderSide == null)
  48. {
  49. switch (Name)
  50. {
  51. case "ShuttleA":
  52. _loaderSide = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideA");
  53. break;
  54. default:
  55. _loaderSide = DEVICE.GetDevice<LoaderSideDevice>($"{Module}.SideB");
  56. break;
  57. }
  58. }
  59. }
  60. /// <summary>
  61. /// GotoPosition条件检验
  62. /// </summary>
  63. /// <param name="station"></param>
  64. /// <returns></returns>
  65. /// <exception cref="NotImplementedException"></exception>
  66. public bool CheckGotoPosition(string station)
  67. {
  68. if (!_axis.IsHomed)
  69. {
  70. LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{Name} is not home, Cannot execute GotoSavedPosition");
  71. return false;
  72. }
  73. return true;
  74. //GetLoaderSide();
  75. //JetAxisBase tiltAxis = null;
  76. //if(Name=="ShuttleA")
  77. //{
  78. // tiltAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.TiltA");
  79. //}
  80. //else
  81. //{
  82. // tiltAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.TiltB");
  83. //}
  84. //if (!tiltAxis.IsSwitchOn)
  85. //{
  86. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{tiltAxis.Module} is switch off");
  87. // return false;
  88. //}
  89. //if (tiltAxis.IsRun)
  90. //{
  91. // LOG.WriteLog(eEvent.ERR_LOADER, Module, "tilt is running,Cannot execute GotoSavedPosition");
  92. // return false;
  93. //}
  94. //if (station.EndsWith("CLOSED"))
  95. //{
  96. // double tiltPosition = tiltAxis.MotionData.MotorPosition;
  97. // if(!tiltAxis.CheckPositionIsInStation(tiltPosition, "VERT"))
  98. // {
  99. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{tiltAxis.Module} {tiltPosition} is not in VERT");
  100. // return false;
  101. // }
  102. //}
  103. ////Puf vertical is park
  104. //if (ModuleHelper.IsInstalled(ModuleName.PUF1))
  105. //{
  106. // JetAxisBase puf1VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Vertical");
  107. // if (puf1VerticalAxis != null)
  108. // {
  109. // double puf1VertocalPosition = puf1VerticalAxis.MotionData.MotorPosition;
  110. // if (!puf1VerticalAxis.CheckPositionIsInStation(puf1VertocalPosition, "Park"))
  111. // {
  112. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} Vertical {puf1VertocalPosition} is not in Park, Cannot execute GotoSavedPosition");
  113. // return false;
  114. // }
  115. // }
  116. //}
  117. //if (ModuleHelper.IsInstalled(ModuleName.PUF2))
  118. //{
  119. // JetAxisBase puf2VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Vertical");
  120. // if (puf2VerticalAxis != null)
  121. // {
  122. // double puf2VerticalPosition=puf2VerticalAxis.MotionData.MotorPosition;
  123. // if (!puf2VerticalAxis.CheckPositionIsInStation(puf2VerticalPosition, "Park"))
  124. // {
  125. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF2} Vertical {puf2VerticalPosition} is not in Park, Cannot execute GotoSavedPosition");
  126. // return false;
  127. // }
  128. // }
  129. //}
  130. ////Door 在Closed,无法从其他位置运动至Closed位置
  131. //if (_loaderSide.SideData.DoorLowerLocked||_loaderSide.SideData.DoorUpperLocked)
  132. //{
  133. // if (station.EndsWith("CLOSED"))
  134. // {
  135. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"door locked, {Name} cannot goto CLOSED");
  136. // return false;
  137. // }
  138. // else
  139. // {
  140. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"door locked, {Name} cannot move to other stations");
  141. // return false;
  142. // }
  143. //}
  144. //JetAxisBase rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
  145. //if (!rotationAxis.IsSwitchOn)
  146. //{
  147. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{rotationAxis.Module} is switch off");
  148. // return false;
  149. //}
  150. //if (rotationAxis.IsRun)
  151. //{
  152. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"rotation is running,Cannot execute GotoSavedPosition");
  153. // return false;
  154. //}
  155. //double rotationPosition = rotationAxis.MotionData.MotorPosition;
  156. //if (rotationAxis.CheckPositionIsEmpty(rotationPosition))
  157. //{
  158. // //LOG.WriteLog(eEvent.ERR_LOADER, Module, "loader rotation axis is empty, Cannot execute GotoSavedPosition");
  159. // //return false;
  160. // return true;
  161. //}
  162. //else
  163. //{
  164. // if (rotationAxis.CheckPositionIsInStation(rotationPosition, "LOADA") ||
  165. // rotationAxis.CheckPositionIsInStation(rotationPosition, "LOADB")||
  166. // rotationAxis.CheckPositionIsInStation(rotationPosition, "SERVICEB"))
  167. // {
  168. // return true;
  169. // }
  170. // else if (rotationAxis.CheckPositionIsInStation(rotationPosition, "CAMERA"))
  171. // {
  172. // if (station.EndsWith("CAMERA"))
  173. // {
  174. // return true;
  175. // }
  176. // else
  177. // {
  178. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"loader rotation axis {rotationPosition} is in Camera, {Name} only goto Camera");
  179. // return false;
  180. // }
  181. // }
  182. // else
  183. // {
  184. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"loader rotation axis is in {rotationAxis.CurrentStation}, can not go to position");
  185. // return false;
  186. // }
  187. //}
  188. }
  189. }
  190. }