PM.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.DataCenter;
  7. using Aitex.Core.RT.Device;
  8. using Aitex.Core.RT.Event;
  9. using Aitex.Core.RT.Log;
  10. using Aitex.Core.RT.SCCore;
  11. using MECF.Framework.Common.DataCenter;
  12. using MECF.Framework.Common.DBCore;
  13. using MECF.Framework.Common.Equipment;
  14. using MECF.Framework.Common.Schedulers;
  15. using MECF.Framework.Common.SubstrateTrackings;
  16. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs;
  17. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs
  18. {
  19. public class PM : BaseDevice, IDevice, IPM
  20. {
  21. //如果true,robot采用extend, retract指令
  22. //如果false,robot采用pick,place指令
  23. public bool IsActiveHandoff { get; set; }
  24. //如果true,robot调用收尾PostTransfer
  25. public bool IsNeedPostTransfer { get; set; }
  26. public virtual double ChamberPressure { get; }
  27. public virtual bool IsError { get; }
  28. public virtual bool IsIdle { get; }
  29. public virtual bool IsProcessing { get; }
  30. public virtual bool IsInstalled { get; set; }
  31. public virtual double ForelinePressure { get; set; }
  32. protected readonly string _statNameWaferProcessed;
  33. protected readonly string _statNameWaferProcessedSincePreviousClean;
  34. public PM(string module) : base(module, module, module, module)
  35. {
  36. _statNameWaferProcessed = $"{module}.WaferProcessed";
  37. _statNameWaferProcessedSincePreviousClean = $"{module}.WaferProcessedSincePreviousClean";
  38. }
  39. public virtual bool Initialize()
  40. {
  41. DATA.Subscribe($"{Name}.IsAtm", () => { return CheckAtm(); });
  42. DATA.Subscribe($"{Name}.IsVacuum", () => { return CheckVacuum(); });
  43. DATA.Subscribe($"{Name}.ChamberPressure", () => ChamberPressure);
  44. IsInstalled = !SC.ContainsItem($"System.{Name}IsInstalled") || SC.GetValue<bool>($"System.{Name}IsInstalled");
  45. StatsDataManager.Instance.Subscribe(_statNameWaferProcessed, $"{Name} Wafer processed", 0);
  46. StatsDataManager.Instance.Subscribe(_statNameWaferProcessedSincePreviousClean, $"{Name} Wafer processed since previous clean", 0);
  47. return true;
  48. }
  49. public virtual bool CheckAtm()
  50. {
  51. return false;
  52. }
  53. public virtual bool CheckVacuum()
  54. {
  55. return false;
  56. }
  57. public virtual bool CheckChuckState()
  58. {
  59. return false;
  60. }
  61. public virtual bool CheckServoTransferPos()
  62. {
  63. return false;
  64. }
  65. public virtual bool CheckChuckPos()
  66. {
  67. return false;
  68. }
  69. public virtual bool CheckHandoff(EnumTransferType type)
  70. {
  71. return false;
  72. }
  73. public virtual bool CheckEnableTransfer(EnumTransferType type, out string reason)
  74. {
  75. reason = string.Empty;
  76. return false;
  77. }
  78. public virtual bool CheckEnableTransfer(EnumTransferType type, int slot, out string reason)
  79. {
  80. reason = string.Empty;
  81. return false;
  82. }
  83. public virtual bool CheckEnablePump(out string reason)
  84. {
  85. reason = "Undefined";
  86. return false;
  87. }
  88. public virtual void Monitor()
  89. {
  90. }
  91. public virtual void Terminate()
  92. {
  93. }
  94. public virtual void Reset()
  95. {
  96. }
  97. public virtual bool PrepareTransfer(EnumTransferType type, out string reason)
  98. {
  99. reason = string.Empty;
  100. return true;
  101. }
  102. public virtual bool Home()
  103. {
  104. return true;
  105. }
  106. public virtual void PostTransfer(EnumTransferType type)
  107. {
  108. }
  109. public virtual void TransferHandoff(EnumTransferType type)
  110. {
  111. }
  112. public virtual void StartProcess(string recipeName, string recipeContent, bool isClean)
  113. {
  114. }
  115. public virtual bool SetPumpOn(out string reason)
  116. {
  117. throw new NotImplementedException();
  118. }
  119. public virtual void OnProcessStart(string guid, string recipeName, bool isClean)
  120. {
  121. ProcessDataRecorder.Start(guid, recipeName,
  122. WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module), 0).InnerId.ToString(), Module);
  123. if (!isClean)
  124. {
  125. int value1 = StatsDataManager.Instance.Increase(_statNameWaferProcessed);
  126. int value2 = StatsDataManager.Instance.Increase(_statNameWaferProcessedSincePreviousClean);
  127. LOG.Write($"{_statNameWaferProcessed} counter increase 1 to {value1}");
  128. LOG.Write($"{_statNameWaferProcessedSincePreviousClean} counter increase 1 to {value2}");
  129. }
  130. LOG.Write($"{Module} start run recipe {recipeName}, guid {guid}, clean: {isClean}");
  131. }
  132. public virtual bool CheckPumpIsOn()
  133. {
  134. throw new NotImplementedException();
  135. }
  136. public virtual bool SetPumpOff(out string reason)
  137. {
  138. throw new NotImplementedException();
  139. }
  140. public virtual void OnProcessEnd(string guid, string recipeName, bool isClean, bool isSucceed)
  141. {
  142. if (isClean)
  143. {
  144. int value = StatsDataManager.Instance.Reset(_statNameWaferProcessedSincePreviousClean);
  145. LOG.Write($"{_statNameWaferProcessedSincePreviousClean} counter reset from {value}");
  146. }
  147. LOG.Write($"{Module} end run recipe {recipeName}, guid {guid}, clean: {isClean}, result {isSucceed}");
  148. ProcessDataRecorder.End(guid, isSucceed ? "Complete" : "Failed");
  149. }
  150. public virtual void OnProcessAbort(string guid, string recipeName, bool isClean, bool isSucceed)
  151. {
  152. if (isClean)
  153. {
  154. int value = StatsDataManager.Instance.Reset(_statNameWaferProcessedSincePreviousClean);
  155. LOG.Write($"{_statNameWaferProcessedSincePreviousClean} counter reset from {value}");
  156. }
  157. LOG.Write($"{Module} end run recipe {recipeName}, guid {guid}, clean: {isClean}, result {isSucceed}");
  158. ProcessDataRecorder.End(guid, "Abort" );
  159. }
  160. public virtual bool SetThrottleValvePosition(int slowPumpPosition, out string reason)
  161. {
  162. throw new NotImplementedException();
  163. }
  164. public virtual bool SetThrottleValvePressure(float pressure, out string reason)
  165. {
  166. throw new NotImplementedException();
  167. }
  168. public virtual bool CloseThrottleValve(out string reason)
  169. {
  170. throw new NotImplementedException();
  171. }
  172. public virtual bool SetFastPumpValve(bool isOpen, out string reason)
  173. {
  174. throw new NotImplementedException();
  175. }
  176. public virtual bool SetSlowPumpValve(bool isOpen, out string reason)
  177. {
  178. throw new NotImplementedException();
  179. }
  180. public virtual bool OpenThrottleValve(out string reason)
  181. {
  182. throw new NotImplementedException();
  183. }
  184. public virtual bool SetAllValves(bool isOpen, out string reason)
  185. {
  186. reason = string.Empty;
  187. return true;
  188. }
  189. public virtual bool CheckNoError(out List<string> reason)
  190. {
  191. reason = new List<string>();
  192. return true;
  193. }
  194. }
  195. }