using Aitex.Core.RT.Event; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using VirgoRT.Devices; namespace VirgoRT.Modules.PMs { class StartPumpRoutine : PMRoutineBase, IRoutine { private enum StartPumpSequence { kCheckForelinePressure, kCloseSoftPumpValve, kFastPumpValve, kCloseValves, kEnd } private double _chamberForelinePressureThreshold; private int _chamberForelinePressureTimeout; public StartPumpRoutine(JetPM chamber) : base(chamber) { Name = "LaunchPump"; bUINotify = true; } public void Terminate() { } public Result Start(params object[] objs) { try { if (_chamber.IsPumpRunning) { Stop("泵已经运行"); return Result.FAIL; } Reset(); _chamberForelinePressureThreshold = SC.GetValue($"{Module}.DryPump.ChamberForelinePressureThreshold"); _chamberForelinePressureTimeout = SC.GetValue($"{Module}.DryPump.ChamberForelinePressureTimeout"); _chamber.StartPump(true); _chamber.SetValveOnOff(ValveType.FAST_PUMP, false); _chamber.SetValveOnOff(ValveType.SOFT_PUMP, false); Notify("开始"); return Result.RUN; } catch { return Result.FAIL; } } public Result Monitor() { try { CheckForeline((int)StartPumpSequence.kCheckForelinePressure, (uint)_chamberForelinePressureThreshold, _chamberForelinePressureTimeout); End((int)StartPumpSequence.kEnd); } catch (RoutineBreakException) { return Result.RUN; } catch (RoutineFaildException) { Notify("出错 "); return Result.FAIL; } catch (System.Exception ex) { Stop(ex.Message); return Result.FAIL; } Notify("结束"); return Result.DONE; } public override void Abort() { _chamber.CloseValves(); _chamber.StartPump(false); } } }