using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using Venus_RT.Devices; using MECF.Framework.Common.Routine; using Venus_Core; using Aitex.Core.RT.DataCenter; namespace Venus_RT.Modules.PMs { class VentRoutine : PMRoutineBase, IRoutine { private enum VentStep { kISODelay, kClosePVValves, kOpenVentValves, kDelay_2, kCloseVentValves, } //private int _ventTime; private double _ventTimeDelay = 1; private int _checkATMTimeout = 90; public bool VentingFlag=> _ventingflag; private bool _ventingflag = false; public VentRoutine(JetPMBase chamber) : base(chamber) { Name = "PM Vent"; } public RState Start(params object[] objs) { if (CheckLid() && CheckSlitDoor() && CheckCDA() && CheckATM()) { Reset(); _chamber.CloseValves(); _chamber.OpenValve(ValveType.TurboPumpPumping, true); _chamber.OpenValve(ValveType.TurboPumpPurge, true); _chamber.OpenValve(ValveType.PVN22, true); _chamber.OpenValve(ValveType.GasFinal, true); _checkATMTimeout = SC.GetValue($"{Module}.CheckATMTimeout"); _ventTimeDelay = SC.GetValue($"{Module}.OverVentTime"); if (Runner.Start(Module, Name) == RState.Running) { _ventingflag = true; return RState.Running; } else { _ventingflag = false; return RState.Failed; } } return RState.Failed; } public RState Monitor() { Runner.Delay(VentStep.kISODelay, _delay_2s) .Run(VentStep.kClosePVValves, ClosePVValves, _delay_10s) .Run(VentStep.kOpenVentValves, HOFs.WrapAction(_chamber.OpenValve, ValveType.N2, true), ()=> { return _chamber.IsATM; }, _checkATMTimeout * 1000) .Delay(VentStep.kDelay_2, (int)_ventTimeDelay) .End(VentStep.kCloseVentValves, CloseVentGasFinalValves, _delay_2s); _ventingflag = Runner.Status == RState.Running; return Runner.Status; } private bool ClosePVValves() { _chamber.OpenValve(ValveType.Guage, false); if (_chamber.PendulumValveIsOpen()) { return _chamber.TurnPendulumValve(false); } return true; } private bool CloseVentGasFinalValves() { _chamber.OpenValve(ValveType.GasFinal, false); _chamber.OpenValve(ValveType.N2, false); return true; } public void Abort() { CloseAllValves(); } } }