LoadPortMapRoutine.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  7. namespace JetEfemLib.LPs
  8. {
  9. class LoadPortMapRoutine : ModuleRoutineBase, IStepRoutine
  10. {
  11. enum RoutineStep
  12. {
  13. Map,
  14. QueryStatus,
  15. End,
  16. }
  17. private int _timeout = 0;
  18. private LoadPortModule _lpModule;
  19. public LoadPortMapRoutine(LoadPortModule lpModule) : base(lpModule.Module)
  20. {
  21. _lpModule = lpModule;
  22. Name = "Map";
  23. }
  24. public bool Initalize()
  25. {
  26. return true;
  27. }
  28. public RState Start(params object[] objs)
  29. {
  30. Reset();
  31. _timeout = SC.GetValue<int>("EFEM.LoadPort.MotionTimeout");
  32. return Runner.Start(_lpModule.Module, Name);
  33. }
  34. public RState Monitor()
  35. {
  36. Runner.Run(RoutineStep.Map, Map, CheckDevice,_timeout *1000)
  37. .End(RoutineStep.QueryStatus, QueryStatus, CheckDevice,_timeout *1000);
  38. return Runner.Status;
  39. }
  40. bool Map()
  41. {
  42. Notify($"Start map {_lpModule.LPDevice.Name}");
  43. string reason;
  44. if (!_lpModule.LPDevice.QueryWaferMap(out reason))
  45. {
  46. Stop(reason);
  47. return false;
  48. }
  49. return true;
  50. }
  51. bool CheckDevice()
  52. {
  53. return !(_lpModule.LPDevice.Error || _lpModule.LPDevice.IsBusy);
  54. }
  55. bool QueryStatus()
  56. {
  57. Notify($"Start query status {_lpModule.LPDevice.Name}");
  58. string reason;
  59. if (!_lpModule.LPDevice.QueryState(out reason))
  60. {
  61. Stop(reason);
  62. return false;
  63. }
  64. return true;
  65. }
  66. public void Abort()
  67. {
  68. }
  69. }
  70. }