SchedulerBuffer.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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
  18. {
  19. return _buffer.IsOnline; }
  20. }
  21. public override bool IsError
  22. {
  23. get { return _buffer.IsError; }
  24. }
  25. private BufferModuleBase _buffer = null;
  26. private DeviceTimer _timerCooling = new DeviceTimer();
  27. private float _paramCoolingTime = 0;
  28. public SchedulerBuffer(ModuleName module) : base(module.ToString())
  29. {
  30. _buffer = EquipmentManager.Modules[module] as BufferModuleBase;
  31. }
  32. public override bool IsReadyForPick(ModuleName robot, Hand hand, int slot)
  33. {
  34. return WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(_module), slot);
  35. }
  36. public override bool IsReadyForPlace(ModuleName robot, Hand hand, int slot)
  37. {
  38. return WaferManager.Instance.CheckNoWafer(ModuleHelper.Converter(_module), slot);
  39. }
  40. public override bool Cooling(int coolingTime)
  41. {
  42. _task = TaskType.Cooling;
  43. LogTaskStart(_task, $"Cooling {coolingTime} seconds" );
  44. _paramCoolingTime = coolingTime;
  45. _timerCooling.Start(_paramCoolingTime * 1000);
  46. return true;
  47. }
  48. public bool Monitor()
  49. {
  50. return true;
  51. }
  52. public bool CheckTaskDone()
  53. {
  54. bool ret = false;
  55. switch (_task)
  56. {
  57. case TaskType.None:
  58. ret = true;
  59. break;
  60. case TaskType.Cooling:
  61. ret = _timerCooling.IsTimeout() && /* _entity.CheckAcked(_token) &&*/ _buffer.IsReady;
  62. break;
  63. }
  64. if (ret && _task != TaskType.None)
  65. {
  66. LogTaskDone(_task, "");
  67. _task = TaskType.None;
  68. }
  69. return ret;
  70. }
  71. }
  72. }