EfemExtendRoutine.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System;
  2. using Aitex.Core.RT.Routine;
  3. using Aitex.Core.RT.SCCore;
  4. using Aitex.Core.Util;
  5. using Aitex.Sorter.Common;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.Common.Schedulers;
  8. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
  9. using MECF.Framework.RT.EquipmentLibrary.LogicUnits;
  10. using MECF.Framework.RT.ModuleLibrary.PMModules;
  11. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  12. namespace JetEfemLib.Efems
  13. {
  14. class EfemExtendRoutine : ModuleRoutineBase, IStepRoutine
  15. {
  16. enum RoutineStep
  17. {
  18. WaitOpenSlitValveInterlock,
  19. OpenSlitValve,
  20. CheckBeforeExtend,
  21. Extend,
  22. PrepareTransfer,
  23. End,
  24. }
  25. private ModuleName _source;
  26. private int _sourceSlot;
  27. private Hand _hand;
  28. private int _timeout;
  29. //private TMSlitValveRoutine _openSlitValveRoutine = new TMSlitValveRoutine();
  30. private ITransferTarget _target;
  31. private EfemModule _robotModule;
  32. //private RobotPostionEnum postiontype;
  33. public EfemExtendRoutine(EfemModule robotModule) : base("Efem")
  34. {
  35. Name = "Extend";
  36. _robotModule = robotModule;
  37. }
  38. private string _type;
  39. public void Init(ModuleName source, int sourceSlot, string blade,string type)
  40. {
  41. _source = source;
  42. _sourceSlot = sourceSlot;
  43. _hand = (Hand)Enum.Parse(typeof(Hand), blade);
  44. _type = type;
  45. // _openSlitValveRoutine.Init(source.ToString(), true);
  46. }
  47. public void Init(ModuleName source, int sourceSlot, int blade)
  48. {
  49. Init(source, sourceSlot, blade);
  50. }
  51. public RState Start(params object[] objs)
  52. {
  53. Reset();
  54. _timeout = SC.GetValue<int>("EFEM.EfemRobot.PickTimeout");
  55. //if (ModuleHelper.IsLoadLock(_source))
  56. //{
  57. // LoadLock ll = DEVICE.GetDevice<LoadLock>(_source.ToString());
  58. // if (!ll.CheckEnableTransfer(EnumTransferType.Extend))
  59. // {
  60. // EV.PostWarningLog(Module, $"can not extend, {_source} not ready for transfer");
  61. // return Result.FAIL;
  62. // }
  63. //}
  64. if (ModuleHelper.IsPm(_source))
  65. {
  66. if (_type=="Place")
  67. {
  68. //postiontype = RobotPostionEnum.PlaceExtendUp;//_hand == Hand.Blade1 ? RobotPostionEnum.PlaceExtendDown : RobotPostionEnum.PlaceExtendUp;
  69. }
  70. else
  71. {
  72. //postiontype = RobotPostionEnum.PickExtendLow;//_hand == Hand.Blade1 ? RobotPostionEnum.PickExtendLow : RobotPostionEnum.PickExtendUp;
  73. }
  74. _target = EquipmentManager.Modules[_source] as ITransferTarget;
  75. //if (!pm.CheckReadyForTransfer(ModuleName.EfemRobot,_hand, _sourceSlot, EnumTransferType.Extend, out _))
  76. //{
  77. // EV.PostWarningLog(Module, $"can not extend, {_source} not ready for transfer");
  78. // return Result.FAIL;
  79. //}
  80. }
  81. Notify($"Start, extend to {_source} slot {_sourceSlot + 1} with {_hand}");
  82. return Runner.Start(_robotModule.Module, Name);
  83. }
  84. public void Abort()
  85. {
  86. Notify("Abort");
  87. }
  88. public RState Monitor()
  89. {
  90. Runner.Run(RoutineStep.Extend, RobotExtend, CheckRobotExtend, _timeout * 1000)
  91. .End(RoutineStep.End, NullFun, _delay_50ms);
  92. if(Runner.Status == RState.End)
  93. Notify($"Finish, extend to {_source} slot {_sourceSlot + 1} with {_hand}");
  94. return Runner.Status;
  95. }
  96. public bool RobotExtend()
  97. {
  98. Notify("robot execute extend command");
  99. //string reason;
  100. //if (!_robotModule.RobotDevice.GotoRE(chamber, hand, slot,postiontype, out reason))
  101. //{
  102. // Stop(reason);
  103. // return false;
  104. //}
  105. return true;
  106. }
  107. bool CheckRobotExtend()
  108. {
  109. return !_robotModule.RobotDevice.IsError && _robotModule.RobotDevice.IsIdle;
  110. }
  111. }
  112. }