Merge branch 'develop' into feature/测温重构

This commit is contained in:
hanqiangqiang 2023-11-06 13:43:45 +08:00
commit 4ea50478e4
2 changed files with 21 additions and 35 deletions

View File

@ -1,10 +1,8 @@
using Aitex.Core.RT.Event; using Aitex.Core.RT.DataCenter;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.IOCore; using Aitex.Core.RT.IOCore;
using Aitex.Core.RT.SCCore; using Aitex.Core.RT.SCCore;
using Aitex.Core.Util; using Aitex.Core.Util;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Xml; using System.Xml;
namespace Aitex.Core.RT.Device.Devices namespace Aitex.Core.RT.Device.Devices
@ -12,17 +10,8 @@ namespace Aitex.Core.RT.Device.Devices
public class IoGasBoxTemp : BaseDevice, IDevice public class IoGasBoxTemp : BaseDevice, IDevice
{ {
//配置中标记的AI名称 //配置中标记的AI名称
protected readonly List<string> _aiGasBoxTempName = new List<string>()
{
"aiHeatTMA",
"aiHeatTCSPanel",
"aiHeatinsidePanel",
"aiHeatoutsidePanel",
"aiHeatoutsideSH",
"aiHeatLeakBypass"
};
protected readonly List<AIAccessor> _aiGasBoxTemp; protected readonly AIAccessor _aiGasBoxTemp;
protected readonly DOAccessor _doLineHeaterEnable; protected readonly DOAccessor _doLineHeaterEnable;
@ -36,28 +25,18 @@ namespace Aitex.Core.RT.Device.Devices
public IoGasBoxTemp(string module, XmlElement node, string ioModule = "") : base(module, node, ioModule) public IoGasBoxTemp(string module, XmlElement node, string ioModule = "") : base(module, node, ioModule)
{ {
_aiGasBoxTemp = new List<AIAccessor>(); _aiGasBoxTemp = ParseAiNode("aiHeatTMA", node, ioModule);
foreach (var aiName in _aiGasBoxTempName)
{
_aiGasBoxTemp.Add(ParseAiNode(aiName, node, ioModule));
}
_doLineHeaterEnable = ParseDoNode("doLineHeaterEnable", node, ioModule); _doLineHeaterEnable = ParseDoNode("doLineHeaterEnable", node, ioModule);
_scNameAlarmHigh = $"PM.{module}.Heater.{node.GetAttribute("scItemName")}"; _scNameAlarmHigh = $"{ScBasePath}.{node.GetAttribute("scAlarmHigh")}";
Debug.Assert(_doLineHeaterEnable != null, "doLineHeaterEnable is not defined.");
} }
protected override void HandleMonitor() protected override void HandleMonitor()
{ {
var alarmMsg = _aiGasBoxTemp.Where(ai => _alarmHigh > 0 && ai != null && ai.FloatValue >= _alarmHigh) if (_alarmHigh == 0)
.Aggregate("", (current, ai) => current + $"{ai.Name} = {ai.FloatValue} ; "); return;
if (_aiGasBoxTemp.FloatValue >= _alarmHigh)
if (_alarmCount != alarmMsg.Length)// 报警数量发生变化才复位trig防止未复位时产生新的报警不提示问题
_trigIsAlarm.RST = true;
if (alarmMsg.Length > 0)//有报警
{ {
_trigIsAlarm.CLK = true; _trigIsAlarm.CLK = true;
if (_trigIsAlarm.Q) if (_trigIsAlarm.Q)
@ -65,26 +44,25 @@ namespace Aitex.Core.RT.Device.Devices
if (_doLineHeaterEnable == null) if (_doLineHeaterEnable == null)
{ {
EV.PostWarningLog(Module, EV.PostWarningLog(Module,
$"{alarmMsg} over temperature {_alarmHigh} but doLineHeaterEnable can not be off since it's not defined"); $"{_aiGasBoxTemp.Name} {_aiGasBoxTemp.FloatValue} over temperature {_alarmHigh} but doLineHeaterEnable can not be off since it's not defined");
} }
else else
{ {
_doLineHeaterEnable.SetValue(false, out _); _doLineHeaterEnable.SetValue(false, out _);
EV.PostWarningLog(Module, EV.PostWarningLog(Module,
$"{alarmMsg} over temperature {_alarmHigh}\r\n{Module}.{_doLineHeaterEnable.Name} force off"); $"{_aiGasBoxTemp.Name} {_aiGasBoxTemp.FloatValue} over temperature {_alarmHigh}\r\n{Module}.{_doLineHeaterEnable.Name} force off");
} }
} }
} }
_alarmCount = alarmMsg.Length;
} }
public bool Initialize() public bool Initialize()
{ {
DATA.Subscribe($"{Module}.GasBoxTemp.{Name}", () => _aiGasBoxTemp.FloatValue);
_alarmHigh = SC.SafeGetValue(_scNameAlarmHigh, double.PositiveInfinity); _alarmHigh = SC.SafeGetValue(_scNameAlarmHigh, double.PositiveInfinity);
SC.RegisterValueChangedCallback(_scNameAlarmHigh, v => _alarmHigh = (double)v); SC.RegisterValueChangedCallback(_scNameAlarmHigh, v => _alarmHigh = (double)v);
return true; return true;
} }

View File

@ -39,6 +39,8 @@ namespace Aitex.Core.RT.Device.Devices
private readonly SCConfigItem _scDefaultSetPoint; private readonly SCConfigItem _scDefaultSetPoint;
private readonly bool _isFloatAioType = false; private readonly bool _isFloatAioType = false;
private readonly R_TRIG _valveCloseTrigger = new R_TRIG();
/// <summary> /// <summary>
/// 当前MFC前置或后置阀门ID /// 当前MFC前置或后置阀门ID
/// </summary> /// </summary>
@ -297,6 +299,12 @@ namespace Aitex.Core.RT.Device.Devices
{ {
// 如果Valve关闭则不检测。 // 如果Valve关闭则不检测。
isAllowErrMon = valveData.Feedback; isAllowErrMon = valveData.Feedback;
_valveCloseTrigger.CLK = !valveData.IsOpen;
if (_valveCloseTrigger.Q)
{
Reset();
}
} }
else else
{ {