Files
yangpengyu 9eaf87ab7d 现场调试版同步: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
2026-11-19 10:59:27 +08:00

164 lines
5.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 本地调试配置(PC 上跑 mock_tcp_servers.py 时用)
# 与生产 config.yaml 的唯一区别:数据源指向 127.0.0.1、数据库落在当前目录、
# RTU 从站端口换成 PC 上的 COM 口。点表、字序、scale 与生产完全一致。
#
# 启动 mock: python tools\mock_tcp_servers.py
# 启动网关: python -m gateway.app --config config/config.debug.yaml
gateway:
db_path: ./data/gateway.db # Windows/Linux 都可用,目录会自动创建
log_level: INFO # 想看清帧收发可改 DEBUG(日志会很多)
log_file: ""
persist_interval_s: 60
status_interval_s: 10
stale_warn_s: 20
register_float_order: ABCD
devices:
mogo_meter:
host: 127.0.0.1
port: 1502
slave_id: 1
timeout_s: 1.0
poll_interval_s: 2.0
address_offset: 0
max_registers_per_read: 100
max_gap: 6
reconnect_min_s: 1.0
reconnect_max_s: 30.0
s331_1:
host: 127.0.0.1
port: 502
slave_id: 10
timeout_s: 1.0
poll_interval_s: 2.0
address_offset: 0
max_registers_per_read: 100
max_gap: 2
reconnect_min_s: 1.0
reconnect_max_s: 30.0
s331_2:
host: 127.0.0.1
port: 503
slave_id: 20
timeout_s: 1.0
poll_interval_s: 2.0
address_offset: 0
max_registers_per_read: 100
max_gap: 2
reconnect_min_s: 1.0
reconnect_max_s: 30.0
compressors:
- id: 3
name: "3#空压机"
s331: s331_1
meter: mogo_meter
register_index: 0
flow_instant: { address: 112, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 114, type: uint32, word_order: CDAB }
power_instant: { address: 149, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 151, type: float32, word_order: ABCD, scale: 0.1 }
- id: 4
name: "4#空压机"
s331: s331_1
meter: mogo_meter
register_index: 1
flow_instant: { address: 122, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 124, type: uint32, word_order: CDAB }
power_instant: { address: 157, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 159, type: float32, word_order: ABCD, scale: 0.1 }
- id: 5
name: "5#空压机"
s331: s331_1
meter: mogo_meter
register_index: 2
flow_instant: { address: 132, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 134, type: uint32, word_order: CDAB }
power_instant: { address: 165, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 167, type: float32, word_order: ABCD, scale: 0.1 }
- id: 11
name: "11#空压机"
s331: s331_1
meter: mogo_meter
register_index: 8
flow_instant: { address: 142, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 144, type: uint32, word_order: CDAB }
power_instant: { address: 197, type: int32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 199, type: int32, word_order: ABCD, scale: 0.1 }
- id: 6
name: "6#空压机"
s331: s331_2
meter: mogo_meter
register_index: 3
flow_instant: { address: 118, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 120, type: uint32, word_order: CDAB }
power_instant: { address: 173, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 175, type: float32, word_order: ABCD, scale: 0.1 }
- id: 7
name: "7#空压机"
s331: s331_2
meter: mogo_meter
register_index: 4
flow_instant: { address: 128, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 130, type: uint32, word_order: CDAB }
power_instant: { address: 181, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 183, type: float32, word_order: ABCD, scale: 0.1 }
- id: 8
name: "8#空压机"
s331: s331_2
meter: mogo_meter
register_index: 5
flow_instant: { address: 138, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 140, type: uint32, word_order: CDAB }
power_instant: { address: 189, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 191, type: float32, word_order: ABCD, scale: 0.1 }
- id: 9
name: "9#空压机"
s331: s331_2
meter: mogo_meter
register_index: 6
flow_instant: { address: 148, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 150, type: uint32, word_order: CDAB }
power_instant: { address: 213, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 215, type: float32, word_order: ABCD, scale: 0.1 }
- id: 10
name: "10#空压机"
s331: s331_2
meter: mogo_meter
register_index: 7
flow_instant: { address: 158, type: float32, word_order: CDAB, scale: 60 }
flow_total: { address: 160, type: uint32, word_order: CDAB }
power_instant: { address: 205, type: float32, word_order: ABCD, scale: 0.001 }
energy_total: { address: 207, type: float32, word_order: ABCD, scale: 0.1 }
# PC 调试用 RTU 从站:没有串口也不影响 TCP 采集,从站会每 3~5 秒重试并打印异常。
# Windows 接 USB-RS485 后改成实际 COM 号;Linux 改成 /dev/ttyUSB0、/dev/ttyUSB1。
slaves:
- name: gateway_to_s331_1
port: COM10
slave_id: 10
baudrate: 19200
bytesize: 8
parity: N
stopbits: 1
timeout_s: 0.5
- name: gateway_to_s331_2
port: COM11
slave_id: 10
baudrate: 19200
bytesize: 8
parity: N
stopbits: 1
timeout_s: 0.5