Kaynağa Gözat

add AN direplen releated

chenzk 1 hafta önce
ebeveyn
işleme
06b4b1f386
1 değiştirilmiş dosya ile 98 ekleme ve 0 silme
  1. 98 0
      PunkHPX8_RT/Devices/Reservoir/ReservoirDevice.cs

+ 98 - 0
PunkHPX8_RT/Devices/Reservoir/ReservoirDevice.cs

@@ -165,6 +165,14 @@ namespace PunkHPX8_RT.Devices.Reservoir
         /// </summary>
         public bool IsCALowLevel { get { return CheckCALowLevelStatus(); } }
         /// <summary>
+        /// 检验阳极是否highlevel
+        /// </summary>
+        public bool IsANHighLevel { get { return _reservoirData.AnTowerHigh; } }
+        /// <summary>
+        /// 检验阳极是否lowlevel
+        /// </summary>
+        public bool IsANLowLevel { get { return _reservoirData.AnTowerLow; } }
+        /// <summary>
         /// 当前Recipe
         /// </summary>
         public ResRecipe Recipe { get { return _resRecipe; } }
@@ -435,11 +443,23 @@ 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>
         /// 自动注水监控
@@ -831,6 +851,73 @@ namespace PunkHPX8_RT.Devices.Reservoir
         }
         #endregion
 
+        #region AN DiReplen
+        /// <summary>
+        /// 阳极DI Replen On
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private bool ANDiReplenOnOperation(string cmd, object[] args)
+        {
+            return ANDiReplenOn();
+        }
+        /// <summary>
+        /// 阳极DI Replen On
+        /// </summary>
+        /// <param name="showError"></param>
+        /// <returns></returns>
+        private bool ANDiReplenOn()
+        {
+            bool preCondition = CheckPreDiReplenCondition();
+            if (!preCondition)
+            {
+                return false;
+            }
+            if (IsANHighLevel)
+            {
+                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"ANHighLevel is activate,Can't do AN_DIReple");
+                return false;
+            }
+            if (IsANLowLevel)
+            {
+                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, $"ANLowLevel is activate,Can't do AN_DIReple");
+                return false;
+            }
+            if (ReservoirData.CaDiReplen)
+            {
+                LOG.WriteLog(eEvent.ERR_RESERVOIR, Module, "CADiReplen is on");
+                return false;
+            }
+            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{AN_DI_REPLEN}");
+            return BeckhoffIOManager.Instance.WriteIoValue(ioName, true);
+        }
+
+        /// <summary>
+        /// 阳极DI Replen Off
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private bool ANDiReplenOff(string cmd, object[] args)
+        {
+            string ioName = BeckhoffModuleIOManager.Instance.GetIoNameByInnerModuleName($"{Module}.{AN_DI_REPLEN}");
+            bool result = BeckhoffIOManager.Instance.WriteIoValue(ioName, false);
+            if (result)
+            {
+                _persistentValue.IsDiReplenOn = false;
+                if (_currentDireplenOperation == DiReplenOperation.ManualANDiReplen || _currentDireplenOperation == DiReplenOperation.AutoANDiReplen)
+                {
+                    _currentDireplenOperation = DiReplenOperation.None;
+                    _persistentValue.LastTotalReplen = _persistentValue.TotalReplen;
+                    ReservoirsPersistentManager.Instance.UpdatePersistentValue(Module);
+                }
+            }
+            return result;
+        }
+
+        #endregion
+
         #region DiReplen Operation
         /// <summary>
         /// 重置时长
@@ -857,6 +944,16 @@ namespace PunkHPX8_RT.Devices.Reservoir
             return ManualDiReplen(CADiReplenOnOperation, DiReplenOperation.ManualCADiReplen, args[0].ToString());
         }
         /// <summary>
+        /// 手动阳极注水
+        /// </summary>
+        /// <param name="cmd"></param>
+        /// <param name="args"></param>
+        /// <returns></returns>
+        private bool ManualANDiReplen(string cmd, object[] args)
+        {
+            return ManualDiReplen(ANDiReplenOnOperation, DiReplenOperation.ManualANDiReplen, args[0].ToString());
+        }
+        /// <summary>
         /// 手动注水
         /// </summary>
         /// <param name="direplenOn"></param>
@@ -952,6 +1049,7 @@ namespace PunkHPX8_RT.Devices.Reservoir
             return ReservoirData.CaWaterLevel < SC.GetValue<double>($"Reservoir.{Module}.CALowLevel") ? true : false;
         }
 
+
         public void Reset()
         {
         }