LoadFoupRoutine.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Routine;
  3. using Aitex.Sorter.Common;
  4. using athosRT.FSM;
  5. using athosRT.tool;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
  8. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. namespace athosRT.Modules.LPs
  15. {
  16. class LoadFoupRoutine : ModuleRoutineBase, FSM.IRoutine
  17. {
  18. int _timeout = -1;//超时计数器
  19. private LoadPortBaseDevice _device = null;
  20. public ModuleName _chamber { get; set; }
  21. public LoadFoupRoutine(ModuleName chamber) : base(chamber)
  22. {
  23. _chamber = chamber;
  24. _timeout = 30000;
  25. }
  26. public void Abort()
  27. {
  28. }
  29. public RState Monitor()
  30. {
  31. Runner.Run(LoadFoupStep.MapLoadFoup, MapLoadFoup, WaitLoadportMotion, _timeout)
  32. .End(LoadFoupStep.End, NullFun,500);
  33. return Runner.Status;
  34. }
  35. public RState Start(params object[] objs)
  36. {
  37. Reset();
  38. _device = DEVICE.GetDevice<LoadPortBaseDevice>(_chamber.ToString());
  39. if (_device.DockState == FoupDockState.Docked) {
  40. return RState.Failed;
  41. }
  42. return Runner.Start(Module,"Start LoadFoup");
  43. }
  44. protected bool MapLoadFoup() {
  45. string reason = string.Empty;
  46. //LogObject.Info(GetName.GetCurrentName(),"正在执行Map Load Foup");
  47. return this._device.Load(out reason);
  48. }
  49. protected bool CheckMapLoadFoup() {
  50. string reason = string.Empty;
  51. //LogObject.Info(GetName.GetCurrentName(), "正在检查Map Load Foup");
  52. return this._device.Load(out reason);
  53. }
  54. protected bool WaitLoadportMotion() {
  55. //LogObject.Info(GetName.GetCurrentName(), "正在等待LoadportMotion");
  56. if (_device.CurrentState == LoadPortStateEnum.Error)
  57. return false;
  58. if (!_device.IsReady())
  59. return false;
  60. //LogObject.Info(GetName.GetCurrentName(), "等待Load port Motion完毕");
  61. return true;
  62. }
  63. enum LoadFoupStep {
  64. MapLoadFoup,
  65. WaitLoadportMotion,
  66. End
  67. }
  68. }
  69. }