From 18a505cc30ca8e5374115d0712e09d16907a5749 Mon Sep 17 00:00:00 2001 From: hanqiangqiang <1364346467@qq.com> Date: Wed, 21 Feb 2024 10:59:59 +0800 Subject: [PATCH] =?UTF-8?q?[RT.EquipmentLibrary]=20=E5=8A=A0=E7=83=AD?= =?UTF-8?q?=E5=B8=A6=E6=8A=A5=E8=AD=A6=E7=9B=91=E6=8E=A7=EF=BC=8C=E6=AD=A3?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E9=A1=B9=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8A=A5=E8=AD=A6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Devices/IoLineHeater.cs | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/MECF.Framework.RT.EquipmentLibrary/Devices/IoLineHeater.cs b/MECF.Framework.RT.EquipmentLibrary/Devices/IoLineHeater.cs index 725cdbe..4aecb4d 100644 --- a/MECF.Framework.RT.EquipmentLibrary/Devices/IoLineHeater.cs +++ b/MECF.Framework.RT.EquipmentLibrary/Devices/IoLineHeater.cs @@ -25,11 +25,13 @@ namespace Aitex.Core.RT.Device.Devices protected int _alarmCount; + protected string _scWarningLog; private readonly LineHeaterData _lineHeaterData = new(); + public LineHeaterData lineHeaterData { - get + get { _lineHeaterData.LineHeaterLaber = Display; _lineHeaterData.ScHighTemp = _alarmHigh; @@ -46,6 +48,14 @@ namespace Aitex.Core.RT.Device.Devices _doLineHeaterEnable = ParseDoNode("doLineHeaterEnable", node, ioModule); _scNameAlarmHigh = $"{ScBasePath}.{node.GetAttribute("scAlarmHigh")}"; + + var scWarningLog = node.GetAttribute("scWarningLog"); + _scWarningLog = scWarningLog == "" ? scWarningLog : SC.GetStringValue($"{ScBasePath}.{scWarningLog}"); + + if (scWarningLog != "") + { + SC.RegisterValueChangedCallback($"{ScBasePath}.{scWarningLog}", (obj) => { _scWarningLog = (string)obj; }); + } } protected override void HandleMonitor() @@ -59,19 +69,26 @@ namespace Aitex.Core.RT.Device.Devices { if (_doLineHeaterEnable == null) { - EV.PostWarningLog(Module, - $"{_aiTemp.Name} {_aiTemp.FloatValue} over temperature {_alarmHigh} but doLineHeaterEnable can not be off since it's not defined"); + PostLog($"{_aiTemp.Name} {_aiTemp.FloatValue} over temperature {_alarmHigh}"); } else { _doLineHeaterEnable.SetValue(false, out _); - EV.PostWarningLog(Module, - $"{_aiTemp.Name} {_aiTemp.FloatValue} over temperature {_alarmHigh}\r\n{Module}.{_doLineHeaterEnable.Name} force off"); + PostLog($"{_aiTemp.Name} {_aiTemp.FloatValue} over temperature {_alarmHigh}\r\n{Module}.{_doLineHeaterEnable.Name} force off"); } + } } } + private void PostLog(string log) + { + if (_scWarningLog == "Alarm") + EV.PostAlarmLog(Module, log); + else + EV.PostWarningLog(Module, log); + } + public bool Initialize() { DATA.Subscribe($"{Module}.LineHeater.{Display}", () => _aiTemp.FloatValue);