using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Venus_RT.Devices; using MECF.Framework.Common.Routine; using Venus_Core; namespace Venus_RT.Modules.PMs { enum GasStep { kStartGas, kEnd, } class GasFlowRoutine : PMRoutineBase, IRoutine { public bool _gasStatus = false; private double[] _mfcSetPoint = new double[8]; public GasFlowRoutine(JetPMBase chamber) : base(chamber) { Name = "Gas Flow"; } public RState Start(params object[] objs) { //if (!_chamber.IsFastPumpOpened) //{ // StopFlow(); // Stop("Pump 阀没有打开"); // return RState.Failed; //} if(!CheckTurboPump()) { return RState.Failed; } if(_chamber.GetPVPosition() == 0) { Stop("钟摆阀没有打开"); return RState.Failed; } Reset(); // open process final valve and flow Notify("Open valve and flow mfc"); _chamber.OpenValve(ValveType.GasFinal, true); int i = 0; foreach (object o in objs) { _mfcSetPoint[i++] = (double)o; } _gasStatus = true; Reset(); return Runner.Start(Module, Name); } public RState Monitor() { Runner.Run((int)GasStep.kStartGas, FlowMfc, CheckRange, 6000000) .End((int)GasStep.kEnd, NullFun, _delay_50ms); return Runner.Status; } public void Abort() { StopFlow(); } public bool FlowMfc() { for (int index = 0; index < _mfcSetPoint.Length; index++) { if (_mfcSetPoint[index] > 0) OpenPVNVlv(index, true); _chamber.FlowGas(index, _mfcSetPoint[index]); } return true; } private void OpenPVNVlv(int mfcIndex, bool on) { ValveType[] vlvs = new ValveType[] { ValveType.PV11, ValveType.PV21, ValveType.PV31, ValveType.PV41 }; if (mfcIndex < 4) { _chamber.OpenValve(vlvs[mfcIndex], on); } } private bool CheckRange() { if (_chamber.HasGasOutOfRange) { Stop("流气率越界"); _gasStatus = false; return true; } return false; } public void StopFlow() { Notify("Close valve and stop to flow MFC"); _chamber.OpenValve(ValveType.GasFinal, false); _chamber.StopAllGases(); OpenPVNVlv(0, false); OpenPVNVlv(1, false); OpenPVNVlv(2, false); OpenPVNVlv(3, false); } } }