AlignerAlignRoutine.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using MECF.Framework.Common.Equipment;
  6. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners;
  7. using MECF.Framework.RT.ModuleLibrary.AlignerModules;
  8. namespace JetEfemLib.Aligners
  9. {
  10. class AlignerAlignRoutine : ModuleRoutineBase, IStepRoutine
  11. {
  12. enum Align
  13. {
  14. Align,
  15. End,
  16. }
  17. private int _timeout = 0;
  18. private double _angle = 0.0;
  19. private AlignerBase _aligner;
  20. public AlignerAlignRoutine(AlignerModuleBase module) : base(module.Module)
  21. {
  22. Name = "Align";
  23. _aligner = DEVICE.GetDevice<AlignerBase>($"{Module}.{Module}");
  24. _angle = SC.GetValue<double>("EFEM.Aligner.DefaultNotchDegree");
  25. }
  26. public bool Initalize()
  27. {
  28. return true;
  29. }
  30. public void Init(double notch)
  31. {
  32. _angle = notch;
  33. }
  34. public RState Start(params object[] objs)
  35. {
  36. Reset();
  37. _timeout = SC.GetValue<int>("EFEM.Aligner.AlignTimeout");
  38. Notify($"Start align to {_angle} degree");
  39. //AlignersState.IsAligning = true;
  40. return Runner.Start(_aligner.Module, Name);
  41. }
  42. public RState Monitor()
  43. {
  44. Runner.Run(Align.Align, AlignWafer, CheckAlignDone, _timeout * 1000)
  45. .End(Align.End, NullFun, _delay_50ms);
  46. return Runner.Status;
  47. }
  48. bool AlignWafer()
  49. {
  50. Notify($"Start align to {_angle} degree");
  51. string reason;
  52. if (!_aligner.Align(_angle, out reason))
  53. {
  54. Stop(reason);
  55. return false;
  56. }
  57. return true;
  58. }
  59. bool CheckAlignDone()
  60. {
  61. return !(_aligner.IsError || _aligner.IsBusy);
  62. }
  63. public void Abort()
  64. {
  65. //AlignersState.IsAligning = false;
  66. Notify("Abort");
  67. }
  68. }
  69. }