using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Aitex.Core.Common; using Aitex.Core.RT.Device; using Aitex.Core.RT.Device.Unit; using Aitex.Core.RT.Event; using Aitex.Core.RT.IOCore; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.Event; using MECF.Framework.Common.SubstrateTrackings; namespace EfemDualRT.Equipments.Devices { public class IOMonitorDevice : BaseDevice, IDevice { private R_TRIG bufferASmallWaferProtrusionAlarmTrig = new R_TRIG(); private R_TRIG bufferABigWaferProtrusionAlarmTrig = new R_TRIG(); private R_TRIG bufferBSmallWaferProtrusionAlarmTrig = new R_TRIG(); private R_TRIG bufferBBigWaferProtrusionAlarmTrig = new R_TRIG(); private R_TRIG waterFlowAlarmTrig = new R_TRIG(); private R_TRIG IonizerAlarmTrig = new R_TRIG(); private R_TRIG ffuAlarmTrig = new R_TRIG(); private List _pmList; public IOMonitorDevice(List pmList) : base(" IOMonitor", " IOMonitor", " IOMonitor", " IOMonitor") { _pmList = pmList; } public bool Initialize() { var WaterInletValve = DEVICE.GetDevice($"System.WaterInletValve"); WaterInletValve.TurnValve(WaterInletValve.GVIsDefaultOpen, out _); return true; } public void Monitor() { if (_pmList != null) _pmList.ForEach(pm => IO.DO[$"{pm}.DO_CDAPressureNormal"].Value = IO.DI["System.DI_CDAPressureSW"].Value); bufferASmallWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFA"].Value && IO.DI["System.DI_EFEMRBNotExtendBFA"].Value && IO.DI["System.DI_Buffer_ABigWaferProtrusion"].Value && WaferManager.Instance.GetWafers(ModuleName.LLA).Any(x => !x.IsEmpty) && (WaferManager.Instance.GetWafers(ModuleName.LLA).All(x => x.Size == WaferSize.WS12) || WaferManager.Instance.GetWafers(ModuleName.LLA).All(x => x.Size == WaferSize.WS6)); if (bufferASmallWaferProtrusionAlarmTrig.Q) { EV.PostAlarmLog("TM", $"Buffer_ABigWaferProtrusion Sensor is on!"); } bufferABigWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFA"].Value && IO.DI["System.DI_EFEMRBNotExtendBFA"].Value && IO.DI["System.DI_Buffer_ASmallWaferProtrusion"].Value && (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)); if (bufferABigWaferProtrusionAlarmTrig.Q) { EV.PostAlarmLog("TM", "Buffer_ASmallWaferProtrusion Sensor is on!"); } bufferBSmallWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFB"].Value && IO.DI["System.DI_EFEMRBNotExtendBFB"].Value && IO.DI["System.DI_Buffer_BBigWaferProtrusion"].Value && WaferManager.Instance.GetWafers(ModuleName.LLB).Any(x => !x.IsEmpty) && (WaferManager.Instance.GetWafers(ModuleName.LLB).All(x => x.Size == WaferSize.WS12) || WaferManager.Instance.GetWafers(ModuleName.LLB).All(x => x.Size == WaferSize.WS6)); if (bufferBSmallWaferProtrusionAlarmTrig.Q) { EV.PostAlarmLog("TM", "Buffer_BBigWaferProtrusion Sensor is on!"); } bufferBBigWaferProtrusionAlarmTrig.CLK = IO.DI["System.DI_TMRBNotExtendBFB"].Value && IO.DI["System.DI_EFEMRBNotExtendBFB"].Value && IO.DI["System.DI_Buffer_BSmallWaferProtrusion"].Value && (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)); if (bufferBBigWaferProtrusionAlarmTrig.Q) { EV.PostAlarmLog("System", "Buffer_BSmallWaferProtrusion Sensor is on!"); } waterFlowAlarmTrig.CLK = !IO.DI["System.DI_WaterFlowSW"].Value && !SC.GetValueOrDefault("EFEM.IgnoreWaterFlowError"); if (waterFlowAlarmTrig.Q) { EV.PostAlarmLog("System", "DI_WaterFlowSW Sensor is off !"); } IonizerAlarmTrig.CLK = !IO.DI["System.DI_INONormal"].Value && !SC.GetValueOrDefault("EFEM.IgnoreIonizerError"); if (IonizerAlarmTrig.Q) { EV.PostAlarmLog("System", "DI_INONormal Sensor is off !"); } ffuAlarmTrig.CLK = !IO.DI["System.DI_TMFFUNormal"].Value && !SC.GetValueOrDefault("EFEM.IgnoreFFUError"); if (ffuAlarmTrig.Q) { EV.PostAlarmLog("System", "DI_TMFFUNormal Sensor is off !"); } //if (IO.DI["PMA.DI_CHBOTSW"].Value == false) //{ // EV.PostAlarmLog("PMA", "DI_CHBOTSW Sensor is off !"); // IO.DO["PMA.DO_CHBHeaterOn"].Value = false; //} //if (IO.DI["PMA.DI_1_LEOTSW"].Value == false) //{ // EV.PostAlarmLog("PMA", "DI_1_LEOTSW Sensor is off !"); // IO.DO["PMA.DO_1_LEHeaterOn"].Value = false; //} //if (IO.DI["PMA.DI_2_LEOTSW"].Value == false) //{ // EV.PostAlarmLog("PMA", "DI_2_LEOTSW Sensor is off !"); // IO.DO["PMA.DO_2_LEHeaterOn"].Value = false; //} //if (IO.DI["PMB.DI_CHBOTSW"].Value == false) //{ // EV.PostAlarmLog("PMB", "DI_CHBOTSW Sensor is off !"); // IO.DO["PMB.DO_CHBHeaterOn"].Value = false; //} //if (IO.DI["PMB.DI_1_LEOTSW"].Value == false) //{ // EV.PostAlarmLog("PMB", "DI_1_LEOTSW Sensor is off !"); // IO.DO["PMB.DO_1_LEHeaterOn"].Value = false; //} //if (IO.DI["PMB.DI_2_LEOTSW"].Value == false) //{ // EV.PostAlarmLog("PMB", "DI_2_LEOTSW Sensor is off !"); // IO.DO["PMB.DO_2_LEHeaterOn"].Value = false; //} if (IO.DI["System.DI_TMBufferOTSW"].Value == false) { EV.PostAlarmLog("System", "DI_TMBufferOTSW Sensor is off !"); IO.DO["System.DO_BufferHeatOn"].Value = false; } if (IO.DI["System.DI_WaterLeakSW"].Value == false) { EV.PostAlarmLog("System", "DI_WaterLeakSW Sensor is off !"); IO.DO["System.DO_WaterInletValve"].Value = false; } } public void Reset() { } public void Terminate() { } } }