Kaynağa Gözat

add dm reservoir valve operation

chenzk 1 hafta önce
ebeveyn
işleme
cc67f923bf

+ 6 - 2
Framework/Common/CommonData/Reservoir/ReservoirData.cs

@@ -33,7 +33,7 @@ namespace MECF.Framework.Common.CommonData.Reservoir
 
         public double CaPumpSpeed { get { return _caPumpSpeed; } set { _caPumpSpeed = value;InvokePropertyChanged(nameof(CaPumpSpeed)); } }
 
-        public bool ReturnValve { get { return _returnValve; } set { _returnValve = value;InvokePropertyChanged(nameof(ReturnValve)); } }
+        public bool ReturnValveEnable { get { return _returnValveEnable; } set { _returnValveEnable = value;InvokePropertyChanged(nameof(ReturnValveEnable)); } }
 
         public double ReturnValvePercent { get { return _returnValvePercent; } set { _returnValvePercent = value; InvokePropertyChanged(nameof(ReturnValvePercent)); } }
 
@@ -50,6 +50,8 @@ namespace MECF.Framework.Common.CommonData.Reservoir
         public bool HedFlowEnable { get { return _hedFlowEnable; } set { _hedFlowEnable = value;InvokePropertyChanged(nameof(HedFlowEnable)); } }
 
         public bool PhFlowValve { get { return _phFlowValve; } set { _phFlowValve = value;InvokePropertyChanged(nameof (PhFlowValve)); } }
+        public bool AnIsolation { get { return _anIsolation; } set { _anIsolation = value;InvokePropertyChanged(nameof (AnIsolation)); } }
+        public bool CaIsolation { get { return _caIsolation; } set { _caIsolation = value;InvokePropertyChanged(nameof (CaIsolation)); } }
 
         public double PHValue { get { return _phValue; } set { _phValue = value; InvokePropertyChanged(nameof(PHValue)); } }
         public bool IsDataInitialized { get { return _isDataInitialized; } set { _isDataInitialized = value; InvokePropertyChanged(nameof(IsDataInitialized)); } }
@@ -68,7 +70,7 @@ namespace MECF.Framework.Common.CommonData.Reservoir
         private bool _caPumpEnable;
         private double _caPumpSpeed;
         private double _returnValveOpening;
-        private bool _returnValve;
+        private bool _returnValveEnable;
         private double _returnValvePercent;
         private bool _caDiReplen;
         private bool _anDiReplen;
@@ -77,6 +79,8 @@ namespace MECF.Framework.Common.CommonData.Reservoir
         private double _hedFlow;
         private bool _hedFlowEnable;
         private bool _phFlowValve;
+        private bool _anIsolation;
+        private bool _caIsolation;
         private double _phValue;
         private bool _isDataInitialized;
         #endregion

+ 1 - 1
PunkHPX8_MainPages/ViewModels/DMReservoirViewModel.cs

@@ -252,7 +252,7 @@ namespace PunkHPX8_MainPages.ViewModels
         /// <param name="param"></param>
         private void ReturnFlowOpenPercentSetAction(object param)
         {
-            InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
+            InvokeClient.Instance.Service.DoOperation($"{Module}.ReturnValvePercent", InputRetrunFlowOpenPercent);
         }
         #endregion
 

+ 6 - 6
PunkHPX8_MainPages/Views/DMReservoirView.xaml

@@ -234,7 +234,7 @@
                         <Control:IntegerTextBox IsEnabled="{Binding IsEnabled}" Value="{Binding InputRetrunFlowOpenPercent,Mode=TwoWay}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" Height="30"  Width="70"/>
                     </Grid>
                     <Border Grid.Row="5" Grid.Column="1" Background="Black" Width="80" Height="30" Margin="0 0 0 0">
