Merge branch 'develop' into feature/测温重构
This commit is contained in:
commit
4ea50478e4
|
@ -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.SCCore;
|
||||
using Aitex.Core.Util;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
namespace Aitex.Core.RT.Device.Devices
|
||||
|
@ -12,17 +10,8 @@ namespace Aitex.Core.RT.Device.Devices
|
|||
public class IoGasBoxTemp : BaseDevice, IDevice
|
||||
{
|
||||
//配置中标记的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;
|
||||
|
||||
|
@ -36,28 +25,18 @@ namespace Aitex.Core.RT.Device.Devices
|
|||
|
||||
public IoGasBoxTemp(string module, XmlElement node, string ioModule = "") : base(module, node, ioModule)
|
||||
{
|
||||
_aiGasBoxTemp = new List<AIAccessor>();
|
||||
foreach (var aiName in _aiGasBoxTempName)
|
||||
{
|
||||
_aiGasBoxTemp.Add(ParseAiNode(aiName, node, ioModule));
|
||||
}
|
||||
_aiGasBoxTemp = ParseAiNode("aiHeatTMA", node, ioModule);
|
||||
|
||||
_doLineHeaterEnable = ParseDoNode("doLineHeaterEnable", node, ioModule);
|
||||
|
||||
_scNameAlarmHigh = $"PM.{module}.Heater.{node.GetAttribute("scItemName")}";
|
||||
|
||||
Debug.Assert(_doLineHeaterEnable != null, "doLineHeaterEnable is not defined.");
|
||||
_scNameAlarmHigh = $"{ScBasePath}.{node.GetAttribute("scAlarmHigh")}";
|
||||
}
|
||||
|
||||
protected override void HandleMonitor()
|
||||
{
|
||||
var alarmMsg = _aiGasBoxTemp.Where(ai => _alarmHigh > 0 && ai != null && ai.FloatValue >= _alarmHigh)
|
||||
.Aggregate("", (current, ai) => current + $"{ai.Name} = {ai.FloatValue} ; ");
|
||||
|
||||
if (_alarmCount != alarmMsg.Length)// 报警数量发生变化才复位trig,防止未复位时产生新的报警不提示问题
|
||||
_trigIsAlarm.RST = true;
|
||||
|
||||
if (alarmMsg.Length > 0)//有报警
|
||||
if (_alarmHigh == 0)
|
||||
return;
|
||||
if (_aiGasBoxTemp.FloatValue >= _alarmHigh)
|
||||
{
|
||||
_trigIsAlarm.CLK = true;
|
||||
if (_trigIsAlarm.Q)
|
||||
|
@ -65,26 +44,25 @@ namespace Aitex.Core.RT.Device.Devices
|
|||
if (_doLineHeaterEnable == null)
|
||||
{
|
||||
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
|
||||
{
|
||||
_doLineHeaterEnable.SetValue(false, out _);
|
||||
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()
|
||||
{
|
||||
|
||||
DATA.Subscribe($"{Module}.GasBoxTemp.{Name}", () => _aiGasBoxTemp.FloatValue);
|
||||
|
||||
_alarmHigh = SC.SafeGetValue(_scNameAlarmHigh, double.PositiveInfinity);
|
||||
SC.RegisterValueChangedCallback(_scNameAlarmHigh, v => _alarmHigh = (double)v);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace Aitex.Core.RT.Device.Devices
|
|||
private readonly SCConfigItem _scDefaultSetPoint;
|
||||
private readonly bool _isFloatAioType = false;
|
||||
|
||||
private readonly R_TRIG _valveCloseTrigger = new R_TRIG();
|
||||
|
||||
/// <summary>
|
||||
/// 当前MFC前置或后置阀门ID
|
||||
/// </summary>
|
||||
|
@ -297,6 +299,12 @@ namespace Aitex.Core.RT.Device.Devices
|
|||
{
|
||||
// 如果Valve关闭,则不检测。
|
||||
isAllowErrMon = valveData.Feedback;
|
||||
|
||||
_valveCloseTrigger.CLK = !valveData.IsOpen;
|
||||
if (_valveCloseTrigger.Q)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue