VpwChamberDownRoutine.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using Aitex.Core.RT.Device;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using Aitex.Core.Util;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.Common.RecipeCenter;
  8. using MECF.Framework.Common.Routine;
  9. using MECF.Framework.Common.SubstrateTrackings;
  10. using PunkHPX8_Core;
  11. using PunkHPX8_RT.Devices.AXIS;
  12. using PunkHPX8_RT.Devices.VpwCell;
  13. using PunkHPX8_RT.Devices.VpwMain;
  14. using PunkHPX8_RT.Modules.VpwMain;
  15. using PunkHPX8_RT.Schedulers;
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. namespace PunkHPX8_RT.Modules.VpwCell
  22. {
  23. public class VpwChamberDownRoutine : RoutineBase, IRoutine
  24. {
  25. private enum PrepareStep
  26. {
  27. CheckPreCondition,
  28. ChamerDown,
  29. Delay,
  30. End
  31. }
  32. #region 内部变量
  33. /// <summary>
  34. /// Main设备
  35. /// </summary>
  36. private VpwMainDevice _mainDevice;
  37. #endregion
  38. /// <summary>
  39. /// 构造函数
  40. /// </summary>
  41. /// <param name="module"></param>
  42. public VpwChamberDownRoutine(string module) : base(module)
  43. {
  44. }
  45. /// <summary>
  46. /// 中止
  47. /// </summary>
  48. public void Abort()
  49. {
  50. Runner.Stop("Manual abort");
  51. }
  52. /// <summary>
  53. /// 监控
  54. /// </summary>
  55. /// <returns></returns>
  56. public RState Monitor()
  57. {
  58. Runner.Run(PrepareStep.CheckPreCondition, CheckPreCondition, _delay_1ms)
  59. .Run(PrepareStep.ChamerDown, ChamberDown, CheckChamberOpend,_delay_10s)
  60. .End(PrepareStep.End,NullFun,_delay_1ms);
  61. return Runner.Status;
  62. }
  63. /// <summary>
  64. /// 打开 Chamber
  65. /// </summary>
  66. /// <returns></returns>
  67. private bool ChamberDown()
  68. {
  69. return _mainDevice.ChamberDown();
  70. }
  71. /// <summary>
  72. /// 检验Chamber是否打开
  73. /// </summary>
  74. /// <returns></returns>
  75. private bool CheckChamberOpend()
  76. {
  77. return _mainDevice.CommonData.ChamberOpened && !_mainDevice.CommonData.ChamberClosed;
  78. }
  79. /// <summary>
  80. /// 检验前置条件
  81. /// </summary>
  82. /// <returns></returns>
  83. private bool CheckPreCondition()
  84. {
  85. string matcher = ModuleMatcherManager.Instance.GetMatcherByModule(Module);
  86. VpwCellEntity vpwCellEntity = Singleton<RouteManager>.Instance.GetModule<VpwCellEntity>(matcher);
  87. if (vpwCellEntity == null)
  88. {
  89. return true;
  90. }
  91. if (vpwCellEntity.IsDisable)
  92. {
  93. return true;
  94. }
  95. if (!vpwCellEntity.IsAuto)
  96. {
  97. return true;
  98. }
  99. bool result = vpwCellEntity.IsIdle;
  100. if (!result)
  101. {
  102. NotifyError(eEvent.ERR_PLATINGCELL, $"{vpwCellEntity.Module} is not idle,cannot chamber up", 0);
  103. }
  104. return result;
  105. }
  106. /// <summary>
  107. /// 启动
  108. /// </summary>
  109. /// <param name="objs"></param>
  110. /// <returns></returns>
  111. public RState Start(params object[] objs)
  112. {
  113. _mainDevice = DEVICE.GetDevice<VpwMainDevice>(ModuleName.VPWMain1.ToString());
  114. return Runner.Start(Module, $"{Module} chamber down");
  115. }
  116. }
  117. }