using Aitex.Core.Common.DeviceData; using Aitex.Core.RT.Device; using Aitex.Core.RT.Device.Unit; using Aitex.Core.Util; using Aitex.Core.RT.SCCore; using Aitex.Core.RT.Log; using Aitex.Sorter.Common; using MECF.Framework.Common.Device.Bases; using MECF.Framework.Common.Equipment; using System; using System.Collections.Generic; using Venus_Core; using Venus_RT.Modules; using Venus_RT.Modules.PMs; using Venus_RT.Devices.IODevices; using Venus_RT.Devices.EPD; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.OperationCenter; using MECF.Framework.Common.SubstrateTrackings; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.TMs; namespace Venus_RT.Devices { class JetTM : TM { private readonly IoLid _TMLid; private readonly IoLid _LLALid; private readonly IoLid _LLBLid; private readonly IoCylinder _LLATSlitDoor; private readonly IoCylinder _LLBTSlitDoor; private readonly IoCylinder _LLAESlitDoor; private readonly IoCylinder _LLBESlitDoor; private readonly IoValve _TMN2Valve; private readonly IoValve _TMSoftPumpValve; private readonly IoValve _TMFastPumpValve; private readonly IoValve _TMPurgeValve; private readonly IoValve _TMVentValve; //private readonly IoValve _TMSoftVentValve; //private readonly IoValve _TMFastVentValve; private readonly IoValve _LLASoftPumpValve; private readonly IoValve _LLAFastPumpValve; private readonly IoValve _LLAPurgeValve; private readonly IoValve _LLAVentValve; private readonly IoValve _LLASoftVentValve; private readonly IoValve _LLAFastVentValve; private readonly IoValve _LLBSoftVentValve; private readonly IoValve _LLBFastVentValve; private readonly IoValve _LLBSoftPumpValve; private readonly IoValve _LLBFastPumpValve; private readonly IoValve _LLBPurgeValve; private readonly IoValve _LLBVentValve; private readonly IoValve _WaferRelayValve; private readonly IoValve _TMVacAtmMode; private readonly IoSensor _TMPowerOn; private readonly IoSensor _TMInSafty; private readonly IoSensor _WaferLeakSensor; private readonly IoSensor _EFEMSideDoorClosed; private readonly IoSensor _TMPCWFlowSwitch; private readonly IoSensor _LLAPCWFlowSwitch; private readonly IoSensor _LLBPCWFlowSwitch; private readonly IoSensor _TMLidClosed; private readonly IoSensor _CDAPressureSwitch; private readonly IoSensor _VaccumPressureSwitch; private readonly IoSensor _N2PressureSwitch; private readonly IoSensor _TMRobotNotExtendPMA; private readonly IoSensor _TMRobotNotExtendPMB; private readonly IoSensor _TMRobotNotExtendPMC; private readonly IoSensor _TMRobotNotExtendPMD; private readonly IoSensor _TMRobotNotExtendLLA; private readonly IoSensor _TMRobotNotExtendLLB; private readonly IoSensor _EfemRobotNotExtendLLA; private readonly IoSensor _EfemRobotNotExtendLLB; private readonly IoSensor _TMVacSwitch; private readonly IoSensor _LLAVacSwitch; private readonly IoSensor _LLBVacSwitch; private readonly IoSensor _TMATMSwitch; private readonly IoSensor _LLAATMSwitch; private readonly IoSensor _LLBATMSwitch; private readonly IoSwitch _LLAWaferSizeCheck; private readonly IoSwitch _LLBWaferSizeCheck; private readonly IoSwitch _PMAWaferSizeCheck; private readonly IoSwitch _PMBWaferSizeCheck; private readonly IoSwitch _PMCWaferSizeCheck; private readonly IoSwitch _PMDWaferSizeCheck; private readonly PumpBase _TMPump; private readonly PumpBase _LLPump; private readonly IoTMPressureCtrl _presureCtrl; private readonly bool _isATMMode; public bool TMLidClosed => _TMLid.OFFFeedback; public bool LLALidClosed => _LLALid.OFFFeedback; public bool LLBLidClosed => _LLBLid.OFFFeedback; public bool IsLLASlitDoorClosed => _LLATSlitDoor.State == CylinderState.Close; public bool IsLLASlitDoorOpen => _LLATSlitDoor.State == CylinderState.Open; public bool IsLLAESlitDoorClosed => _LLAESlitDoor.State == CylinderState.Close; public bool IsLLAESlitDoorOpen => _LLAESlitDoor.State == CylinderState.Open; public bool IsLLBSlitDoorClosed => _LLBTSlitDoor.State == CylinderState.Close; public bool IsLLBSlitDoorOpen => _LLBTSlitDoor.State == CylinderState.Open; public bool IsLLBESlitDoorClosed => _LLBESlitDoor.State == CylinderState.Close; public bool IsLLBESlitDoorOpen => _LLBESlitDoor.State == CylinderState.Open; public bool IsTMVac => _TMVacSwitch.Value; public bool IsLLAVac => _LLAVacSwitch.Value; public bool IsLLBVac => _LLBVacSwitch.Value; public bool IsTMATM => _TMATMSwitch.Value; public bool IsLLAATM => _LLAATMSwitch.Value; public bool IsLLBATM => _LLBATMSwitch.Value; public bool IsTMPowerOn => _TMPowerOn.Value; public bool IsTMInSafty => _TMInSafty.Value; public bool IsLLAFastPumpOpen => _LLAFastPumpValve.Status; public bool IsLLASoftPumpOpen => _LLASoftPumpValve.Status; public bool IsLLBFastPumpOpen => _LLBFastPumpValve.Status; public bool IsLLBSoftPumpOpen => _LLBSoftPumpValve.Status; public bool IsLLAVentValveOpen => _LLAVentValve.Status; public bool IsLLAPurgeValveOpen => _LLAPurgeValve.Status; public bool IsLLBVentValveOpen => _LLBVentValve.Status; public bool IsLLBPurgeValveOpen => _LLBPurgeValve.Status; public bool IsTMVentValveOpen => _TMVentValve.Status; // public bool IsTMFastVentValveOpen => _TMFastVentValve.Status; public bool IsTMPurgeValveOpen => _TMPurgeValve.Status; public bool IsTMFastPumpOpen => _TMFastPumpValve.Status; public bool IsTMSoftPumpOpen => _TMSoftPumpValve.Status; public bool TMRobotNotExtendToPMA => _TMRobotNotExtendPMA.Value; public bool TMRobotNotExtendToPMB => _TMRobotNotExtendPMB.Value; public bool TMRobotNotExtendToPMC => _TMRobotNotExtendPMC.Value; public bool TMRobotNotExtendToPMD => _TMRobotNotExtendPMD.Value; public bool TMRobotNotExtendToLLA => _TMRobotNotExtendLLA.Value; public bool TMRobotNotExtendToLLB => _TMRobotNotExtendLLB.Value; public bool EfemRobotNotExtendToLLA => _EfemRobotNotExtendLLA.Value; public bool EfemRobotNotExtendToLLB => _EfemRobotNotExtendLLB.Value; public double TMPressure => _presureCtrl.TMPressureGauge.Value; public double LLAPressure => _presureCtrl.LLAPressureGauge.Value; public double LLBPressure => _presureCtrl.LLBPressureGauge.Value; public double TMForelinePressure => _presureCtrl.MFForelineGauge.Value; public double LoadlockForelinePressure => _presureCtrl.LLForelineGauge.Value; public bool? TMPumpIsRunning => _TMPump?.IsRunning; public bool? LLPumpIsRunning => _LLPump?.IsRunning; public JetTM() : base("TM") { _TMLid = DEVICE.GetDevice($"TM.{VenusDevice.TMLid}"); _LLALid = DEVICE.GetDevice($"TM.{VenusDevice.LLALid}"); _LLBLid = DEVICE.GetDevice($"TM.{VenusDevice.LLBLid}"); _LLATSlitDoor = DEVICE.GetDevice($"TM.{VenusDevice.LLATSlitDoor}"); _LLBTSlitDoor = DEVICE.GetDevice($"TM.{VenusDevice.LLBTSlitDoor}"); _LLAESlitDoor = DEVICE.GetDevice($"TM.{VenusDevice.LLAESlitDoor}"); _LLBESlitDoor = DEVICE.GetDevice($"TM.{VenusDevice.LLBESlitDoor}"); _TMN2Valve = DEVICE.GetDevice($"TM.{VenusDevice.TMValveN2}"); _TMSoftPumpValve = DEVICE.GetDevice($"TM.{VenusDevice.TMSoftPumpValve}"); _TMFastPumpValve = DEVICE.GetDevice($"TM.{VenusDevice.TMFastPumpValve}"); _TMPurgeValve = DEVICE.GetDevice($"TM.{VenusDevice.TMPurgeValve}"); _TMVentValve = DEVICE.GetDevice($"TM.{VenusDevice.TMVentValve}"); //_TMSoftVentValve = DEVICE.GetDevice($"TM.{VenusDevice.TMSoftVentValve}"); //_TMFastVentValve = DEVICE.GetDevice($"TM.{VenusDevice.TMFastVentValve}"); _LLASoftPumpValve = DEVICE.GetDevice($"TM.{VenusDevice.LLASoftPumpValve}"); _LLAFastPumpValve = DEVICE.GetDevice($"TM.{VenusDevice.LLAFastPumpValve}"); _LLAPurgeValve = DEVICE.GetDevice($"TM.{VenusDevice.LLAPurgeValve}"); _LLAVentValve = DEVICE.GetDevice($"TM.{VenusDevice.LLAVentValve}"); _LLASoftVentValve = DEVICE.GetDevice($"TM.{VenusDevice.LLASoftVentValve}"); _LLAFastVentValve = DEVICE.GetDevice($"TM.{VenusDevice.LLAFastVentValve}"); _LLBSoftVentValve = DEVICE.GetDevice($"TM.{VenusDevice.LLBSoftVentValve}"); _LLBFastVentValve = DEVICE.GetDevice($"TM.{VenusDevice.LLBFastVentValve}"); _TMVacAtmMode = DEVICE.GetDevice($"TM.{VenusDevice.TMVacAtmMode}"); _LLBSoftPumpValve = DEVICE.GetDevice($"TM.{VenusDevice.LLBSoftPumpValve}"); _LLBFastPumpValve = DEVICE.GetDevice($"TM.{VenusDevice.LLBFastPumpValve}"); _LLBPurgeValve = DEVICE.GetDevice($"TM.{VenusDevice.LLBPurgeValve}"); _LLBVentValve = DEVICE.GetDevice($"TM.{VenusDevice.LLBVentValve}"); _WaferRelayValve = DEVICE.GetDevice($"TM.{VenusDevice.ValveWaterRelay}"); _TMPowerOn = DEVICE.GetDevice($"TM.{VenusDevice.TMPowerOn}"); _TMInSafty = DEVICE.GetDevice($"TM.{VenusDevice.TMInSafty}"); _WaferLeakSensor = DEVICE.GetDevice($"TM.{VenusDevice.WaferLeakSensor}"); _EFEMSideDoorClosed = DEVICE.GetDevice($"TM.{VenusDevice.EFEMSideDoorClosed}"); _TMPCWFlowSwitch = DEVICE.GetDevice($"TM.{VenusDevice.TMPCWFlowSwitch}"); _LLAPCWFlowSwitch = DEVICE.GetDevice($"TM.{VenusDevice.LLAPCWFlowSwitch}"); _LLBPCWFlowSwitch = DEVICE.GetDevice($"TM.{VenusDevice.LLBPCWFlowSwitch}"); _TMLidClosed = DEVICE.GetDevice($"TM.{VenusDevice.TMLidClosed}"); _CDAPressureSwitch = DEVICE.GetDevice($"TM.{VenusDevice.CDAPressureSwitch}"); _VaccumPressureSwitch = DEVICE.GetDevice($"TM.{VenusDevice.VaccumPressureSwitch}"); _N2PressureSwitch = DEVICE.GetDevice($"TM.{VenusDevice.N2PressureSwitch}"); _TMRobotNotExtendPMA = DEVICE.GetDevice($"TM.{VenusDevice.TMRobotNotExtendPMA}"); _TMRobotNotExtendPMB = DEVICE.GetDevice($"TM.{VenusDevice.TMRobotNotExtendPMB}"); _TMRobotNotExtendPMC = DEVICE.GetDevice($"TM.{VenusDevice.TMRobotNotExtendPMC}"); _TMRobotNotExtendPMD = DEVICE.GetDevice($"TM.{VenusDevice.TMRobotNotExtendPMD}"); _TMRobotNotExtendLLA = DEVICE.GetDevice($"TM.{VenusDevice.TMRobotNotExtendLLA}"); _TMRobotNotExtendLLB = DEVICE.GetDevice($"TM.{VenusDevice.TMRobotNotExtendLLB}"); _EfemRobotNotExtendLLA = DEVICE.GetDevice($"TM.{VenusDevice.EfemRobotNotExtendLLA}"); _EfemRobotNotExtendLLB = DEVICE.GetDevice($"TM.{VenusDevice.EfemRobotNotExtendLLB}"); _TMVacSwitch = DEVICE.GetDevice($"TM.{VenusDevice.TMVacSwitch}"); _LLAVacSwitch = DEVICE.GetDevice($"TM.{VenusDevice.LLAVacSwitch}"); _LLBVacSwitch = DEVICE.GetDevice($"TM.{VenusDevice.LLBVacSwitch}"); _TMATMSwitch = DEVICE.GetDevice($"TM.{VenusDevice.TMATMSwitch}"); _LLAATMSwitch = DEVICE.GetDevice($"TM.{VenusDevice.LLAATMSwitch}"); _LLBATMSwitch = DEVICE.GetDevice($"TM.{VenusDevice.LLBATMSwitch}"); _LLAWaferSizeCheck = DEVICE.GetDevice($"TM.{VenusDevice.LLAWaferSizeCheckSwitch}"); _LLBWaferSizeCheck = DEVICE.GetDevice($"TM.{VenusDevice.LLBWaferSizeCheckSwitch}"); _PMAWaferSizeCheck = DEVICE.GetDevice($"TM.{VenusDevice.PMAWaferSizeCheckSwitch}"); _PMBWaferSizeCheck = DEVICE.GetDevice($"TM.{VenusDevice.PMBWaferSizeCheckSwitch}"); _PMCWaferSizeCheck = DEVICE.GetDevice($"TM.{VenusDevice.PMCWaferSizeCheckSwitch}"); _PMDWaferSizeCheck = DEVICE.GetDevice($"TM.{VenusDevice.PMDWaferSizeCheckSwitch}"); _presureCtrl = DEVICE.GetDevice($"TM.{VenusDevice.TMPressureCtrl}"); if (SC.GetValue($"TM.DryPump.CommunicationType") == (int)CommunicationType.RS232) { if (SC.GetValue($"TM.DryPump.MFG") == (int)DryPumpMFG.SKY) { _TMPump = DEVICE.GetDevice($"TM.{VenusDevice.MainPump}"); } else if (SC.GetValue($"TM.DryPump.MFG") == (int)DryPumpMFG.Edwards) { _TMPump = DEVICE.GetDevice($"TM.{VenusDevice.MainPump}"); } } if (SC.GetValue($"LLA.DryPump.CommunicationType") == (int)CommunicationType.RS232) { if (SC.GetValue($"LLA.DryPump.MFG") == (int)DryPumpMFG.SKY) { _LLPump = DEVICE.GetDevice($"LLA.{VenusDevice.MainPump}"); } else if (SC.GetValue($"LLA.DryPump.MFG") == (int)DryPumpMFG.Edwards) { _LLPump = DEVICE.GetDevice($"LLA.{VenusDevice.MainPump}"); } } //_LLPump = DEVICE.GetDevice($"LLA.{VenusDevice.MainPump}"); //_TMPump = DEVICE.GetDevice($"TM.{VenusDevice.MainPump}"); DATA.Subscribe("TM.PumpIsRunning", () => TMPumpIsRunning); OP.Subscribe("TM.ControlPump", (cmd, args) => { _TMPump.SetPumpOnOff((bool)args[0]); return true; }); DATA.Subscribe("LL.PumpIsRunning", () => LLPumpIsRunning); OP.Subscribe("LL.ControlPump", (cmd, args) => { _LLPump.SetPumpOnOff((bool)args[0]); return true; }); OP.Subscribe("TM.SetChamberPressure", (cmd, args) => { _presureCtrl.SetTMPressure((int)(args[0])); return true; }); _isATMMode = SC.GetValue("System.IsATMMode"); _TMVacAtmMode.TurnValve(_isATMMode, out string _); } public override void Monitor() { _WaferRelayValve.TurnValve(_WaferLeakSensor.Value, out string _); } public void TurnSoftPumpValve(ModuleName mod, bool bOn) { switch(mod) { case ModuleName.TM: _TMSoftPumpValve.TurnValve(bOn, out string _); break; case ModuleName.LLA: _LLASoftPumpValve.TurnValve(bOn, out string _); break; case ModuleName.LLB: _LLBSoftPumpValve.TurnValve(bOn, out string _); break; } } public void TurnFastPumpValve(ModuleName mod, bool bOn) { switch(mod) { case ModuleName.TM: _TMFastPumpValve.TurnValve(bOn, out string _); break; case ModuleName.LLA: _LLAFastPumpValve.TurnValve(bOn, out string _); break; case ModuleName.LLB: _LLBFastPumpValve.TurnValve(bOn, out string _); break; } } public void TurnVentValve(ModuleName mod, bool bOn) { _TMN2Valve.TurnValve(bOn, out string _); switch (mod) { case ModuleName.TM: _TMVentValve.TurnValve(bOn, out string _); break; case ModuleName.LLA: _LLAVentValve.TurnValve(bOn, out string _); break; case ModuleName.LLB: _LLBVentValve.TurnValve(bOn, out string _); break; } } public void TurnPurgeValve(ModuleName mod, bool bOn) { switch(mod) { case ModuleName.TM: _TMPurgeValve.TurnValve(bOn, out string _); break; case ModuleName.LLA: _LLAPurgeValve.TurnValve(bOn, out string _); break; case ModuleName.LLB: _LLBPurgeValve.TurnValve(bOn, out string _); break; } } public void TurnN2Valve(bool bOn) { _TMN2Valve.TurnValve(bOn, out string _); } public void CloseModuleAllValves(ModuleName mod) { TurnFastPumpValve(mod, false); TurnSoftPumpValve(mod, false); TurnVentValve(mod, false); TurnPurgeValve(mod, false); if (mod == ModuleName.TM) TurnN2Valve(false); } public double GetModulePressure(ModuleName mod) { switch (mod) { case ModuleName.TM: return TMPressure; case ModuleName.LLA: return LLAPressure; case ModuleName.LLB: return LLBPressure; } return 0; } public bool IsModuleATM(ModuleName mod) { switch (mod) { case ModuleName.TM: return IsTMATM; case ModuleName.LLA: return IsLLAATM; case ModuleName.LLB: return IsLLBATM; } return false; } public bool IsModuleVaccum(ModuleName mod) { switch (mod) { case ModuleName.TM: return IsTMVac; case ModuleName.LLA: return IsLLAVac; case ModuleName.LLB: return IsLLBVac; } return false; } public bool CheckLidClosed(ModuleName mod) { switch (mod) { case ModuleName.TM: if(!TMLidClosed) { LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Lid not closed"); return false; } break; case ModuleName.LLA: if(!LLALidClosed) { LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Lid not closed"); return false; } break; case ModuleName.LLB: if (!LLBLidClosed) { LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Lid not closed"); return false; } break; } return true; } public bool CheckVentValveClosed(ModuleName mod) { switch (mod) { case ModuleName.TM: if (IsTMVentValveOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Vent Valve not closed"); return false; } break; case ModuleName.LLA: if (IsLLAVentValveOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Vent Valve not closed"); return false; } break; case ModuleName.LLB: if (IsLLBVentValveOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Vent Valve not closed"); return false; } break; } return true; } public bool CheckPurgeValveClosed(ModuleName mod) { switch (mod) { case ModuleName.TM: if (IsTMPurgeValveOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Purge Valve not closed"); return false; } break; case ModuleName.LLA: if (IsLLAPurgeValveOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Purge Valve not closed"); return false; } break; case ModuleName.LLB: if (IsLLBPurgeValveOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Purge Valve not closed"); return false; } break; } return true; } public bool CheckPumpValveClosed(ModuleName mod) { switch (mod) { case ModuleName.TM: if (IsTMFastPumpOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Fast Pump Valve not closed"); return false; } else if(IsTMSoftPumpOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.TM, "TM Soft Pump Valve not closed"); return false; } break; case ModuleName.LLA: if (IsLLAFastPumpOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Fast Pump Valve not closed"); return false; } else if(IsLLASoftPumpOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLA, "LLA Soft Pump Valve not closed"); return false; } break; case ModuleName.LLB: if (IsLLBFastPumpOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Fast Pump Valve not closed"); return false; } else if(IsLLBSoftPumpOpen) { LOG.Write(eEvent.ERR_TM, ModuleName.LLB, "LLB Soft Pump Valve not closed"); return false; } break; } return true; } public bool TurnMFSlitDoor(ModuleName loadlock, bool open, out string reason) { if (open) { if (_isATMMode) { if (!IsTMATM) { reason = $"TM is not ATM, can not open slit door"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } if (!IsModuleATM(loadlock)) { reason = $"{loadlock} is not ATM, can not open slit door"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } } else { if(!IsModuleVaccum(loadlock)) { reason = $"{loadlock} is notVacuum, can not open slit door"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } double maxPressureDifference = SC.GetValue("System.TMLLMaxPressureDifference"); if (Math.Abs(GetModulePressure(loadlock) - GetModulePressure(ModuleName.TM)) > maxPressureDifference) { reason = $"{loadlock} and TM pressure difference exceeds the max limit {maxPressureDifference}"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } } } switch(loadlock) { case ModuleName.LLA: return _LLATSlitDoor.SetCylinder(open, out reason); case ModuleName.LLB: return _LLBTSlitDoor.SetCylinder(open, out reason); } reason = $"Invalid module {loadlock}"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } public bool TurnEFEMSlitDoor(ModuleName loadlock, bool open, out string reason) { if(open && !IsModuleATM(loadlock)) { reason = $"{loadlock} is not ATM, can not open EFEM side slit door"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } switch (loadlock) { case ModuleName.LLA: return _LLAESlitDoor.SetCylinder(open, out reason); case ModuleName.LLB: return _LLBESlitDoor.SetCylinder(open, out reason); } reason = $"Invalid module {loadlock}"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } //public bool ControlTMPump(bool ison) //{ // _TMPump.SetPumpOnOff(ison); // return true; //} } }