OPC AE to转存modbusMQTT Gateway(odbc转opc) ypxx.net

OPC AE to转存modbus/MQTT Gateway 网关软件

作为物联网数据采集解决方案专业提供商,工业物联网数据采集专家(专业户),上海数采物联网科技有限公司小编 daq-iot 在这里做以下内容介绍,并诚挚的欢迎大家讨论和交流。As a professional provider of IoT data acquisition solutions and an expert specializing in industrial IoT data acquisition, daq-iot, editor of Shanghai Data-Acquisition IoT Technology Co., Ltd., hereby presents the following introduction, and sincerely welcomes discussions and exchanges with all.

========================================

OPC AE to MQTT Gateway - 使用说明版本信息

OPC AE to MQTT Gateway - TEST VERSION (Expires: 2026-05-10) 如需正式版,请联系技术支持。

功能说明

本程序作为 OPC AE 客户端,连接 OPC AE Server(如 KEPServerEX), 接收报警事件,转换为 JSON 格式,通过 MQTT 协议发布到 Broker。

运行环境

【操作系统】 Windows 10 / Windows 11 (64位)

【OPC AE Server】 本程序需要连接一个 OPC AE Server,例如:

  • KEPServerEX V5 / V6(推荐)
  • 其他支持 OPC AE 接口的 Server

【OPC 运行环境】 OPC Core Components 已安装(通常 KEPServerEX 安装时会自动安装) 无需额外注册 DLL 或拷贝文件

【MQTT Broker】 需要有一个 MQTT Broker 接收数据,例如:

  • Mosquitto(推荐)
  • 其他 MQTT Broker(EMQX、VerneMQ 等)
程序参数

用法:

ae2mqtt.exe [AEServerName] [AEServerIP] [MQTTHost] [MQTTPort]

参数说明:

  • AEServerName - OPC AE Server 的 ProgID
  • AEServerIP - OPC AE Server 所在机器的 IP 地址
  • MQTTHost - MQTT Broker 的 IP 地址或域名
  • MQTTPort - MQTT Broker 的端口号

默认参数(不带参数运行时自动使用):

  • AEServerName = Kepware.KEPServerEX_AE.V6
  • AEServerIP = 127.0.0.1
  • MQTTHost = 127.0.0.1
  • MQTTPort = 1883

示例:

# 使用默认参数(直接双击运行)

ae2mqtt.exe

# 指定参数

ae2mqtt.exe "Kepware.KEPServerEX_AE.V6" 127.0.0.1 192.168.1.100 1883

MQTT 主题

程序发布消息的主题为:

opcae/events

消息格式为 JSON,示例:

{ "source": "Channel1.Device1.Temperature",

"message": "温度过高报警",

"severity": 500, "eventType": 4,

"active": 1,

"timestamp": "2026-04-22T14:30:00"

}

字段说明:

source - 报警来源

message - 报警消息

severity - 严重等级 (0-1000)

eventType - 事件类型 (1=简单,2=跟踪,4=条件)

active - 是否激活 (1=激活,0=已恢复)

timestamp - 事件发生时间

日志文件

程序运行时会生成日志文件:

opcae_mqtt.log

日志文件与 exe 在同一目录下,记录运行状态和错误信息。

KEPServerEX 配置要点
  1. 确保 AE 接口已启用: Project → Properties → OPC AE → 勾选 “Enable Alarms and Events (AE) Interface”
  2. 创建报警条件 (Condition): 在 Alarms & Events 中创建 Area → Source → Condition 绑定一个 Tag 并设置触发阈值
  3. 启动 Runtime Service: 系统托盘 KEPServerEX 图标应为绿色
常见问题

Q: 提示 “Failed to connect to OPC AE Server” A: 检查 KEPServerEX 是否运行,AE 接口是否启用

Q: 提示 “MQTT connection failed” A: 检查 MQTT Broker 是否运行,地址和端口是否正确

Q: 程序能连上但收不到事件 A: 检查 KEPServerEX 中是否配置了有效的 Condition,并触发报警

技术支持

本程序为测试版本,有效期截止2026-09-10,如有问题请联系技术支持。

========================================