Plc Read
plc_readRead data from PLCs via Modbus, FINS, MELSEC, or S7, interpreting values as uint16, int16, or float32. Specify address, count, and datatype to get typed values or raw interpretations.
Instructions
从 PLC 读取数据区并按数据类型解释。
address/count 为通用地址与数量, 语义由协议决定:
Modbus: address 为 0 基寄存器地址, count 为寄存器个数
FINS: address 为字地址, count 为字数
MELSEC: address 为起始编号, count 为点数 (位软元件按 16 点/字)
S7: address 为字节地址, count 为字节数 (count=4 + uint16 → 2 个值)
datatype 取 uint16/int16/float32, None 返回原始 16 位值 + 所有常见数据类型的多解释 (interpretations 字段), 便于 Agent 识别正确的数据类型。 byteorder 仅影响 float32 寄存器对顺序 (big=ABCD, little=DCBA)。
options: 协议特有参数, 由各协议 adapter 自行定义与校验。 用 list_protocols 查看每个协议的 read_options 说明。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | ||
| port | Yes | ||
| unit | No | ||
| count | No | ||
| address | Yes | ||
| options | No | ||
| datatype | No | ||
| protocol | Yes | ||
| byteorder | No | big | |
| timeout_ms | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | 目标设备标识, 同时是连接池 key 的组成部分 (D1)。 | |
| address | Yes | ||
| elapsed_ms | Yes | ||
| interpreted | No | ||
| raw_registers | Yes | ||
| request_frame | Yes | ||
| interpretations | No |