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(JetPM chamber) : base(chamber) { Name = "Gas Flow"; } public RState Start(params object[] objs) { if (!_chamber.IsFastPumpOpened) { StopFlow(); Stop("Pump 阀没有打开"); 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; return Runner.Start(Module, Name); } public RState Monitor() { Runner.Run((int)GasStep.kStartGas, FlowMfc, CheckRange, _delay_1s) .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++) { _chamber.FlowGas(index, _mfcSetPoint[index]); } return true; } private bool CheckRange() { if (_chamber.HasGasOutOfRange) { Stop("流气率越界"); _gasStatus = false; return false; } return true; } public void StopFlow() { Notify("Close valve and stop to flow MFC"); _chamber.OpenValve(ValveType.GasFinal, false); _chamber.StopAllGases(); } } }