BufferLiftRoutine.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.Buffers
  9. {
  10. class BufferLiftRoutine : ModuleRoutineBase, IStepRoutine
  11. {
  12. enum Lift
  13. {
  14. Lift,
  15. End,
  16. }
  17. private int _timeout = 0;
  18. private bool _isUp;
  19. private AlignerBase _aligner;
  20. public BufferLiftRoutine(AlignerModuleBase module) : base(module.ToString())
  21. {
  22. Name = "Lift";
  23. _aligner = DEVICE.GetDevice<AlignerBase>($"{Module}.{Module}");
  24. }
  25. public bool Initalize()
  26. {
  27. return true;
  28. }
  29. public void Init(bool isUp)
  30. {
  31. _isUp = isUp;
  32. }
  33. public RState Start(params object[] objs)
  34. {
  35. Reset();
  36. _timeout = SC.GetValue<int>("EFEM.Aligner.LiftTimeout");
  37. Notify($"Start Lift to {(_isUp ? "Up" : "Down")} ");
  38. //AlignersState.IsAligning = true;
  39. return Runner.Start(Module, Name);
  40. }
  41. public RState Monitor()
  42. {
  43. Runner.Run(Lift.Lift, LiftWafer, CheckLiftWafer, _timeout * 1000)
  44. .End(Lift.Lift, NullFun, _delay_50ms);
  45. return Runner.Status;
  46. }
  47. bool LiftWafer()
  48. {
  49. string reason;
  50. if (!_aligner.Lift(_isUp ? "UP" : "DOWN", out reason))
  51. {
  52. Stop(reason);
  53. return false;
  54. }
  55. return true;
  56. }
  57. bool CheckLiftWafer()
  58. {
  59. return !(_aligner.IsError || _aligner.IsBusy);
  60. }
  61. public void Abort()
  62. {
  63. //AlignersState.IsAligning = false;
  64. Notify("Abort");
  65. }
  66. }
  67. }