LoaderTiltAxisInterLock.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. ////Puf vertical is park
  54. //if (ModuleHelper.IsInstalled(ModuleName.PUF1))
  55. //{
  56. // JetAxisBase puf1VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF1}.Vertical");
  57. // if (puf1VerticalAxis != null)
  58. // {
  59. // double puf1VerticalPosition = puf1VerticalAxis.MotionData.MotorPosition;
  60. // if (!puf1VerticalAxis.CheckPositionIsInStation(puf1VerticalPosition, "Park"))
  61. // {
  62. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF1} {puf1VerticalPosition} is not in Park, Cannot execute GotoSavedPosition");
  63. // return false;
  64. // }
  65. // }
  66. //}
  67. //if (ModuleHelper.IsInstalled(ModuleName.PUF2))
  68. //{
  69. // JetAxisBase puf2VerticalAxis = DEVICE.GetDevice<JetAxisBase>($"{ModuleName.PUF2}.Vertical");
  70. // if (puf2VerticalAxis != null)
  71. // {
  72. // double puf2VerticalPosition = puf2VerticalAxis.MotionData.MotorPosition;
  73. // if (!puf2VerticalAxis.CheckPositionIsInStation(puf2VerticalPosition, "Park"))
  74. // {
  75. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"{ModuleName.PUF2} {puf2VerticalPosition} is not in Park, Cannot execute GotoSavedPosition");
  76. // return false;
  77. // }
  78. // }
  79. //}
  80. //JetAxisBase swingAxis = null;
  81. //double swingPosition = 0;
  82. //if (Name == "TiltA")
  83. //{
  84. // swingAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.SwingA");
  85. // swingPosition=swingAxis.MotionData.MotorPosition;
  86. // if (!swingAxis.IsSwitchOn)
  87. // {
  88. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingA is switch off");
  89. // return false;
  90. // }
  91. // if (swingAxis.IsRun)
  92. // {
  93. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingA is running,Cannot execute GotoSavedPosition");
  94. // return false;
  95. // }
  96. //}
  97. //else
  98. //{
  99. // swingAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.SwingB");
  100. // swingPosition=swingAxis.MotionData.MotorPosition;
  101. // if (!swingAxis.IsSwitchOn)
  102. // {
  103. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingB is switch off");
  104. // return false;
  105. // }
  106. // if (swingAxis.IsRun)
  107. // {
  108. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"SwingB is running,Cannot execute GotoSavedPosition");
  109. // return false;
  110. // }
  111. //}
  112. //JetAxisBase rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Rotation");
  113. //if (!rotationAxis.IsSwitchOn)
  114. //{
  115. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"rotation is switch off");
  116. // return false;
  117. //}
  118. //if (rotationAxis.IsRun)
  119. //{
  120. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"rotation is running,Cannot execute GotoSavedPosition");
  121. // return false;
  122. //}
  123. //if(swingAxis.CheckPositionIsEmpty(swingPosition))
  124. //{
  125. // return true;
  126. //}
  127. ////Swing在CLOSED,不可以去某一Station
  128. //if (swingAxis.CheckPositionIsInStation(swingPosition, "CLOSED"))
  129. //{
  130. // //LOG.WriteLog(eEvent.ERR_LOADER, Module, "Swing is CLOSED, Cannot execute GotoSavedPosition");
  131. // //return false;
  132. // return true;
  133. //}
  134. ////Swing在OPEN/OPENB,除了FLIP外其他位置都可以去
  135. //if (swingAxis.CheckPositionIsInStation(swingPosition, "OPEN")||
  136. // swingAxis.CheckPositionIsInStation(swingPosition,"OPENB"))
  137. //{
  138. // if(station.EndsWith("FLIP"))
  139. // {
  140. // LOG.WriteLog(eEvent.ERR_LOADER, Module, $"Swing {swingPosition} is OPEN/OPENB, Cannot Goto Flip");
  141. // return false;
  142. // }
  143. // else
  144. // {
  145. // return true;
  146. // }
  147. //}
  148. ////Swing在Clean
  149. //if(swingAxis.CheckPositionIsInStation(swingPosition,"CLEAN"))
  150. //{
  151. // return true;
  152. //}
  153. return true;
  154. }
  155. }
  156. }