Explorar el Código

Add DIReplen ClearError and optimize DIReplen function;

niuyx hace 2 semanas
padre
commit
8a491a5886

+ 15 - 0
CyberX8_MainPages/ViewModels/ReservoirsAnolyteViewModel.cs

@@ -478,6 +478,7 @@ namespace CyberX8_MainPages.ViewModels
         public ICommand BaseLineKeyDownCommand { get; set; }
         public ICommand StartLeakTestCommand { get; set; }
         public ICommand BackCommand { get; set; }
+        public ICommand DIReplenClearErrorCommand { get; set; }
         #endregion
 
         #region 构造函数
@@ -496,11 +497,20 @@ namespace CyberX8_MainPages.ViewModels
             BaseLineKeyDownCommand = new DelegateCommand<object[]>(BaseLineKeyDownAction);
             StartLeakTestCommand = new DelegateCommand<object[]>(StartLeakTestAction);
             BackCommand = new DelegateCommand<object>(BackAction);
+            DIReplenClearErrorCommand = new DelegateCommand<object>(DIReplenClearErrorAction);
         }
         #endregion
 
         #region 命令方法
         /// <summary>
+        /// DIReplen Clear Error
+        /// </summary>
+        /// <param name="obj"></param>
+        private void DIReplenClearErrorAction(object obj)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.DIReplenClearError");
+        }
+        /// <summary>
         /// 回到Reservoir主页面
         /// </summary>
         /// <param name="param"></param>
@@ -653,6 +663,7 @@ namespace CyberX8_MainPages.ViewModels
             _rtDataKeys.Add($"{Module}.IsCalibrateEnable");
             _rtDataKeys.Add($"{Module}.ReservoirAverageANLevel");
             _rtDataKeys.Add($"{Module}.CroseDoseType");
+            _rtDataKeys.Add($"{Module}.DIReplenMaxTimeOut");
 
             if (_timer == null)
             {
@@ -685,6 +696,10 @@ namespace CyberX8_MainPages.ViewModels
                     IsCrossDoseTypeConfig = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.CroseDoseType");
                     IsCalibrateEnable = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsCalibrateEnable");
                     State = CommonFunction.GetValue<string>(_rtDataValueDic, $"{Module}.FsmState");
+
+                    IsDIReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault")
+                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.DIReplenMaxTimeOut");
+
                     if ("Idle".Equals(State)) 
                     {
                         _isInitialized = true;                    

+ 10 - 0
CyberX8_MainPages/ViewModels/ReservoirsCatholyteViewModel.cs

@@ -373,6 +373,7 @@ namespace CyberX8_MainPages.ViewModels
         public ICommand CAPumpSpeedCommand { get; private set; }
         public ICommand BackCommand { get; set; }
         public ICommand JumpToTCCommand { get; set; }
+        public ICommand DIReplenClearErrorCommand { get; set; }
         #endregion
 
         public ReservoirsCatholyteViewModel()
@@ -383,10 +384,19 @@ namespace CyberX8_MainPages.ViewModels
             CAPumpSpeedCommand = new DelegateCommand<object>(CAPumpSpeedAction);
             BackCommand = new DelegateCommand<object>(BackAction);
             JumpToTCCommand = new DelegateCommand<object>(JumpToTCAction);
+            DIReplenClearErrorCommand = new DelegateCommand<object>(DIReplenClearErrorAction);
         }
 
         #region 命令方法
         /// <summary>
+        /// DIReplen Clear Error
+        /// </summary>
+        /// <param name="obj"></param>
+        private void DIReplenClearErrorAction(object obj)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.DIReplenClearError");
+        }
+        /// <summary>
         /// 回到Reservoir主页面
         /// </summary>
         /// <param name="param"></param>

+ 13 - 3
CyberX8_MainPages/ViewModels/StandardHotReservoirsViewModel.cs

@@ -710,6 +710,7 @@ namespace CyberX8_MainPages.ViewModels
         public ICommand ResPowerOnCommand { get; set; }
         public ICommand ResPowerOffCommand { get; set; }
         public ICommand PumpSpeedCommand { get; set; }
