123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using Aitex.Core.Common.DeviceData;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.IOCore;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml;
- namespace JetMainframe.Devices
- {
- public class IoTempMeter : BaseDevice, IDevice
- {
- private AIAccessor _aiFeedBack = null;
- private bool _isFloatAioType;
- public float FeedBack
- {
- get
- {
- if (_aiFeedBack != null)
- return _isFloatAioType ? _aiFeedBack.FloatValue : _aiFeedBack.Value;
- return 0;
- }
- }
- public AITHeaterData DeviceData
- {
- get
- {
- var data = new AITHeaterData()
- {
- Module = Module,
- DeviceName = Name,
- DisplayName = Display,
- DeviceSchematicId = DeviceID,
- //UniqueName = UniqueName,
- FeedBack = FeedBack,
- };
- // data.AttrValue["PV"] = _aiFeedBack;
- return data;
- }
- }
- public IoTempMeter(string module, XmlElement node, string ioModule = "")
- {
- var attrModule = node.GetAttribute("module");
- base.Module = string.IsNullOrEmpty(attrModule) ? module : attrModule;
- base.Name = node.GetAttribute("id");
- base.Display = node.GetAttribute("display");
- base.DeviceID = node.GetAttribute("schematicId");
- _isFloatAioType = !string.IsNullOrEmpty(node.GetAttribute("aioType")) && (node.GetAttribute("aioType") == "float");
- _aiFeedBack = ParseAiNode("aiFeedback", node, ioModule);
- UniqueName = Module + "." + Name;
- }
- public bool Initialize()
- {
- //DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
- DATA.Subscribe($"BufferA.Heater", () => FeedBack);
- return true;
- }
- public void Reset()
- {
- }
- public void Terminate()
- {
- }
- public void Monitor()
- {
- }
- }
- }
|