从 MT2-AM8 模拟量模块迁移到 Easy521 PLC(Modbus TCP)
- 读取 D700(阀后流量)、D710(阀后压力)、D720(阀前压力), 读用功能码 03,0~32000 线性映射到各自量程(300 SLM / 400 kPa / 300 kPa) - 输出 D730(电机位置,0~10V),写用功能码 06,行程仍为 0~1000、死区 800 - 复用 MT2 骨架,保留 get_flow/get_pressure/set_motor_position 接口, channel 参数改为直接 Modbus 地址 - config.py 新增 PLC 设置,保留 MT2AM8 设置为死代码(MT2AM8Client 类保留) - 同步更新 README.md 中的硬件接线、配置默认值与模块职责描述
This commit is contained in:
+4
-4
@@ -1,7 +1,7 @@
|
||||
"""流量闭环控制层。
|
||||
|
||||
本模块只负责“读取传感器 -> PID -> 开度/行程映射 -> 下发电机位置”以及
|
||||
安全处理;底层 Modbus 通讯仍由 PcControl.MT2AM8Client 完成。
|
||||
安全处理;底层 Modbus 通讯仍由 PcControl.Easy521ModbusClient 完成。
|
||||
"""
|
||||
|
||||
from dataclasses import asdict, dataclass
|
||||
@@ -75,7 +75,7 @@ def opening_to_motor_position(
|
||||
|
||||
|
||||
class FlowControlLoop:
|
||||
"""基于 MT2AM8Client 和 IncrementalPID 的单回路流量控制器。"""
|
||||
"""基于 Easy521ModbusClient 和 IncrementalPID 的单回路流量控制器。"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -352,7 +352,7 @@ class FlowControlLoop:
|
||||
self._trip(
|
||||
"DEVICE_DISCONNECTED",
|
||||
"PRECHECK",
|
||||
"MT2-AM8 未连接",
|
||||
"PLC 未连接",
|
||||
)
|
||||
|
||||
current_time = time.perf_counter() if now is None else float(now)
|
||||
@@ -763,7 +763,7 @@ class FlowControlLoop:
|
||||
self._trip(
|
||||
"MOTOR_COMMAND_FAILED",
|
||||
"WRITE_MOTOR",
|
||||
"MT2-AM8 返回电机位置写入失败",
|
||||
"PLC 返回电机位置写入失败",
|
||||
{
|
||||
"requested_opening_pct": opening,
|
||||
"requested_motor_position": position,
|
||||
|
||||
Reference in New Issue
Block a user