+        public ICommand DIReplenClearErrorCommand { get; set; }
         #endregion
 
         /// <summary>
@@ -738,8 +739,7 @@ namespace CyberX8_MainPages.ViewModels
             ResPowerOnCommand = new DelegateCommand<object>(ResPowerOnAction);
             ResPowerOffCommand = new DelegateCommand<object>(ResPowerOffAction);
             PumpSpeedCommand = new DelegateCommand<object>(PumpSpeedAction);
-
-
+            DIReplenClearErrorCommand = new DelegateCommand<object>(DIReplenClearErrorAction);
         }
         /// <summary>
         /// 加载数据
@@ -793,6 +793,7 @@ namespace CyberX8_MainPages.ViewModels
             _rtDataKeys.Add($"{Module}.IsRegulatePump");
             _rtDataKeys.Add($"{Module}.IsCMMConfig");
             _rtDataKeys.Add($"{Module}.IsDIReplenInFault");
+            _rtDataKeys.Add($"{Module}.DIReplenMaxTimeOut");
             if (_timer == null)
             {
                 _timer = new DispatcherTimer();
@@ -818,6 +819,14 @@ namespace CyberX8_MainPages.ViewModels
 
         #region 命令方法
         /// <summary>
+        /// DIReplen Clear Error
+        /// </summary>
+        /// <param name="obj"></param>
+        private void DIReplenClearErrorAction(object obj)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.DIReplenClearError");
+        }
+        /// <summary>
         /// 初始化
         /// </summary>
         /// <param name="param"></param>
@@ -1160,7 +1169,8 @@ namespace CyberX8_MainPages.ViewModels
                         //HedFlow管流
                         HEDFlowIsOn = (ReservoirData.HedFlow > 0) ? true : false;
                         //DIReplenFault
-                        IsDiReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault");
+                        IsDiReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenInFault")
+                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.DIReplenMaxTimeOut");
 
                         IsError = State== "Error" ? true : false;
                     }

+ 4 - 0
CyberX8_MainPages/Views/ReservoirsAnolyteView.xaml

@@ -110,6 +110,7 @@
                         <RowDefinition Height="25"></RowDefinition>
                         <RowDefinition Height="35"></RowDefinition>
                         <RowDefinition Height="25"></RowDefinition>
+                        <RowDefinition Height="35"></RowDefinition>
                     </Grid.RowDefinitions>
 
                     <Grid Grid.Row="0">
@@ -147,6 +148,9 @@
                         <Label Content="DI Replen Fault" HorizontalAlignment="Left" FontSize="14" VerticalAlignment="Center" Height="30" Margin="10 -3 0 0"></Label>
                         <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 -3 30 0" Fill="{Binding IsDIReplenFault, Converter={StaticResource boolToRedColor}}"   Stroke="Silver"/>
                     </Grid>
+                    <Grid Grid.Row="9">
+                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding DIReplenClearErrorCommand}" Height="28" Width="130" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Clear Error"/>
+                    </Grid>
                 </Grid>
             </GroupBox>
         </Grid>

+ 7 - 3
CyberX8_MainPages/Views/ReservoirsCatholyteView.xaml

@@ -70,7 +70,7 @@
                         <Label Content="Operating Mode"  FontSize="15" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Bottom" HorizontalAlignment="Center"></Label>
                     </Grid>
                 </Grid>
-                <GroupBox Header="CA Settings" FontWeight="Bold" FontSize="15" Grid.Column="3" Grid.Row="3" Margin="10 -30 0 80">
+                <GroupBox Header="CA Settings" FontWeight="Bold" FontSize="15" Grid.Column="3" Grid.Row="2" Margin="10,140,0,109" Grid.RowSpan="2">
                     <Grid>
                         <Grid.RowDefinitions>
                             <RowDefinition Height="30"></RowDefinition>
@@ -85,7 +85,7 @@
                     </Grid>
                 </GroupBox>
 
