LoadPortClampRoutine.cs 1.9 KB

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