-                        <TextBlock Text="{Binding ReservoirData.ReturnValvePercent}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+                        <TextBlock Text="{Binding ReservoirData.ReturnValveOpening}" Foreground="Lime" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                     </Border>
                     <Grid Grid.Row="1" Grid.Column="2">
                         <Button IsEnabled="{Binding IsEnabled}" Style="{StaticResource SysBtnStyle}" Command="{Binding CAPumpSpeedSetCommand}" Height="30" Width="50" Margin="0,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"  Content="Set"/>
@@ -283,17 +283,17 @@
             <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Grid.RowSpan="3" Margin="250,0,0,0">
                 <userControls:DMReservoirUIControl
                     ModuleName="{Binding Module}"
-                    ANIsolationValve="True"
-                    CAIsolationValve="True"
-                    ReturnFlowValve="{Binding ReservoirData.ReturnValveOpening}"
-                    DegasValve="True"
+                    ANIsolationValve="{Binding ReservoirData.AnIsolation}"
+                    CAIsolationValve="{Binding ReservoirData.CaIsolation}"
+                    ReturnFlowValve="{Binding ReservoirData.ReturnValveEnable}"
+                    DegasValve="{Binding ReservoirData.DegasEnable}"
                     SampleValve="{Binding ReservoirData.SampleOut}"
                     IsANPumpOpen="{Binding ReservoirData.AnPumpEnable}"
                     IsCAPumpOpen="{Binding ReservoirData.CaPumpEnable}"
                     IsCALevelHigh="True"
                     IsCALevelLow="True"
                     IsANLevelHigh="{Binding ReservoirData.AnTowerHigh}"
-                    IsANLevelLow="{Binding ReservoirData.CaWaterLevel}"
+                    IsANLevelLow="{Binding ReservoirData.AnTowerLow}"
                     ANFlow="0"
                     CAFlow="0"
                     CALevel="{Binding ReservoirData.CaLevel}"

+ 142 - 10
PunkHPX8_RT/Devices/Reservoir/ReservoirDevice.cs

@@ -255,6 +255,22 @@ namespace PunkHPX8_RT.Devices.Reservoir
             OP.Subscribe($"{Module}.CAPumpSpeed", CAPumpSpeedOperation);
             OP.Subscribe($"{Module}.CAPumpDisable", CAPumpOff);
             OP.Subscribe($"{Module}.LoadRecipe", LoadRecipeOperation);
+            OP.Subscribe($"{Module}.ReturnValveOn", ReturnValveOn);
+            OP.Subscribe($"{Module}.ReturnValveOff", (cmd, para) => { return ReturnValveOff();});
+            OP.Subscribe($"{Module}.ReturnValvePercent", ReturnValvePercentOperation);
+
+            OP.Subscribe($"{Module}.CAIsolationOn", (cmd, para) => { return CAIsolationOn(); });
+            OP.Subscribe($"{Module}.CAIsolationOff", (cmd, para) => { return CAIsolationOff(); });
+            OP.Subscribe($"{Module}.ANIsolationOn", (cmd, para) => { return ANIsolationOn(); });
+            OP.Subscribe($"{Module}.ANIsolationOff", (cmd, para) => { return ANIsolationOff(); });
+            OP.Subscribe($"{Module}.SampleOutValveOn", (cmd, para) => { return SampleOutValveOn(); });
+            OP.Subscribe($"{Module}.SampleOutValveOff", (cmd, para) => { return SampleOutValveOff(); });
+            OP.Subscribe($"{Module}.DegasValveOn", (cmd, para) => { return DegasValveOn(); });
+            OP.Subscribe($"{Module}.DegasValveOff", (cmd, para) => { return DegasValveOff(); });
+            OP.Subscribe($"{Module}.PhValveOn", (cmd, para) => { return PhValveOn(); });
+            OP.Subscribe($"{Module}.PhValveOff", (cmd, para) => { return PhValveOff(); });
+            OP.Subscribe($"{Module}.HedValveOn", (cmd, para) => { return HedValveOn(); });
+            OP.Subscribe($"{Module}.HedValveOff", (cmd, para) => { return HedValveOff(); });
         }
         /// <summary>
         /// 订阅变量数值发生变化
