SchedulerBuffer.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using Aitex.Core.Util;
  2. using Aitex.Sorter.Common;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.SubstrateTrackings;
  5. using MECF.Framework.RT.ModuleLibrary.BufferModules;
  6. using MECF.Framework.RT.ModuleLibrary.SystemModules;
  7. namespace EfemDualSchedulerLib.Schedulers
  8. {
  9. public class SchedulerBuffer : SchedulerModule
  10. {
  11. public override bool IsAvailable
  12. {
  13. get { return _buffer.IsReady && _buffer.IsOnline && CheckTaskDone(); }
  14. }
  15. public override bool IsOnline
  16. {
  17. get { return _buffer.IsOnline; }
  18. }
  19. public override bool IsError
  20. {
  21. get { return _buffer.IsError; }
  22. }
  23. private BufferModuleBase _buffer = null;
  24. private DeviceTimer _timerCooling = new DeviceTimer();
  25. private float _paramCoolingTime = 0;
  26. public SchedulerBuffer(ModuleName module) : base(module.ToString())
  27. {
  28. _buffer = EquipmentManager.Modules[module] as BufferModuleBase;
  29. }
  30. public override bool IsReadyForPick(ModuleName robot, Hand hand, int slot)
  31. {
  32. if (hand == Hand.Blade1)
  33. return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot) &&
  34. WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot + 1);
  35. else if (hand == Hand.Blade2)
  36. return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot);
  37. else
  38. return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot) &&
  39. WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot + 1) &&
  40. WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot + 2);
  41. }
  42. public override bool IsReadyForPlace(ModuleName robot, Hand hand, int slot)
  43. {
  44. if (hand == Hand.Blade1)
  45. return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot) &&
  46. WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot + 1);
  47. else if (hand == Hand.Blade2)
  48. return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot);
  49. else
  50. return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot) &&
  51. WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot + 1) &&
  52. WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot + 2);
  53. }
  54. public override bool Cooling(int coolingTime)
  55. {
  56. _task = TaskType.Cooling;
  57. LogTaskStart(_task, $"Cooling {coolingTime} seconds" );
  58. _paramCoolingTime = coolingTime;
  59. _timerCooling.Start(_paramCoolingTime * 1000);
  60. return true;
  61. }
  62. public bool Monitor()
  63. {
  64. return true;
  65. }
  66. public bool CheckTaskDone()
  67. {
  68. bool ret = false;
  69. switch (_task)
  70. {
  71. case TaskType.None:
  72. ret = true;
  73. break;
  74. case TaskType.Cooling:
  75. ret = _timerCooling.IsTimeout() && /* _entity.CheckAcked(_token) &&*/ _buffer.IsReady;
  76. break;
  77. }
  78. if (ret && _task != TaskType.None)
  79. {
  80. LogTaskDone(_task, "");
  81. _task = TaskType.None;
  82. }
  83. return ret;
  84. }
  85. }
  86. }