AlignerLiftRoutine.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 AlignerLiftRoutine : 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 AlignerLiftRoutine(AlignerModuleBase module) : base(module.Module)
  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.GetValueOrDefault<int>("EFEM.Aligner.LiftTimeout");
  37. if(_aligner.Name=="Cooling1"|| _aligner.Name == "Cooling2")
  38. {
  39. _timeout = SC.GetValue<int>("EFEM.Cooling.LiftTimeout");
  40. }
  41. Notify($"Start Lift to {(_isUp?"Up":"Down")} ");
  42. //AlignersState.IsAligning = true;
  43. return Runner.Start(_aligner.Module, Name);
  44. }
  45. public RState Monitor()
  46. {
  47. Runner.Run(Lift.Lift, LiftWafer, CheckLiftWafer, _timeout * 1000)
  48. .End(Lift.End, NullFun, _delay_50ms);
  49. return Runner.Status;
  50. }
  51. bool LiftWafer()
  52. {
  53. string reason;
  54. if (!_aligner.Lift(_isUp ? "UP" : "DOWN", out reason))
  55. {
  56. Stop(reason);
  57. return false;
  58. }
  59. return true;
  60. }
  61. bool CheckLiftWafer()
  62. {
  63. return !(_aligner.IsError || _aligner.IsBusy);
  64. }
  65. public void Abort()
  66. {
  67. //AlignersState.IsAligning = false;
  68. Notify("Abort");
  69. }
  70. }
  71. }