No description
- C 97.6%
- Makefile 2%
- Dockerfile 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| docs | ||
| mongoose@5683677e68 | ||
| .clangd | ||
| .gitignore | ||
| .gitmodules | ||
| args.c | ||
| args.h | ||
| array.h | ||
| config.c | ||
| config.h | ||
| cspell.json | ||
| Dockerfile | ||
| example.yaml | ||
| log.c | ||
| log.h | ||
| main.c | ||
| Makefile | ||
| mb_random_walk.c | ||
| mb_sequence.c | ||
| mb_utils.c | ||
| mb_utils.h | ||
| parse_yaml.c | ||
| parse_yaml.h | ||
| README.md | ||
| utils.c | ||
| utils.h | ||
| web.c | ||
| web.h | ||
Modbus Simulator
A lightweight Modbus TCP simulator designed for testing, development, and integration of Modbus-based systems.
The simulator provides:
- Multiple Modbus TCP server instances
- Configurable register generators
- Optional HTTP API for runtime interaction
- CLI and YAML-based configuration
Avaliable as docker image for amd64 and arm64: https://hub.docker.com/r/mrhlebusheck/modbus_simulator
Build
Dependencies
Debian (13+)
sudo apt update
sudo apt install -y \
make \
pkg-config \
gcc \
libmodbus-dev \
libyaml-dev
Arch Linux
sudo pacman -S --needed \
base-devel \
pkgconf \
libmodbus \
libyaml
Compile
Debug build
make
Release build
make NDEBUG=1
Overview
The simulator can be started in two ways:
- Using a YAML configuration file
- Using command-line arguments (limited mode)
Configuration File
./build/modbus_simulator -c config.yaml
Provides full functionality, including:
- Multiple simulators
- Generators
- Web API configuration
CLI Mode
./build/modbus_simulator --web 0.0.0.0:8080 --modbus tcp:0.0.0.0:502
Limitations:
- No generator configuration
- Only Modbus TCP supported
Features
-
Multiple independent Modbus TCP servers
-
Register types:
- Coil
- Discrete Input
- Input Register
- Holding Register
-
Data generators:
random_walksequence_walk
-
HTTP API:
- Read/write registers
- Control simulator lifecycle (start/stop)
-
Debug/verbose mode (global and per-component)
Documentation
usage.md— CLI usage and modesconfig-yaml.md— YAML configuration referenceapi.md— HTTP API specification
Notes
- Register values are stored as 16-bit units internally.
- 32-bit types and floats are mapped to two consecutive registers.
- Designed primarily for development and testing.