JetEfem.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System;
  2. using System.Xml;
  3. using Aitex.Core.Common;
  4. using Aitex.Core.RT.DataCenter;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.OperationCenter;
  7. using Aitex.Core.RT.Routine;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.Event;
  10. using MECF.Framework.Common.SubstrateTrackings;
  11. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Efems.Rorzes;
  12. namespace JetEfemLib
  13. {
  14. /// <summary>
  15. /// Future EFEM compatible with Rorze communication protocol
  16. /// </summary>
  17. public class JetEfem : RorzeEfem
  18. {
  19. public AlarmEventItem FfuAlarm { get; set; }
  20. public AlarmEventItem IonizerAlarm { get; set; }
  21. public AlarmEventItem AirErrorForRobot { get; set; }
  22. //public AlarmEventItem AirErrorForChamber { get; set; }
  23. public AlarmEventItem IsMaintain { get; set; }
  24. public AlarmEventItem DoorOpen { get; set; }
  25. public AlarmEventItem EmoAlarm { get; set; }
  26. public AlarmEventItem WaterLeakWarning { get; set; }
  27. private bool _stateFfuAlarm;
  28. private bool _stateIonizerAlarm;
  29. private bool _stateAirErrorForRobot;
  30. private bool _stateIsMaintain;
  31. private bool _stateDoorOpen;
  32. private bool _stateEmoAlarm;
  33. private bool _stateWaterLeakWarning;
  34. public JetEfem(string module, XmlElement node, string ioModule = "") : base("System", "EFEM", "")
  35. {
  36. }
  37. public JetEfem( ) : base("System", "EFEM", "")
  38. {
  39. }
  40. public override bool Initialize()
  41. {
  42. FfuAlarm = SubscribeAlarm($"{Module}.{Name}.FFUAlarm", "EFEM FFU Error", () => !_stateFfuAlarm, EventLevel.Warning);
  43. IonizerAlarm = SubscribeAlarm($"{Module}.{Name}.IonizerAlarm", "EFEM Ionizer Error", () => !_stateIonizerAlarm, EventLevel.Warning);
  44. AirErrorForRobot = SubscribeAlarm($"{Module}.{Name}.AirErrorForRobot", "EFEM Robot Air Error", () => !_stateAirErrorForRobot, EventLevel.Warning);
  45. //AirErrorForChamber = SubscribeAlarm($"{Module}.{Name}.AirErrorForChamber", "EFEM Chamber Air Error", () => !_stateAirErrorForChamber, EventLevel.Warning);
  46. IsMaintain = SubscribeAlarm($"{Module}.{Name}.IsMaintain", "EFEM in Maintenance Mode, switch to online and turn key to auto", () => !_stateIsMaintain, EventLevel.Alarm);
  47. DoorOpen = SubscribeAlarm($"{Module}.{Name}.DoorOpen", "EFEM door open", () => !_stateDoorOpen, EventLevel.Alarm);
  48. EmoAlarm = SubscribeAlarm($"{Module}.{Name}.EmoAlarm", "EFEM EMO error", () => !_stateEmoAlarm, EventLevel.Alarm);
  49. WaterLeakWarning = SubscribeAlarm($"{Module}.{Name}.WaterLeakWarning", "EFEM Water Leak Warning", () => !_stateFfuAlarm, EventLevel.Alarm);
  50. DATA.Subscribe($"{Module}.{Name}.FFUAlarm", () => _stateFfuAlarm);
  51. DATA.Subscribe($"{Module}.{Name}.IonizerAlarm", () => _stateIonizerAlarm);
  52. DATA.Subscribe($"{Module}.{Name}.AirErrorForRobot", () => _stateAirErrorForRobot);
  53. //DATA.Subscribe($"{Module}.{Name}.AirErrorForChamber", () => _stateAirErrorForChamber);
  54. DATA.Subscribe($"{Module}.{Name}.IsMaintain", () => _stateIsMaintain);
  55. DATA.Subscribe($"{Module}.{Name}.DoorOpen", () => _stateDoorOpen);
  56. DATA.Subscribe($"{Module}.{Name}.EmoAlarm", () => _stateEmoAlarm);
  57. DATA.Subscribe($"{Module}.{Name}.WaterLeakWarning", () => _stateWaterLeakWarning);
  58. OP.Subscribe("System.SetWaferSize", (string cmd, object[] args) =>
  59. {
  60. string module = (string)args[0];
  61. int slot = (int)args[1];
  62. string size = (string)args[2];
  63. switch (size)
  64. {
  65. case "4":
  66. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), slot, WaferSize.WS4);
  67. break;
  68. case "6":
  69. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), slot, WaferSize.WS6);
  70. break;
  71. case "8":
  72. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), slot, WaferSize.WS8);
  73. break;
  74. case "12":
  75. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), slot, WaferSize.WS12);
  76. break;
  77. default:
  78. EV.PostWarningLog("System", $"wafer size {size} not valid");
  79. break;
  80. }
  81. return true;
  82. });
  83. return base.Initialize();
  84. }
  85. public override void NoteStateEvent(ModuleName module, string data1, string data2)
  86. {
  87. if (module == ModuleName.System)
  88. {
  89. uint result1 = Convert.ToUInt32(data1, 16);
  90. uint result2 = Convert.ToUInt32(data2, 16);
  91. _stateAirErrorForRobot = !((result1 & 0x00000004u) == 0x00000004u);
  92. if (_stateAirErrorForRobot)
  93. AirErrorForRobot.Set();
  94. _stateWaterLeakWarning = !((result1 & 0x00000020u) == 0x00000020u);
  95. if (_stateWaterLeakWarning)
  96. WaterLeakWarning.Set();
  97. _stateIonizerAlarm = !((result1 & 0x00000400u) == 0x00000400u);
  98. if (_stateIonizerAlarm)
  99. IonizerAlarm.Set();
  100. _stateFfuAlarm = !((result1 & 0x00000800u) == 0x00000800u);
  101. if (_stateFfuAlarm)
  102. FfuAlarm.Set();
  103. //_stateAirErrorForChamber = !((result1 & 0x00000008u) == 0x00000008u);
  104. //if (_stateAirErrorForChamber)
  105. // AirErrorForChamber.Set();
  106. _stateIsMaintain = !((result1 & 0x00002000u) == 0x00002000u);
  107. if (_stateIsMaintain)
  108. IsMaintain.Set();
  109. _stateDoorOpen = !((result1 & 0x000080000u) == 0x000080000u);
  110. if (_stateDoorOpen)
  111. DoorOpen.Set();
  112. //_stateEmoAlarm = (result1 & 0x00000040u) == 0x00000040u;
  113. //if (_stateEmoAlarm)
  114. // EmoAlarm.Set();
  115. return;
  116. }
  117. base.NoteStateEvent(module, data1, data2);
  118. }
  119. public override void NoteWaferTrack(string waferInfo)
  120. {
  121. if (waferInfo[0] == '1' && !WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 1))
  122. {
  123. WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 1, WaferStatus.Normal);
  124. }
  125. else if (waferInfo[0] == '0' && !WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, 1))
  126. {
  127. WaferManager.Instance.DeleteWafer(ModuleName.EfemRobot, 1);
  128. }
  129. if (waferInfo[1] == '1' && !WaferManager.Instance.CheckHasWafer(ModuleName.EfemRobot, 0))
  130. {
  131. WaferManager.Instance.CreateWafer(ModuleName.EfemRobot, 0, WaferStatus.Normal);
  132. }
  133. else if (waferInfo[1] == '0' && !WaferManager.Instance.CheckNoWafer(ModuleName.EfemRobot, 0))
  134. {
  135. WaferManager.Instance.DeleteWafer(ModuleName.EfemRobot, 0);
  136. }
  137. if (waferInfo[2] == '1' && !WaferManager.Instance.CheckHasWafer(ModuleName.Aligner, 0))
  138. {
  139. WaferManager.Instance.CreateWafer(ModuleName.Aligner, 0, WaferStatus.Normal);
  140. }
  141. else if (waferInfo[2] == '0' && !WaferManager.Instance.CheckNoWafer(ModuleName.Aligner, 0))
  142. {
  143. WaferManager.Instance.DeleteWafer(ModuleName.Aligner, 0);
  144. }
  145. }
  146. public override void Monitor()
  147. {
  148. base.Monitor();
  149. }
  150. public override void Reset()
  151. {
  152. FfuAlarm.Reset();
  153. IonizerAlarm.Reset();
  154. AirErrorForRobot.Reset();
  155. //AirErrorForChamber.Reset();
  156. IsMaintain.Reset();
  157. DoorOpen.Reset();
  158. EmoAlarm.Reset();
  159. base.Reset();
  160. }
  161. public void ResetData()
  162. {
  163. Reset();
  164. }
  165. public bool MapCarrier(string lp, int thicknessIndex, out string slotMap, out string reason)
  166. {
  167. slotMap = string.Empty;
  168. if (!Connection.IsConnected)
  169. {
  170. reason = "not connected";
  171. return false;
  172. }
  173. return Connection.Execute(new RorzeEfemHandlerWafsh(this, ModuleHelper.Converter(lp), true, thicknessIndex), out reason);
  174. }
  175. }
  176. }