@@ -273,6 +289,9 @@ namespace PunkHPX8_RT.Devices.Reservoir
             IoSubscribeUpdateVariable(RETURN_VALVE_OPENING);
             IoSubscribeUpdateVariable(RETURN_VALVE_PERCENT);
             IoSubscribeUpdateVariable(SAMPLE_OUT);
+            IoSubscribeUpdateVariable(CA_ISOLATION);
+            IoSubscribeUpdateVariable(AN_ISOLATION);
+            IoSubscribeUpdateVariable(DEGAS_ENABLE);
         }
         /// <summary>
         /// 订阅IO变量
@@ -310,6 +329,19 @@ namespace PunkHPX8_RT.Devices.Reservoir
             }
         }
         /// <summary>
+        /// 写变量
+        /// </summary>
+        /// <param name="variable"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        private bool WriteVariableValue(string variable, object value)
+        {
+            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{variable}");
+            return IOModuleManager.Instance.WriteIoValue(ioName, value);
+        }
+
+
+        /// <summary>
         /// 定时器
         /// </summary>
         /// <returns></returns>
@@ -578,6 +610,8 @@ namespace PunkHPX8_RT.Devices.Reservoir
             ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
             return true;
         }
+        #endregion
+        
         /// <summary>
         /// 加载Recipe
         /// </summary>
@@ -598,7 +632,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
             LOG.WriteLog(eEvent.INFO_RESERVOIR, Module.ToString(), $"Load {recipeRoute} Recipe {_resRecipe.Ppid} Success");
             return true;
         }
-        #endregion
+   
 
         /// <summary>
         /// 监控
@@ -692,11 +726,11 @@ namespace PunkHPX8_RT.Devices.Reservoir
             if (double.TryParse(args[0].ToString(), out double percent))
             {
                 _returnValvePercent = percent;
-                return CAPumpSpeed(_caPumpSpeed);
+                return ReturnValvePercent(_returnValvePercent);
             }
             else
             {
-                LOG.WriteLog(eEvent.ERR_METAL, Module, $"{args[0]} is nor invalid speed");
+                LOG.WriteLog(eEvent.ERR_METAL, Module, $"{args[0]} is invalid percent");
                 return false;
             }
         }
@@ -707,7 +741,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
         /// <returns></returns>
         public bool ReturnValvePercent(double percent)
         {
-            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{RETURN_VALVE_PERCENT}");
+            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{RETURN_VALVE_OPENING}");
             return BeckhoffIOManager.Instance.WriteIoValue(ioName, percent);
         }
         /// <summary>