-                <GroupBox Header="DI Replen" FontWeight="Bold" FontSize="15" Grid.Row="3" Grid.Column="3"  Margin="10,100,0,0" Grid.RowSpan="3">
+                <GroupBox Header="DI Replen" FontWeight="Bold" FontSize="15" Grid.Row="3" Grid.Column="3"  Margin="10,80,0,0" Grid.RowSpan="3">
                     <Grid>
                         <Grid.RowDefinitions>
                             <RowDefinition Height="35"></RowDefinition>
@@ -97,6 +97,7 @@
                             <RowDefinition Height="35"></RowDefinition>
                             <RowDefinition Height="35"></RowDefinition>
                             <RowDefinition Height="35"></RowDefinition>
+                            <RowDefinition Height="35"></RowDefinition>
                         </Grid.RowDefinitions>
 
                         <Grid Grid.Row="0">
@@ -129,6 +130,9 @@
                             <Label Content="DI Replen Fault" HorizontalAlignment="Left" FontSize="14" VerticalAlignment="Center" Height="30" Margin="10 -3 0 0"></Label>
                             <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 -3 30 0"  Fill="{Binding IsDIReplenFault, Converter={StaticResource boolToRedColor}}" Stroke="Silver"/>
                         </Grid>
+                        <Grid Grid.Row="9">
+                            <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding DIReplenClearErrorCommand}" Height="28" Width="130" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Clear Error"/>
+                        </Grid>
                     </Grid>
                 </GroupBox>
 
@@ -422,7 +426,7 @@
                 <TextBlock Text="{Binding ReservoirData.CAHedFlow, StringFormat={}{0:F2} L/min}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
             </Border>
         </Grid>
-      
+
         <Grid Canvas.Top="590" Canvas.Left="1515">
             <Grid.RowDefinitions>
                 <RowDefinition Height="30"/>

+ 7 - 3
CyberX8_MainPages/Views/StandardHotReservoirsView.xaml

@@ -374,7 +374,7 @@ Visibility="{Binding IsError,Converter={StaticResource boolToVisibility2}}" Canv
                 <Grid Grid.Row="5" Grid.Column="4" Margin="0 0 0 10">
                     <Button IsEnabled="{Binding IsAutoEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding GotoPMCounterCommand}" Margin="10,0,0,0" Grid.Column="1" Height="30" Width="100" HorizontalAlignment="Center" VerticalAlignment="Bottom"  Content="PM Counters"></Button>
                 </Grid>
-                <GroupBox Header="DI Replen" FontWeight="Bold" FontSize="15" Grid.Row="4" Grid.Column="4" Margin="10 -40 0 0">
+                <GroupBox Header="DI Replen" FontWeight="Bold" FontSize="15" Grid.Row="3" Grid.Column="4" Margin="10,107,0,58" Grid.RowSpan="3">
                     <Grid>
                         <Grid.RowDefinitions>
                             <RowDefinition Height="25"></RowDefinition>
@@ -386,6 +386,7 @@ Visibility="{Binding IsError,Converter={StaticResource boolToVisibility2}}" Canv
                             <RowDefinition Height="30"></RowDefinition>
                             <RowDefinition Height="35"></RowDefinition>
                             <RowDefinition Height="35"></RowDefinition>
+                            <RowDefinition Height="35"></RowDefinition>
                         </Grid.RowDefinitions>
 
                         <Grid Grid.Row="0">
@@ -418,19 +419,22 @@ Visibility="{Binding IsError,Converter={StaticResource boolToVisibility2}}" Canv
                             <Label Content="DI Replen Fault" HorizontalAlignment="Left" FontSize="14" VerticalAlignment="Center" Height="30" Margin="10 -3 0 0"></Label>
                             <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 -3 30 0" Fill="{Binding IsDiReplenFault,Converter={StaticResource boolToRedGreenColor}}"   Stroke="Silver"/>
                         </Grid>
+                        <Grid Grid.Row="9">
+                            <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding DIReplenClearErrorCommand}" Height="28" Width="130" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Clear Error"/>
+                        </Grid>
                     </Grid>
                 </GroupBox>
 
                 <Grid Grid.Row="3" Grid.Column="4">
                     <Grid.RowDefinitions>
