现场调试版同步:S331 点表修正(CDAB/scale 60/int32) + SafeRTUFramer 多点485 + 哨兵过滤

- config.yaml: 恢复现场 IP(10.50.253.165/.181/.182)、s331_2 端口 502
- config.yaml: S331 全部 32 位量 word_order 改 CDAB,瞬时流量 scale=60 (m3/min -> m3/h)
- config.yaml: 11# 电表功率/电能类型改 int32;第二路 RTU 从站 slave_id 改 10
- poller.py: 过滤 S331 无数据哨兵 -9999 与非有限值,避免污染周期基准
- rtu.py: 新增 SafeRTUFramer 支持多点半总线,忽略其它从站请求
- 新增 config.debug.yaml、README.md、wheelhouse 离线依赖
- tests: 适配新配置(ttyS7/address_offset);新增 pytest.ini 限定 testpaths
This commit is contained in:
yangpengyu authored and trae-solo-agent committed 2026-11-19 10:59:27 +08:00
commit 9eaf87ab7d
43 files changed
+4514

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""从 PC 侧用 RTU 主站探测两个 USB-485 口,确定哪只适配器接到了网关。"""
import sys
from pymodbus.client import ModbusSerialClient
for port in ("COM4", "COM5"):
client = ModbusSerialClient(port=port, baudrate=19200, bytesize=8, parity="N", stopbits=1, timeout=1.0)
try:
if not client.connect():
print(f"{port}: 打开失败(可能被其他程序占用)")
continue
for slave in (10, 20):
try:
rr = client.read_holding_registers(0, count=8, slave=slave)
if rr.isError():
print(f"{port} slave={slave}: 异常响应 {rr}")
else:
regs = rr.registers
print(f"{port} slave={slave}: OK 寄存器0~7={regs}")
except Exception as e: # noqa: BLE001
print(f"{port} slave={slave}: 超时/无响应 ({type(e).__name__})")
client.close()
except Exception as e: # noqa: BLE001
print(f"{port}: 串口错误 {e}")