@@ -722,8 +756,9 @@ namespace PunkHPX8_RT.Devices.Reservoir
             bool result = ReturnValvePercent(percent);
             if (result)
             {
-                string enableIOName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{RETURN_VALVE}");
-                return BeckhoffIOManager.Instance.WriteIoValue(enableIOName, true);
+                //string enableIOName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{RETURN_VALVE}");
+                //return BeckhoffIOManager.Instance.WriteIoValue(enableIOName, true);
+                return WriteVariableValue(RETURN_VALVE, true);
             }
             else
             {
@@ -736,13 +771,110 @@ namespace PunkHPX8_RT.Devices.Reservoir
         /// <param name="cmd"></param>
         /// <param name="args"></param>
         /// <returns></returns>
-        private bool ReturnValveOff(string cmd, object[] args)
+        public bool ReturnValveOff()
         {
-            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{RETURN_VALVE}");
-            return BeckhoffIOManager.Instance.WriteIoValue(ioName, false);
+            //string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{RETURN_VALVE}");
+            //return BeckhoffIOManager.Instance.WriteIoValue(ioName, false);
+            return WriteVariableValue(RETURN_VALVE, false);
         }
-
         #endregion
+        
+        /// <summary>
+        /// ANIsolationOn
+        /// </summary>
+        /// <returns></returns>
+        public bool ANIsolationOn()
+        {
+            return WriteVariableValue(AN_ISOLATION, true);
+        }
+        /// <summary>
+        /// ANIsolationOff
+        /// </summary>
+        /// <returns></returns>
+        public bool ANIsolationOff()
+        {
+            return WriteVariableValue(AN_ISOLATION, false);
+        }
+        /// <summary>
+        /// CAIsolationOn
+        /// </summary>
+        /// <returns></returns>
+        public bool CAIsolationOn()
+        {
+            return WriteVariableValue(CA_ISOLATION, true);
+        }
+        /// <summary>
+        /// CAIsolationOff
+        /// </summary>
+        /// <returns></returns>
+        public bool CAIsolationOff()
+        {
+            return WriteVariableValue(CA_ISOLATION, false);
+        }
+        /// <summary>
+        /// DegasValveOn
+        /// </summary>
+        /// <returns></returns>
+        public bool DegasValveOn()
+        {
+            return WriteVariableValue(DEGAS_ENABLE, true);
+        }
+        /// <summary>
+        /// DegasValveOff
+        /// </summary>
+        /// <returns></returns>
+        public bool DegasValveOff()
+        {
+            return WriteVariableValue(DEGAS_ENABLE, false);
+        }
+        /// <summary>
+        /// HedValveOn
+        /// </summary>
+        /// <returns></returns>
+        public bool HedValveOn()
+        {
+            return WriteVariableValue(HED_FLOW_ENABLE, true);
+        }
+        /// <summary>
+        /// HedValveOff
+        /// </summary>
+        /// <returns></returns>
+        public bool HedValveOff()
+        {
+            return WriteVariableValue(HED_FLOW_ENABLE, false);
+        }
+        /// <summary>
+        /// PhValveOn
+        /// </summary>
+        /// <returns></returns>
+        public bool PhValveOn()
+        {
+            return WriteVariableValue(PH_FLOW_VALVE, true);
+        }
+        /// <summary>
+        /// PhValveOff
+        /// </summary>
+        /// <returns></returns>
+        public bool PhValveOff()
+        {
+            return WriteVariableValue(PH_FLOW_VALVE, false);
+        }
+        /// <summary>
+        /// SampleOutValveOn
+        /// </summary>
+        /// <returns></returns>
+        public bool SampleOutValveOn()
+        {
+            return WriteVariableValue(SAMPLE_OUT, true);
+        }
+        /// <summary>
+        /// SampleOutValveOff
+        /// </summary>
+        /// <returns></returns>
+        public bool SampleOutValveOff()
+        {
+            return WriteVariableValue(SAMPLE_OUT, false);
+        }
 
         #region CA DiReplen
         /// <summary>

+ 14 - 13
PunkHPX8_Themes/UserControls/DMReservoirUIControl.xaml.cs

@@ -1,6 +1,9 @@
-using System;
+using MECF.Framework.Common.OperationCenter;
+using OpenSEMI.ClientBase;
+using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
@@ -12,8 +15,6 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
-using OpenSEMI.ClientBase;
-using MECF.Framework.Common.OperationCenter;
 
 namespace PunkHPX8_Themes.UserControls
 {
@@ -350,52 +351,52 @@ namespace PunkHPX8_Themes.UserControls
 
         private void OpenANIsolationValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ANIsolationOn"); 
         }
 
         private void CloseANIsolationValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ANIsolationOff");
         }
 
         private void OpenCAIsolationValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.CAIsolationOn");
         }
 
         private void CloseCAIsolationValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.CAIsolationOff");
         }
 
         private void OpenReturnFlowValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReturnValveOn");
         }
 
         private void CloseReturnFlowValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReturnValveOff");
         }
 
         private void OpenDegasValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DegasValveOn");
         }
 
         private void CloseDegasValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DegasValveOff");
         }
 
         private void OpenSampleValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SampleOutValveOn");
         }
 
         private void CloseSampleValve_Click(object sender, RoutedEventArgs e)
         {
-
+            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SampleOutValveOff");
         }
     }