-                        <RowDefinition Height="30"></RowDefinition>
+                        <RowDefinition Height="10"></RowDefinition>
                         <RowDefinition Height="100"></RowDefinition>
                     </Grid.RowDefinitions>
                     <Grid Grid.Row="0">
 
                     </Grid>
                     <Grid Grid.Row="1">
-                        <GroupBox Header="Pump Settings" FontWeight="Bold" FontSize="15"  Visibility="{Binding IsRegulatePump,Converter={StaticResource boolToVisibility2}}">
+                        <GroupBox VerticalAlignment="Top" Header="Pump Settings" FontWeight="Bold" FontSize="15"  Visibility="{Binding IsRegulatePump,Converter={StaticResource boolToVisibility2}}" Margin="10,0,0,0">
                             <Grid>
                                 <Grid.RowDefinitions>
                                     <RowDefinition Height="30"></RowDefinition>

+ 40 - 8
CyberX8_RT/Devices/Reservoir/CompactMembranReservoirDevice.cs

@@ -20,17 +20,16 @@ using MECF.Framework.Common.Beckhoff.IOAxis;
 using System.Linq;
 using MECF.Framework.Common.Alarm;
 using MECF.Framework.Common.ProcessCell;
-using MECF.Framework.Common.Persistent.Temperature;
 using CyberX8_Core;
 using CyberX8_RT.Devices.Facilities;
 using CyberX8_RT.Devices.Metal;
-using CyberX8_RT.Devices.Reservoir;
 using CyberX8_RT.Devices.Safety;
 using CyberX8_RT.Devices.Temperature;
 using CyberX8_RT.Modules.Metal;
 using CyberX8_RT.Modules.Reservoir;
 using CyberX8_RT.Modules;
 using MECF.Framework.Common.IOCore;
