| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581 | using Aitex.Core.Common.DeviceData;using Aitex.Core.RT.DataCenter;using Aitex.Core.RT.Device;using Aitex.Core.RT.Device.Unit;using Aitex.Core.RT.Log;using Aitex.Core.RT.OperationCenter;using Aitex.Core.RT.SCCore;using Aitex.Core.UI.Control;using Aitex.Core.Util;using Aitex.Core.RT.Fsm;using MECF.Framework.Common.Device.Bases;using MECF.Framework.Common.Equipment;using MECF.Framework.Common.SubstrateTrackings;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Media;using Venus_Core;using Venus_RT.Devices.IODevices;using Venus_RT.Modules;using IoMfc = Venus_RT.Devices.IODevices.IoMfc;namespace Venus_RT.Devices{    class JetVenusDEPM : JetPMBase    {        #region io变量定义        private readonly IoLid _Lid;        private readonly IoCylinder _linerDoor;        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 _PV51Valve;//新增        private readonly IoValve _PV52Valve;//新增        private readonly IoValve _PV61Valve;//新增        private readonly IoValve _PV62Valve;//新增        private readonly IoValve _PV71Valve;//新增        private readonly IoValve _PV72Valve;//新增        private readonly IoValve _PV81Valve;//新增        private readonly IoValve _PV82Valve;//新增        private readonly IoValve _PV91Valve;//新增        private readonly IoValve _PV92Valve;//新增        private readonly IoValve _PVA1Valve;//新增        private readonly IoValve _PVA2Valve;//新增        private readonly IoValve _PVB1Valve;//新增        private readonly IoValve _PVB2Valve;//新增        private readonly IoValve _PVC1Valve;//新增        private readonly IoValve _PVC2Valve;//新增        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 _Mfc9Valve; //新增        private readonly IoValve _Mfc10Valve;//新增        private readonly IoValve _Mfc11Valve;//新增 空的        private readonly IoValve _Mfc12Valve;//新增        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 _PVHe3Valve;        private readonly IoValve _HeISOValve;        private readonly IoValve _MainPurgeValve;//新增        private readonly IoValve _SecondPurgeValve;//新增        private readonly IoValve _PurgeValve;        private readonly IoSensor _ATM_sw;        private readonly IoSensor _CDAPressure;        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 _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 ChillerBase _WallChiller;        private readonly RfPowerBase _Generator;//srf=>AdTecGenerator        private readonly RfPowerBase _GeneratorBias;//brf=>CometRF        private readonly RfMatchBase _Match;        private readonly RfMatchBase _BiasMatch;        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 IoMagnet _Magnet;        //private readonly IoMfc _heMfc;        private readonly double _foreline_interlock_pressure = 750;        private readonly Dictionary<ValveType, IoValve> Valve2IO;        #endregion        #region 构造函数        public JetVenusDEPM(ModuleName moduleName) : base(moduleName)        {            Module = moduleName;            _Lid = DEVICE.GetDevice<IoLid>($"{Module}.{VenusDevice.Lid}");            _LiftPin = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LiftPin}");            _linerDoor = DEVICE.GetDevice<IoCylinder>($"{Module}.{VenusDevice.LinerDoor}");            _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}");            _PV51Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV51}");            _PV52Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV52}");            _PV61Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV61}");            _PV62Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV62}");            _PV71Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV71}");            _PV72Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV72}");            _PV81Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV81}");            _PV82Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV82}");            _PV91Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV91}");            _PV92Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePV92}");            _PVA1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVA1}");            _PVA2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVA2}");            _PVB1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVB1}");            _PVB2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVB2}");            _PVC1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVC1}");            _PVC2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVC2}");            _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}");            _Mfc9Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc9}");            _Mfc10Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc10}");            _Mfc11Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc11}");            _Mfc12Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMfc12}");            _PVHe1Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe1}");            _PVHe2Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe2}");            _GasFinalValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveGasFinal}");            _PurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePurge}");            //_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}");            _PVHe3Valve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValvePVHe3}");            _HeISOValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveHeISO}");            _SecondPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveSecondPurge}");            _ATM_sw = DEVICE.GetDevice<IoSensor>($"{Module}.SensorATMSwitch");            _N2Pressure_sw = DEVICE.GetDevice<IoSensor>($"{Module}.N2PressureOk");            _MainPurgeValve = DEVICE.GetDevice<IoValve>($"{Module}.{VenusDevice.ValveMainPurge}");            _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");            _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");            _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");            _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VenusDevice.PressureControl}");            _gasLines = new IoGasStick[12];            for (int index = 0; index < 12; 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>($"{Module}.DryPump.CommunicationType") == (int)CommunicationType.RS232)            {                if (SC.GetValue<int>($"{Module}.DryPump.MFG") == (int)DryPumpMFG.SKY)                {                    _MainPump = DEVICE.GetDevice<SkyPump>($"{Module}.{VenusDevice.MainPump}");                }                else if (SC.GetValue<int>($"{Module}.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>($"{Module}.Chiller.EnableChiller") &&                SC.GetValue<int>($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS232)            {                if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC)                {                    _Chiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.Chiller}");                }                else if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)                {                    _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");                }            }            else            if (SC.GetValue<bool>($"{Module}.Chiller.EnableChiller") &&                SC.GetValue<int>($"{Module}.Chiller.CommunicationType") == (int)CommunicationType.RS485 &&                SC.GetValue<bool>($"{Module}.Chiller.ShareCOM"))            {                if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.SMC)                {                    _Chiller = DEVICE.GetDevice<SMCShareChiller>($"{Module}.{VenusDevice.Chiller}");                }                else if (SC.GetValue<int>($"{Module}.Chiller.MFG") == (int)ChillerMFG.AIRSYS)                {                    _Chiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.Chiller}");                }            }            if (SC.GetValue<bool>($"{Module}.WallChiller.EnableChiller") &&                SC.GetValue<int>($"{Module}.WallChiller.CommunicationType") == (int)CommunicationType.RS232)            {                if (SC.GetValue<int>($"{Module}.WallChiller.MFG") == (int)ChillerMFG.SMC)                {                    _WallChiller = DEVICE.GetDevice<SMCChiller>($"{Module}.{VenusDevice.WallChiller}");                }                else if (SC.GetValue<int>($"{Module}.WallChiller.MFG") == (int)ChillerMFG.AIRSYS)                {                    _WallChiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.WallChiller}");                }            }            else            if (SC.GetValue<bool>($"{Module}.WallChiller.EnableChiller") &&                SC.GetValue<int>($"{Module}.WallChiller.CommunicationType") == (int)CommunicationType.RS485 &&                SC.GetValue<bool>($"{Module}.WallChiller.ShareCOM"))            {                if (SC.GetValue<int>($"{Module}.WallChiller.MFG") == (int)ChillerMFG.SMC)                {                    _WallChiller = DEVICE.GetDevice<SMCShareChiller>($"{Module}.{VenusDevice.WallChiller}");                }                else if (SC.GetValue<int>($"{Module}.WallChiller.MFG") == (int)ChillerMFG.AIRSYS)                {                    _WallChiller = DEVICE.GetDevice<AIRSYSChiller>($"{Module}.{VenusDevice.WallChiller}");                }            }            // RS232 AdTec Generator            if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 &&                SC.GetValue<int>($"{Module}.Rf.MFG") == (int)GeneratorMFG.AdTec)            {                _Generator = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.Rf}");            }            // Ethernet & RS232  Generator Bias            if (SC.GetValue<bool>($"{Module}.BiasRf.EnableBiasRF"))            {                if (SC.GetValue<int>($"{Module}.BiasRf.CommunicationType") == (int)CommunicationType.Ethernet &&                    SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.Comet)                {                    _GeneratorBias = DEVICE.GetDevice<CometRF>($"{Module}.{VenusDevice.BiasRf}");                }                else if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.AdTec)                {                    _GeneratorBias = DEVICE.GetDevice<AdTecGenerator>($"{Module}.{VenusDevice.BiasRf}");                }                else if (SC.GetValue<int>($"{Module}.Rf.CommunicationType") == (int)CommunicationType.RS232 && SC.GetValue<int>($"{Module}.BiasRf.MFG") == (int)GeneratorMFG.Truplasma)                {                    _GeneratorBias = DEVICE.GetDevice<TruPlasmaRF>($"{Module}.{VenusDevice.BiasRf}");                }            }            // RS232 AdTec match            if (SC.GetValue<int>($"{Module}.Match.CommunicationType") == (int)CommunicationType.RS232 &&                SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.AdTec)            {                _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");            }            else if (SC.GetValue<int>($"{Module}.Match.CommunicationType") == (int)CommunicationType.RS232 &&                SC.GetValue<int>($"{Module}.Match.MFG") == (int)MatchMFG.Tru)            {                _Match = DEVICE.GetDevice<AdTecMatch>($"{Module}.{VenusDevice.Match}");            }            // Bias Match            if (SC.GetValue<bool>($"{Module}.BiasMatch.EnableBiasMatch") &&            SC.GetValue<int>($"{Module}.BiasMatch.CommunicationType") == (int)CommunicationType.RS232 &&            SC.GetValue<int>($"{Module}.BiasMatch.MFG") == (int)MatchMFG.Tru)            {                _BiasMatch = DEVICE.GetDevice<TruPlasmaMatch>($"{Module}.{VenusDevice.BiasMatch}");            }            _foreline_interlock_pressure = SC.GetValue<double>($"{Module}.ForelineInterlockPressure");            _Magnet = DEVICE.GetDevice<IoMagnet>($"{Module}.AIoMagnet");            Valve2IO = new Dictionary<ValveType, IoValve>()            {                { ValveType.PVN21, _PVN21Valve },                { ValveType.PVN22, _PVN22Valve },                { ValveType.PV11,  _PV11Valve  },                { ValveType.PV12,  _PV12Valve  },                { ValveType.PV21,  _PV21Valve  },                { ValveType.PV22,  _PV22Valve  },                { ValveType.PV31,  _PV31Valve  },                { ValveType.PV32,  _PV32Valve  },                { ValveType.PV41,  _PV41Valve  },                { ValveType.PV42,  _PV42Valve  },                { ValveType.PV51,  _PV51Valve  },                { ValveType.PV52,  _PV52Valve  },                { ValveType.PV61,  _PV61Valve  },                { ValveType.PV62,  _PV62Valve  },                { ValveType.PV71,  _PV71Valve  },                { ValveType.PV72,  _PV72Valve  },                { ValveType.PV81,  _PV81Valve  },                { ValveType.PV82,  _PV82Valve  },                { ValveType.PV91,  _PV91Valve  },                { ValveType.PV92,  _PV92Valve  },                { ValveType.PVA1,  _PVA1Valve  },                { ValveType.PVA2,  _PVA2Valve  },                { ValveType.PVB1,  _PVB1Valve  },                { ValveType.PVB2,  _PVB2Valve  },                { ValveType.PVC1,  _PVC1Valve  },                { ValveType.PVC2,  _PVC2Valve  },                { ValveType.N2,    _N2Valve    },                { ValveType.Mfc1,  _Mfc1Valve  },                { ValveType.Mfc2,  _Mfc2Valve  },                { ValveType.Mfc3,  _Mfc3Valve  },                { ValveType.Mfc4,  _Mfc4Valve  },                { ValveType.Mfc5,  _Mfc5Valve  },                { ValveType.Mfc6,  _Mfc6Valve  },                { ValveType.Mfc7,  _Mfc7Valve  },                { ValveType.Mfc8,  _Mfc8Valve  },                { ValveType.Mfc9,  _Mfc9Valve  },                { ValveType.Mfc10, _Mfc10Valve },                { ValveType.Mfc11, _Mfc11Valve },                { ValveType.Mfc12, _Mfc12Valve },                { ValveType.PVHe1, _PVHe1Valve },                { ValveType.PVHe3, _PVHe3Valve },                { ValveType.PVHe2, _PVHe2Valve },                { ValveType.GasFinal,  _GasFinalValve},                { ValveType.Purge,  _PurgeValve},                { ValveType.FastPump,  _FastPumpValve},                { ValveType.TurboPumpPumping,  _TurboPumpPumpingValve},                { ValveType.TurboPumpPurge,  _TurboPumpPurgeValve},                { ValveType.Guage,  _GuageValve},                { ValveType.HeISO,  _HeISOValve},                { ValveType.MainPurge,_MainPurgeValve},                { ValveType.SecondPurge,  _SecondPurgeValve},            };            SensorWithAlarm();            DATA.Subscribe($"{Name}.ESCHePressure", () => ESCHePressure);            DATA.Subscribe($"{Name}.ESCHV.Temp", () => CoolantOutletTempFB);            DATA.Subscribe($"{Name}.Chiller.Temp", () => CoolantInletTempFB);        }        #endregion        #region 暴露变量        public override bool IsLidClosed => _Lid.OFFFeedback;        public override bool IsSlitDoorClosed        {            get            {                if (Singleton<RouteManager>.Instance.seTM != null)                {                    switch (Module)                    {                        case ModuleName.PMA:                            return Singleton<RouteManager>.Instance.seTM.IsPMASlitDoorClosed;                        case ModuleName.PMB:                            return Singleton<RouteManager>.Instance.seTM.IsPMBSlitDoorClosed;                        case ModuleName.PMC:                            return Singleton<RouteManager>.Instance.seTM.IsPMCSlitDoorClosed;                        case ModuleName.PMD:                            return Singleton<RouteManager>.Instance.seTM.IsPMDSlitDoorClosed;                        default:                            return false;                    }                }                else                    return false;            }        }        public override bool IsLinerDoorClosed => _linerDoor.State == CylinderState.Close;        public override bool IsPumpRunning => _MainPump.IsRunning;        public override bool IsISOOpen => _TurboPumpPumpingValve.Status;        public override bool IsTurboPumpRunning => _TurboPump.IsRunning;        public override bool IsPenVOpen => _pendulumValve.DeviceData.IsOpen;        public override bool IsTurboPumpAtSpeed => _TurboPump.AtSpeed;        public override float TurboPumpSpeed => _TurboPump.Speed;        public override bool HasPumpError => _MainPump.IsError || !_MainPump.IsRunning;        public override bool HasTurboPumpError => _TurboPump.IsError || !_TurboPump.IsRunning;        public override bool IsCDA_OK => _CDAPressure.Value;        public override bool IsFastPumpOpened => _FastPumpValve.Status;        public override bool IsSoftPumpOpened { get; }//_SoftPumpValve.Status        public override bool IsMfc1ValveOpened => _Mfc1Valve.Status;        public override bool IsMfc2ValveOpened => _Mfc2Valve.Status;        public override bool IsMfc3ValveOpened => _Mfc3Valve.Status;        public override bool IsMfc4ValveOpened => _Mfc4Valve.Status;        public override bool IsMfc5ValveOpened => _Mfc5Valve.Status;        public override bool IsMfc6ValveOpened => _Mfc6Valve.Status;        public override bool IsMfc7ValveOpened => _Mfc7Valve.Status;        public override bool IsMfc8ValveOpened => _Mfc8Valve.Status;        public override double MFC1FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas1").FeedBack;        public override double MFC2FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas2").FeedBack;        public override double MFC3FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas3").FeedBack;        public override double MFC4FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas4").FeedBack;        public override double MFC5FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas5").FeedBack;        public override double MFC6FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas6").FeedBack;        public override double MFC7FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas7").FeedBack;        public override double MFC8FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas8").FeedBack;        public override double MFC9FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas9").FeedBack;        public override double MFC10FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas10").FeedBack;        public override double MFC11FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas11").FeedBack;        public override double MFC12FeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcGas12").FeedBack;        public override double HeliumFeedBack => DEVICE.GetDevice<IoMfc>($"{Module}.MfcHe").FeedBack;        public bool IsMfc9ValveOpened => _Mfc9Valve.Status;        public bool IsMfc10ValveOpened => _Mfc10Valve.Status;        public bool IsMfc11ValveOpened => _Mfc11Valve.Status;        public bool IsMfc12ValveOpened => _Mfc12Valve.Status;        public override bool IsGuageValveOpened => _GuageValve.Status;        public override bool IsATM => _ATM_sw.Value;        public override bool PVN22ValveIsOpen => _PVN22Valve.Status;        public override bool LiftPinIsDown => _LiftPin.OFFFeedback;        public override bool LiftPinIsUp => _LiftPin.ONFeedback;        public override bool IsVAC => _VAC_sw.Value;        //public override bool IsWaterFlowOk => _Water_Flow.Value;        public override bool IsWaterFlowOk => false;        public override bool IsWLK => _WLK_sw.Value;        public override bool IsRFGInterlockOn => _RFG_Interlock.Value;        //public override bool PMLidClosed => _PM_Lid_Closed.Value;        public override bool TurboPumpInterlock => _TurboPumpInterlock.Value;        public override bool LinerDoorClosed => _linerDoor.State == CylinderState.Close;        public override float PendulumPressure => _pendulumValve.Pressure;        public override float PendulumPosition => _pendulumValve.Position;        public override float BiasForwardPower => _GeneratorBias.ForwardPower;        public override float MagnetIntensity => _Magnet.MagnetPowerIntensity;        public override bool SlitDoorClosed        {            get            {                switch (Module)                {                    case ModuleName.PMA:                        return Singleton<RouteManager>.Instance.seTM.IsPMASlitDoorClosed;                    case ModuleName.PMB:                        return Singleton<RouteManager>.Instance.seTM.IsPMBSlitDoorClosed;                    case ModuleName.PMC:                        return Singleton<RouteManager>.Instance.seTM.IsPMCSlitDoorClosed;                    case ModuleName.PMD:                        return Singleton<RouteManager>.Instance.seTM.IsPMDSlitDoorClosed;                    default:                        return true;                }            }        }        //public override double ProcessLowPressure => _pressureController.ProcessLow.Value;        //public override double ProcessHighPressure => _pressureController.ProcessHigh.Value;        public override double ProcessPressure => _pendulumValve.Pressure >= 950 ? 950 : _pendulumValve.Pressure;        public override double ChamberPressure => _pressureController.PressureGauge.Value;        public override double ForelinePressure => _pressureController.ForelineGauge.Value;        public override double TargetPressure => _pressureController.TargetPressure;        public override double ESCHePressure => _pressureController.ESCHeGauge.Value;        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 CoolantInletWallTempFB        {            get            {                switch (SC.GetValue<int>($"{Module}.WallChiller.CommunicationType"))                {                    case (int)CommunicationType.RS232:                        return _WallChiller.ControlTcFeedback;                    case (int)CommunicationType.RS485:                        return _WallChiller.Temperature;                    default:                        return 0;                }            }        }        public override float CoolantInletTempFB        {            get            {                switch (SC.GetValue<int>($"{Module}.Chiller.CommunicationType"))                {                    case (int)CommunicationType.RS232:                        return _Chiller.ControlTcFeedback;                    case (int)CommunicationType.RS485:                        return _Chiller.Temperature;                    default:                        return 0;                }            }        }        public override float CoolantOutletTempFB => _Chiller.CoolantOutletTcFeedback;        public override bool ChillerIsRunning => _Chiller.IsRunning;        public override float ReflectPower => _Generator.ReflectPower;        public override float BiasReflectPower => _GeneratorBias.ReflectPower;        public override bool BackSideHeOutOfRange => _backsideHe.OutOfRange;        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 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 bool IsLidLoadlockClosed        {            get            {                //LOG.Write(eEvent.ERR_PM,Module,"VenusSE PM is not exist Loadlock!");                return false;            }        }        //public override bool IsATMLoadlock        //{        //    get        //    {        //        //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");        //        return false;        //    }        //}        //public override bool IsVACLoadLock        //{        //    get        //    {        //        //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");        //        return false;        //    }        //}        public override bool IsLoadlockArmRetract        {            get            {                //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");                return false;            }        }        public override bool IsLoadlockArmExtend        {            get            {                //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");                return false;            }        }        public override bool LoadlockArmRetract        {            get            {                //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");                return false;            }        }        public override bool LoadlockArmExtend        {            get            {                //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");                return false;            }        }        public override float RFMatchC1 => _Match != null ? _Match.TunePosition1 : 0;        public override float RFMatchC2 => _Match != null ? _Match.TunePosition1 : 0;        public override float BiasRFMatchC1 => _BiasMatch != null ? _BiasMatch.TunePosition1 : 0;        public override float BiasRFMatchC2 => _BiasMatch != null ? _BiasMatch.TunePosition1 : 0;        //public override double LoadlockPressure        //{        //    get        //    {        //        //LOG.Write(eEvent.ERR_PM, Module, "VenusSE PM is not exist Loadlock!");        //        return -100;        //    }        //}        public override void Monitor()        {            CheckPermanentInterlock();        }        public override void BuzzerBlinking(double time)        {            LOG.Write(eEvent.ERR_PM, Module, "VenusDE PM is not exist SignalTower!");        }        #endregion        #region 公共方法        //public override bool CheckAtm()        //{        //    //检查是否是ATM模式        //    return _ATM_sw.Value && ChamberPressure > 700000;        //}        public override void RTCloseEvent()        {            if (_GeneratorBias.IsPowerOn)            {                GeneratorBiasPowerOn(false);            }            if (PendulumValveIsOpen())            {                //SetPVPostion(0);                TurnPendulumValve(false);            }        }        public override bool CheckChillerStatus()        {            return _Chiller != null /*&& _Chiller.IsRunning*/ && !_Chiller.IsError;        }        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 (!LinerDoorClosed)            {                LOG.Write(evt, Module, $"Cannot Power ON {device} as Liner 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 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 IsRFAble()        {            return false;        }        public override bool StartControlPressure(int pressureSetpoint, int flowSetpoint)        {            OpenValve(ValveType.TurboPumpPumping, true);            if (_TurboPumpPumpingValve.Status)            {                OpenValve(ValveType.Purge, true);                OpenValve(ValveType.GasFinal, false);                //OpenValve(ValveType.N2, true);                OpenValve(ValveType.PVN22, true);                TurnPendulumValve(true);                SetPVPressure(pressureSetpoint);                return true;            }            else            {                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot control pressure,cause Turbo Pump Pumping Valve is Close");                return true;            }        }        public async override void AbortControlPressure()        {            SetPVPostion(1000);            OpenValve(ValveType.PVN22, false);            OpenValve(ValveType.N2, false);            await Task.Delay(2000);            OpenValve(ValveType.GasFinal, true);            OpenValve(ValveType.Purge, false);            //return true;        }        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 bool CheckLiftDown()        {            return _LiftPin.State == CylinderState.Close;        }        public override bool CheckLiftUp()        {            return _LiftPin.State == CylinderState.Open;        }        public override bool CheckLinerDoorOpen()        {            return _linerDoor.State == CylinderState.Open;        }        public override bool CheckLinerDoorClose()        {            return IsLinerDoorClosed;        }        public override bool CheckSlitDoorClose()        => IsSlitDoorClosed;        public override bool CheckSlitDoorOpen()        => !IsSlitDoorClosed;// !IsLinerDoorClosed        public async override void CloseValves(int? delayTime = null)        {            _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 _);            _PurgeValve.TurnValve(false, out _);            _N2Valve.TurnValve(false, out _);            _FastPumpValve.TurnValve(false, out _);            _PVHe3Valve.TurnValve(false, out _);            _HeISOValve.TurnValve(false, out _);            _MainPurgeValve.TurnValve(false, out _);            _SecondPurgeValve.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 _);            _Mfc9Valve.TurnValve(false, out _);            _Mfc10Valve.TurnValve(false, out _);            _Mfc11Valve.TurnValve(false, out _);            _Mfc12Valve.TurnValve(false, out _);            _PV51Valve.TurnValve(false, out _);            _PV52Valve.TurnValve(false, out _);            _PV61Valve.TurnValve(false, out _);            _PV62Valve.TurnValve(false, out _);            _PV71Valve.TurnValve(false, out _);            _PV72Valve.TurnValve(false, out _);            _PV81Valve.TurnValve(false, out _);            _PV82Valve.TurnValve(false, out _);            _PV91Valve.TurnValve(false, out _);            _PV92Valve.TurnValve(false, out _);            _PVA1Valve.TurnValve(false, out _);            _PVA2Valve.TurnValve(false, out _);            _PVB1Valve.TurnValve(false, out _);            _PVB2Valve.TurnValve(false, out _);            _PVC1Valve.TurnValve(false, out _);            _PVC2Valve.TurnValve(false, out _);            foreach (var stick in _gasLines)            {                stick.Stop();            }            if (delayTime != null)            {                await Task.Delay((int)delayTime);            }        }        public override bool ExtendWafer()        {            throw new NotImplementedException();        }        public override bool FlowGas(int gasNum, double val)        {            if (_gasLines.Length <= gasNum)                return false;            _gasLines[gasNum].Flow(val);            return true;        }        public override bool FlowN2(double val)        {            _gasLineN2.Flow(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 MagnetPowerOn(bool on)        //{        //    if (_Magnet == null) return false;        //    return _Magnet.SetMagnetOnOff(on, out _);        //}        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 GeneratorBiasSetpower(float val)        {            if (_GeneratorBias == null) return false;            _GeneratorBias.SetPower((ushort)val);            return true;        }        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 MagnetSetpower(float val)        {            if (_Magnet == null) return false;            if (Math.Abs(val) >= 0)                _Magnet.SetMagnetPower(val);            return true;        }        public override bool SetFieldRatio(float val)        {            if (_Magnet == null) return false;            _Magnet.SetFieldRatio(val);            return true;        }        public override bool SetWaveform(int val)        {            if (_Magnet == null) return false;            _Magnet.SetWaveform(val);            return true;        }        public override float GetPVPosition()        {            return _pendulumValve.Position;        }        public override async void HeatChiller(ChillerType chillerType, double value, double offset)        {			SC.SetItemValue($"{Module}.{chillerType}.LastTemp", value);            switch (chillerType)            {                case ChillerType.Chiller:                    _Chiller?.SetChillerTemp((float)value, (float)offset);                    await Task.Delay(1000);                    _Chiller?.SetChillerOnOff(true);                    break;                case ChillerType.WallChiller:                    _WallChiller?.SetChillerTemp((float)value, (float)offset);                    await Task.Delay(1000);                    _WallChiller?.SetChillerOnOff(true);                    break;            }        }        public override void Home()        {            SetLiftPin(MovementPosition.Down, out _);            //转交TM            if (!IsSlitDoorClosed)            {                SetSlitDoor(false, out _);            }            if (!IsLinerDoorClosed) //            {                SetLinerDoor(false, out _);            }            SetLinerDoor(false, out _);            OpenValve(ValveType.PVN22, false);            _GeneratorBias?.ReConnect();            _ESCHV?.ReConnect();            _BiasMatch?.ReConnect();            _MainPump?.ReConnect();            _TurboPump?.ReConnect();            _pendulumValve?.ReConnect();            _GeneratorBias?.Reset();            _BiasMatch?.Reset();            _Magnet?.Reset();        }        public override void OnOffChiller(ChillerType chillerType, bool onoff)        {            switch (chillerType)            {                case ChillerType.Chiller:                    _Chiller?.SetChillerOnOff(onoff);                    break;                case ChillerType.WallChiller:                    _WallChiller?.SetChillerOnOff(onoff);                    break;            }        }                public override bool OnOffSetESCHV(bool on)        => _ESCHV.SetPowerOnOff(on);        public override void OpenValve(ValveType vlvType, bool on)        {            if (vlvType != ValveType.SoftPump)            {                if (Valve2IO.ContainsKey(vlvType))                {                    if (vlvType == ValveType.TurboPumpPurge && on)                    {                        if (!IsISOOpen)                        {                            LOG.Write(eEvent.WARN_DEFAULT_WARN, Module, $"Chamber TurboPumpPumping valve is not open, can not turn on TurboPumpPurge valve.");                            return;                        }                    }                    else if (vlvType == ValveType.TurboPumpPumping && !on)                    {                        if (IsTurboPumpRunning)                        {                            if (IsPenVOpen)                            {                                LOG.Write(eEvent.WARN_DEFAULT_WARN, Module, $"Chamber TurboPump is open but Pendulum Valve is open, can not turn off TurboPumpPumping valve.");                                return;                            }                        }                    }                    if (vlvType == ValveType.TurboPumpPurge && !_TurboPumpPumpingValve.Status && on)                    {                        LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot open Turbo Pump Purge, cause Turbo Pump Valve not open");                        return;                    }                    if (vlvType == ValveType.TurboPumpPumping && on)                    {                        if (!_MainPump.IsRunning)                        {                            LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot open Turbo Pump Pump, cause Dry Pump Valve is not open");                            return;                        }                        if (ForelinePressure > SC.GetValue<int>($"{Module}.TurboPumpPumpingValveMinForelinePressure"))                        {                            LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"cannot open Turbo Pump Pump, cause forelinePressure:{ForelinePressure}");                            return;                        }                    }                    Valve2IO[vlvType].TurnValve(on, out _);                    LOG.Write(eEvent.EV_DEVICE_INFO, Module, $"{(on ? "打开" : "关闭")} 阀 {vlvType.ToString()}");                }                else                {                    throw new ArgumentOutOfRangeException($"Argument error {vlvType}-{on}");                }            }        }        public override bool FullMFC(int gasNum)        {            _gasLines[gasNum].Pump();            return true;        }        public override bool PumpGas(int gasNum)        {            if (_gasLines.Length <= gasNum)                return false;            switch (gasNum)            {                case 0:                    //OpenValve(ValveType.PV11, true);                    OpenValve(ValveType.Mfc1, true);                    break;                case 1:                    //OpenValve(ValveType.PV21, true);                    OpenValve(ValveType.Mfc2, true);                    break;                case 2:                    //OpenValve(ValveType.PV31, true);                    OpenValve(ValveType.Mfc3, true);                    break;                case 3:                    //OpenValve(ValveType.PV41, true);                    OpenValve(ValveType.Mfc4, true);                    break;                case 4:                    //OpenValve(ValveType.PV51, true);                    OpenValve(ValveType.Mfc5, true);                    break;                case 5:                    //OpenValve(ValveType.PV61, true);                    OpenValve(ValveType.Mfc6, true);                    break;                case 6:                    //OpenValve(ValveType.PV71, true);                    OpenValve(ValveType.Mfc7, true);                    break;                case 7:                    //OpenValve(ValveType.PV81, true);                    OpenValve(ValveType.Mfc8, true);                    break;                case 8:                    //OpenValve(ValveType.PV91, true);                    OpenValve(ValveType.Mfc9, true);                    break;                case 9:                    //OpenValve(ValveType.PVA1, true);                    OpenValve(ValveType.Mfc10, true);                    break;                case 10:                    //OpenValve(ValveType.PVB1, true);                    OpenValve(ValveType.Mfc11, true);                    break;                case 11:                    //OpenValve(ValveType.PVC1, true);                    OpenValve(ValveType.Mfc12, true);                    break;            }            _gasLines[gasNum].Pump();            OpenValve(ValveType.SecondPurge, true);            return true;        }                public override bool PendulumValveIsOpen()        {            return _pendulumValve.DeviceData.IsOpen;        }        public override bool RetractWafer()        {            throw new NotImplementedException();        }        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(float nMin, float nMax)        {            if (_backsideHe == null) return false;            return _backsideHe.SetFlowThreshold(nMin, nMax);        }        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 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 void SetGeneratorCommunicationMode(int mode)        => _Generator?.SetCommunicationMode(mode);        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 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 SetPVPostion(float position)        => _pendulumValve.SetPosition(position);        public override bool SetPVPressure(float pressure)        => _pendulumValve.SetPressure(pressure);        public override bool SetSlitDoor(bool open, out string reason)        {            reason = string.Empty;            //OP.DoOperation($"{Singleton<RouteManager>.Instance.seTM.Module}.SetSlitDoor", Module, open);            return true;        }        public override bool SetLinerDoor(bool open, out string reason)        {            return _linerDoor.SetCylinder(open, out reason);        }        public override bool SetWallTCTemperature(float value)        => _WallTC.RampTemp(value);        public override void StopAllGases()        {            foreach (var line in _gasLines)            {                line.Stop();            }        }        public override bool StopGas(int gasNum)        {            if (_gasLines.Length <= gasNum)                return false;            _gasLines[gasNum].Stop();            return true;        }        public override bool StopN2()        {            _gasLineN2.Stop();            return true;        }        public override void SwitchOnBuzzerAndRed()        {            throw new NotImplementedException();        }        public override void TurnDryPump(bool on)        => _MainPump?.SetPumpOnOff(on);        public override bool TurnPendulumValve(bool on)        {			if (on && (!TurboPumpInterlock || !IsCDA_OK || !IsTurboPumpAtSpeed || !IsWLK))            {                LOG.Write(eEvent.ERR_PENDULUM_VALVE, Module, "Cannot open PendulumValve, as Interlock not arrival");                return false;            }            return _pendulumValve.TurnValve(on);        }        public override void TurnTurboPump(bool on)        {            _TurboPump?.SetPumpOnOff(on);        }        public override bool PreparePlace()        {            if (!SetLinerDoor(true, out string reason))            {                LOG.Write(eEvent.ERR_PM, Module, $"Set Liner 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 (!SetLinerDoor(true, out string reason))            {                LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Open failed:{reason}");                return false;            }            if (!SetLiftPin(MovementPosition.Up, out reason))            {                LOG.Write(eEvent.ERR_PM, Module, $"Set Lift Pin Up failed:{reason}");                return false;            }            return true;        }        public override bool PreparePlaceIsOK()        {            return LiftPinIsDown && CheckLinerDoorOpen();        }        public override bool PreparePickIsOK()        {            return LiftPinIsUp && CheckLinerDoorOpen();        }        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 (!SetLinerDoor(false, out reason))            {                LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Close failed:{reason}");                return false;            }            return true;        }        public override bool EndPick()        {            if (!SetLinerDoor(false, out string reason))            {                LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Close failed:{reason}");                return false;            }            return true;        }        private void ALARM_WLK_Notify()        {            if (Singleton<RouteManager>.Instance.GetPM(Module).IsProcessing)            {                LOG.Write(eEvent.ERR_PM, Module, "WaterLeak is off");                Singleton<RouteManager>.Instance.GetPM(Module).PostMsg(FSM_MSG.ALARM);            }        }        private void ALARM_RFGInterlock_Notify()        {            if (Singleton<RouteManager>.Instance.GetPM(Module).IsProcessing)            {                LOG.Write(eEvent.ERR_PM, Module, "RFGInterlock is off");                Singleton<RouteManager>.Instance.GetPM(Module).PostMsg(FSM_MSG.ALARM);            }        }        private void ALARM_TurboPumpInterlock_Notify()        {            if (Singleton<RouteManager>.Instance.GetPM(Module).IsProcessing)            {                LOG.Write(eEvent.ERR_PM, Module, "TurboPumpInterlock is off");                Singleton<RouteManager>.Instance.GetPM(Module).PostMsg(FSM_MSG.ALARM);            }        }        private void ALARM_GasBoxDoor_Notify()        {            if (Singleton<RouteManager>.Instance.GetPM(Module).IsProcessing)            {                LOG.Write(eEvent.ERR_PM, Module, "GasBoxDoor is off");                Singleton<RouteManager>.Instance.GetPM(Module).PostMsg(FSM_MSG.ALARM);            }        }        private void ALARM_GasBoxPressure_Notify()        {            if (Singleton<RouteManager>.Instance.GetPM(Module).IsProcessing)            {                LOG.Write(eEvent.ERR_PM, Module, "GasBoxPressure is off");                Singleton<RouteManager>.Instance.GetPM(Module).PostMsg(FSM_MSG.ALARM);            }        }        private void SensorWithAlarm()        {            _WLK_sw.WarningAction += ALARM_WLK_Notify;            _RFG_Interlock.WarningAction += ALARM_RFGInterlock_Notify;            _TurboPumpInterlock.WarningAction += ALARM_TurboPumpInterlock_Notify;            _GasBoxDoor.WarningAction += ALARM_GasBoxDoor_Notify;            _GasBoxPressure.WarningAction += ALARM_GasBoxPressure_Notify;        }        public override bool EndPlaceIsOK()        {            return CheckSlitDoorClose() && LiftPinIsDown && CheckLinerDoorClose();        }        public override bool EndPickIsOK()        {            return CheckSlitDoorClose() && CheckLinerDoorClose();        }        #endregion        protected override void CheckPermanentInterlock()        {            if (ChamberPressure > 950 && _GuageValve.SetPoint)            {                _GuageValve.TurnValve(false, out _);                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ChamberPressure} exceed 950 mtorr, Guage Valve (DO-31) closed automaticlly.");            }            if (ChamberPressure < 950 && !_GuageValve.SetPoint)            {                _GuageValve.TurnValve(true, out _);                LOG.Write(eEvent.WARN_DEVICE_INFO, Module, $"Process pressure:{ChamberPressure} exceed 950 mtorr, Guage Valve (DO-31) open automaticlly.");            }        }        public override void PMInError()        {            CloseValves(2000);            GeneratorPowerOn(false);            GeneratorBiasPowerOn(false);            OpenValve(ValveType.TurboPumpPumping, true);            OpenValve(ValveType.TurboPumpPurge, true);            _Magnet.SetMagnetPower(0);            if (IsTurboPumpAtSpeed)            {                OpenValve(ValveType.TurboPumpPumping, true);                _pendulumValve.SetPosition(1000);            }                       OnOffSetESCHV(false);            SetBacksideHeThreshold(0, 0);        }    }}
 |