Преглед изворни кода

add dm an reservoir manual direplen

chenzk пре 1 недеља
родитељ
комит
562322b450

+ 43 - 6
PunkHPX8_MainPages/ViewModels/DMReservoirViewModel.cs

@@ -68,14 +68,22 @@ namespace PunkHPX8_MainPages.ViewModels
         /// </summary>
         private bool _isEvaporatorConfig;
         /// <summary>
-        /// 是否正在手动注水
+        /// 阴极是否正在手动注水
         /// </summary>
         private bool _isManualReplen;
         /// <summary>
-        /// 手动注水时长(秒)
+        /// 阳极是否正在手动注水
+        /// </summary>
+        private bool _isANManualReplen;
+        /// <summary>
+        /// 阴极手动注水时长(秒)
         /// </summary>
         private int _manualFillSeconds;
         /// <summary>
+        /// 阳极手动注水时长(秒)
+        /// </summary>
+        private int _manualANFillSeconds;
+        /// <summary>
         /// DIValveMaxOnTime
         /// </summary>
         private double _diValveMaxOnTime;
@@ -227,7 +235,7 @@ namespace PunkHPX8_MainPages.ViewModels
             set { SetProperty(ref _diValveMaxOnTime, value); }
         }
         /// <summary>
-        /// 手动注水时长
+        /// 阴极手动注水时长
         /// </summary>
         public int ManualFillSeconds
         {
@@ -235,7 +243,15 @@ namespace PunkHPX8_MainPages.ViewModels
             set { SetProperty(ref _manualFillSeconds, value); }
         }
         /// <summary>
-        /// 正在手动注水
+        /// 阳极手动注水时长
+        /// </summary>
+        public int ManualANFillSeconds
+        {
+            get { return _manualANFillSeconds; }
+            set { SetProperty(ref _manualANFillSeconds, value); }
+        }
+        /// <summary>
+        /// 阴极正在手动注水
         /// </summary>
         public bool IsManualReplen
         {
@@ -243,6 +259,14 @@ namespace PunkHPX8_MainPages.ViewModels
             set { SetProperty(ref _isManualReplen, value); }
         }
         /// <summary>
+        /// 阳极正在手动注水
+        /// </summary>
+        public bool IsANManualReplen
+        {
+            get { return _isANManualReplen; }
+            set { SetProperty(ref _isANManualReplen, value); }
+        }
+        /// <summary>
         /// 是否补水异常
         /// </summary>
         public bool IsDIReplenFault
@@ -261,6 +285,7 @@ namespace PunkHPX8_MainPages.ViewModels
         public ICommand ReturnFlowOpenPercentSetCommand { get; set; }
         public ICommand ResetTotalCommand { get; set; }
         public ICommand ManualDireplenCommand { get; set; }
+        public ICommand ManualANDireplenCommand { get; set; }
 
         #endregion
 
@@ -272,6 +297,7 @@ namespace PunkHPX8_MainPages.ViewModels
             ReturnFlowOpenPercentSetCommand = new DelegateCommand<object>(ReturnFlowOpenPercentSetAction);
             ResetTotalCommand = new DelegateCommand<object>(ResetTotalAction);
             ManualDireplenCommand = new DelegateCommand<object>(ManualDireplenAction);
+            ManualANDireplenCommand = new DelegateCommand<object>(ManualANDireplenAction);
         }
 
         #region 命令方法
@@ -333,13 +359,21 @@ namespace PunkHPX8_MainPages.ViewModels
             InvokeClient.Instance.Service.DoOperation($"{Module}.ResetTotalTime");
         }
         /// <summary>
-        /// 手动注水
+        /// 手动阴极注水
         /// </summary>
         /// <param name="param"></param>
         private void ManualDireplenAction(object param)
         {
             InvokeClient.Instance.Service.DoOperation($"{Module}.ManualCADiReplen", ManualFillSeconds);
         }
+        /// <summary>
+        /// 手动阳极注水
+        /// </summary>
+        /// <param name="param"></param>
+        private void ManualANDireplenAction(object param)
+        {
+            InvokeClient.Instance.Service.DoOperation($"{Module}.ManualANDiReplen", ManualANFillSeconds);
+        }
         #endregion
 
         public void LoadData(string systemName)
@@ -358,6 +392,7 @@ namespace PunkHPX8_MainPages.ViewModels
 
             _rtDataKeys.Add($"{Module}.DIValveMaxOnTime");
             _rtDataKeys.Add($"{Module}.IsManualCAReplen");