+using static CyberX8_RT.Devices.Reservoir.ReservoirDiReplenHelper;
 
 namespace CyberX8_RT.Devices.Reservoir
 {
@@ -339,6 +338,21 @@ namespace CyberX8_RT.Devices.Reservoir
         {
             get { return _diReplenMaxTimeOut; }
         }
+        /// <summary>
+        /// 注水是否出错
+        /// </summary>
+        public bool IsDiReplenInFault { get { return _isDiReplenInFault; } }
+        /// <summary>
+        /// Facility DIReplenOn
+        /// </summary>
+        public bool TotalDIReplenOn
+        {
+            get
+            {
+                var facilitiesDevice = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
+                return facilitiesDevice != null ? facilitiesDevice.DIReplenEnable : false;
+            }
+        }
         #endregion
         /// <summary>
         /// 初始化成功清除对应的错误log
@@ -472,6 +486,7 @@ namespace CyberX8_RT.Devices.Reservoir
             DATA.Subscribe($"{Module}.IsLeakDetected", () => _isLeakDetected, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsCrossDoseInstalled", () => _isCrossDoseInstalled, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.ANBypassCounterFlow", () => ReservoirCounterByPassFlow.CounterValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.DIReplenMaxTimeOut", () => _diReplenMaxTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
 
             if (_isCrossDoseInstalled)
             {
@@ -522,6 +537,7 @@ namespace CyberX8_RT.Devices.Reservoir
             OP.Subscribe($"{Module}.StartLeakTest", StartLeakTestAction);
             OP.Subscribe($"{Module}.ResetTotalTime", ResetTotalTime);
             OP.Subscribe($"{Module}.ClearSlowLeak", ClearSlowLeak);
+            OP.Subscribe($"{Module}.DIReplenClearError", DIReplenClearError);
 
             if (_isCrossDoseInstalled)
             {
@@ -537,6 +553,16 @@ namespace CyberX8_RT.Devices.Reservoir
 
         #region Operation
         /// <summary>
+        /// DIReplen Clear Error
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="args"></param>
+        private bool DIReplenClearError(string cmd, object[] args)
+        {
+            _isDiReplenInFault = false;
+            return true;
+        }
+        /// <summary>
         /// DI Replen超时
         /// </summary>
         private void DiReplenTimeOutOpeartion(bool timeOutFlag)
@@ -1510,6 +1536,12 @@ namespace CyberX8_RT.Devices.Reservoir
                 LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
                 return false;
             }
+            if (IsDiReplenInFault)
+            {
+                double diValveMaxOnTimePerFill = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTimePerFill");
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                return false;
+            }
             bool result = direplenOn("", null);
             if (result)
             {
@@ -2360,7 +2392,7 @@ namespace CyberX8_RT.Devices.Reservoir
             if (_direplenHelper != null)
             {
                 _direplenHelper.MonitorPeriodTime(DiReplenTimeOutOpeartion);
-                if (!_diReplenMaxTimeOut)
+                if (!_diReplenMaxTimeOut && !_isDiReplenInFault && TotalDIReplenOn)
                 {
                     if (_currentOperation == ReservoirOperation.ManualANDiReplen)
                     {
@@ -2567,18 +2599,18 @@ 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, DiReplenTimeOutOpeartion);
-            if (result)
+            var result = _direplenHelper.AutoDiReplenMonitorTimeOut(direplenOff, DiReplenTimeOutOpeartion);
+            if (result.Item1)
             {
                 _currentOperation = ReservoirOperation.None;
                 //触发注水异常信号
-                _isDiReplenInFault = true;
+                if (result.Item2 == DIReplenFaultType.PerFillTimeOut) _isDiReplenInFault = true;
             }
             else
             {
                 //按液位补水
-                result = _direplenHelper.AutoDiReplenMonitorComplete(level, recipeLevel, replenEnable, direplenTimeRate, direplenCurrentRate, direplenOff);
-                if (result)
+                var result1 = _direplenHelper.AutoDiReplenMonitorComplete(level, recipeLevel, replenEnable, direplenTimeRate, direplenCurrentRate, direplenOff);
+                if (result1)
                 {
                     _currentOperation = ReservoirOperation.None;
                 }

+ 10 - 4
CyberX8_RT/Devices/Reservoir/ReservoirDiReplenHelper.cs

@@ -106,7 +106,7 @@ namespace CyberX8_RT.Devices.Reservoir
         /// 自动注水超时
         /// </summary>
         /// <returns></returns>
-        public bool AutoDiReplenMonitorTimeOut(Func<string, object[], bool> direplenOffAction, Action<bool> timeOutAction)
+        public (bool, DIReplenFaultType) AutoDiReplenMonitorTimeOut(Func<string, object[], bool> direplenOffAction, Action<bool> timeOutAction)
         {
             lock (_locker)
             {
@@ -131,7 +131,7 @@ namespace CyberX8_RT.Devices.Reservoir
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
                 }
-                return result;
+                return (result, DIReplenFaultType.PerFillTimeOut);
             }
             //累计补水超时
             double diValveMaxOnTime = SC.GetValue<double>($"Reservoir.{_module}.DIValveMaxOnTime");
@@ -147,9 +147,9 @@ namespace CyberX8_RT.Devices.Reservoir
                     _persistentValue.IsDiReplenOn = false;
                     ReservoirsPersistentManager.Instance.UpdatePersistentValue(_module);
                 }
-                return result;
+                return (result, DIReplenFaultType.MaxTimeOut);
             }
-            return false;
+            return (false, DIReplenFaultType.None);
         }
         /// <summary>
         /// 自动注水是否结束
@@ -178,5 +178,11 @@ namespace CyberX8_RT.Devices.Reservoir
             }
             return false;
         }
+        public enum DIReplenFaultType
+        {
+            None,
+            MaxTimeOut,
+            PerFillTimeOut
+        }
     }
 }

+ 50 - 18
CyberX8_RT/Devices/Reservoir/StandardHotReservoirDevice.cs

@@ -10,7 +10,6 @@ using MECF.Framework.Common.CommonData.Reservoir;
 using MECF.Framework.Common.Persistent.Reservoirs;
 using MECF.Framework.Common.RecipeCenter;
 using MECF.Framework.Common.ToolLayout;
