using Aitex.Core.Common.DeviceData; using Aitex.Core.RT.Device; using Aitex.Core.RT.Device.Unit; using Aitex.Core.RT.SCCore; using Aitex.Core.RT.Log; using MECF.Framework.Common.Device.Bases; using MECF.Framework.Common.Equipment; using System; using Venus_Core; using Venus_RT.Modules; using Venus_RT.Devices.IODevices; using MECF.Framework.Common.SubstrateTrackings; using IoMfc = Venus_RT.Devices.IODevices.IoMfc; using System.Threading.Tasks; using System.Diagnostics; namespace Venus_RT.Devices { class JetKepler2300PM : JetPMBase { //private readonly IoLid _Lid; //private readonly IoCylinder _slitDoor; //private readonly IoCylinder _LiftPin; //private readonly IoValve _PVN21Valve; //private readonly IoValve _PVN22Valve; //private readonly IoValve _PV11Valve; //private readonly IoValve _PV12Valve; //private readonly IoValve _PV21Valve; //private readonly IoValve _PV22Valve; //private readonly IoValve _PV31Valve; //private readonly IoValve _PV32Valve; //private readonly IoValve _PV41Valve; //private readonly IoValve _PV42Valve; //private readonly IoValve _N2Valve; //private readonly IoValve _Mfc1Valve; //private readonly IoValve _Mfc2Valve; //private readonly IoValve _Mfc3Valve; //private readonly IoValve _Mfc4Valve; //private readonly IoValve _Mfc5Valve; //private readonly IoValve _Mfc6Valve; //private readonly IoValve _Mfc7Valve; //private readonly IoValve _Mfc8Valve; //private readonly IoValve _PVHe1Valve; //private readonly IoValve _PVHe2Valve; //private readonly IoValve _GasFinalValve; //private readonly IoValve _SoftPumpValve; //private readonly IoValve _FastPumpValve; //private readonly IoValve _TurboPumpPumpingValve; //private readonly IoValve _TurboPumpPurgeValve; //private readonly IoValve _GuageValve; //private readonly IoSensor _ATM_sw; //private readonly IoSensor _CDAPressure; //private readonly IoSensor _ATM_Loadlock_sw; //private readonly IoSensor _N2Pressure_sw; //private readonly IoSensor _VAC_sw; //private readonly IoSensor _WLK_sw; //private readonly IoSensor _Water_Flow; //private readonly IoSensor _RFG_Interlock; //private readonly IoSensor _Source_RF_Fan; //private readonly IoSensor _PM_SlitDoor_Closed; //private readonly IoSensor _TurboPumpInterlock; //private readonly IoSensor _GasBoxDoor; //private readonly IoSensor _GasBoxPressure; private readonly PumpBase _MainPump; private readonly ESC5HighVoltage _ESCHV; private readonly AdixenTurboPump _TurboPump; private readonly PendulumValve _pendulumValve; private readonly ChillerBase _InnerChiller; private readonly ChillerBase _OuterChiller; private readonly ChillerBase _TopChiller; private readonly RfPowerBase _Generator;//srf=>AdTecGenerator private readonly RfPowerBase _GeneratorBias;//brf=>CometRF private readonly RfMatchBase _Match; private readonly RfMatchBase _BiasMatch; private readonly IoSignalTower _SignalTower; private readonly IoHeater _ForelineTC; private readonly IoHeater _WallTC; private readonly IoPressureControl _pressureController; private readonly IoGasStick[] _gasLines; private readonly IoGasStick _gasLineN2; private readonly IoBacksideHe _backsideHe; private readonly IoMfc _heMfc; private readonly double _foreline_interlock_pressure = 750; private Stopwatch _GasRFStopWatch = new Stopwatch(); private Stopwatch _pendulumValveStopWatch = new Stopwatch(); // 盖子的状态 public override bool IsLidClosed => false; public override bool IsSlitDoorClosed => false; public override bool IsPumpRunning => _MainPump.IsRunning; public override bool IsTurboPumpRunning => _TurboPump.IsRunning; public override bool IsTurboPumpAtSpeed => _TurboPump.AtSpeed; public override float TurboPumpSpeed => _TurboPump.Speed; public override bool IsISOOpen => false; public override bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning; public override bool HasTurboPumpError => _TurboPump.IsError || !_TurboPump.IsRunning; public override bool IsCDA_OK => false; public override bool IsFastPumpOpened => false; public override bool IsSoftPumpOpened => false; public override bool IsMfc1ValveOpened => false; public override bool IsMfc2ValveOpened => false; public override bool IsMfc3ValveOpened => false; public override bool IsMfc4ValveOpened => false; public override bool IsMfc5ValveOpened => false; public override bool IsMfc6ValveOpened => false; public override bool IsMfc7ValveOpened => false; public override bool IsMfc8ValveOpened => false; public override bool IsGuageValveOpened => false; // 压力信号 public override bool IsATM => false; public override bool PVN22ValveIsOpen => false; public override bool LiftPinIsDown => false; public override bool LiftPinIsUp => false; //public override bool IsATMLoadlock => _ATM_Loadlock_sw.Value; //public override bool IsVACLoadLock => LoadlockPressure <= 1000; public override bool IsVAC => false; public override bool IsWaterFlowOk => true; public override bool IsWLK => false; public override bool IsRFGInterlockOn => false; public override bool TurboPumpInterlock => false; public override bool SourceRFFanInterlock => false; public override bool SlitDoorClosed => false; //public override double ProcessLowPressure => _pressureController.ProcessLow.Value; //public override double ProcessHighPressure => _pressureController.ProcessHigh.Value; //public override double CalculationPressure //{ // get // { // if (ProcessPressure < 100) // { // return ProcessPressure; // } // else // { // return ChamberPressure; // } // } //} public override double ProcessPressure => 0; public override double ChamberPressure => 0; public override double ForelinePressure => 0; public override double TargetPressure =>0; public override double ESCHePressure => 0; public override int ESCOutputVoltage => _ESCHV.OutputVoltage; public override double ESCPositiveOutputCurrent => _ESCHV.PositiveOutputCurrent; public override double ESCNegativeOutputCurrent => _ESCHV.NegativeOutputCurrent; public override bool IsHVOn => _ESCHV.IsOn; public override float CoolantInletTempFB => 0; public override float CoolantOutletTempFB => 0; public override bool ChillerIsRunning => false; public bool innerChillerIsRunning => _InnerChiller.IsRunning; public bool outerChillerIsRunning => _OuterChiller.IsRunning; public bool topChillerIsRunning => _TopChiller.IsRunning; //Loadlock_Arm //public override bool IsLoadlockArmRetract => _LoadLockArm.OFFFeedback; //public override bool IsLoadlockArmExtend => _LoadLockArm.ONFeedback; ////Loadlock_Arm DO //public override bool LoadlockArmRetract => _LoadLockArm.OFFSetPoint; //public override bool LoadlockArmExtend => _LoadLockArm.ONSetPoint; public override float ReflectPower => _Generator.ReflectPower; public override float BiasReflectPower => _GeneratorBias.ReflectPower; public override float ForwardPower => _Generator.ForwardPower; public override float BiasForwardPower => _GeneratorBias.ForwardPower; public override bool BackSideHeOutOfRange => _backsideHe.OutOfRange; public override float RFMatchC1 => _Match != null ? _Match.TunePosition1 : 0; public override float RFMatchC2 => _Match != null ? _Match.TunePosition2 : 0; public override float BiasRFMatchC1 => _BiasMatch != null ? _BiasMatch.TunePosition1 : 0; public override float BiasRFMatchC2 => _BiasMatch != null ? _BiasMatch.TunePosition1 : 0; public new ModuleName Module { get; } //public override MovementPosition LiftPinPosition //{ // get // { // MovementPosition pos = MovementPosition.Unknown; // if (_LiftPin.ONFeedback && !_LiftPin.OFFFeedback) // { // pos = MovementPosition.Up; // } // else if (!_LiftPin.ONFeedback && _LiftPin.OFFFeedback) // { // pos = MovementPosition.Down; // } // return pos; // } //} //public override bool CheckAtm() //{ // return _ATM_sw.Value && ChamberPressure > 700000; //} //public override bool CheckSlitDoorOpen() //{ // return _slitDoor.State == CylinderState.Open; //} //public override bool CheckSlitDoorClose() //{ // return _slitDoor.State == CylinderState.Close; //} //public override bool CheckLiftUp() //{ // return _LiftPin.State == CylinderState.Open; //} //public override bool CheckLiftDown() //{ // return _LiftPin.State == CylinderState.Close; //} public override double TotalGasSetpoint { get { double sum = 0; foreach (var gas in _gasLines) { sum += gas.FlowSP; } return sum; } } public override bool HasGasOutOfRange { get { foreach (var gas in _gasLines) { if (!gas.IsOutOfRange) return false; } return true; } } public override double MFC1FeedBack => DEVICE.GetDevice($"{Module}.MfcGas1").FeedBack; public override double MFC2FeedBack => DEVICE.GetDevice($"{Module}.MfcGas2").FeedBack; public override double MFC3FeedBack => DEVICE.GetDevice($"{Module}.MfcGas3").FeedBack; public override double MFC4FeedBack => DEVICE.GetDevice($"{Module}.MfcGas4").FeedBack; public override double MFC5FeedBack => DEVICE.GetDevice($"{Module}.MfcGas5").FeedBack; public override double MFC6FeedBack => DEVICE.GetDevice($"{Module}.MfcGas6").FeedBack; public override double MFC7FeedBack => DEVICE.GetDevice($"{Module}.MfcGas7").FeedBack; public override double MFC8FeedBack => DEVICE.GetDevice($"{Module}.MfcGas8").FeedBack; public override float PendulumPressure => _pendulumValve.Pressure; public override float PendulumPosition => _pendulumValve.Position; public override bool PendulumValveIsOpen() { return _pendulumValve.IsOpen; } #region 构造函数 public JetKepler2300PM(ModuleName moduleName) : base(moduleName) { Module = moduleName; // _Lid = DEVICE.GetDevice($"{Module}.{VenusDevice.Lid}"); //_slitDoor = DEVICE.GetDevice($"{Module}.{VenusDevice.SlitDoor}"); //_LiftPin = DEVICE.GetDevice($"{Module}.{VenusDevice.LiftPin}"); //_PVN21Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePVN21}"); //_PVN22Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePVN22}"); //_PV11Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV11}"); //_PV12Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV12}"); //_PV21Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV21}"); //_PV22Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV22}"); //_PV31Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV31}"); //_PV32Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV32}"); //_PV41Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV41}"); //_PV42Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePV42}"); //_N2Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveN2}"); //_Mfc1Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc1}"); //_Mfc2Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc2}"); //_Mfc3Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc3}"); //_Mfc4Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc4}"); //_Mfc5Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc5}"); //_Mfc6Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc6}"); //_Mfc7Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc7}"); //_Mfc8Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveMfc8}"); //_PVHe1Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePVHe1}"); //_PVHe2Valve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValvePVHe2}"); //_GasFinalValve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveGasFinal}"); //_SoftPumpValve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveSoftPump}"); //_FastPumpValve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveFastPump}"); //_TurboPumpPumpingValve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveTurboPumpPumping}"); //_TurboPumpPurgeValve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveTurboPumpPurge}"); //_GuageValve = DEVICE.GetDevice($"{Module}.{VenusDevice.ValveGuage}"); //_heMfc = DEVICE.GetDevice($"{Module}.MfcHe"); //_ATM_sw = DEVICE.GetDevice($"{Module}.SensorATMSwitch"); //_ATM_Loadlock_sw = DEVICE.GetDevice($"{Module}.SensorLoadlockATMSwitch"); //_N2Pressure_sw = DEVICE.GetDevice($"{Module}.N2PressureOk"); //_VAC_sw = DEVICE.GetDevice($"{Module}.SensorVacSwitch"); //_Water_Flow = DEVICE.GetDevice($"{Module}.SensorWaterFlowOk"); //_WLK_sw = DEVICE.GetDevice($"{Module}.SensorWaterLeakOk"); //_CDAPressure = DEVICE.GetDevice($"{Module}.SensorCDAPressureOk"); //_RFG_Interlock = DEVICE.GetDevice($"{Module}.GeneratorInterlock"); //_Source_RF_Fan = DEVICE.GetDevice($"{Module}.SensorSourceRFFan"); //_PM_SlitDoor_Closed = DEVICE.GetDevice($"{Module}.SensorSlitDoorClosed"); //_TurboPumpInterlock = DEVICE.GetDevice($"{Module}.TurboPumpInterlock"); //_GasBoxDoor = DEVICE.GetDevice($"{Module}.GasBoxDoorSW"); //_GasBoxPressure = DEVICE.GetDevice($"{Module}.GasBoxPressureSW"); _ForelineTC = DEVICE.GetDevice($"{Module}.ForelineHeater"); _WallTC = DEVICE.GetDevice($"{Module}.WallHeater"); _SignalTower = DEVICE.GetDevice($"{Module}.SignalTower"); //_CDAPressure = DEVICE.GetDevice($"{Module}.SensorCDAPressureOk"); _pressureController = DEVICE.GetDevice($"{Module}.{VenusDevice.PressureControl}"); _gasLines = new IoGasStick[8]; for (int index = 0; index < 8; index++) { _gasLines[index] = DEVICE.GetDevice($"{Module}.GasStick{index + 1}"); } _gasLineN2 = DEVICE.GetDevice($"{Module}.GasStickN2"); _backsideHe = DEVICE.GetDevice($"{Module}.BacksideHelium"); _MainPump = DEVICE.GetDevice($"{Module}.{VenusDevice.MainPump}"); // RS232 Dry pump, SKY if (SC.GetValue($"{Module}.DryPump.CommunicationType") == (int)CommunicationType.RS232) { if (SC.GetValue($"{Module}.DryPump.MFG") == (int)DryPumpMFG.SKY) { _MainPump = DEVICE.GetDevice($"{Module}.{VenusDevice.MainPump}"); } else if (SC.GetValue($"{Module}.DryPump.MFG") == (int)DryPumpMFG.Edwards) { _MainPump = DEVICE.GetDevice($"{Module}.{VenusDevice.MainPump}"); } } _ESCHV = DEVICE.GetDevice($"{Module}.{VenusDevice.ESCHV}"); _TurboPump = DEVICE.GetDevice($"{Module}.{VenusDevice.TurboPump}"); _pendulumValve = DEVICE.GetDevice($"{Module}.{VenusDevice.PendulumValve}"); //if (SC.GetValue($"{Module}.Chiller.EnableChiller") && // SC.GetValue($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS232) //{ // if (SC.GetValue($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC) // { // _Chiller = DEVICE.GetDevice($"{Module}.{VenusDevice.Chiller}"); // } // else if (SC.GetValue($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS) // { // _Chiller = DEVICE.GetDevice($"{Module}.{VenusDevice.Chiller}"); // } //} if (SC.GetValue($"{Module}.InnerChiller.EnableChiller") && SC.GetValue($"{Module}.InnerChiller.CommunicationType") == (int)CommunicationType.RS232) { if (SC.GetValue($"{Module}.InnerChiller.MFG") == (int)ChillerMFG.SMC) { _InnerChiller = DEVICE.GetDevice($"{Module}.{VenusDevice.InnerChiller}"); } else if (SC.GetValue($"{Module}.InnerChiller.MFG") == (int)ChillerMFG.AIRSYS) { _InnerChiller = DEVICE.GetDevice($"{Module}.{VenusDevice.InnerChiller}"); } } if (SC.GetValue($"{Module}.OuterChiller.EnableChiller") && SC.GetValue($"{Module}.OuterChiller.CommunicationType") == (int)CommunicationType.RS232) { if (SC.GetValue($"{Module}.OuterChiller.MFG") == (int)ChillerMFG.SMC) { _OuterChiller = DEVICE.GetDevice($"{Module}.{VenusDevice.OuterChiller}"); } else if (SC.GetValue($"{Module}.OuterChiller.MFG") == (int)ChillerMFG.AIRSYS) { _OuterChiller = DEVICE.GetDevice($"{Module}.{VenusDevice.OuterChiller}"); } } if (SC.GetValue($"{Module}.TopChiller.EnableChiller") && SC.GetValue($"{Module}.TopChiller.CommunicationType") == (int)CommunicationType.RS232) { if (SC.GetValue($"{Module}.TopChiller.MFG") == (int)ChillerMFG.SMC) { _TopChiller = DEVICE.GetDevice($"{Module}.{VenusDevice.TopChiller}"); } else if (SC.GetValue($"{Module}.TopChiller.MFG") == (int)ChillerMFG.AIRSYS) { _TopChiller = DEVICE.GetDevice($"{Module}.{VenusDevice.TopChiller}"); } } // RS223 AdTec Generator if (SC.GetValue($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue($"{Module}.Rf.MFG") == (int)GeneratorMFG.AdTec) { _Generator = DEVICE.GetDevice($"{Module}.{VenusDevice.Rf}"); } // Ethernet Comet Generator Bias if (SC.GetValue($"{Module}.BiasRf.EnableBiasRF")) { if (SC.GetValue($"{Module}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet && SC.GetValue($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.Comet) { _GeneratorBias = DEVICE.GetDevice($"{Module}.{VenusDevice.BiasRf}"); } else if (SC.GetValue($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.AdTec) { _GeneratorBias = DEVICE.GetDevice($"{Module}.{VenusDevice.BiasRf}"); } } // RS232 AdTec match if (SC.GetValue($"{Module}.Match.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue($"{Module}.Match.MFG") == (int)MatchMFG.AdTec) { _Match = DEVICE.GetDevice($"{Module}.{VenusDevice.Match}"); } // Bias Match if (SC.GetValue($"{Module}.BiasMatch.EnableBiasMatch") && SC.GetValue($"{Module}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue($"{Module}.BiasMatch.MFG") == (int)MatchMFG.AdTec) { _BiasMatch = DEVICE.GetDevice($"{Module}.{VenusDevice.BiasMatch}"); } _foreline_interlock_pressure = SC.GetValue($"{Module}.ForelineInterlockPressure"); _GasRFStopWatch.Stop(); //DATA.Subscribe($"{Module}.ChillerInnerTemp", () => _chillerInnerTemp); //DATA.Subscribe($"{Module}.ChillerOuterTemp", () => _chillerOuterTemp); //DATA.Subscribe($"{Module}.ChillerTopTemp", () => _chillerTopTemp); //DATA.Subscribe($"{Module}.InnerChiller.IsRunning", () => innerChillerIsRunning); //DATA.Subscribe($"{Module}.OuterChiller.IsRunning", () => outerChillerIsRunning); //DATA.Subscribe($"{Module}.TopChiller.IsRunning", () => topChillerIsRunning); //OP.Subscribe($"{Module}.HeatChiller", (cmd, args) => { // HeatChiller(ChillerType.InnerChiller, Convert.ToDouble(args[1]), Convert.ToDouble(args[2])); // return true; //}); //OP.Subscribe($"{Module}.OnOffChiller", (cmd, args) => { // //HeatChiller(ChillerType.InnerChiller, Convert.ToDouble(args[1]), Convert.ToDouble(args[2])); // OnOffChiller(ChillerType.InnerChiller, (bool)(args[1])); // return true; //}); _pendulumValveStopWatch.Start(); } #endregion public async override void CloseValves(int? delayTime = null) { //_PVN21Valve.TurnValve(false, out _); //_PV11Valve.TurnValve(false, out _); //_PV12Valve.TurnValve(false, out _); //_PV21Valve.TurnValve(false, out _); //_PV22Valve.TurnValve(false, out _); //_PV31Valve.TurnValve(false, out _); //_PV32Valve.TurnValve(false, out _); //_PV41Valve.TurnValve(false, out _); //_PV42Valve.TurnValve(false, out _); //_PVHe1Valve.TurnValve(false, out _); //_PVHe2Valve.TurnValve(false, out _); //_SoftPumpValve.TurnValve(false, out _); //_FastPumpValve.TurnValve(false, out _); //_TurboPumpPumpingValve.TurnValve(false, out _); //_TurboPumpPurgeValve.TurnValve(false, out _); //_GuageValve.TurnValve(false, out _); //_N2Valve.TurnValve(false, out _); //_FastPumpValve.TurnValve(false, out _); //_Mfc1Valve.TurnValve(false, out _); //_Mfc2Valve.TurnValve(false, out _); //_Mfc3Valve.TurnValve(false, out _); //_Mfc4Valve.TurnValve(false, out _); //_Mfc5Valve.TurnValve(false, out _); //_Mfc6Valve.TurnValve(false, out _); //_Mfc7Valve.TurnValve(false, out _); //_Mfc8Valve.TurnValve(false, out _); //foreach (var stick in _gasLines) //{ // stick.Stop(); //} //if (delayTime != null) //{ // await Task.Delay((int)delayTime); //} //_GasFinalValve.TurnValve(false, out _); } public override void TurnDryPump(bool on) { //_pressureController.StartPump(on); _MainPump?.SetPumpOnOff(on); } public override void TurnTurboPump(bool on) { _TurboPump?.SetPumpOnOff(on); } public override void OpenValve(ValveType vlvType, bool on) { //switch (vlvType) //{ // case ValveType.PVN21: // _PVN21Valve.TurnValve(on, out _); // break; // case ValveType.PVN22: // _PVN22Valve.TurnValve(on, out _); // LOG.Write(eEvent.EV_DEVICE_INFO, Module, $"{(on ? "打开" : "关闭")} 阀 {vlvType.ToString()}"); // break; // case ValveType.PV11: // _PV11Valve.TurnValve(on, out _); // break; // case ValveType.PV12: // _PV12Valve.TurnValve(on, out _); // break; // case ValveType.PV21: // _PV21Valve.TurnValve(on, out _); // break; // case ValveType.PV22: // _PV22Valve.TurnValve(on, out _); // break; // case ValveType.PV31: // _PV31Valve.TurnValve(on, out _); // break; // case ValveType.PV32: // _PV32Valve.TurnValve(on, out _); // break; // case ValveType.PV41: // _PV41Valve.TurnValve(on, out _); // break; // case ValveType.PV42: // _PV42Valve.TurnValve(on, out _); // break; // case ValveType.N2: // _N2Valve.TurnValve(on, out _); // break; // case ValveType.PVHe1: // _PVHe1Valve.TurnValve(on, out _); // break; // case ValveType.PVHe2: // _PVHe2Valve.TurnValve(on, out _); // break; // case ValveType.GasFinal: // _GasFinalValve.TurnValve(on, out _); // break; // case ValveType.SoftPump: // _SoftPumpValve.TurnValve(on, out _); // break; // case ValveType.FastPump: // _FastPumpValve.TurnValve(on, out _); // break; // case ValveType.TurboPumpPumping: // _TurboPumpPumpingValve.TurnValve(on, out _); // break; // case ValveType.TurboPumpPurge: // _TurboPumpPurgeValve.TurnValve(on, out _); // break; // case ValveType.Guage: // _GuageValve.TurnValve(on, out _); // break; // //case ValveType.LoadlockVent: // // _LoadlockVentValve.TurnValve(on, out _); // // break; // //case ValveType.LoadlockPumping: // // _LoadlockPumpingValve.TurnValve(on, out _); // // break; // case ValveType.Mfc1: // _Mfc1Valve.TurnValve(on, out _); // break; // case ValveType.Mfc2: // _Mfc2Valve.TurnValve(on, out _); // break; // case ValveType.Mfc3: // _Mfc3Valve.TurnValve(on, out _); // break; // case ValveType.Mfc4: // _Mfc4Valve.TurnValve(on, out _); // break; // case ValveType.Mfc5: // _Mfc5Valve.TurnValve(on, out _); // break; // case ValveType.Mfc6: // _Mfc6Valve.TurnValve(on, out _); // break; // case ValveType.Mfc7: // _Mfc7Valve.TurnValve(on, out _); // break; // case ValveType.Mfc8: // _Mfc8Valve.TurnValve(on, out _); // break; // default: // throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}"); //} } public override void Monitor() { //if (_pendulumValveStopWatch.ElapsedMilliseconds > 1000) //{ // CheckPermanentInterlock(); // _pendulumValveStopWatch.Restart(); //} var test= DEVICE.GetDevice($"{Module}.MfcGas1").FeedBack; var test2= DEVICE.GetAllDevice(); } protected override void CheckPermanentInterlock() { //if (ProcessPressure >= 99 && _GuageValve.SetPoint) //{ // _GuageValve.TurnValve(false, out _); // LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ProcessPressure} exceed 99 mtorr, Guage Valve (DO-31) closed automaticlly."); //} } public override void CheckIdleInterlock(int delaytime ) { //if (ForelinePressure > _foreline_interlock_pressure) //{ // if (_TurboPumpPumpingValve.SetPoint || _TurboPumpPurgeValve.SetPoint || _pendulumValve.IsOpen) // { // _pendulumValve.TurnValve(false); // _TurboPumpPurgeValve.TurnValve(false, out _); // _TurboPumpPumpingValve.TurnValve(false, out _); // LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Foreline pressure:{ForelinePressure} exceed {_foreline_interlock_pressure} mtorr, Pendulum valve & PV6 & PV7 closed automaticlly."); // } //} } public override void BuzzerBlinking(double time) { _SignalTower.BuzzerBlinking(time); } public override void SwitchOnBuzzerAndRed() { _SignalTower.SwitchOnBuzzerAndRed("", null); } public override void Home() { _pendulumValve.ReConnect(); // 与yp讨论过,PM 初始化不需要 SetLiftPin(MovementPosition.Down, out _); //if (_slitDoor.State == CylinderState.Open) //{ // SetSlitDoor(true, out _); //} //else //{ // SetSlitDoor(false, out _); //} //SetSlitDoor(false, out _); //2023/03/08添加 OpenValve(ValveType.PVN22, true); //2023/04/25临时添加 //RetractWafer(); } public override bool SetLiftPin(MovementPosition dirt, out string reason) { reason = string.Empty; //switch (dirt) //{ // case MovementPosition.Down: // return _LiftPin.SetCylinder(false, out reason); // case MovementPosition.Up: // return _LiftPin.SetCylinder(true, out reason); // case MovementPosition.Left: // case MovementPosition.Right: // case MovementPosition.Middle: // throw new ArgumentException("Movement argument error"); //} return true; } public override bool SetSlitDoor(bool open, out string reason) { if (open) { if (RouteManager.IsATMMode) { if (!IsATM) { reason = $"{Module} is not ATM, can not open slit door"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } if (!IsTMATM) { reason = $"LoadLock is not ATM, can not open slit door"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } } else { double maxPressureDifference = SC.GetValue("System.PMTMMaxPressureDifference"); if (Math.Abs(TMPressure - ChamberPressure) > maxPressureDifference) { reason = $"{Module} and TM pressure difference exceeds the max limit {maxPressureDifference}, TMPressure:{TMPressure}, {Module}Pressure:{ChamberPressure}"; LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason); return false; } } } reason = string.Empty; return false; //return _slitDoor.SetCylinder(open, out reason); } //public override bool RetractWafer() //{ // return _LoadLockArm.SetCylinder(false, out _); //} //public override bool ExtendWafer() //{ // return _LoadLockArm.SetCylinder(true, out _); //} public override bool FlowGas(int gasNum, double val) { if (_gasLines.Length <= gasNum) return false; _gasLines[gasNum].Flow(val); return true; } public override bool StopGas(int gasNum) { if (_gasLines.Length <= gasNum) return false; _gasLines[gasNum].Stop(); return true; } public override bool FlowN2(double val) { _gasLineN2.Flow(val); return true; } public override bool StopN2() { _gasLineN2.Stop(); return true; } public override void StopAllGases() { foreach (var line in _gasLines) { line.Stop(); } } public override bool TurnPendulumValve(bool on) { return _pendulumValve.TurnValve(on); } public override bool SetPVPressure(float pressure) { return _pendulumValve.SetPressure(pressure); } public override bool SetPVPostion(float position) { return _pendulumValve.SetPosition(position); } public override float GetPVPosition() { return _pendulumValve.Position; } public override async void HeatChiller(ChillerType chillerType, double value, double offset) { switch (chillerType) { //case ChillerType.Chiller: // _Chiller?.SetChillerTemp((float)value, (float)offset); // await Task.Delay(1000); // _Chiller?.SetChillerOnOff(true); // break; case ChillerType.InnerChiller: _InnerChiller?.SetChillerTemp((float)value, (float)offset); await Task.Delay(1000); _InnerChiller?.SetChillerOnOff(true); break; case ChillerType.OuterChiller: _OuterChiller?.SetChillerTemp((float)value, (float)offset); await Task.Delay(1000); _OuterChiller?.SetChillerOnOff(true); break; case ChillerType.TopChiller: _TopChiller?.SetChillerTemp((float)value, (float)offset); await Task.Delay(1000); _TopChiller?.SetChillerOnOff(true); break; } } public override void OnOffChiller(ChillerType chillerType, bool onoff) { switch (chillerType) { //case ChillerType.Chiller: // _Chiller?.SetChillerOnOff(onoff); // break; case ChillerType.InnerChiller: _InnerChiller?.SetChillerOnOff(onoff); break; case ChillerType.OuterChiller: _OuterChiller?.SetChillerOnOff(onoff); break; case ChillerType.TopChiller: _TopChiller?.SetChillerOnOff(onoff); break; } } //public override bool CheckChillerStatus() //{ // return _Chiller != null /*&& _Chiller.IsRunning*/ && !_Chiller.IsError; //} public override void SetGeneratorCommunicationMode(int mode) { _Generator?.SetCommunicationMode(mode); } public override bool GeneratorPowerOn(bool on) { if (_Generator == null) return false; if (on && !IsRFGInterlockOn) { LOG.Write(eEvent.ERR_RF, Module, "射频电源 Interlock条件不满足"); return false; } return _Generator.SetPowerOnOff(on, out _); } public override bool GeneratorSetpower(float val) { if (_Generator == null) return false; if (Math.Abs(val) > 0.01) _Generator.SetPower((ushort)val); return true; } public override bool GeneratorBiasPowerOn(bool on) { if (_GeneratorBias == null) return false; if (on && !IsRFGInterlockOn) { LOG.Write(eEvent.ERR_RF, Module, "Bias射频电源 Interlock条件不满足"); return false; } return _GeneratorBias.SetPowerOnOff(on, out _); } public override bool GeneratorBiasSetpower(float val) { if (_GeneratorBias == null) return false; if (Math.Abs(val) > 0.01) _GeneratorBias.SetPower((ushort)val); return true; } public override bool OnOffSetESCHV(bool val) { return _ESCHV.SetPowerOnOff(val); } public override bool SetWallTCTemperature(float value) { return _WallTC.RampTemp(value); } public override bool GeneratorBiasSetMatchMode(bool val) { if (_GeneratorBias == null) return false; string reason = string.Empty; _GeneratorBias.SetMatchingAutoMode(val, out reason); return true; } public override bool SetMatchPosition(float c1, float c2) { if (_Match == null) return false; string reason = string.Empty; _Match.SetMatchPosition(c1, c2, out reason); return true; } public override bool SetMatchWorkMode(MatchWorkMode matchWorkMode) { if (_Match == null) return false; if (matchWorkMode == MatchWorkMode.Auto) { return _Match.SetMatchMode(EnumRfMatchTuneMode.Auto, out _); } else if (matchWorkMode == MatchWorkMode.Manual) { return _Match.SetMatchMode(EnumRfMatchTuneMode.Manual, out _); } return false; } public override bool SetBiasMatchPosition(float c1, float c2) { if (_BiasMatch == null) return false; string reason = string.Empty; _BiasMatch.SetMatchPosition(c1, c2, out reason); return true; } public override bool SetBiasMatchWorkMode(MatchWorkMode matchWorkMode) { if (_BiasMatch == null) return false; if (matchWorkMode == MatchWorkMode.Auto) { return _BiasMatch.SetMatchMode(EnumRfMatchTuneMode.Auto, out _); } else if (matchWorkMode == MatchWorkMode.Manual) { return _BiasMatch.SetMatchMode(EnumRfMatchTuneMode.Manual, out _); } return false; } public override bool SetBiasPulseMode(bool on) { if (_GeneratorBias == null) return false; _GeneratorBias.SetPulseMode(on); return true; } public override bool SetBiasPulseRateFreq(int nFreq) { if (_GeneratorBias == null) return false; _GeneratorBias.SetPulseRateFreq(nFreq); return true; } public override bool SetDiasPulseDutyCycle(int percentage) { if (_GeneratorBias == null) return false; _GeneratorBias.SetPulseDutyCycle(percentage); return true; } public override bool SetESCClampVoltage(int nVoltage) { if (_ESCHV == null) return false; return _ESCHV.SetOutputVoltage(nVoltage); } public override bool CheckGeneratorAndHVInterlock(VenusDevice device) { eEvent evt = device == VenusDevice.Rf ? eEvent.ERR_RF : eEvent.ERR_ESC_HV; if (!IsLidClosed) { LOG.Write(evt, Module, $"Cannot Power ON {device} as PM Lid is Open."); return false; } if (!IsVAC) { LOG.Write(evt, Module, $"Cannot Power ON {device} as PM is not Vacuum."); return false; } if (!IsWaterFlowOk) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Water Flow is OFF."); return false; } if (!IsRFGInterlockOn) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Generator Interlock is OFF."); return false; } if (!SourceRFFanInterlock) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Source RF Fan is OFF."); return false; } if (!SlitDoorClosed) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Slit Door is open."); return false; } if ((device == VenusDevice.ESCHV || device == VenusDevice.BiasRf) && WaferManager.Instance.CheckNoWafer(Module, 0)) { LOG.Write(evt, Module, $"Cannot Power ON {device} as {Module} has no wafer"); return false; } return true; } public override void SetBacksideHeFlow(double flow) { if (_backsideHe == null) return; _backsideHe.Flow(flow); } public override bool SetBacksideHePressure(float mTorr) { if (_backsideHe == null) return false; return _backsideHe.SetBacksideHelium(mTorr); } //public override bool SetBacksideHeThreshold(int nMin, int nMax) //{ // if (_backsideHe == null) return false; // return _backsideHe.SetFlowThreshold(nMin, nMax); //} public override bool StartControlPressure(int pressureSetpoint, int flowSetpoint) { OpenValve(ValveType.GasFinal, true); FlowGas(5, flowSetpoint); TurnPendulumValve(true); SetPVPressure(pressureSetpoint); return true; } public async override void AbortControlPressure() { FlowGas(5, 0); //SetPVPressure(0); SetPVPostion(1000); await Task.Delay(500); OpenValve(ValveType.GasFinal, false); //return true; } public override bool PreparePlace() { if (!SetSlitDoor(true, out string reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}"); return false; } if (!SetLiftPin(MovementPosition.Down, out reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}"); return false; } return true; } public override bool PreparePick() { if (!SetSlitDoor(true, out string reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}"); return false; } if (!SetLiftPin(MovementPosition.Up, out reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin down failed:{reason}"); return false; } return true; } public override bool PreparePlaceIsOK() { return CheckSlitDoorOpen() && LiftPinIsDown; } public override bool PreparePickIsOK() { return CheckSlitDoorOpen() && LiftPinIsUp; } public override bool EndPlace() { if (!SetLiftPin(MovementPosition.Down, out string reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Down failed:{reason}"); return false; } if (!SetSlitDoor(false, out reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}"); return false; } return true; } public override bool EndPick() { if (!SetSlitDoor(false, out string reason)) { LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Close failed:{reason}"); return false; } return true; } public override bool EndPlaceIsOK() { return CheckSlitDoorClose() && LiftPinIsDown; } public override bool EndPickIsOK() { return CheckSlitDoorClose(); } public override void RTCloseEvent() { if (_Generator.IsPowerOn) { GeneratorPowerOn(false); } if (_GeneratorBias.IsPowerOn) { GeneratorBiasPowerOn(false); } if (PendulumValveIsOpen()) { TurnPendulumValve(false); } } public override bool RFInterlock(VenusDevice device) { eEvent evt = eEvent.ERR_RF; if (!IsWaterFlowOk) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Water Flow is OFF."); return false; } if (!IsRFGInterlockOn) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Generator Interlock is OFF."); return false; } if (!SourceRFFanInterlock) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Source RF Fan is OFF."); return false; } if (GasIsOff()) { LOG.Write(evt, Module, $"Cannot Power ON {device} as Gas is OFF."); return false; } return true; } private bool GasIsOff() { if (IsMfc1ValveOpened == false && IsMfc2ValveOpened == false && IsMfc3ValveOpened == false && IsMfc4ValveOpened == false && IsMfc5ValveOpened == false && IsMfc6ValveOpened == false && IsMfc7ValveOpened == false && IsMfc8ValveOpened == false) { if (_GasRFStopWatch.IsRunning == false) { _GasRFStopWatch.Start(); } if (_GasRFStopWatch.ElapsedMilliseconds > 1000) { _GasRFStopWatch.Reset(); //_GasFlag = true; return true; } } else { _GasRFStopWatch.Reset(); //_GasFlag = false; } return false; } public override void PMInError() { CloseValves(); GeneratorPowerOn(false); GeneratorBiasPowerOn(false); OpenValve(ValveType.TurboPumpPumping, true); OpenValve(ValveType.TurboPumpPurge, true); } } }