using System; using Aitex.Core.Common.DeviceData; using Aitex.Core.RT.Event; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using JetVirgoPM.Devices; namespace JetVirgoPM.PMs.Routines { class GasFlowRoutine : PMRoutineBase, IStepRoutine { private enum RoutineStep { CheckPressure, StartFlow, StopFlow, CheckStable, End, }; public bool _gasStatus = false; private double _pressureAlarmRange; private double _pressureAlarmTime; //private double _gasFlowAlarmRange; //private double _gasFlowAlarmTime; private double[] _mfcSetPoint = new double[6]; public GasFlowRoutine(JetDualPM chamber) : base(chamber) { Name = "Flow gas"; bUINotify = true; } public RState Start(params object[] objs) { if (!_chamber.IsFastPumpOpened) { StopFlow2(); Stop("Pump 阀没有打开"); return RState.Failed; } Reset(); _pressureAlarmRange = SC.GetValue($"{Module}.GasFlowPressureAlarmRange"); _pressureAlarmTime = SC.GetValue($"{Module}.GasFlowPressureAlarmTime"); // open process final valve and flow Notify("Open valve and flow mfc"); _chamber.OpenValve(ValveType.PURGE, true); _chamber.OpenValve(ValveType.PROCESS, true); int i = 0; foreach (object o in objs) { _mfcSetPoint[i++] = (double)o; } FlowMfc2((int)RoutineStep.StartFlow, _mfcSetPoint); _gasStatus = true; return Runner.Start(_chamber.Module.ToString(), Name); } public RState Monitor() { if (_chamber.HasGasOutOfRange) { Stop("流气率越界"); _gasStatus = false; return RState.Failed; } Runner.End(RoutineStep.End, EndFunc, _delay_50ms); return Runner.Status; } public void FlowMfc2(int id, double[] mfcValues) { string reason = string.Empty; for (int index = 0; index < mfcValues.Length; index++) { _chamber.FlowGas(index, mfcValues[index]); } } public void StopFlow2() { Notify("Close valve and stop to flow MFC"); _chamber.OpenValve(ValveType.PURGE, false); _chamber.OpenValve(ValveType.PROCESS, false); _chamber.StopAllGases(); } public override void Abort() { this.StopFlow2(); _gasStatus = false; } } }