IOMonitorDevice.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.Common;
  7. using Aitex.Core.RT.Device;
  8. using Aitex.Core.RT.Device.Unit;
  9. using Aitex.Core.RT.Event;
  10. using Aitex.Core.RT.IOCore;
  11. using Aitex.Core.RT.SCCore;
  12. using Aitex.Core.Util;
  13. using MECF.Framework.Common.Equipment;
  14. using MECF.Framework.Common.Event;
  15. using MECF.Framework.Common.SubstrateTrackings;
  16. namespace EfemDualRT.Equipments.Devices
  17. {
  18. public class IOMonitorDevice : BaseDevice, IDevice
  19. {
  20. private R_TRIG bufferASmallWaferProtrusionAlarmTrig = new R_TRIG();
  21. private R_TRIG bufferABigWaferProtrusionAlarmTrig = new R_TRIG();
  22. private R_TRIG bufferBSmallWaferProtrusionAlarmTrig = new R_TRIG();
  23. private R_TRIG bufferBBigWaferProtrusionAlarmTrig = new R_TRIG();
  24. private R_TRIG waterFlowAlarmTrig = new R_TRIG();
  25. private R_TRIG IonizerAlarmTrig = new R_TRIG();
  26. private R_TRIG ffuAlarmTrig = new R_TRIG();
  27. private List<ModuleName> _pmList;
  28. public IOMonitorDevice(List<ModuleName> pmList) : base(" IOMonitor", " IOMonitor", " IOMonitor", " IOMonitor")
  29. {
  30. _pmList = pmList;
  31. }
  32. public bool Initialize()
  33. {
  34. var WaterInletValve = DEVICE.GetDevice<IoValve>($"System.WaterInletValve");
  35. WaterInletValve.TurnValve(WaterInletValve.GVIsDefaultOpen, out _);
  36. return true;
  37. }
  38. public void Monitor()
  39. {
  40. if (_pmList != null)
  41. _pmList.ForEach(pm => IO.DO[$"{pm}.DO_CDAPressureNormal"].Value = IO.DI["System.DI_CDAPressureSW"].Value);
  42. bufferASmallWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFA"].Value
  43. && IO.DI["System.DI_EFEMRBNotExtendBFA"].Value
  44. && IO.DI["System.DI_Buffer_ABigWaferProtrusion"].Value
  45. && WaferManager.Instance.GetWafers(ModuleName.LLA).Any(x => !x.IsEmpty)
  46. && (WaferManager.Instance.GetWafers(ModuleName.LLA).All(x => x.Size == WaferSize.WS12) || WaferManager.Instance.GetWafers(ModuleName.LLA).All(x => x.Size == WaferSize.WS6));
  47. if (bufferASmallWaferProtrusionAlarmTrig.Q)
  48. {
  49. EV.PostAlarmLog("TM", $"Buffer_ABigWaferProtrusion Sensor is on!");
  50. }
  51. bufferABigWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFA"].Value
  52. && IO.DI["System.DI_EFEMRBNotExtendBFA"].Value
  53. && IO.DI["System.DI_Buffer_ASmallWaferProtrusion"].Value
  54. && (WaferManager.Instance.GetWafers(ModuleName.LLA).Any(x => !x.IsEmpty && x.Size == WaferSize.WS8) || WaferManager.Instance.GetWafers(ModuleName.LLA).Any(x => !x.IsEmpty && x.Size == WaferSize.WS4));
  55. if (bufferABigWaferProtrusionAlarmTrig.Q)
  56. {
  57. EV.PostAlarmLog("TM", "Buffer_ASmallWaferProtrusion Sensor is on!");
  58. }
  59. bufferBSmallWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFB"].Value
  60. && IO.DI["System.DI_EFEMRBNotExtendBFB"].Value
  61. && IO.DI["System.DI_Buffer_BBigWaferProtrusion"].Value
  62. && WaferManager.Instance.GetWafers(ModuleName.LLB).Any(x => !x.IsEmpty)
  63. && (WaferManager.Instance.GetWafers(ModuleName.LLB).All(x => x.Size == WaferSize.WS12) || WaferManager.Instance.GetWafers(ModuleName.LLB).All(x => x.Size == WaferSize.WS6));
  64. if (bufferBSmallWaferProtrusionAlarmTrig.Q)
  65. {
  66. EV.PostAlarmLog("TM", "Buffer_BBigWaferProtrusion Sensor is on!");
  67. }
  68. bufferBBigWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFB"].Value
  69. && IO.DI["System.DI_EFEMRBNotExtendBFB"].Value
  70. && IO.DI["System.DI_Buffer_BSmallWaferProtrusion"].Value
  71. && (WaferManager.Instance.GetWafers(ModuleName.LLB).Any(x => !x.IsEmpty && x.Size == WaferSize.WS8) || WaferManager.Instance.GetWafers(ModuleName.LLB).Any(x => !x.IsEmpty && x.Size == WaferSize.WS4));
  72. if (bufferBBigWaferProtrusionAlarmTrig.Q)
  73. {
  74. EV.PostAlarmLog("System", "Buffer_BSmallWaferProtrusion Sensor is on!");
  75. }
  76. waterFlowAlarmTrig.CLK = !IO.DI["System.DI_WaterFlowSW"].Value && !SC.GetValueOrDefault<bool>("EFEM.IgnoreWaterFlowError");
  77. if (waterFlowAlarmTrig.Q)
  78. {
  79. EV.PostAlarmLog("System", "DI_WaterFlowSW Sensor is off !");
  80. }
  81. IonizerAlarmTrig.CLK = !IO.DI["System.DI_INONormal"].Value && !SC.GetValueOrDefault<bool>("EFEM.IgnoreIonizerError");
  82. if (IonizerAlarmTrig.Q)
  83. {
  84. EV.PostAlarmLog("System", "DI_INONormal Sensor is off !");
  85. }
  86. ffuAlarmTrig.CLK = !IO.DI["System.DI_TMFFUNormal"].Value && !SC.GetValueOrDefault<bool>("EFEM.IgnoreFFUError");
  87. if (ffuAlarmTrig.Q)
  88. {
  89. EV.PostAlarmLog("System", "DI_TMFFUNormal Sensor is off !");
  90. }
  91. //if (IO.DI["PMA.DI_CHBOTSW"].Value == false)
  92. //{
  93. // EV.PostAlarmLog("PMA", "DI_CHBOTSW Sensor is off !");
  94. // IO.DO["PMA.DO_CHBHeaterOn"].Value = false;
  95. //}
  96. //if (IO.DI["PMA.DI_1_LEOTSW"].Value == false)
  97. //{
  98. // EV.PostAlarmLog("PMA", "DI_1_LEOTSW Sensor is off !");
  99. // IO.DO["PMA.DO_1_LEHeaterOn"].Value = false;
  100. //}
  101. //if (IO.DI["PMA.DI_2_LEOTSW"].Value == false)
  102. //{
  103. // EV.PostAlarmLog("PMA", "DI_2_LEOTSW Sensor is off !");
  104. // IO.DO["PMA.DO_2_LEHeaterOn"].Value = false;
  105. //}
  106. //if (IO.DI["PMB.DI_CHBOTSW"].Value == false)
  107. //{
  108. // EV.PostAlarmLog("PMB", "DI_CHBOTSW Sensor is off !");
  109. // IO.DO["PMB.DO_CHBHeaterOn"].Value = false;
  110. //}
  111. //if (IO.DI["PMB.DI_1_LEOTSW"].Value == false)
  112. //{
  113. // EV.PostAlarmLog("PMB", "DI_1_LEOTSW Sensor is off !");
  114. // IO.DO["PMB.DO_1_LEHeaterOn"].Value = false;
  115. //}
  116. //if (IO.DI["PMB.DI_2_LEOTSW"].Value == false)
  117. //{
  118. // EV.PostAlarmLog("PMB", "DI_2_LEOTSW Sensor is off !");
  119. // IO.DO["PMB.DO_2_LEHeaterOn"].Value = false;
  120. //}
  121. if (IO.DI["System.DI_TMBufferOTSW"].Value == false)
  122. {
  123. EV.PostAlarmLog("System", "DI_TMBufferOTSW Sensor is off !");
  124. IO.DO["System.DO_BufferHeatOn"].Value = false;
  125. }
  126. if (IO.DI["System.DI_WaterLeakSW"].Value == false)
  127. {
  128. EV.PostAlarmLog("System", "DI_WaterLeakSW Sensor is off !");
  129. IO.DO["System.DO_WaterInletValve"].Value = false;
  130. }
  131. }
  132. public void Reset()
  133. {
  134. }
  135. public void Terminate()
  136. {
  137. }
  138. }
  139. }