FutureEfem.cs 8.0 KB

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