Aucune description

Lu Xianghui 266af6fa37 修改配置文件参数 il y a 3 jours
__pycache__ 58d3f89f36 Fist commit il y a 3 jours
tests 266af6fa37 修改配置文件参数 il y a 3 jours
wiki 58d3f89f36 Fist commit il y a 3 jours
.gitignore 58d3f89f36 Fist commit il y a 3 jours
Dockerfile 58d3f89f36 Fist commit il y a 3 jours
README.md 58d3f89f36 Fist commit il y a 3 jours
app_config.py 266af6fa37 修改配置文件参数 il y a 3 jours
config.yaml 266af6fa37 修改配置文件参数 il y a 3 jours
constants.py 58d3f89f36 Fist commit il y a 3 jours
db.py 58d3f89f36 Fist commit il y a 3 jours
http_value_provider.py 58d3f89f36 Fist commit il y a 3 jours
logging_config.py 58d3f89f36 Fist commit il y a 3 jours
main.py 266af6fa37 修改配置文件参数 il y a 3 jours
modbus_codec.py 58d3f89f36 Fist commit il y a 3 jours
modbus_context.py 58d3f89f36 Fist commit il y a 3 jours
modbus_server.py 58d3f89f36 Fist commit il y a 3 jours
poetry.lock 58d3f89f36 Fist commit il y a 3 jours
point_loader.py 58d3f89f36 Fist commit il y a 3 jours
point_model.py 58d3f89f36 Fist commit il y a 3 jours
pyproject.toml 58d3f89f36 Fist commit il y a 3 jours
register_store.py 58d3f89f36 Fist commit il y a 3 jours
value_provider.py 58d3f89f36 Fist commit il y a 3 jours
value_refresh.py 266af6fa37 修改配置文件参数 il y a 3 jours

README.md

modbus-server-nd

只读 Modbus TCP Server。启动时从 modbus_server_point 加载全部点位,校验 pt_point 中点位是否存在,校验保持寄存器地址是否重叠,并通过实时值接口初始化和周期刷新 Holding Register。

启动

python main.py

默认读取当前目录下的 config.yaml

不要使用旧的 modbus-server-nd 命令启动服务;当前项目按根目录下的 main.py 启动。

测试

python -m unittest discover -s tests

Modbus/HTTP 对比

服务启动后,对比 Modbus TCP 读取值和实时值 HTTP 接口返回值:

python tests/compare_modbus_http_client.py

如果只想验证当前代码的寄存器写入和 Modbus 读取逻辑,可以让脚本从数据库加载点位并自启动一个临时 Modbus Server:

python tests/compare_modbus_http_client.py --self-start --modbus-port 15024

Modbus 压力测试

服务启动后,测试 4 个和 8 个 client 同时读取全部点位:

python tests/stress_modbus_clients.py --client-counts 4,8

可以增加重复次数:

python tests/stress_modbus_clients.py --client-counts 4,8 --repeat 3