93 lines
2.4 KiB
C#
93 lines
2.4 KiB
C#
|
using Aitex.Core.Backend;
|
|||
|
using Aitex.Core.Common.DeviceData;
|
|||
|
using Aitex.Core.RT.Device;
|
|||
|
using Aitex.Core.RT.Event;
|
|||
|
using Aitex.Core.RT.IOCore;
|
|||
|
using Aitex.Core.RT.SCCore;
|
|||
|
using Aitex.Core.Util;
|
|||
|
using MECF.Framework.Common.SicMath;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Xml;
|
|||
|
|
|||
|
namespace MECF.Framework.RT.EquipmentLibrary.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 DOAccessor _doLineHeaterEnable;
|
|||
|
|
|||
|
protected readonly string _scNameAlarmHigh;
|
|||
|
|
|||
|
protected double _alarmHigh;
|
|||
|
|
|||
|
protected readonly R_TRIG _trigIsAlarm = new R_TRIG();
|
|||
|
|
|||
|
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));
|
|||
|
}
|
|||
|
|
|||
|
_doLineHeaterEnable = ParseDoNode("doLineHeaterEnable", node, ioModule);
|
|||
|
var scAlarmHigh = node.GetAttribute("scAlarmHigh");
|
|||
|
_scNameAlarmHigh = $"{ScBasePath}.{scAlarmHigh}";
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected override void HandleMonitor()
|
|||
|
{
|
|||
|
string alarmMeg ="";
|
|||
|
foreach (var ai in _aiGasBoxTemp)
|
|||
|
{
|
|||
|
if (ai is not null && ai.Value >= _alarmHigh)
|
|||
|
alarmMeg +=ai.Name+" ; ";
|
|||
|
}
|
|||
|
if (alarmMeg.Length>0)
|
|||
|
{
|
|||
|
_trigIsAlarm.CLK = true;
|
|||
|
|
|||
|
EV.PostAlarmLog(Module, alarmMeg);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public bool Initialize()
|
|||
|
{
|
|||
|
_alarmHigh = SC.SafeGetValue(_scNameAlarmHigh, double.PositiveInfinity);
|
|||
|
SC.RegisterValueChangedCallback(_scNameAlarmHigh, v => _alarmHigh = (double)v);
|
|||
|
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public void Reset()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void Terminate()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|