| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222 | 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 MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;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 IoMfc = Venus_RT.Devices.IODevices.IoMfc;using System.Threading.Tasks;namespace Venus_RT.Devices{       class JetPM : PM    {        private readonly IoLid _Lid;        private readonly IoLid _LidLoadlock;        private readonly IoCylinder _slitDoor;        private readonly IoCylinder _LiftPin;        private readonly IoCylinder _LoadLockArm;        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 IoValve _LoadlockVentValve;        private readonly IoValve _LoadlockPumpingValve;        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 _PM_Lid_Closed;        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 _Chiller;        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;        // EndPoint         private readonly EPDClient _epdClient;        private readonly double _foreline_interlock_pressure = 750;        public List<string> EPDCfgList => _epdClient.CFGFileList;        public bool EPDCaptured => _epdClient.Captured;        public bool EPDConnected => _epdClient.IsEPDConnected;        // 盖子的状态        public bool IsLidClosed => _Lid.OFFFeedback;        public bool IsLidLoadlockClosed => _LidLoadlock.OFFFeedback;        public bool IsSlitDoorClosed => !_slitDoor.ONFeedback && _slitDoor.OFFFeedback;        public bool IsPumpRunning => _MainPump.IsRunning;        public bool IsTurboPumpRunning => _TurboPump.IsRunning;        public bool IsTurboPumpAtSpeed => _TurboPump.AtSpeed;        public float TurboPumpSpeed => _TurboPump.Speed;        public bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;        public bool HasTurboPumpError => _TurboPump.IsError || !_TurboPump.IsRunning;        public bool IsCDA_OK => _CDAPressure.Value;        public bool IsFastPumpOpened => _FastPumpValve.Status;        public bool IsSoftPumpOpened => _SoftPumpValve.Status;        public bool IsMfc1ValveOpened => _Mfc1Valve.Status;        public bool IsMfc2ValveOpened => _Mfc2Valve.Status;        public bool IsMfc3ValveOpened => _Mfc3Valve.Status;        public bool IsMfc4ValveOpened => _Mfc4Valve.Status;        public bool IsMfc5ValveOpened => _Mfc5Valve.Status;        public bool IsMfc6ValveOpened => _Mfc6Valve.Status;        public bool IsMfc7ValveOpened => _Mfc7Valve.Status;        public bool IsMfc8ValveOpened => _Mfc8Valve.Status;        public bool IsGuageValveOpened => _GuageValve.Status;        // 压力信号        public bool IsATM => _ATM_sw.Value;        public bool PVN22ValveIsOpen => _PVN22Valve.Status;        public bool LiftPinIsDown => _LiftPin.OFFFeedback;        public bool LiftPinIsUp => _LiftPin.ONFeedback;        public bool IsATMLoadlock => _ATM_Loadlock_sw.Value;        public bool IsVACLoadLock => LoadlockPressure <= 1000;        public bool IsVAC => _VAC_sw.Value;        public bool IsWaterFlowOk => _Water_Flow.Value;        public bool IsWLK => _WLK_sw.Value;        public bool IsRFGInterlockOn => _RFG_Interlock.Value;        public bool PMLidClosed => _PM_Lid_Closed.Value;        public bool TurboPumpInterlock => _TurboPumpInterlock.Value;        public bool SourceRFFanInterlock => _Source_RF_Fan.Value;        public bool SlitDoorClosed => _PM_SlitDoor_Closed.Value;        public double ProcessLowPressure => _pressureController.ProcessLow.Value;        public double ProcessHighPressure => _pressureController.ProcessHigh.Value;        public double ProcessPressure => _pressureController.ProcessGauge.Value;        public override double ChamberPressure => _pressureController.PressureGauge.Value;        public double ForelinePressure => _pressureController.ForelineGauge.Value;        public double TargetPressure => _pressureController.TargetPressure;        public double LoadlockPressure => _pressureController.LoadLockGauge.Value;        public double ESCHePressure => _pressureController.ESCHeGauge.Value;        public int ESCOutputVoltage => _ESCHV.OutputVoltage;        public bool IsHVOn => _ESCHV.IsOn;        public float CoolantInletTempFB => _Chiller.CoolantInletTcFeedback;        public float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;        //Loadlock_Arm        public bool IsLoadlockArmRetract => _LoadLockArm.OFFFeedback;        public bool IsLoadlockArmExtend => _LoadLockArm.ONFeedback;        //Loadlock_Arm DO        public bool LoadlockArmRetract => _LoadLockArm.OFFSetPoint;        public bool LoadlockArmExtend => _LoadLockArm.ONSetPoint;        public float ReflectPower => _Generator.ReflectPower;        public float BiasReflectPower => _GeneratorBias.ReflectPower;        public bool BackSideHeOutOfRange => _backsideHe.OutOfRange;        public new ModuleName Module { get; }        public 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 bool CheckSlitDoorOpen()        {            return _slitDoor.State == CylinderState.Open;        }        public bool CheckSlitDoorClose()        {            return _slitDoor.State == CylinderState.Close;        }        public bool CheckLiftUp()        {            return _LiftPin.State == CylinderState.Open;        }        public bool CheckLiftDown()        {            return _LiftPin.State == CylinderState.Close;        }        public double TotalGasSetpoint        {            get            {                double sum = 0;                foreach (var gas in _gasLines)                {                    sum += gas.FlowSP;                }                return sum;            }        }        public bool HasGasOutOfRange        {            get            {                foreach (var gas in _gasLines)                {                    if (!gas.IsOutOfRange)                        return false;                }                return true;            }        }        public JetPM(ModuleName mod) : base(mod.ToString())        {            Module = mod;            _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.Lid}");            _LidLoadlock = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.LidLoadlock}");            _slitDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.SlitDoor}");            _LiftPin = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LiftPin}");            _LoadLockArm = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LoadLockArm}");            _PVN21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN21}");            _PVN22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVN22}");            _PV11Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV11}");            _PV12Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV12}");            _PV21Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV21}");            _PV22Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV22}");            _PV31Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV31}");            _PV32Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV32}");            _PV41Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV41}");            _PV42Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV42}");            _N2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveN2}");            _Mfc1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc1}");            _Mfc2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc2}");            _Mfc3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc3}");            _Mfc4Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc4}");            _Mfc5Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc5}");            _Mfc6Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc6}");            _Mfc7Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc7}");            _Mfc8Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc8}");            _PVHe1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe1}");            _PVHe2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe2}");            _GasFinalValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGasFinal}");            _SoftPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveSoftPump}");            _FastPumpValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveFastPump}");            _TurboPumpPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPumping}");            _TurboPumpPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveTurboPumpPurge}");            _GuageValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGuage}");            _LoadlockVentValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveLoadlockVent}");            _LoadlockPumpingValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveLoadlockPumping}");            _heMfc= DEVICE.GetDevice<IoMfc>($"{Module}.MfcHe");            _ATM_sw                 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");            _ATM_Loadlock_sw        = DEVICE.GetDevice<IoSensor>($"{Module}.SensorLoadlockATMSwitch");            _N2Pressure_sw          = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");            _VAC_sw                 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorVacSwitch");            _Water_Flow             = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterFlowOk");            _WLK_sw                 = DEVICE.GetDevice<IoSensor>($"{Module}.SensorWaterLeakOk");            _CDAPressure            = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");            _RFG_Interlock          = DEVICE.GetDevice<IoSensor>($"{Module}.GeneratorInterlock");            _PM_Lid_Closed          = DEVICE.GetDevice<IoSensor>($"{Module}.SensorPMLidClosed");            _Source_RF_Fan          = DEVICE.GetDevice<IoSensor>($"{Module}.SensorSourceRFFan");            _PM_SlitDoor_Closed     = DEVICE.GetDevice<IoSensor>($"{Module}.SensorSlitDoorClosed");            _TurboPumpInterlock     = DEVICE.GetDevice<IoSensor>($"{Module}.TurboPumpInterlock");            _GasBoxDoor             = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxDoorSW");            _GasBoxPressure         = DEVICE.GetDevice<IoSensor>($"{Module}.GasBoxPressureSW");            _ForelineTC = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");            _WallTC = DEVICE.GetDevice<IoHeater>($"{Module}.WallHeater");            _SignalTower = DEVICE.GetDevice<IoSignalTower>($"{Module}.SignalTower");            _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");            _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VenusDevice.PressureControl}");            _gasLines = new IoGasStick[8];            for (int index = 0; index < 8; index++)            {                _gasLines[index] = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStick{index + 1}");            }            _gasLineN2 = DEVICE.GetDevice<IoGasStick>($"{Module}.GasStickN2");            _backsideHe = DEVICE.GetDevice<IoBacksideHe>($"{Module}.BacksideHelium");            _MainPump = DEVICE.GetDevice<PumpBase>($"{Module}.{VenusDevice.MainPump}");            // RS232 Dry pump, SKY            if (SC.GetValue<int>($"{mod}.DryPump.CommunicationType") == (int)CommunicationType.RS232)            {                if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.SKY)                {                    _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VenusDevice.MainPump}");                }                else if (SC.GetValue<int>($"{mod}.DryPump.MFG") == (int)DryPumpMFG.Edwards)                {                    _MainPump = DEVICE.GetDevice<EdwardsPump>($"{Module}.{VenusDevice.MainPump}");                }            }            _ESCHV          = DEVICE.GetDevice<ESC5HighVoltage>($"{Module}.{VenusDevice.ESCHV}");            _TurboPump      = DEVICE.GetDevice<AdixenTurboPump>($"{Module}.{VenusDevice.TurboPump}");            _pendulumValve  = DEVICE.GetDevice<PendulumValve>($"{Module}.{VenusDevice.PendulumValve}");            if (SC.GetValue<bool>($"{mod}.Chiller.EnableChiller") &&                SC.GetValue<int>($"{mod}.Chiller.CommunicationType") == (int)CommunicationType.RS232)            {                if (SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.SMC)                {                    _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.Chiller}");                }                else if (SC.GetValue<int>($"{mod}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)                {                    _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");                }            }                           // RS223 AdTec Generator            if (SC.GetValue<int>($"{mod}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&                SC.GetValue<int>($"{mod}.Rf.MFG") == (int)GeneratorMFG.AdTec)            {                _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");            }            // Ethernet Comet Generator Bias            if (SC.GetValue<bool>($"{mod}.BiasRf.EnableBiasRF"))            {                if (SC.GetValue<int>($"{mod}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&                    SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.Comet)                {                    _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VenusDevice.BiasRf}");                }                else if (SC.GetValue<int>($"{mod}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)                {                    _GeneratorBias = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.BiasRf}");                }            }            // RS232 AdTec match            if (SC.GetValue<int>($"{mod}.Match.CommunicationType") == (int)CommunicationType.RS232 &&                SC.GetValue<int>($"{mod}.Match.MFG") == (int)MatchMFG.AdTec)            {                _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");            }            // Bias Match            if (SC.GetValue<bool>($"{mod}.BiasMatch.EnableBiasMatch") &&                SC.GetValue<int>($"{mod}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&                SC.GetValue<int>($"{mod}.BiasMatch.MFG") == (int)MatchMFG.AdTec)            {                _BiasMatch = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.BiasMatch}");            }            _epdClient = DEVICE.GetDevice<EPDClient>($"{Module}.{VenusDevice.EndPoint}");                        DATA.Subscribe($"{Name}.ForelinePressure", () => ForelinePressure);            DATA.Subscribe($"{Name}.ProcessHighPressure", () => _pressureController.ProcessHigh.Value);            DATA.Subscribe($"{Name}.ProcessLowPressure",  () => _pressureController.ProcessLow.Value);            DATA.Subscribe($"{Name}.ESCHePressure", () => ESCHePressure);            DATA.Subscribe($"{Name}.LoadlockPressure", () => LoadlockPressure);            DATA.Subscribe($"{Name}.IsATM", () => IsATM);            DATA.Subscribe($"{Name}.IsVAC", () => IsVAC);            DATA.Subscribe($"{Name}.LiftPinIsUp", () => LiftPinIsUp);            DATA.Subscribe($"{Name}.LiftPinIsDown", () => LiftPinIsDown);            DATA.Subscribe($"{Name}.PumpIsRunning", () => IsPumpRunning);            DATA.Subscribe($"{Name}.TurboPumpIsRunning", () => IsTurboPumpRunning);            DATA.Subscribe($"{Name}.IsSlitDoorClosed", () => IsSlitDoorClosed);            DATA.Subscribe($"{Name}.IsLidClosed", () => IsLidClosed);            DATA.Subscribe($"{Name}.SRfIsOn", () => _Generator.IsPowerOn);            DATA.Subscribe($"{Name}.SRfForwardPowerFeedBack", () => _Generator.ForwardPower);            DATA.Subscribe($"{Name}.SRfReflectPower", () => ReflectPower);            DATA.Subscribe($"{Name}.SRfMatchIsAuto", () =>            {                return _Match?.TuneMode1== EnumRfMatchTuneMode.Auto ? true : false;            });            DATA.Subscribe($"{Name}.BRfIsOn", () =>            {                return _GeneratorBias == null ? false : _GeneratorBias.IsPowerOn;            });            DATA.Subscribe($"{Name}.BRfForwardPowerFeedBack", () => _GeneratorBias.ForwardPower);            DATA.Subscribe($"{Name}.BRfReflectPower", () => BiasReflectPower);            DATA.Subscribe($"{Name}.TurboPumpRotationalSpeed", () => _TurboPump?.RotationalSpeed);            DATA.Subscribe($"{Name}.PendulumValve.Position", () => _pendulumValve.Position);            DATA.Subscribe($"{Name}.PendulumValve.Pressure", () => _pendulumValve.Pressure);            DATA.Subscribe($"{Name}.PendulumValve.IsOpen", () => _pendulumValve.IsOpen);            DATA.Subscribe($"{Name}.IsWaterFlowOk", () => IsWaterFlowOk);            DATA.Subscribe($"{Name}.IsWLK", () => IsWLK);            DATA.Subscribe($"{Name}.IsCDA_OK", () => IsCDA_OK);            DATA.Subscribe($"{Name}.SourceRFFanInterlock", () => SourceRFFanInterlock);            DATA.Subscribe($"{Name}.IsTurboPumpInterlock", () => TurboPumpInterlock);            DATA.Subscribe($"{Name}.IsATMLoadlock", () => IsATMLoadlock);            DATA.Subscribe($"{Name}.IsVACLoadlock", () => IsVACLoadLock);            DATA.Subscribe($"{Name}.SensorGasBoxDoor", () => _GasBoxDoor.Value);            DATA.Subscribe($"{Name}.SensorGasBoxPressure", () => _GasBoxPressure.Value);            DATA.Subscribe($"{Name}.WallTempFeedBack", () => _WallTC.MonitorTcFeedback);            DATA.Subscribe($"{Name}.GetPVPosition", () => GetPVPosition());                        DATA.Subscribe($"{Name}.ESCHV.OutputVoltage", () => ESCOutputVoltage);            DATA.Subscribe($"{Name}.ESCHV.IsOn", () => IsHVOn);            DATA.Subscribe($"{Name}.Chiller.Temp", () => CoolantOutletTempFB);            DATA.Subscribe($"{Name}.Chiller.IsOn", () => _Chiller.IsRunning);            DATA.Subscribe($"{Name}.IsTurboPumpAtSpeed", () => IsTurboPumpAtSpeed);            //DATA.Subscribe($"{Name}.TurboPumpIsRunning", () => _);            OP.Subscribe($"{Module}.SetLiftPin", (cmd, args) => {                if ((bool)args[0] == true)                {                  return SetLiftPin(MovementPosition.Up, out _);                }                else                {                   return  SetLiftPin(MovementPosition.Down, out _);                }                            });            OP.Subscribe($"{Module}.SetSRf",  (cmd, args) =>             {                var ison = (bool)args[1];                if (ison == true)                {                    GeneratorPowerOn(true);                    GeneratorSetpower((float)args[0]);                                        }                else                {                    GeneratorPowerOn(false);                }                               return true;            });            OP.Subscribe($"{Module}.SetBRf", (cmd, args) => {                var ison = (bool)args[1];                if (ison == true)                {                    GeneratorBiasPowerOn(true);                    GeneratorBiasSetpower((float)args[0]);                                    }                else                {                    GeneratorBiasPowerOn(false);                }                return true;            });            //OP.Subscribe($"{Module}.SetMatchPosition", (cmd, args) => {            //    float value1;            //    float value2;            //    float.TryParse(args[0].ToString(),out value1);            //    float.TryParse(args[1].ToString(), out value2);            //    SetMatchPosition(value1, value2);            //    return true;            //});            //OP.Subscribe($"{Module}.SetBiasMatchPosition", (cmd, args) => {            //    float value1;            //    float value2;            //    float.TryParse(args[0].ToString(), out value1);            //    float.TryParse(args[1].ToString(), out value2);            //    SetBiasMatchPosition(value1, value2);            //    return true;            //});            OP.Subscribe($"{Module}.SetSlitDoor", (cmd, args) => {                SetSlitDoor((bool)args[0], out _);                return true;            });            OP.Subscribe($"{Module}.SetESCHVIsOn", (cmd, args) => {                _ESCHV.SetPowerOnOff((bool)args[0]);                return true;            });            OP.Subscribe($"{Module}.SetESCHV", (cmd, args) => {                SetESCClampVoltage((int)args[0]);                return true;            });            OP.Subscribe($"{Module}.SetPVPostion", (cmd, args) => {                SetPVPostion((int)args[0]);                return true;            });            OP.Subscribe($"{Module}.SetPVPressure", (cmd, args) => {                SetPVPressure((int)args[0]);                return true;            });            OP.Subscribe($"{Module}.ClosePump", (cmd, args) => {                TurnDryPump(false);                return true;            });            OP.Subscribe($"{Module}.CloseTurboPump", (cmd, args) => {                TurnTurboPump(false);                return true;            });            OP.Subscribe($"{Module}.ControlValve", (cmd, args) => {                OpenValve((ValveType)((int)args[0]), (bool)args[1]);                return true;            });            OP.Subscribe($"{Module}.TurnPendulumValve", (cmd, args) => {                TurnPendulumValve((bool)args[0]);                return true;            });            OP.Subscribe($"{Module}.HeatChiller", (cmd, args) => {                HeatChiller((float)args[0], (float)args[1]);                return true;            });            OP.Subscribe($"{Module}.OnOffChiller", (cmd, args) => {                OnOffChiller((bool)args[0]);                return true;            });            OP.Subscribe($"{Module}.WallChiller", (cmd, args) => {                float value;                float.TryParse(args[0].ToString(),out value);                _WallTC.RampTemp ( value);                return true;            });            OP.Subscribe($"{Module}.SetBacksideHeFlow", (cmd, args) => {                double value;                double.TryParse(args[0].ToString(), out value);                SetBacksideHeFlow(value);                return true;            });            OP.Subscribe($"{Module}.SetBacksideHePressure", (cmd, args) =>            {                float value;                float.TryParse(args[0].ToString(),out value);                SetBacksideHePressure(value);                return true;            });            _foreline_interlock_pressure = SC.GetValue<double>($"{mod}.ForelineInterlockPressure");        }        public void CloseValves()        {            _PVN21Valve.TurnValve(false, out _);           // _PVN22Valve.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 _);            _GasFinalValve.TurnValve(false, out _);            _SoftPumpValve.TurnValve(false, out _);            _FastPumpValve.TurnValve(false, out _);            _TurboPumpPumpingValve.TurnValve(false, out _);            _TurboPumpPurgeValve.TurnValve(false, out _);            _GuageValve.TurnValve(false, out _);            _LoadlockVentValve.TurnValve(false, out _);            _LoadlockPumpingValve.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();            }        }        public void TurnDryPump(bool on)        {            //_pressureController.StartPump(on);            _MainPump?.SetPumpOnOff(on);        }        public void TurnTurboPump(bool on)        {            _TurboPump?.SetPumpOnOff(on);        }        public 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()        {            foreach (var gas in _gasLines)            {                gas.Monitor();            }            CheckPermanentInterlock();        }        private void CheckPermanentInterlock()        {            if (ProcessPressure > 100 && _GuageValve.SetPoint)            {                _GuageValve.TurnValve(false, out _);                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ProcessPressure} exceed 100 mtorr, Guage Valve (DO-31) closed automaticlly.");            }        }        public void CheckIdleInterlock()        {            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 void BuzzerBlinking(double time)        {            _SignalTower.BuzzerBlinking(time);        }        public void SwitchOnBuzzerAndRed()        {            _SignalTower.SwitchOnBuzzerAndRed("", null);        }        public override void Home()        {            // 与yp讨论过,PM 初始化不需要            SetLiftPin(MovementPosition.Down, out _);            SetSlitDoor(false, out _);            //2023/03/08添加            OpenValve(ValveType.PVN22, true);            //2023/04/25临时添加            //RetractWafer();        }        public 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 bool SetSlitDoor(bool open, out string reason)        {            reason = string.Empty;            //if(open)            //{            //    bool _isATMMode = SC.GetValue<bool>("System.IsATMMode");            //    if(_isATMMode)            //    {            //        if(!IsATM)            //        {            //            reason = $"{Module} is not ATM, can not open slit door";            //            LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);            //            return false;            //        }            //        if(!IsATMLoadlock)            //        {            //            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<double>("System.PMLLMaxPressureDifference");            //        if (Math.Abs(LoadlockPressure - ChamberPressure) > maxPressureDifference)            //        {            //            reason = $"{Module} and Loadlock pressure difference exceeds the max limit {maxPressureDifference}";            //            LOG.Write(eEvent.ERR_DEVICE_INFO, Module, reason);            //            return false;            //        }            //    }                            //}            return _slitDoor.SetCylinder(open, out reason);        }        public bool RetractWafer()        {            return _LoadLockArm.SetCylinder(false, out _);        }        public bool ExtendWafer()        {            return _LoadLockArm.SetCylinder(true, out _);        }        public bool FlowGas(int gasNum, double val)        {            if (_gasLines.Length <= gasNum)                return false;            _gasLines[gasNum].Flow(val);            return true;        }        public bool StopGas(int gasNum)        {            if (_gasLines.Length <= gasNum)                return false;            _gasLines[gasNum].Stop();            return true;        }        public bool FlowN2(double val)        {            _gasLineN2.Flow(val);            return true;        }        public bool StopN2()        {            _gasLineN2.Stop();            return true;        }        public void StopAllGases()        {            foreach (var line in _gasLines)            {                line.Stop();            }        }        public bool TurnPendulumValve(bool on)        {            return _pendulumValve.TurnValve(on);        }        public bool SetPVPressure(int pressure)        {            return _pendulumValve.SetPressure(pressure);        }        public bool SetPVPostion(int position)        {            return _pendulumValve.SetPosition(position);        }        public int GetPVPosition()        {            return _pendulumValve.Position;        }        public async void HeatChiller(double value, double offset)        {            _Chiller?.SetChillerTemp((float)value, (float)offset);             await Task.Delay(1000);            _Chiller?.SetChillerOnOff(true);        }        public  void OnOffChiller(bool onoff)        {            _Chiller?.SetChillerOnOff(onoff);        }        public bool CheckChillerStatus()        {            return _Chiller != null /*&& _Chiller.IsRunning*/ && !_Chiller.IsError;        }        public void SetGeneratorCommunicationMode(int mode)        {            _Generator?.SetCommunicationMode(mode);        }        public 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 bool GeneratorSetpower(float val)        {            if (_Generator == null) return false;            if (Math.Abs(val) > 0.01)                _Generator.SetPower((ushort)val);            return true;        }        public 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 bool GeneratorBiasSetpower(float val)        {            if (_GeneratorBias == null) return false;            if (Math.Abs(val) > 0.01)                _GeneratorBias.SetPower((ushort)val);            return true;        }        public bool GeneratorBiasSetMatchMode(bool val)        {            if (_GeneratorBias == null) return false;            string reason = string.Empty;            _GeneratorBias.SetMatchingAutoMode(val, out reason);            return true;        }        public bool SetMatchPosition(float c1, float c2)        {            if (_Match == null) return false;            string reason = string.Empty;            _Match.SetMatchPosition(c1, c2, out reason);            return true;        }        public bool SetBiasMatchPosition(float c1, float c2)        {            if (_BiasMatch == null) return false;            string reason = string.Empty;            _BiasMatch.SetMatchPosition(c1, c2, out reason);            return true;        }        public bool SetBiasPulseMode(bool on)        {            if (_GeneratorBias == null) return false;            _GeneratorBias.SetPulseMode(on);            return true;        }        public bool SetBiasPulseRateFreq(int nFreq)        {            if (_GeneratorBias == null) return false;            _GeneratorBias.SetPulseRateFreq(nFreq);            return true;        }        public bool SetDiasPulseDutyCycle(int percentage)        {            if (_GeneratorBias == null) return false;            _GeneratorBias.SetPulseDutyCycle(percentage);            return true;        }        public bool SetESCClampVoltage(int nVoltage)        {            if (_ESCHV == null) return false;            return _ESCHV.SetOutputVoltage(nVoltage);        }        public bool CheckGeneratorAndHVInterlock(VenusDevice device)        {            eEvent evt = device == VenusDevice.Rf ? eEvent.ERR_RF : eEvent.ERR_ESC_HV;            if (!PMLidClosed)            {                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;        }        #region EndPoint        public void EPDRecipeStart()        {            _epdClient.RecipeStart();        }        public void EPDRecipeStop()        {            _epdClient.RecipeStop();        }        public void EPDStepStart(string cfgName)        {            _epdClient.StepStart(cfgName);        }        public void EPDStepStop()        {            _epdClient.StepStop();        }        #endregion        public void SetBacksideHeFlow(double flow)        {            if (_backsideHe == null) return ;            _backsideHe.Flow(flow);        }        public bool SetBacksideHePressure(float mTorr)        {            if (_backsideHe == null) return false;            return _backsideHe.SetBacksideHelium(mTorr);        }        public bool SetBacksideHeThreshold(int nMin, int nMax)        {            if (_backsideHe == null) return false;            return _backsideHe.SetFlowThreshold(nMin, nMax);        }    }    /// <summary>    /// PM Action    /// </summary>    abstract class PmActionBase : ActionBase    {        protected internal JetPM _chamber;        protected PmActionBase(ModuleName mod, JetPM pm) : base(mod)        {            _chamber = pm;        }    }    class PinAction : PmActionBase    {        public MovementPosition Pos { get; }        public bool IsWaferTransfered { get; }        public PMEntity PmEntity { get; set; }        private Hand _blade;        private bool _isPick;        public PinAction(ModuleName mod, JetPM pm, MovementPosition pos, bool isTransferWafer, Hand blade, bool isPick) : base(mod, pm)        {            this.Pos = pos;            IsWaferTransfered = isTransferWafer;            _blade = blade;            _isPick = isPick;        }        public override void Execute()        {            if (Module == ModuleName.PMA)                PmEntity = Singleton<RouteManager>.Instance.PMA;            else if (Module == ModuleName.PMB)                PmEntity = Singleton<RouteManager>.Instance.PMB;            if (PmEntity != null)            {                PmEntity.PostMsg(PMEntity.MSG.MoveLiftPin, Pos, ID, _isPick);            }        }        public override void OnPostWork(string data = null)        {            if (IsWaferTransfered)            {                if (Pos == MovementPosition.Up)                {                    WaferManager.Instance.WaferMoved(ModuleName.EfemRobot, _blade == Hand.Blade1 ? 0 : 1, Module, 0);                }                else                {                    WaferManager.Instance.WaferMoved(Module, 0, ModuleName.EfemRobot, _blade == Hand.Blade1 ? 0 : 1);                }                Singleton<RouteManager>.Instance.EFEM.EfemDevice.SetRobotMovingInfo(MECF.Framework.Common.CommonData.RobotAction.None, Hand.Both, ModuleName.System);            }        }    }}
 |