IOMonitorDevice.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. public IOMonitorDevice() : base(" IOMonitor", " IOMonitor", " IOMonitor", " IOMonitor")
  28. {
  29. }
  30. public bool Initialize()
  31. {
  32. var WaterInletValve = DEVICE.GetDevice<IoValve>($"System.WaterInletValve");
  33. WaterInletValve.TurnValve(WaterInletValve.GVIsDefaultOpen, out _);
  34. return true;
  35. }
  36. public void Monitor()
  37. {
  38. IO.DO["PMA.DO_CDAPressureNormal"].Value = IO.DI["System.DI_CDAPressureSW"].Value;
  39. IO.DO["PMB.DO_CDAPressureNormal"].Value = IO.DI["System.DI_CDAPressureSW"].Value;
  40. bufferASmallWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFA"].Value
  41. && IO.DI["System.DI_EFEMRBNotExtendBFA"].Value
  42. && IO.DI["System.DI_Buffer_ASmallWaferProtrusion"].Value
  43. && WaferManager.Instance.GetWafers(ModuleName.LLA).Any(x => !x.IsEmpty)
  44. && WaferManager.Instance.GetWafers(ModuleName.LLA).All(x => x.Size != WaferSize.WS12);
  45. if (bufferASmallWaferProtrusionAlarmTrig.Q)
  46. {
  47. EV.PostAlarmLog("TM", "Buffer_ASmallWaferProtrusion Sensor is on!");
  48. }
  49. bufferABigWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFA"].Value
  50. && IO.DI["System.DI_EFEMRBNotExtendBFA"].Value
  51. && IO.DI["System.DI_Buffer_ABigWaferProtrusion"].Value
  52. && WaferManager.Instance.GetWafers(ModuleName.LLA).Any(x => !x.IsEmpty && x.Size == WaferSize.WS12);
  53. if (bufferABigWaferProtrusionAlarmTrig.Q)
  54. {
  55. EV.PostAlarmLog("TM", "Buffer_ABigWaferProtrusion Sensor is on!");
  56. }
  57. bufferBSmallWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFB"].Value
  58. && IO.DI["System.DI_EFEMRBNotExtendBFB"].Value
  59. && IO.DI["System.DI_Buffer_BSmallWaferProtrusion"].Value
  60. && WaferManager.Instance.GetWafers(ModuleName.LLB).Any(x => !x.IsEmpty)
  61. && WaferManager.Instance.GetWafers(ModuleName.LLB).All(x => x.Size != WaferSize.WS12);
  62. if (bufferBSmallWaferProtrusionAlarmTrig.Q)
  63. {
  64. EV.PostAlarmLog("TM", "Buffer_BSmallWaferProtrusion Sensor is on!");
  65. }
  66. bufferBBigWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFB"].Value
  67. && IO.DI["System.DI_EFEMRBNotExtendBFB"].Value
  68. && IO.DI["System.DI_Buffer_BBigWaferProtrusion"].Value
  69. && WaferManager.Instance.GetWafers(ModuleName.LLB).Any(x => !x.IsEmpty && x.Size == WaferSize.WS12);
  70. if (bufferBBigWaferProtrusionAlarmTrig.Q)
  71. {
  72. EV.PostAlarmLog("System", "Buffer_BBigWaferProtrusion Sensor is on!");
  73. }
  74. waterFlowAlarmTrig.CLK = !IO.DI["System.DI_WaterFlowSW"].Value && !SC.GetValueOrDefault<bool>("EFEM.IgnoreWaterFlowError");
  75. if (waterFlowAlarmTrig.Q)
  76. {
  77. EV.PostAlarmLog("System", "DI_WaterFlowSW Sensor is off !");
  78. }
  79. IonizerAlarmTrig.CLK = !IO.DI["System.DI_INONormal"].Value && !SC.GetValueOrDefault<bool>("EFEM.IgnoreIonizerError");
  80. if (IonizerAlarmTrig.Q)
  81. {
  82. EV.PostAlarmLog("System", "DI_INONormal Sensor is off !");
  83. }
  84. ffuAlarmTrig.CLK = !IO.DI["System.DI_TMFFUNormal"].Value && !SC.GetValueOrDefault<bool>("EFEM.IgnoreFFUError");
  85. if (ffuAlarmTrig.Q)
  86. {
  87. EV.PostAlarmLog("System", "DI_TMFFUNormal Sensor is off !");
  88. }
  89. }
  90. public void Reset()
  91. {
  92. }
  93. public void Terminate()
  94. {
  95. }
  96. }
  97. }