| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 | using Aitex.Core.RT.Routine;using Aitex.Core.RT.SCCore;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Venus_Core;using Venus_RT.Devices;namespace Venus_RT.Modules.PMs{    class VenusVentRoutine : PMRoutineBase, IRoutine    {        private enum VentStep        {            vISODelay,            vClosePendulumValve,            vCloseTurboPurge,            vCloseTurboPumping,            vClosePVValves,            vDelayForPendulumValve,            vOpenVentValves,            vDelay_2,            vCloseVentValves,        }        //private int _ventTime;        private double _ventTimeDelay = 1;        private int _checkATMTimeout = 90;        public bool VentingFlag => _ventingflag;        private bool _ventingflag = false;        public VenusVentRoutine(JetPMBase chamber) : base(chamber)        {            Name = "PM Vent";        }        public RState Start(params object[] objs)        {            if (CheckLid() &&                CheckSlitDoor() &&                CheckCDA() &&                CheckATM())            {                Reset();                _checkATMTimeout = SC.GetValue<int>($"{Module}.CheckATMTimeout");                _ventTimeDelay = SC.GetValue<int>($"{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.vISODelay,                _delay_2s)                .Run(VentStep.vClosePendulumValve,          PendulumValveClose,         () => { return !_chamber.PendulumValveIsOpen(); })                .Delay(VentStep.vDelayForPendulumValve,     500)                .Run(VentStep.vCloseTurboPurge,             CloseTurboPurge,            _delay_3s)                .Run(VentStep.vCloseTurboPumping,           CloseTurboPumping,          _delay_3s)                .Run(VentStep.vClosePVValves,               ClosePVValves,              _delay_3s)                .Run(VentStep.vOpenVentValves,              OpenValve,                  () => { return _chamber.IsATM; }, _checkATMTimeout * 1000)                .Delay(VentStep.vDelay_2,                   (int)_ventTimeDelay)                .End(VentStep.vCloseVentValves,             CloseVentGasFinalValves,    _delay_2s);            _ventingflag = Runner.Status == RState.Running;            return Runner.Status;        }        private bool CloseTurboPumping()        {            _chamber.OpenValve(ValveType.TurboPumpPumping, false);            return true;        }        private bool CloseTurboPurge()        {            _chamber.OpenValve(ValveType.TurboPumpPurge, false);            return true;        }        private bool PendulumValveClose()        {            _chamber.TurnPendulumValve(false);            return true;        }        private bool ClosePVValves()        {            _chamber.OpenValve(ValveType.Guage, false);            if (_chamber.PendulumValveIsOpen())            {                return _chamber.TurnPendulumValve(false);            }            _chamber.OpenValve(ValveType.TurboPumpPumping, false);            _chamber.OpenValve(ValveType.TurboPumpPurge, false);            _chamber.OpenValve(ValveType.FastPump, false);            _chamber.OpenValve(ValveType.SoftPump, false);            return true;        }        private bool OpenValve()        {            _chamber.OpenValve(ValveType.PVN22, true);            _chamber.OpenValve(ValveType.N2, true);            _chamber.OpenValve(ValveType.GasFinal, true);            return true;        }        private bool CloseVentGasFinalValves()        {            if (_chamber.ChamberType == JetChamber.VenusSE || _chamber.ChamberType == JetChamber.VenusDE)            {                _chamber.OpenValve(ValveType.PVN22, false);            }            _chamber.OpenValve(ValveType.GasFinal, false);            _chamber.OpenValve(ValveType.N2, false);            return true;        }        public void Abort()        {            CloseAllValves();        }    }}
 |