using Aitex.Core.RT.Event; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using JetVirgoPM.Devices; using MECF.Framework.Common.Routine; namespace JetVirgoPM.PMs.Routines { class StartPumpRoutine : PMRoutineBase, IStepRoutine { private enum StartPumpSequence { kCheckForelinePressure, kCloseSoftPumpValve, kFastPumpValve, kCloseValves, kEnd } private double _chamberForelinePressureThreshold; private int _chamberForelinePressureTimeout; public StartPumpRoutine(JetDualPM chamber) : base(chamber) { Name = "LaunchPump"; bUINotify = true; } public void Terminate() { } public RState Start(params object[] objs) { try { if (_chamber.IsPumpRunning) { Stop("泵已经运行"); return RState.Failed; } Reset(); _chamberForelinePressureThreshold = SC.GetValue($"{Module}.DryPump.ChamberForelinePressureThreshold"); _chamberForelinePressureTimeout = SC.GetValue($"{Module}.DryPump.ChamberForelinePressureTimeout"); _chamber.StartPump(true); _chamber.OpenValve(ValveType.FAST_PUMP, false); _chamber.OpenValve(ValveType.SOFT_PUMP, false); return Runner.Start(_chamber.Module.ToString(), Name); } catch { return RState.Failed; } } public RState Monitor() { Runner.Run(StartPumpSequence.kCheckForelinePressure, HOFs.Apply(Foreline, (uint)_chamberForelinePressureThreshold), HOFs.Apply(CheckForeline, (uint)_chamberForelinePressureThreshold), _chamberForelinePressureTimeout * 1000) .End(StartPumpSequence.kEnd, EndFunc, _delay_0s); return Runner.Status; } public override void Abort() { _chamber.CloseValves(); _chamber.StartPump(false); } } }