Browse Source

Revise Reservoir UI of MaxOnTime unit; Add DIValveMaxOnTime check function;

niuyx 2 weeks ago
parent
commit
c257cf3011

+ 3 - 2
CyberX8_MainPages/ViewModels/StandardHotReservoirsViewModel.cs

@@ -459,7 +459,7 @@ namespace CyberX8_MainPages.ViewModels
         public bool IsDiReplenFault
         {
             get { return _isDiReplenFault; }
-            set { SetProperty(ref _hedFlowIsOn, value); }
+            set { SetProperty(ref _isDiReplenFault, value); }
         }
         /// <summary>
         /// Safety数据
@@ -792,6 +792,7 @@ namespace CyberX8_MainPages.ViewModels
             _rtDataKeys.Add($"{Module}.PumpSpeed");
             _rtDataKeys.Add($"{Module}.IsRegulatePump");
             _rtDataKeys.Add($"{Module}.IsCMMConfig");
+            _rtDataKeys.Add($"{Module}.IsDIReplenInFault");
             if (_timer == null)
             {
                 _timer = new DispatcherTimer();
@@ -1159,7 +1160,7 @@ namespace CyberX8_MainPages.ViewModels
                         //HedFlow管流
                         HEDFlowIsOn = (ReservoirData.HedFlow > 0) ? true : false;
                         //DIReplenFault
-                        IsDiReplenFault = false;
+                        IsDiReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault");
 
                         IsError = State== "Error" ? true : false;
                     }

+ 1 - 1
CyberX8_MainPages/Views/ReservoirsAnolyteView.xaml

@@ -126,7 +126,7 @@
                         <Label Content="Max On Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
                     </Grid>
                     <Border Grid.Row="4" Background="Black" Width="130" Margin="0 -3 0 0">
-                        <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} min}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Border>
                     <Grid Grid.Row="5">
                         <Label Content="Manual Fill Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />

+ 1 - 1
CyberX8_MainPages/Views/ReservoirsCatholyteView.xaml

@@ -112,7 +112,7 @@
                             <Label Content="Max On Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
                         </Grid>
                         <Border Grid.Row="4" Background="Black" Width="130" Margin="0 -3 0 0">
-                            <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} s}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                            <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                         </Border>
                         <Grid Grid.Row="5">
                             <Label Content="Manual Fill Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />

+ 2 - 2
CyberX8_MainPages/Views/StandardHotReservoirsView.xaml

@@ -392,7 +392,7 @@ Visibility="{Binding IsError,Converter={StaticResource boolToVisibility2}}" Canv
                             <Label Content="Total On Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
                         </Grid>
                         <Border Grid.Row="1" Background="Black" Width="130" Margin="0 -3 0 0">
-                            <TextBlock Text="{Binding ReservoirsPersistent.TotalReplen}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                            <TextBlock Text="{Binding ReservoirsPersistent.TotalReplen,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                         </Border>
                         <Grid Grid.Row="2">
                             <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Grid.Column="1" Height="30" Width="130" HorizontalAlignment="Center" VerticalAlignment="Bottom"  Content="Reset Total" Command="{Binding ResetTotalCommand}"></Button>
@@ -401,7 +401,7 @@ Visibility="{Binding IsError,Converter={StaticResource boolToVisibility2}}" Canv
                             <Label Content="Max On Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
                         </Grid>
                         <Border Grid.Row="4" Background="Black" Width="130" Margin="0 -3 0 0">
-                            <TextBlock Text="{Binding DIValveMaxOnTime}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                            <TextBlock Text="{Binding DIValveMaxOnTime,StringFormat={}{0} sec}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                         </Border>
                         <Grid Grid.Row="5">
                             <Label Content="Manual Fill Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />

+ 59 - 24
CyberX8_RT/Devices/Reservoir/CompactMembranReservoirDevice.cs

@@ -269,6 +269,10 @@ namespace CyberX8_RT.Devices.Reservoir
         /// 用于控制打印错误log
         /// </summary>
         private HashSet<string> errorLogSet = new HashSet<string>();
+        /// <summary>
+        /// 累计补水超时
+        /// </summary>
+        private bool _diReplenMaxTimeOut;
         #endregion
 
         #region 属性
@@ -328,6 +332,13 @@ namespace CyberX8_RT.Devices.Reservoir
         /// ReservoirCounterByPassFlow
         /// </summary>
         public CounterFlowData ReservoirCounterByPassFlow { get { return _reservoirCounterByPassFlow; } }
+        /// <summary>
+        /// 补水累计超时
+        /// </summary>
+        public bool DiReplenMaxTimeOut
+        {
+            get { return _diReplenMaxTimeOut; }
+        }
         #endregion
         /// <summary>
         /// 初始化成功清除对应的错误log
@@ -526,6 +537,13 @@ namespace CyberX8_RT.Devices.Reservoir
 
         #region Operation
         /// <summary>
+        /// DI Replen超时
+        /// </summary>
+        private void DiReplenTimeOutOpeartion(bool timeOutFlag)
+        {
+            _diReplenMaxTimeOut = timeOutFlag;
+        }
+        /// <summary>
         /// 重置时长
         /// </summary>
         /// <param name="cmd"></param>
@@ -533,6 +551,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <returns></returns>
         private bool ResetTotalTime(string cmd, object[] objs)
         {
+            _diReplenMaxTimeOut = false;
             _persistentValue.TotalReplen = 0;
             _persistentValue.LastTotalReplen = 0;
             ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
@@ -1479,6 +1498,18 @@ namespace CyberX8_RT.Devices.Reservoir
                 LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"current operation is {_currentOperation},cannot execute {direplenOperation}");
                 return false;
             }
