# modbus-server-nd 只读 Modbus TCP Server。启动时从 `modbus_server_point` 加载全部点位,校验 `pt_point` 中点位是否存在,校验保持寄存器地址是否重叠,并通过实时值接口初始化和周期刷新 Holding Register。 ## 启动 ```bash python main.py ``` 默认读取当前目录下的 `config.yaml`。 不要使用旧的 `modbus-server-nd` 命令启动服务;当前项目按根目录下的 `main.py` 启动。 ## 测试 ```bash python -m unittest discover -s tests ``` ## Modbus/HTTP 对比 服务启动后,对比 Modbus TCP 读取值和实时值 HTTP 接口返回值: ```bash python tests/compare_modbus_http_client.py ``` 如果只想验证当前代码的寄存器写入和 Modbus 读取逻辑,可以让脚本从数据库加载点位并自启动一个临时 Modbus Server: ```bash python tests/compare_modbus_http_client.py --self-start --modbus-port 15024 ``` ## Modbus 压力测试 服务启动后,测试 4 个和 8 个 client 同时读取全部点位: ```bash python tests/stress_modbus_clients.py --client-counts 4,8 ``` 可以增加重复次数: ```bash python tests/stress_modbus_clients.py --client-counts 4,8 --repeat 3 ```