-using MECF.Framework.Common.TwinCat;
 using CyberX8_Core;
 using CyberX8_RT.Devices.Facilities;
 using CyberX8_RT.Devices.Metal;
@@ -29,7 +28,7 @@ using CyberX8_RT.Devices.Safety;
 using MECF.Framework.Common.ProcessCell;
 using MECF.Framework.Common.Alarm;
 using MECF.Framework.Common.IOCore;
-using Aitex.Core.RT.Routine;
+using static CyberX8_RT.Devices.Reservoir.ReservoirDiReplenHelper;
 
 
 namespace CyberX8_RT.Devices.Reservoir
@@ -300,6 +299,21 @@ namespace CyberX8_RT.Devices.Reservoir
         /// 每隔30秒打印槽体相关的信息
         /// </summary>
         private DateTime _periodLogTime;
+        /// <summary>
+        /// Facility DIReplenOn
+        /// </summary>
+        public bool TotalDIReplenOn
+        {
+            get
+            {
+                var facilitiesDevice = DEVICE.GetDevice<SystemFacilities>("System.Facilities");
+                return facilitiesDevice != null ? facilitiesDevice.DIReplenEnable : false;
+            }
+        }
+        /// <summary>
+        /// 注水是否出错
+        /// </summary>
+        public bool IsDiReplenInFault { get { return _isDiReplenInFault; } }
         #endregion
         /// <summary>
         /// 初始化成功清除对应的错误log