+            ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(Module);
+            if (!reservoirEntity.IsInitialized)
+            {
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} is not initialized. Can't start DiReplen");
+                return false;
+            }
+            if (DiReplenMaxTimeOut)
+            {
+                double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTime");
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
+                return false;
+            }
             bool result = direplenOn("", null);
             if (result)
             {
@@ -2328,34 +2359,36 @@ namespace CyberX8_RT.Devices.Reservoir
             //补水监控
             if (_direplenHelper != null)
             {
-                _direplenHelper.MonitorPeriodTime();
-
-                if (_currentOperation == ReservoirOperation.ManualANDiReplen)
+                _direplenHelper.MonitorPeriodTime(DiReplenTimeOutOpeartion);
+                if (!_diReplenMaxTimeOut)
                 {
-                    bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, ANDiReplenOff);
-                    if (result)
+                    if (_currentOperation == ReservoirOperation.ManualANDiReplen)
                     {
-                        _currentOperation = ReservoirOperation.None;
+                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, ANDiReplenOff, DiReplenTimeOutOpeartion);
+                        if (result)
+                        {
+                            _currentOperation = ReservoirOperation.None;
+                        }
                     }
-                }
-                if (_currentOperation == ReservoirOperation.ManualCADiReplen)
-                {
-                    bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, CADiReplenOff);
-                    if (result)
+                    if (_currentOperation == ReservoirOperation.ManualCADiReplen)
                     {
-                        _currentOperation = ReservoirOperation.None;
+                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, CADiReplenOff, DiReplenTimeOutOpeartion);
+                        if (result)
+                        {
+                            _currentOperation = ReservoirOperation.None;
+                        }
                     }
-                }
-                if (_currentOperation == ReservoirOperation.AutoANDiReplen)
-                {
-                    AutoDiReplenMonitor(ANDiReplenOff, _reservoirData.ANLevel, _resRecipe.ReservoirANLevel, _resRecipe.ANDIReplenEnable,
-                        _resRecipe.ANDIReplenTimeRate, _resRecipe.ANDIReplenCurrentRate);
-                }
-                if (_currentOperation == ReservoirOperation.AutoCADiReplen)
-                {
-                    AutoDiReplenMonitor(CADiReplenOff, _reservoirData.CALevel, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
-                        _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate);
-                }
+                    if (_currentOperation == ReservoirOperation.AutoANDiReplen)
+                    {
+                        AutoDiReplenMonitor(ANDiReplenOff, _reservoirData.ANLevel, _resRecipe.ReservoirANLevel, _resRecipe.ANDIReplenEnable,
+                            _resRecipe.ANDIReplenTimeRate, _resRecipe.ANDIReplenCurrentRate);
+                    }
+                    if (_currentOperation == ReservoirOperation.AutoCADiReplen)
+                    {
+                        AutoDiReplenMonitor(CADiReplenOff, _reservoirData.CALevel, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
+                            _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate);
+                    }
+                }        
             }
             //计算AN/CA level的平均值
             if (ReservoirData != null)
