170 lines
3.0 KiB
Plaintext
170 lines
3.0 KiB
Plaintext
modbus {
|
|
# 通信参数
|
|
transport rtu {
|
|
port /dev/ttyUSB0;
|
|
baudrate 9600;
|
|
parity none;
|
|
stopbits 1;
|
|
timeout 1s;
|
|
}
|
|
|
|
# 或TCP配置
|
|
#transport tcp {
|
|
# host 192.168.1.100;
|
|
# port 502;
|
|
# timeout 500ms;
|
|
#}
|
|
|
|
# 日志设置
|
|
error_log /var/log/modbus_error.log;
|
|
access_log /var/log/modbus_access.log;
|
|
}
|
|
|
|
device_io t1 {
|
|
# 轮询间隔
|
|
poll_interval 5s;
|
|
|
|
# 重试策略
|
|
retries 3;
|
|
retry_timeout 2s;
|
|
|
|
# 数据点定义
|
|
metrics {
|
|
# 温度读取(保持寄存器)
|
|
temperature {
|
|
address 40001; # Modbus地址表示法
|
|
type int16;
|
|
scale 0.1;
|
|
unit "°C";
|
|
}
|
|
|
|
# 压力传感器(输入寄存器)
|
|
pressure {
|
|
address 30001;
|
|
type uint16;
|
|
scale 0.01;
|
|
unit "kPa";
|
|
}
|
|
}
|
|
|
|
# 写入控制
|
|
controls {
|
|
# 启停控制
|
|
power_switch {
|
|
address 00010;
|
|
type bool;
|
|
safe_value off;
|
|
}
|
|
|
|
# PID设定值
|
|
pid_setpoint {
|
|
address 40010;
|
|
type float32;
|
|
min 0.0;
|
|
max 100.0;
|
|
precision 0.1;
|
|
}
|
|
}
|
|
|
|
## 告警信息
|
|
alarms {
|
|
high_temperature {
|
|
# 触发条件
|
|
condition $temperature > 90.0;
|
|
|
|
# 持续判定
|
|
hold_time 30s;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
device boiler_controller {
|
|
# 设备标识
|
|
slave_id 1;
|
|
model "Siemens S7-1200";
|
|
description "Main boiler controller";
|
|
|
|
device_io t1;
|
|
|
|
# 写入控制
|
|
controls {
|
|
# 启停控制
|
|
power_switch {
|
|
address 00010;
|
|
type bool;
|
|
safe_value off;
|
|
}
|
|
|
|
# PID设定值
|
|
pid_setpoint {
|
|
address 40010;
|
|
type float32;
|
|
min 0.0;
|
|
max 100.0;
|
|
precision 0.1;
|
|
}
|
|
}
|
|
}
|
|
|
|
device xyz {
|
|
# 设备标识
|
|
slave_id 1;
|
|
model "Siemens S7-1200";
|
|
description "Main boiler controller";
|
|
|
|
# 轮询间隔
|
|
poll_interval 5s;
|
|
|
|
# 重试策略
|
|
retries 3;
|
|
retry_timeout 2s;
|
|
|
|
# 数据点定义
|
|
metrics {
|
|
# 温度读取(保持寄存器)
|
|
temperature {
|
|
address 40001; # Modbus地址表示法
|
|
type int16;
|
|
scale 0.1;
|
|
unit "° C";
|
|
}
|
|
|
|
# 压力传感器(输入寄存器)
|
|
pressure {
|
|
address 30001;
|
|
type uint16;
|
|
scale 0.01;
|
|
unit "kPa";
|
|
}
|
|
}
|
|
|
|
# 写入控制
|
|
controls {
|
|
# 启停控制
|
|
power_switch {
|
|
address 00010;
|
|
type bool;
|
|
safe_value off;
|
|
}
|
|
|
|
# PID设定值
|
|
pid_setpoint {
|
|
address 40010;
|
|
type float32;
|
|
min 0.0;
|
|
max 100.0;
|
|
precision 0.1;
|
|
}
|
|
}
|
|
|
|
alarms {
|
|
high_temperature {
|
|
# 触发条件
|
|
condition $temperature > 90.0;
|
|
|
|
# 持续判定
|
|
hold_time 30s;
|
|
}
|
|
}
|
|
} |