LoadPortHomeRoutine.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Log;
  4. using Aitex.Core.RT.Routine;
  5. using Aitex.Core.RT.SCCore;
  6. using MECF.Framework.Common.Equipment;
  7. using CyberX8_Core;
  8. namespace CyberX8_RT.Modules.LPs
  9. {
  10. class LoadPortHomeRoutine : ModuleRoutineBase, IRoutine
  11. {
  12. enum RoutineStep
  13. {
  14. Home,
  15. End,
  16. }
  17. private int _timeout = 0;
  18. private LoadPortModule _lpModule;
  19. public LoadPortHomeRoutine(LoadPortModule lpModule) : base(ModuleHelper.Converter( lpModule.Module))
  20. {
  21. _lpModule = lpModule;
  22. Name = "Home";
  23. }
  24. public RState Start(params object[] objs)
  25. {
  26. Reset();
  27. _timeout = SC.GetValue<int>("EFEM.LoadPort.HomeTimeout");
  28. Notify($"Start");
  29. return Runner.Start(Module, Name);
  30. }
  31. public RState Monitor()
  32. {
  33. Runner.Run(RoutineStep.Home, Home, CheckDevice, _timeout * 1000)
  34. .End(RoutineStep.End, NullFun, _delay_1s);
  35. return Runner.Status;
  36. }
  37. public bool Home()
  38. {
  39. Notify($"Start home {_lpModule.Name}");
  40. _lpModule.LPDevice.Home();
  41. return true;
  42. }
  43. bool CheckDevice()
  44. {
  45. if (_lpModule.LPDevice.IsError)
  46. return false;
  47. if (_lpModule.LPDevice.IsBusy)
  48. return false;
  49. return true;
  50. }
  51. public void Abort()
  52. {
  53. }
  54. }
  55. }