AlignerHomeRoutine.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 AlignerHomeRoutine : ModuleRoutineBase, IStepRoutine
  11. {
  12. enum RoutineStep
  13. {
  14. ClearError,
  15. Home,
  16. QueryStatus,
  17. End,
  18. }
  19. private int _timeout = 0;
  20. AlignerBase _aligner = null;
  21. public AlignerHomeRoutine(AlignerModuleBase module) : base(module.Module)
  22. {
  23. Name = "Home";
  24. }
  25. public bool Initalize()
  26. {
  27. return true;
  28. }
  29. public RState Start(params object[] objs)
  30. {
  31. Reset();
  32. _aligner = DEVICE.GetDevice<AlignerBase>($"{Module}.{Module}");
  33. _timeout = SC.GetValue<int>("EFEM.Aligner.HomeTimeout");
  34. if (_aligner.Name == "Cooling1" || _aligner.Name == "Cooling2")
  35. {
  36. _timeout = SC.GetValue<int>("EFEM.Cooling.HomeTimeout");
  37. }
  38. return Runner.Start(_aligner.Module, Name);
  39. }
  40. public RState Monitor()
  41. {
  42. Runner.Run(RoutineStep.Home, Home, CheckHome, _timeout * 1000)
  43. .End(RoutineStep.End, NullFun, _delay_50ms);
  44. return Runner.Status;
  45. }
  46. bool Home()
  47. {
  48. string reason;
  49. Notify($"Start home {_aligner.Name}");
  50. if (!_aligner.Home(out reason))
  51. {
  52. Stop(reason);
  53. return false;
  54. }
  55. return true;
  56. }
  57. bool CheckHome()
  58. {
  59. return !(_aligner.IsError || _aligner.IsBusy);
  60. }
  61. public void Abort()
  62. {
  63. }
  64. }
  65. }