| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742 | using Aitex.Core.RT.Device;using Aitex.Core.RT.Log;using Aitex.Core.RT.Routine;using Aitex.Core.RT.SCCore;using MECF.Framework.Common.Persistent.Reservoirs;using MECF.Framework.Common.RecipeCenter;using MECF.Framework.Common.Routine;using System;using System.Collections.Generic;using MECF.Framework.Common.Alarm;using CyberX8_Core;using CyberX8_RT.Devices.Facilities;using CyberX8_RT.Devices.Metal;using CyberX8_RT.Devices.PowerSupplier;using CyberX8_RT.Devices.Reservoir;using CyberX8_RT.Devices.Temperature;using MECF.Framework.Common.ToolLayout;using Aitex.Core.Util;namespace CyberX8_RT.Modules.Reservoir{    public class StandardHotReservoirInitializeRoutine : RoutineBase, IRoutine    {        private enum InitializeStep        {            AutoDiReplen,            CellPump,            WaitCellPump,            WaitRegulatePumpOn,            CheckCellFlow,            ManualCellByPass,            AutoCellManual,            AutoEnableCMM,            AutoEnableCMMWait,            AutoCMMFlowDelay,            AutoCMMFlowCheck,            AutoPHDetect,            AutoCellAutoFlow,            AutoCellAutoFlowDelay,            AutoCellAutoFlowCheck,            AutoCellAutoEnableHED,            AutoCellAutoEnableHEDDelay,            AutoCellAutoEnableHEDCheck,            AutoCellAutoCheckPowerSupplier,            AutoCellAutoLinmotReset,            AutoCellAutoLinmotResetCheck,            CellWSUnclamp,            End        }        #region 常量        private const string AUTO = "Auto";        private const string MANUAL = "Manual";        private const int ENABLE = 5;        #endregion        #region 内部变量        List<StandardHotMetalDevice> _metalDevices = new List<StandardHotMetalDevice>();        private double _cellFlowLowLimit;        private StandardHotReservoirDevice _reservoirDevice;        private ResRecipe _recipe;        private CellPowerSupplier _cellPowerSupplier;        private TemperatureController _temperatureController;        private int _autoHedDelay = 0;        private bool _isRegulatePump;        private int _cellFlowFaultHoldOffTime = 5000;        /// <summary>        /// CMM Check Flow延时        /// </summary>        private int _cmmFlowCheckDelay = 6;        /// <summary>        /// CMM Flow High Fault        /// </summary>        private double _cmmFlowHighFault;        /// <summary>        /// CMM Flow High Warning        /// </summary>        private double _cmmFlowHighWarning;        /// <summary>        /// CMM Flow High Warning        /// </summary>        private double _cmmFlowLowFault;        /// <summary>        /// CMM Flow High Warning        /// </summary>        private double _cmmFlowLowWarning;        /// <summary>        /// Reservoir Persistent        /// </summary>        private ReservoirsPersistentValue _persistentValue;        #endregion        /// <summary>        /// 构造函数        /// </summary>        /// <param name="module"></param>        public StandardHotReservoirInitializeRoutine(string module) : base(module)        {        }        /// <summary>        /// 中止        /// </summary>        public void Abort()        {            Runner.Stop("Manual Abort");        }        /// <summary>        /// 监控        /// </summary>        /// <returns></returns>        public RState Monitor()        {            //Cell Pump            Runner.RunIf(InitializeStep.AutoDiReplen, _recipe.DIReplenEnable, CheckFacilitiesDiReplenStatus, _delay_1ms)                .RunIf(InitializeStep.CellPump, !_isRegulatePump,CellsPumpOn, _delay_1ms)                .WaitWithStopConditionIf(InitializeStep.WaitCellPump, !_isRegulatePump, CheckPumpOnEndStatus, CheckPumpOnStopStatus)                .RunIf(InitializeStep.CellPump, _isRegulatePump, ReservoirPumpOn, _delay_1ms)                .WaitIf(InitializeStep.WaitCellPump, _isRegulatePump, CheckRegulatePumpOn,_delay_3s)                .DelayIf(InitializeStep.WaitRegulatePumpOn,_isRegulatePump, _cellFlowFaultHoldOffTime)                .Run(InitializeStep.CheckCellFlow, CheckCellFlow, _delay_1ms)                //Manual cell Bypass同时disable HED                .RunIf(InitializeStep.ManualCellByPass, _reservoirDevice.OperationMode == MANUAL, CellsByPassEnableHed, _delay_1ms)                //Auto 所有metal 处于Manual, cell Bypass,Enable HED,设置温度                .RunIf(InitializeStep.AutoCellManual, CheckAutoAndAllMetalManual(), AutoCellManualByPassEnableHed, CheckCellManualByPassAndTemperature, _delay_2s)                //Auto 同时recipe enable cmm,并检测CMM Flow                .RunIf(InitializeStep.AutoEnableCMM, CheckAutoEnableCMM(), AutoEnableCMM, _delay_1ms)                .WaitWithStopConditionIf(InitializeStep.AutoEnableCMMWait, CheckAutoEnableCMM(), () => { return _cellPowerSupplier.Status == RState.End; }                    , () => { return _cellPowerSupplier.Status == RState.Failed; }, _delay_5s)                .DelayIf(InitializeStep.AutoCMMFlowDelay, CheckAutoEnableCMM(), _cmmFlowCheckDelay * 1000)                .RunIf(InitializeStep.AutoCMMFlowCheck, CheckAutoEnableCMM(), CheckCMMTargetFlow, _delay_1ms)                //Auto 启动PH检测                .RunIf(InitializeStep.AutoPHDetect, _reservoirDevice.OperationMode == AUTO && ReservoirItemManager.Instance.GetReservoirItem(Module.ToString()).PHProbeType == "Standard", StartAutoPHDetect, _delay_1ms)                //Auto Cell Flow                .Run(InitializeStep.AutoCellAutoFlow, AllMetalSwitchFlow, _delay_1ms)                .Delay(InitializeStep.AutoCellAutoFlowDelay, 500)                .Run(InitializeStep.AutoCellAutoFlowCheck, AllMetalCheckFlow, _delay_1ms)                //Auto HED                .Run(InitializeStep.AutoCellAutoEnableHED, AutoHedOn, _delay_1ms)                .Delay(InitializeStep.AutoCellAutoEnableHEDDelay, _autoHedDelay)                .Run(InitializeStep.AutoCellAutoEnableHEDCheck, AutoHedSuccess, _delay_1ms)                //检验PowerSupplier通信                .Run(InitializeStep.AutoCellAutoCheckPowerSupplier, AutoMetalsPowerSupplierCommuncationStatus, _delay_1ms)                //Cell Linmot Reset                .RunIf(InitializeStep.AutoCellAutoLinmotReset, _reservoirDevice.OperationMode == AUTO, AutoMetalResetLinmot, _delay_1ms)                .WaitWithStopCondition(InitializeStep.AutoCellAutoLinmotResetCheck, CheckAutoMetalResetStatus, CheckAutoMetalResetStopStatus)                //Cell Unclamp                .Run(InitializeStep.CellWSUnclamp, MetalsWHUnclampOn, _delay_1ms)                .End(InitializeStep.End, ClearAlarmDataError, _delay_1ms);            return Runner.Status;        }        /// <summary>        /// 检验总Di有没有开        /// </summary>        /// <returns></returns>        private bool CheckFacilitiesDiReplenStatus()        {            SystemFacilities systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");            if (systemFacilities != null)            {                bool result = systemFacilities.DIReplenEnable;                if (!result)                {                    LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Facilities DiReplen is disable");                }                return result;            }            return false;        }        /// <summary>        /// Metals Pump On        /// </summary>        /// <returns></returns>        private bool CellsPumpOn()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                hotMetalDevice.OpenPump("", null);            }            return true;        }        /// <summary>        /// Reservoir Pump On        /// </summary>        /// <returns></returns>        private bool ReservoirPumpOn()        {            return _reservoirDevice.RegulatePumpOn("",null);        }        /// <summary>        /// Cell ByPass        /// </summary>        /// <returns></returns>        private bool CellsByPassEnableHed()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                hotMetalDevice.SwitchToBypass("", null);            }            _temperatureController.EnableOperation("", null);            return true;        }        /// <summary>        /// 检验metal Pump        /// </summary>        /// <returns></returns>        private bool CheckPumpOnEndStatus()        {            int totalCount = 0;            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.Status == RState.End)                {                    totalCount++;                }            }            if (totalCount >= _metalDevices.Count)            {                return true;            }            else            {                return false;            }        }        private bool CheckRegulatePumpOn()        {            bool result = _reservoirDevice.ReservoirData.RegulatePumpSignalIn;            return result;        }        /// <summary>        /// 检验metal Pump停止状态        /// </summary>        /// <returns></returns>        private bool CheckPumpOnStopStatus()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.Status == RState.Failed)                {                    PumpOffMetals();                    return true;                }            }            return false;        }        /// <summary>        /// Pump Off All Metals        /// </summary>        private void PumpOffMetals()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                hotMetalDevice.ClosePump("",null);            }        }        /// <summary>        /// 检验Cell Flow        /// </summary>        /// <returns></returns>        private bool CheckCellFlow()        {            double toatalCellFlow = 0;            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice!=null && hotMetalDevice.MetalDeviceData!=null)                {                    toatalCellFlow += hotMetalDevice.MetalDeviceData.CellFlow;                }            }            if (toatalCellFlow < _cellFlowLowLimit)            {                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} Cell flow:{toatalCellFlow} is less than config item CellFlowLowLimit:{_cellFlowLowLimit}");                return false;            }            return true;        }        /// <summary>        /// 检验所有Metal处于Manual        /// </summary>        /// <returns></returns>        private bool CheckAutoAndAllMetalManual()        {            if (_reservoirDevice.OperationMode != AUTO)            {                return false;            }            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.OperationMode != MANUAL)                {                    return false;                }            }            return true;        }        /// <summary>        /// Auto 同时Metal均为Manual,Bypass metal,enable HED,设置温度        /// </summary>        /// <returns></returns>        private bool AutoCellManualByPassEnableHed()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                hotMetalDevice.SwitchToBypass("", null);            }            _temperatureController.EnableOperation("", null);            _temperatureController.SetTargetTemperatureOperation("", new object[] { _recipe.TemperatureSetPoint });            return true;        }        /// <summary>        /// 检验cell By Pass和温度        /// </summary>        /// <returns></returns>        private bool CheckCellManualByPassAndTemperature()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.MetalDeviceData.Circulation)                {                    return false;                }            }            if (_temperatureController.TemperatureData.ControlOperationModel == 0)            {                return false;            }            if (Math.Abs(_recipe.TemperatureSetPoint - _temperatureController.TemperatureData.TargetTemperature) >= 0.1 * _recipe.TemperatureSetPoint)            {                return false;            }            return true;        }        /// <summary>        /// 检验 Auto ,同时Enable CMM        /// </summary>        /// <returns></returns>        private bool CheckAutoEnableCMM()        {            if (_reservoirDevice.OperationMode != AUTO || ReservoirItemManager.Instance.GetReservoirItem(Module.ToString()).CMMType != "Standard")            {                return false;            }            return _recipe.CMMEnable;        }        /// <summary>        /// 自动Enable CMM        /// </summary>        /// <returns></returns>        private bool AutoEnableCMM()        {            return _cellPowerSupplier.SetCurrentAndOutput(_recipe.CMMCurrentSetPoint);        }        /// <summary>        /// 检验目标Flow是否到达设定值        /// </summary>        /// <returns></returns>        private bool CheckCMMTargetFlow()        {            double flow = _reservoirDevice.ReservoirData.Flow;            if (flow < _cmmFlowLowFault)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{Module} CMM flow:{flow} is less than config item CMMFlowLowFault:{_cmmFlowLowFault}");                if (_cellPowerSupplier.PowerSupplierData.Enabled) _cellPowerSupplier.DisableOperation("", null);                return false;            }            else if (flow < _cmmFlowLowWarning)            {                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} CMM flow:{flow} is less than config item CMMFlowLowWarning:{_cmmFlowLowWarning}");            }            else if (flow > _cmmFlowHighFault)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"{Module} CMM flow:{flow} is over config item CMMFlowHighFault:{_cmmFlowLowFault}");                if (_cellPowerSupplier.PowerSupplierData.Enabled) _cellPowerSupplier.DisableOperation("", null);                return false;            }            else if (flow > _cmmFlowHighWarning)            {                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} CMM flow:{flow} is over config item CMMFlowHighWarning:{_cmmFlowLowWarning}");            }            return true;        }        /// <summary>        /// 启动自动检测        /// </summary>        /// <returns></returns>        private bool StartAutoPHDetect()        {            return _reservoirDevice.StartDetectPHValve();        }        /// <summary>        /// 检验所有Metal处于Manual        /// </summary>        /// <returns></returns>        private bool CheckAutoAndAllMetalAuto()        {            if (_reservoirDevice.OperationMode != AUTO)            {                return false;            }            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.OperationMode != AUTO)                {                    return false;                }            }            return true;        }        /// <summary>        /// 所有Metal切换Flow        /// </summary>        /// <returns></returns>        private bool AllMetalSwitchFlow()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice != null && !hotMetalDevice.IsDisable && hotMetalDevice.IsAuto)                {                    bool result = hotMetalDevice.SwitchToFlow("", null);                    if (!result)                    {                        return false;                    }                }            }            return true;        }        /// <summary>        /// 检验所有Metal Flow检验        /// </summary>        /// <returns></returns>        private bool AllMetalCheckFlow()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice != null && !hotMetalDevice.IsDisable && hotMetalDevice.IsAuto)                {                    double cellFlow = hotMetalDevice.MetalDeviceData.CellFlow;                    if (cellFlow <= _recipe.CAFlowRateErrorLow)                    {                        LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"cell {hotMetalDevice.Name} flow {cellFlow} is less than {_recipe.CAFlowRateErrorLow}");                        return false;                    }                    else if (cellFlow <= _recipe.CAFlowRateWarningLow)                    {                        LOG.WriteLog(eEvent.WARN_METAL, Module, $"cell {hotMetalDevice.Name} flow {cellFlow} is less than {_recipe.CAFlowRateWarningLow}");                    }                }            }            return true;        }        /// <summary>        /// 自动HED On        /// </summary>        /// <returns></returns>        private bool AutoHedOn()        {            //double hedFlow = _reservoirDevice.ReservoirData.HedFlow;            //bool result = hedFlow > _hedFlowLowLimit;            //if (!result)            //{            //    LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"HED Flow {hedFlow} is less than {_hedFlowLowLimit}");            //    return false;            //}            _autoHedDelay = _delay_2s;            _temperatureController.EnableOperation("", null);            _temperatureController.SetTargetTemperatureOperation("", new object[] { _recipe.TemperatureSetPoint });            return true;        }        /// <summary>        /// 检验Hed是否成功        /// </summary>        /// <returns></returns>        private bool AutoHedSuccess()        {            if (_temperatureController.TemperatureData.ControlOperationModel == 0)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Temperature control is disable");                return false;            }            if (Math.Abs(_recipe.TemperatureSetPoint - _temperatureController.TemperatureData.TargetTemperature) >= 0.1 * _recipe.TemperatureSetPoint)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"recipe temperature {_recipe.TemperatureSetPoint} is not match temperature target point {_temperatureController.TemperatureData.TargetTemperature}");                return false;            }            return true;        }        /// <summary>        /// 检验Metal A/B PowerSupplier通信状态        /// </summary>        /// <returns></returns>        private bool AutoMetalsPowerSupplierCommuncationStatus()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (!hotMetalDevice.IsDisable && hotMetalDevice.IsAuto)                {                    if (hotMetalDevice.SideAPowerSupplier == null)                    {                        LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Side A PowerSupplier is null");                        return false;                    }                    if (hotMetalDevice.SideBPowerSupplier == null)                    {                        LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Side B PowerSupplier is null");                        return false;                    }                    if (!hotMetalDevice.SideAPowerSupplier.IsConnected)                    {                        LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Side A PowerSupplier {hotMetalDevice.SideAPowerSupplier.Name} is not connected");                        return false;                    }                    if (!hotMetalDevice.SideBPowerSupplier.IsConnected)                    {                        LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Side B PowerSupplier {hotMetalDevice.SideBPowerSupplier.Name} is not connected");                        return false;                    }                }            }            return true;        }        /// <summary>        /// Auto Metal reset linmot        /// </summary>        /// <returns></returns>        private bool AutoMetalResetLinmot()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.OperationMode == AUTO)                {                    bool result = hotMetalDevice.ResetLinmot();                    if (!result)                    {                        LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Reset linmot error");                        return false;                    }                }            }            return true;        }        /// <summary>        /// Auto Metal reset linmot        /// </summary>        /// <returns></returns>        private bool CheckAutoMetalResetStatus()        {            if (_reservoirDevice.OperationMode == MANUAL)            {                return true;            }            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.OperationMode == AUTO)                {                    bool result = hotMetalDevice.CheckLinmotRoutineEnd();                    if (!result)                    {                        return false;                    }                }            }            return true;        }        /// <summary>        /// Auto Metal reset linmot        /// </summary>        /// <returns></returns>        private bool CheckAutoMetalResetStopStatus()        {            if (_reservoirDevice.OperationMode == MANUAL)            {                return false;            }            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                if (hotMetalDevice.OperationMode == AUTO)                {                    bool result = hotMetalDevice.CheckLinmotRoutineError();                    if (result)                    {                        return true;                    }                }            }            return false;        }        /// Metal WS Unclamp        /// </summary>        /// <returns></returns>        private bool MetalsWHUnclampOn()        {            for (int i = 0; i < _metalDevices.Count; i++)            {                StandardHotMetalDevice hotMetalDevice = _metalDevices[i];                bool result = hotMetalDevice.WaferHolderClampOff("", null);                if (!result)                {                    return false;                }            }            return true;        }        /// <summary>        /// 清除alarm界面相关的dataerror        /// </summary>        private bool ClearAlarmDataError()        {            AlarmListManager.Instance.RemoveDataError(Module);            _reservoirDevice.ClearErrorLogSet(Module); //清除device里面的ErrorLogSet            return true;        }        /// <summary>        /// 启动        /// </summary>        /// <param name="objs"></param>        /// <returns></returns>        public RState Start(params object[] objs)        {            List<MetalCellDevice> lstDevice = (List<MetalCellDevice>)objs[0];            _metalDevices.Clear();            for (int i = 0; i < lstDevice.Count; i++)            {                _metalDevices.Add((StandardHotMetalDevice)lstDevice[i]);            }            if (ReservoirItemManager.Instance.GetReservoirItem(Module.ToString()).PumpType == "Regulate")             {                _isRegulatePump = true;            }            _reservoirDevice = DEVICE.GetDevice<StandardHotReservoirDevice>(Module.ToString());            _reservoirDevice.ClearErrorLogSet(Module);            _recipe = _reservoirDevice.Recipe;            if (!(objs[1] is null))            {                _cellPowerSupplier = (CellPowerSupplier)objs[1];            }            _temperatureController = (TemperatureController)objs[2];            _cellFlowLowLimit = SC.GetValue<double>($"Reservoir.{Module}.CellFlowLowLimit");            if (!CheckPreCondition())            {                return RState.Failed;            }            if (ReservoirItemManager.Instance.GetReservoirItem(Module.ToString()).CMMType == "Standard")            {                _cmmFlowHighFault = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowHighFault");                _cmmFlowHighWarning = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowHighWarning");                _cmmFlowLowFault = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowLowFault");                _cmmFlowLowWarning = SC.GetValue<double>($"Reservoir.{Module}.CMMFlowLowWarning");                _cmmFlowCheckDelay = SC.GetValue<int>($"Reservoir.{Module}.CMMFlowCheckDelaySeconds");            }            if (_recipe.CMMEnable)            {                _persistentValue = ReservoirsPersistentManager.Instance.GetReservoirsPersistentValue(Module);            }            _cellFlowFaultHoldOffTime = SC.GetValue<int>("Metal.CellFlowFaultHoldOffTime");            return Runner.Start(Module, "Start Initialize");        }        /// <summary>        /// 检验前置条件        /// </summary>        /// <returns></returns>        private bool CheckPreCondition()        {            if (_recipe == null)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "recipe is null");                return false;            }            if (_recipe.CMMEnable && _cellPowerSupplier != null && !_cellPowerSupplier.IsConnected)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "PowerSupplier is not connected");                return false;            }            if (!_temperatureController.IsConnected)            {                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "Temperature is not connected");                return false;            }            WaterLevelMonitor();            return true;        }        /// <summary>        /// WaterLevelMonitor        /// </summary>        private bool WaterLevelMonitor()        {            ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(Module);            //触发水位过高或者过低将reservoir切成error            if (_reservoirDevice.ReservoirData.WaterLevel < SC.GetValue<double>($"Reservoir.{Module}.LowLevel"))            {                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"WaterLevel low is Activate");                return false;            }            else if (_reservoirDevice.ReservoirData.WaterLevel > SC.GetValue<double>($"Reservoir.{Module}.HighLevel"))            {               LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"WaterLevel:{_reservoirDevice.ReservoirData.WaterLevel} is larger than  HighLevel Config:{SC.GetValue<double>($"Reservoir.{Module}.HighLevel")}");               return false;            }            //水位触发reservoir里面的high/low将对应的reservoir切成error            if (_reservoirDevice.ReservoirData.Level < _recipe.CALevelErrorLow)            {                                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Current level:{_reservoirDevice.ReservoirData.Level} is lower than recipe's CA Errorlow paramater:{_recipe.CALevelErrorLow}");                return false;            }            else if (_reservoirDevice.ReservoirData.Level > _recipe.CALevelErrorHigh)            {                             LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"Current level:{_reservoirDevice.ReservoirData.Level} is larger than recipe's CA ErrorHigh paramater:{_recipe.CALevelErrorHigh}");                return false ;            }            return true;        }    }}
 |