+            _rtDataKeys.Add($"{Module}.IsManualANReplen");
             _rtDataKeys.Add($"{Module}.IsDIReplenPerfillTimeOut");
             _rtDataKeys.Add($"{Module}.IsDIReplenMaxTimeOut");
             _rtDataKeys.Add($"{Module}.AvgCALevel");
@@ -410,7 +445,9 @@ namespace PunkHPX8_MainPages.ViewModels
                     DIValveMaxOnTime = CommonFunction.GetValue<double>(_rtDataValueDic, $"{Module}.DIValveMaxOnTime");
                     IsManualReplen = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsManualCAReplen");
                     IsDIReplenFault = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenPerfillTimeOut") 
-                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenMaxTimeOut"); 
+                        || CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsDIReplenMaxTimeOut");
+
+                    IsANManualReplen = CommonFunction.GetValue<bool>(_rtDataValueDic, $"{Module}.IsManualANReplen");
 
 
                 }

+ 3 - 3
PunkHPX8_MainPages/Views/DMReservoirView.xaml

@@ -141,12 +141,12 @@
                         <Label Content="Manual Fill Time" FontSize="14" FontWeight="Bold" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
                     </Grid>
                     <Grid Grid.Row="6">
-                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding ManualFillSeconds,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="25,-3,0,0" Height="30"  Width="100"/>
+                        <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding ManualANFillSeconds,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="25,-3,0,0" Height="30"  Width="100"/>
                         <Label Content="sec" HorizontalAlignment="Right" VerticalAlignment="Center" Height="30" Width="55"  Margin="0 -3 0 0"></Label>
                     </Grid>
                     <Grid Grid.Row="7">
-                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" HorizontalContentAlignment="Left" Padding="10 0 0 0"  Grid.Column="1" Height="30" Width="130" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Manual Replen" Command="{Binding ManualDireplenCommand}"></Button>
-                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 30 0" Fill="{Binding IsManualReplen, Converter={StaticResource boolToColor}}"  Stroke="Silver"/>
+                        <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" HorizontalContentAlignment="Left" Padding="10 0 0 0"  Grid.Column="1" Height="30" Width="130" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Manual Replen" Command="{Binding ManualANDireplenCommand}"></Button>
+                        <Ellipse Grid.Column="0" Width="16" Height="16" HorizontalAlignment="Right" Margin="0 0 30 0" Fill="{Binding IsANManualReplen, Converter={StaticResource boolToColor}}"  Stroke="Silver"/>
                     </Grid>
                     <Grid Grid.Row="8">
                         <Label Content="DI Replen Fault" HorizontalAlignment="Left" FontSize="14" VerticalAlignment="Center" Height="30" Margin="10 -3 0 0"></Label>

+ 29 - 1
PunkHPX8_RT/Devices/Reservoir/DMReservoirDevice.cs

@@ -1,4 +1,5 @@
-using Aitex.Core.RT.Log;
+using Aitex.Core.RT.DataCenter;
+using Aitex.Core.RT.Log;
 using Aitex.Core.RT.OperationCenter;
 using Aitex.Core.RT.SCCore;
 using Aitex.Core.Util;
@@ -74,6 +75,14 @@ namespace PunkHPX8_RT.Devices.Reservoir
             IoSubscribeUpdateVariable(DEGAS_ENABLE);
         }
         /// <summary>
+        /// 订阅Data
+        /// </summary>
+        protected override void SubscribeData()
+        {
+            base.SubscribeData();
+            DATA.Subscribe($"{Module}.IsManualANReplen", () => { return _currentDireplenOperation == DiReplenOperation.ManualANDiReplen; }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+        }
+        /// <summary>
         /// 订阅Operation
         /// </summary>
         protected override void InitializeOperation()
@@ -84,6 +93,8 @@ namespace PunkHPX8_RT.Devices.Reservoir
             OP.Subscribe($"{Module}.ANPumpDisable", AnPumpOffOperation);
             OP.Subscribe($"{Module}.ANIsolationOn", (cmd, para) => { return ANIsolationOn(); });
             OP.Subscribe($"{Module}.ANIsolationOff", (cmd, para) => { return ANIsolationOff(); });
+
+            OP.Subscribe($"{Module}.ManualANDiReplen", ManualANDiReplen);
         }
 
         #region AnPump
@@ -182,6 +193,8 @@ namespace PunkHPX8_RT.Devices.Reservoir
             return WriteVariableValue(AN_ISOLATION, false);
         }
         #endregion
