PufWaferPickSubRoutine.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Routine;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.Routine;
  5. using MECF.Framework.Common.Utilities;
  6. using CyberX8_Core;
  7. using CyberX8_RT.Devices.AXIS;
  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.Modules.PUF
  14. {
  15. public class PufWaferPickSubRoutine : RoutineBase, IRoutine
  16. {
  17. private enum PufWaferPickSubStep
  18. {
  19. RotationFlip,
  20. RotationFlipWait,
  21. FlipSideA,
  22. FlipSideAWait,
  23. End
  24. }
  25. #region 内部变量
  26. private JetAxisBase _flipAxis;
  27. private JetAxisBase _rotationAxis;
  28. private string _side = "";
  29. #endregion
  30. public PufWaferPickSubRoutine(string module) : base(module)
  31. {
  32. _flipAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.Flip");
  33. _rotationAxis = DEVICE.GetDevice<JetAxisBase>($"{module}.Rotation");
  34. }
  35. public void Abort()
  36. {
  37. Runner.Stop("Manual Abort");
  38. }
  39. public RState Monitor()
  40. {
  41. Runner.Run(PufWaferPickSubStep.RotationFlip,()=> { return _rotationAxis.PositionStation("Flip"); }, NullFun, 100)
  42. .WaitWithStopCondition(PufWaferPickSubStep.RotationFlipWait, CheckRotationPositionStatus, CheckRotationPositionRunStop)
  43. .Run(PufWaferPickSubStep.FlipSideA, () => { return _flipAxis.PositionStation(_side); }, NullFun, 100)
  44. .WaitWithStopCondition(PufWaferPickSubStep.FlipSideAWait, CheckFlipPositionStatus, CheckFlipPositionRunStop)
  45. .End(PufWaferPickSubStep.End,NullFun);
  46. return Runner.Status;
  47. }
  48. /// <summary>
  49. /// 检验Rotation移动状态
  50. /// </summary>
  51. /// <returns></returns>
  52. private bool CheckRotationPositionStatus()
  53. {
  54. return _rotationAxis.Status == RState.End;
  55. }
  56. /// <summary>
  57. /// 检验Rotation是否还在运动
  58. /// </summary>
  59. /// <returns></returns>
  60. private bool CheckRotationPositionRunStop()
  61. {
  62. return _rotationAxis.Status == RState.Failed;
  63. }
  64. /// <summary>
  65. /// 检验Flip移动状态
  66. /// </summary>
  67. /// <returns></returns>
  68. private bool CheckFlipPositionStatus()
  69. {
  70. return _flipAxis.Status == RState.End;
  71. }
  72. /// <summary>
  73. /// 检验Flip是否还在运动
  74. /// </summary>
  75. /// <returns></returns>
  76. private bool CheckFlipPositionRunStop()
  77. {
  78. return _flipAxis.Status == RState.Failed;
  79. }
  80. public RState Start(params object[] objs)
  81. {
  82. _side = objs[0].ToString();
  83. Runner.Start(Module, "WaferPickSubRoutine");
  84. return RState.Running;
  85. }
  86. }
  87. }