@@ -407,7 +421,7 @@ namespace CyberX8_RT.Devices.Reservoir
             if (_direplenHelper != null)
             {
                 _direplenHelper.MonitorPeriodTime(DiReplenTimeOutOpeartion);
-                if (!DiReplenMaxTimeOut)
+                if (!_diReplenMaxTimeOut && !_isDiReplenInFault && TotalDIReplenOn)
                 {
                     if (_currentOperation == ReservoirOperation.ManualDiReplen && _reservoirData.DiReplen)
                     {
@@ -419,19 +433,19 @@ namespace CyberX8_RT.Devices.Reservoir
                     }
                     else if (_currentOperation == ReservoirOperation.AutoDiReplen && _reservoirData.DiReplen)
                     {
-                        bool result = _direplenHelper.AutoDiReplenMonitorTimeOut(DIReplenOff, DiReplenTimeOutOpeartion);
-                        if (result)
+                        var result = _direplenHelper.AutoDiReplenMonitorTimeOut(DIReplenOff, DiReplenTimeOutOpeartion);
+                        if (result.Item1)
                         {
                             _currentOperation = ReservoirOperation.None;
                             //触发注水异常信号
-                            _isDiReplenInFault = true;
+                            if (result.Item2 == DIReplenFaultType.PerFillTimeOut) _isDiReplenInFault = true;
                         }
                         else
                         {
                             //按液位补水
-                            result = _direplenHelper.AutoDiReplenMonitorComplete(_reservoirData.Level, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
+                            var result1 = _direplenHelper.AutoDiReplenMonitorComplete(_reservoirData.Level, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
                             _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate, DIReplenOff);
-                            if (result)
+                            if (result1)
                             {
                                 //补水完成打印日志
                                 LOG.WriteLog(eEvent.INFO_RESERVOIR, Module, $"{Module} CADIReplen State :False,  " +
@@ -493,13 +507,7 @@ namespace CyberX8_RT.Devices.Reservoir
             }
             return true;
         }
-        /// <summary>
-        /// DI Replen超时
-        /// </summary>
-        private void DiReplenTimeOutOpeartion(bool timeOutFlag)
-        {
-            _diReplenMaxTimeOut = timeOutFlag;
-        }
+        
         /// <summary>
         /// Low Level 触发操作
         /// </summary>
@@ -842,6 +850,7 @@ namespace CyberX8_RT.Devices.Reservoir
             DATA.Subscribe($"{Module}.PumpSpeed", () => _regulatePumpSpeed, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.IsCMMConfig", () => _isCMMConfig, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.SubordinateReservoirPump", () => _reservoirData.RegulatePumpSignalIn, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            DATA.Subscribe($"{Module}.DIReplenMaxTimeOut", () => _diReplenMaxTimeOut, SubscriptionAttribute.FLAG.IgnoreSaveDB);
         }
         /// <summary>
         /// 初始化操作
@@ -866,7 +875,8 @@ namespace CyberX8_RT.Devices.Reservoir
             OP.Subscribe($"{Module}.StopManualDosing", StopManualDosing);
             OP.Subscribe($"{Module}.ResetBottleVolume", ResetBottleVolume);
             OP.Subscribe($"{Module}.DosingInitialize", DosingInitialize);
-            
+            OP.Subscribe($"{Module}.DIReplenClearError", DIReplenClearError);
+
             OP.Subscribe($"{Module}.HedPowerOn", HedPowerOnAction);
             OP.Subscribe($"{Module}.HedPowerOff", HedPowerOffAction);
             OP.Subscribe($"{Module}.ResPowerOn", ResPowerOnAction);
@@ -1018,6 +1028,23 @@ namespace CyberX8_RT.Devices.Reservoir
 
         #region Operation
         /// <summary>
+        /// DIReplen Clear Error
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="args"></param>
+        private bool DIReplenClearError(string cmd, object[] args)
+        {
+            _isDiReplenInFault = false;
+            return true;
+        }
+        /// <summary>
+        /// DI Replen超时
+        /// </summary>
+        private void DiReplenTimeOutOpeartion(bool timeOutFlag)
+        {
+            _diReplenMaxTimeOut = timeOutFlag;
+        }
+        /// <summary>
         /// 重置时长
         /// </summary>
         /// <param name="cmd"></param>
@@ -1025,7 +1052,6 @@ namespace CyberX8_RT.Devices.Reservoir
         /// <returns></returns>
         private bool ResetTotalTime(string cmd, object[] objs)
         {
-            _isDiReplenInFault = false;
             _diReplenMaxTimeOut = false;
             _persistentValue.TotalReplen = 0;
             _persistentValue.LastTotalReplen = 0;
@@ -1217,7 +1243,7 @@ namespace CyberX8_RT.Devices.Reservoir
                     reservoirEntity.EnterInit();
                     _persistentValue.OperatingMode = currentOperation;
                     if (_reservoirData.DiReplen) DIReplenOff("", null);
-                    _isDiReplenInFault = false;
+                    //_isDiReplenInFault = false;
                     LOG.WriteLog(eEvent.INFO_RESERVOIR, Module, $"Operating mode is switched from {preOperation} to {currentOperation}");
                 }
                 ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
@@ -1478,6 +1504,12 @@ namespace CyberX8_RT.Devices.Reservoir
                 LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTime:{diValveMaxOnTime} min");
                 return false;
             }
+            if (IsDiReplenInFault)
+            {
+                double diValveMaxOnTimePerFill = SC.GetValue<double>($"Reservoir.{Module}.DIValveMaxOnTimePerFill");
+                LOG.WriteLog(eEvent.WARN_RESERVOIR, Module, $"Direplen time over conifg's DIValveMaxOnTimePerFill:{diValveMaxOnTimePerFill} min");
+                return false;
+            }
             bool result = DIReplenOnOperation("", null);
             if (result)
             {

+ 2 - 2
CyberX8_RT/Devices/Reservoir/TotalReservoirDevice.cs

@@ -196,11 +196,11 @@ namespace CyberX8_RT.Devices.Reservoir
                         {
                             continue;
                         }
-                        if (reservoirDevice.IsDireplenOn)
+                        if (reservoirDevice.IsDireplenOn || !reservoirDevice.TotalDIReplenOn)
                         {
                             break;
                         }
-                        if (reservoirDevice.NeedAutoDireplen && !reservoirDevice.IsDireplenOn)
+                        if (reservoirDevice.NeedAutoDireplen && !reservoirDevice.IsDireplenOn && !reservoirDevice.IsDiReplenInFault)
                         {
                             reservoirDevice.AutoDireplen();
                         }