@@ -2478,6 +2511,8 @@ namespace CyberX8_RT.Devices.Reservoir
 
             if (reservoirEntity == null || !reservoirEntity.IsInitialized)
             {
+                if (_reservoirData.ANDiReplen) ANDiReplenOff("", null);
+                if (_reservoirData.CADiReplen) CADiReplenOff("", null);
                 return true;
             }
             if (_isCrossDoseInstalled)
@@ -2532,7 +2567,7 @@ namespace CyberX8_RT.Devices.Reservoir
         private void AutoDiReplenMonitor(Func<string, object[], bool> direplenOff, double level, double recipeLevel, bool replenEnable,
             int direplenTimeRate, int direplenCurrentRate)
         {
-            bool result = _direplenHelper.AutoDiReplenMonitorTimeOut(direplenOff);
+            bool result = _direplenHelper.AutoDiReplenMonitorTimeOut(direplenOff, DiReplenTimeOutOpeartion);
             if (result)
             {
                 _currentOperation = ReservoirOperation.None;

+ 51 - 6
CyberX8_RT/Devices/Reservoir/ReservoirDiReplenHelper.cs

@@ -1,5 +1,8 @@
-using Aitex.Core.RT.Log;
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.Log;
 using Aitex.Core.RT.SCCore;
+using CyberX8_RT.Devices.Facilities;
+using MECF.Framework.Common.Alarm;
 using MECF.Framework.Common.Persistent.Reservoirs;
 using MECF.Framework.Common.RecipeCenter;
 using System;
@@ -41,7 +44,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <summary>
         /// 监控
         /// </summary>
-        public void MonitorPeriodTime()
+        public void MonitorPeriodTime(Action<bool> timeOutAction)
         {
             double levelHysteresis = SC.GetValue<double>("Reservoir.LevelHysteresis");
             double diValveMaxOnTimePeriod = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTimePeriod");
@@ -51,6 +54,8 @@ namespace CyberX8_RT.Devices.Reservoir
                 //超过时间
                 if (DateTime.Now.Subtract(_persistentValue.PeriodStartTime).TotalMinutes >= diValveMaxOnTimePeriod * 60)
                 {
+                    LOG.WriteLog(eEvent.INFO_RESERVOIR, _module, $"Time is over conifg's DIValveMaxOnTimePeriod:{diValveMaxOnTimePeriod} hour. Restart timer");
+                    timeOutAction(false);
                     _persistentValue.PeriodStartTime = DateTime.Now;
                     _persistentValue.TotalReplen = 0;
                     _persistentValue.LastTotalReplen = 0;
@@ -61,17 +66,33 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <summary>
         /// 监控手动注水
         /// </summary>
-        public bool MonitorManualDiReplenComplete(int replenSecond, Func<string, object[], bool> direplenOffAction)
+        public bool MonitorManualDiReplenComplete(int replenSecond, Func<string, object[], bool> direplenOffAction, Action<bool> timeOutAction)
         {
             lock (_locker)
             {
                 _persistentValue.TotalReplen = _persistentValue.LastTotalReplen + (int)DateTime.Now.Subtract(_persistentValue.DiReplenTime).TotalSeconds;
             }
+            //周期内累计补水超时
+            double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTime");
+            if (_persistentValue.TotalReplen >= diValveMaxOnTime * 60)
+            {
+                bool result = direplenOffAction("", null);
+                if (result)
+                {
+                    timeOutAction(true);
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
+                    _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
+                    _persistentValue.IsDiReplenOn = false;
+                    ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
+                }
+                return result;
+            }
             if (DateTime.Now.Subtract(_persistentValue.DiReplenTime).TotalSeconds >= replenSecond)
             {
                 bool result = direplenOffAction("", null);
                 if (result)
                 {
+                    timeOutAction(true);
                     _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
@@ -82,22 +103,46 @@ namespace CyberX8_RT.Devices.Reservoir
             return false;
         }
         /// <summary>
-        /// 单次自动注水超时
+        /// 自动注水超时
         /// </summary>
         /// <returns></returns>
-        public bool AutoDiReplenMonitorTimeOut(Func<string, object[], bool> direplenOffAction)
+        public bool AutoDiReplenMonitorTimeOut(Func<string, object[], bool> direplenOffAction, Action<bool> timeOutAction)
         {
             lock (_locker)
             {
                 _persistentValue.TotalReplen = _persistentValue.LastTotalReplen + (int)DateTime.Now.Subtract(_persistentValue.DiReplenTime).TotalSeconds;
             }
+            //单次自动补水超时
             double diValveMaxOnTimePerFill = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTimePerFill");
             if (DateTime.Now.Subtract(_persistentValue.DiReplenTime).TotalSeconds >= diValveMaxOnTimePerFill * 60)
             {
                 bool result = direplenOffAction("", null);
                 if (result)
                 {
-                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over {diValveMaxOnTimePerFill} min");
+                    AlarmListManager.Instance.AddWarn(_module, $"", $"{_module} Direplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                    //补水超时关闭总的补水阀
+                    SystemFacilities systemFacilities = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
+                    if (systemFacilities != null)
+                    {
+                        if (systemFacilities.DIReplenEnable) systemFacilities.DiReplenDisableOperation("DiReplenDisableOperation", null);
+                    }
+                    _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
+                    _persistentValue.IsDiReplenOn = false;
+                    ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
+                }
+                return result;
+            }
+            //累计补水超时
+            double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTime");
+            if (_persistentValue.TotalReplen >= diValveMaxOnTime * 60)
+            {
+                bool result = direplenOffAction("", null);
+                if (result)
+                {
+                    timeOutAction(true);
+                    AlarmListManager.Instance.AddWarn(_module, $"", $"{_module} Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
+                    LOG.WriteLog(eEvent.WARN_RESERVOIR, _module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
                     _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);

+ 64 - 27
CyberX8_RT/Devices/Reservoir/StandardHotReservoirDevice.cs

@@ -230,6 +230,10 @@ namespace CyberX8_RT.Devices.Reservoir
         /// holdofftimeMonitor字典;key:Moudle_item,value :HoldoffTimeSignalMonitor对象
         /// </summary>
         private Dictionary<string, HoldoffTimeSignalMonitor> _holdoffTimeSignalDic = new Dictionary<string, HoldoffTimeSignalMonitor>();
+        /// <summary>
+        /// 累计补水超时
+        /// </summary>
+        private bool _diReplenMaxTimeOut;
         #endregion
 
         #region 属性
@@ -285,6 +289,13 @@ namespace CyberX8_RT.Devices.Reservoir
         /// 是否调速泵
         /// </summary>
         public bool IsRegulatePump { get { return _isRegulatePump; } }
+        /// <summary>
+        /// 补水累计超时
+        /// </summary>
+        public bool DiReplenMaxTimeOut
+        {
+            get { return _diReplenMaxTimeOut; }
+        }
         #endregion
         /// <summary>
         /// 初始化成功清除对应的错误log
@@ -317,6 +328,7 @@ namespace CyberX8_RT.Devices.Reservoir
 
             _periodicJob = new PeriodicJob(100, OnTimer, $"{Module}.OnTimer", true);
             ResPowerOn();//保持继电器常开
+
             ClearErrorLogSet(Module.ToString());//软件启动的时候也清一下ErrorLogSet
 
       
@@ -354,45 +366,50 @@ namespace CyberX8_RT.Devices.Reservoir
             WaterLevelMonitor();
             //TC SafeCheck
             TCSafeCheck();
+         
+            ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(Module);
+            if (reservoirEntity == null || !reservoirEntity.IsInitialized)
+            {
+                if (IsDireplenOn) DIReplenOff("", null);
+                return true;
+            }
             //DIReplen
             if (_direplenHelper != null)
             {
-                _direplenHelper.MonitorPeriodTime();
-                if (_currentOperation == ReservoirOperation.ManualDiReplen && _reservoirData.DiReplen)
-                {
-                    bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, DIReplenOff);
-                    if (result)
-                    {
-                        _currentOperation = ReservoirOperation.None;
-                    }
-                }
-                else if (_currentOperation == ReservoirOperation.AutoDiReplen && _reservoirData.DiReplen)
+                _direplenHelper.MonitorPeriodTime(DiReplenTimeOutOpeartion);
+                if (!DiReplenMaxTimeOut)
                 {
-                    bool result = _direplenHelper.AutoDiReplenMonitorTimeOut(DIReplenOff);
-                    if (result)
+                    if (_currentOperation == ReservoirOperation.ManualDiReplen && _reservoirData.DiReplen)
                     {
-                        _currentOperation = ReservoirOperation.None;
-                        //触发注水异常信号
-                        _isDiReplenInFault = true;
+                        bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, DIReplenOff, DiReplenTimeOutOpeartion);
+                        if (result)
+                        {
+                            _currentOperation = ReservoirOperation.None;
+                        }
                     }
-                    else
+                    else if (_currentOperation == ReservoirOperation.AutoDiReplen && _reservoirData.DiReplen)
                     {
-                        //按液位补水
-                        result = _direplenHelper.AutoDiReplenMonitorComplete(_reservoirData.Level, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
-                        _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate, DIReplenOff);
+                        bool result = _direplenHelper.AutoDiReplenMonitorTimeOut(DIReplenOff, DiReplenTimeOutOpeartion);
                         if (result)
                         {
                             _currentOperation = ReservoirOperation.None;
+                            //触发注水异常信号
+                            _isDiReplenInFault = true;
+                        }
+                        else
+                        {
+                            //按液位补水
+                            result = _direplenHelper.AutoDiReplenMonitorComplete(_reservoirData.Level, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
+                            _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate, DIReplenOff);
+                            if (result)
+                            {
+                                _currentOperation = ReservoirOperation.None;
+                            }
                         }
                     }
                 }
-            }
-            ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(Module);
-            if (reservoirEntity == null || !reservoirEntity.IsInitialized)
-            {
-                return true;
-            }
 
+            }
             if (_persistentValue.OperatingMode == AUTO)
             {
                 CAFlowRateCheck();
@@ -441,6 +458,13 @@ namespace CyberX8_RT.Devices.Reservoir
             return true;
         }
         /// <summary>
+        /// DI Replen超时
+        /// </summary>
+        private void DiReplenTimeOutOpeartion(bool timeOutFlag)
+        {
+            _diReplenMaxTimeOut = timeOutFlag;
+        }
+        /// <summary>
         /// Low Level 触发操作
         /// </summary>
         private void LowLevelOperation()
@@ -676,7 +700,7 @@ namespace CyberX8_RT.Devices.Reservoir
             InitializeParameter();
             SubscribeData();
             InitializeOperation();
-            SubscribeValueAction();
+            SubscribeValueAction();          
             return true;
         }
         /// <summary>
@@ -816,7 +840,6 @@ namespace CyberX8_RT.Devices.Reservoir
             OP.Subscribe($"{Module}.RegulatPumpOff", RegulatePumpOff);
 
         }
-
         #region Regulat Pump
         /// <summary>
         /// 调速pump
@@ -966,6 +989,8 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <returns></returns>
         private bool ResetTotalTime(string cmd, object[] objs)
         {
+            _isDiReplenInFault = false;
+            _diReplenMaxTimeOut = false;
             _persistentValue.TotalReplen = 0;
             _persistentValue.LastTotalReplen = 0;
             ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
@@ -1405,6 +1430,18 @@ namespace CyberX8_RT.Devices.Reservoir
                 LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"current operation is {_currentOperation},cannot execute ManualDireplen operation");
                 return false;
             }
+            ReservoirEntity reservoirEntity = Singleton<RouteManager>.Instance.GetModule<ReservoirEntity>(Module);
+            if (!reservoirEntity.IsInitialized)
+            {
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"{Module} is not initialized. Can't start DiReplen");
+                return false;
+            }
+            if (DiReplenMaxTimeOut)
+            {
+                double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTime");
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
+                return false;
+            }
             bool result = DIReplenOnOperation("", null);
             if (result)
             {

+ 4 - 0
CyberX8_RT/Devices/Reservoir/TotalReservoirDevice.cs

@@ -192,6 +192,10 @@ namespace CyberX8_RT.Devices.Reservoir
                     if (reservoirItem.SubType == STRATUS)
                     {
                         StandardHotReservoirDevice reservoirDevice = DEVICE.GetDevice<StandardHotReservoirDevice>(module);
+                        if (!reservoirEntity.IsInitialized || reservoirDevice.DiReplenMaxTimeOut)
+                        {
+                            continue;
+                        }
                         if (reservoirDevice.IsDireplenOn)
                         {
                             break;