EFEMAlignRoutine.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Sorter.Common;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.Common.Schedulers;
  7. using MECF.Framework.Common.SubstrateTrackings;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Diagnostics;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using Venus_Core;
  15. using Venus_RT.Devices.EFEM;
  16. namespace Venus_RT.Modules.EFEM
  17. {
  18. public class EFEMAlignRoutine : ModuleRoutineBase, IRoutine
  19. {
  20. private enum AlignStep
  21. {
  22. WaitIdle,
  23. Rotate,
  24. End
  25. }
  26. private int _moveTimeout = 20 * 1000;
  27. EfemBase _efem;
  28. private double angle = 25;
  29. private WaferSize ws = WaferSize.WS12;
  30. private ModuleName _ll;
  31. public EFEMAlignRoutine(EfemBase efem) : base(ModuleName.Aligner1)
  32. {
  33. _efem = efem;
  34. }
  35. public RState Start(params object[] objs)
  36. {
  37. if (!_efem.IsHomed)
  38. {
  39. LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"EFEM is not homed, please home it first");
  40. return RState.Failed;
  41. }
  42. if (objs.Length >= 3)
  43. {
  44. try
  45. {
  46. angle = Convert.ToDouble(objs[2]);
  47. }
  48. catch
  49. {
  50. LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"ALIAN PARAMETER IS ILLEGAL ");
  51. }
  52. }
  53. if (!WaferManager.Instance.CheckHasWafer(ModuleName.Aligner1, 0))
  54. {
  55. LOG.Write(eEvent.ERR_EFEM_ROBOT, Module, $"Efem PreAligner not have wafer, cannot do the align action");
  56. return RState.Failed;
  57. }
  58. else
  59. {
  60. Trace.WriteLine("开始Align");
  61. return Runner.Start(Module,$"PreAligner Start align");
  62. }
  63. }
  64. public RState Monitor()
  65. {
  66. Runner.Wait(AlignStep.WaitIdle, WaitEFEMIdle, _delay_60s)
  67. .Run(AlignStep.Rotate, fnalign, CheckAlignDone, _moveTimeout)
  68. .End( AlignStep.End, ActionDone, 0);
  69. return Runner.Status;
  70. }
  71. private bool fnalign()
  72. {
  73. LOG.Write(eEvent.EV_EFEM_ROBOT, ModuleName.EfemRobot, $"Wafer Align: {angle}");
  74. return _efem.Align(Module,angle,0,ws);
  75. }
  76. private bool CheckAlignDone()
  77. {
  78. if (_efem.Status == RState.End)
  79. {
  80. return true;
  81. }
  82. else if (_efem.Status != RState.Running)
  83. {
  84. LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, Module, $"Efem PreAligner align failed: {_efem.Status}");
  85. return true;
  86. }
  87. return false;
  88. }
  89. private bool ActionDone()
  90. {
  91. return true;
  92. }
  93. private bool WaitEFEMIdle()
  94. {
  95. return _efem.Status == RState.End;
  96. }
  97. public void Abort()
  98. {
  99. throw new NotImplementedException();
  100. }
  101. }
  102. }