using System.Diagnostics; using Venus_RT.Devices; using Aitex.Core.RT.Log; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.Routine; using System; namespace Venus_RT.Modules.PMs { class PMRoutineBase { public ModuleName Module { get; set; } public string Name { get; set; } public bool NullFun() => true; protected readonly JetPM _chamber; protected Stopwatch _timer = new Stopwatch(); protected RoutineRunner Runner = new RoutineRunner(); protected readonly int _delay_50ms = 50; protected readonly int _delay_1s = 1000; protected readonly int _delay_2s = 2000; protected readonly int _delay_3s = 3000; protected readonly int _delay_4s = 4000; protected readonly int _delay_5s = 5000; protected readonly int _delay_10s = 10000; public PMRoutineBase(JetPM chamber) { Module = chamber.Module; _chamber = chamber; Runner.Reset(); } protected void Notify(string message) { LOG.Write(eEvent.EV_ROUTINE_NOTIFY, Module, Name, message); } protected void Stop(string failReason) { LOG.Write(eEvent.ERR_ROUTINE_FAILED, Module, Name, failReason); } public void Reset() { Runner.Reset(); _timer.Reset(); } public bool CheckLid() { if (!_chamber.IsLidClosed) { this.Stop("Chamber 盖子必须关"); return false; } return true; } public bool CheckLidLoadLock() { if (!_chamber.IsLidLoadlockClosed) { this.Stop("LoadLock 盖子必须关"); return false; } return true; } protected bool CheckSlitDoor() { if (!_chamber.IsSlitDoorClosed) { Stop("传送门必须关"); return false; } return true; } protected bool CheckDryPump() { if (!_chamber.IsPumpRunning) { Stop("干泵没有启动"); return false; } if (_chamber.HasPumpError) { Stop("干泵状态有错误"); return false; } return true; } protected bool CheckTurboPump() { if (!_chamber.IsTurboPumpRunning) { Stop("分子泵没有启动"); return false; } if (_chamber.HasTurboPumpError) { Stop("分子泵状态有错误"); return false; } return true; } protected bool CheckCDA() { if (!_chamber.IsCDA_OK) { Stop("CDA 压力信号不正确"); return false; } return true; } public bool CheckATM() { if (_chamber.IsATM) { this.Stop("Chamber 是ATM状态"); return false; } return true; } protected bool CloseAllValves() { Notify("关闭所有的阀门"); _chamber.CloseValves(); return true; } protected bool TurnValve(ValveType vlv, bool bOpen) { _chamber.OpenValve(vlv, bOpen); Notify($"{(bOpen ? "打开" : "关闭")} {vlv} 阀"); return true; } protected bool CheckValve(ValveType vlv, bool bOpen) { if (vlv == ValveType.FastPump) return _chamber.IsFastPumpOpened == bOpen; else if (vlv == ValveType.SoftPump) return _chamber.IsSoftPumpOpened == bOpen; return true; } protected bool SetCoolantTemp(double target, double offset) { if (!_chamber.CheckChillerStatus()) { Stop("Chiller status error"); return false; } if (_chamber.CoolantOutletTempFB > target) { Notify($"水冷当前温度{_chamber.CoolantOutletTempFB} ℃, 大于目标 {target.ToString()} ℃"); } _chamber.HeatChiller(target, offset); Notify($"检查水冷温度值,当前温度{_chamber.CoolantOutletTempFB} ℃, 目标 {target.ToString()} ℃"); return true; } protected bool CheckCoolantTemp(double target, double tolerance) { return Math.Abs(_chamber.CoolantOutletTempFB - target) <= tolerance; } } }