+
+
         protected override void AutoMonitor()
         {
             base.AutoMonitor();
@@ -215,6 +228,19 @@ namespace PunkHPX8_RT.Devices.Reservoir
         protected override void AutoDireplenMonitor()
         {
             base.AutoDireplenMonitor();
+            if (_currentDireplenOperation == DiReplenOperation.ManualANDiReplen)
+            {
+                bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, ANDiReplenOff, ref _isDIReplenMaxTimeOut);
+                if (result)
+                {
+                    _currentDireplenOperation = DiReplenOperation.None;
+                }
+            }
+            //阳极没有水位,自动补水监控逻辑待修正
+            if (_currentDireplenOperation == DiReplenOperation.AutoANDiReplen)
+            {
+
+            }
         }
 
         /// <summary>
@@ -292,5 +318,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
         }
 
 
+
+
     }
 }

+ 15 - 24
PunkHPX8_RT/Devices/Reservoir/ReservoirDevice.cs

@@ -110,18 +110,12 @@ namespace PunkHPX8_RT.Devices.Reservoir
         private int _levelSampleCount;
      
 
-        /// <summary>
-        /// 累计补水是否超时
-        /// </summary>
-        private bool _isDIReplenMaxTimeOut = false;
+ 
         /// <summary>
         /// 单次补水是否超时
         /// </summary>
         private bool _isDIReplenPerfillTimeOut = false;
-        /// <summary>
-        /// 注水Helper
-        /// </summary>
-        private ReservoirDiReplenHelper _direplenHelper;
+   
 
         /// <summary>
         /// 上一时刻platingcell的overflow level
@@ -182,6 +176,14 @@ namespace PunkHPX8_RT.Devices.Reservoir
         /// Recipe
         /// </summary>
         protected ResRecipe _resRecipe;
+        /// <summary>
+        /// 注水Helper
+        /// </summary>
+        protected ReservoirDiReplenHelper _direplenHelper;
+        /// <summary>
+        /// 累计补水是否超时
+        /// </summary>
+        protected  bool _isDIReplenMaxTimeOut = false;
         #endregion
 
         #region 属性
@@ -301,7 +303,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
         /// <summary>
         /// 订阅数据
         /// </summary>
-        private void SubscribeData()
+        protected virtual void SubscribeData()
         {
             DATA.Subscribe($"{Module}.ReservoirData", () => _reservoirData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
             DATA.Subscribe($"{Module}.PersistentValue", () => _persistentValue, SubscriptionAttribute.FLAG.IgnoreSaveDB);
@@ -501,7 +503,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
             if (reservoirEntity != null) 
             {
                 //retrun valve打开
-                if (ReservoirData.ReturnValveEnable && (!reservoirEntity.IsInit && !reservoirEntity.IsError))
+                if (ReservoirData.ReturnValveEnable && _platingCellDevice!=null && (!reservoirEntity.IsInit && !reservoirEntity.IsError))
                 {
                     double overflow = _platingCellDevice.PlatingCellDeviceData.OverFlowLevel;
                     int _overflowLevelDelta = SC.GetValue<int>($"Reservoir.{Module}.OverflowLevelDelta");
@@ -709,24 +711,12 @@ namespace PunkHPX8_RT.Devices.Reservoir
                     _currentDireplenOperation = DiReplenOperation.None;
                 }
             }
-            if (_currentDireplenOperation == DiReplenOperation.ManualANDiReplen)
-            {
-                //bool result = _direplenHelper.MonitorManualDiReplenComplete(_manualReplenSecond, ANDiReplenOff, ref _isDIReplenMaxTimeOut);
-                //if (result)
-                //{
-                //    _currentDireplenOperation = DiReplenOperation.None;
-                //}
-            }
             if (_currentDireplenOperation == DiReplenOperation.AutoCADiReplen)
             {
                 AutoDiReplenMonitor(CADiReplenOff, _reservoirData.CaLevel, _resRecipe.ReservoirCALevel, _resRecipe.DIReplenEnable,
                     _resRecipe.DIReplenTimeRate, _resRecipe.DIReplenCurrentRate);
             }
-            //阳极没有水位,自动补水监控逻辑待修正
-            if (_currentDireplenOperation == DiReplenOperation.AutoANDiReplen) 
-            {
-                
-            }
+          
         }
         /// <summary>
         /// 自动注水监控
@@ -1167,6 +1157,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
             }
             if (CheckOtherReservoirDiReplenStatus())
             {
+                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"there is exist reservoir in diReplen, can't start auto diReplen");
                 return false;
             }
             return true;
@@ -1297,7 +1288,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
         }
 
         /// <summary>
-        /// 自动注水
+        /// 自动注水公共方法
         /// </summary>
         /// <returns></returns>
         protected bool AutoDireplen(Func<bool> direplenOn, DiReplenOperation reservoirOperation)