8 releases (breaking)

Uses new Rust 2021

0.8.0 Jan 11, 2022
0.7.0 Dec 10, 2021
0.6.0 Dec 10, 2021
0.5.0 Dec 9, 2021
0.1.0 Dec 1, 2021

#7 in Simulation

34 downloads per month


1.5K SLoC

Yet Another Modbus Simulator


A simulator for Modbus client/server that supports YAML based configuration and behavior definition, with pure Rust.

YAMS supports Modbus device configuration and behavior definition via YAML files. This means one can predefine how the simulator works before running the simulator, including:

  • the device type: Server/Client
  • the protocol type: Modbus TCP/RTU
  • communication configurations: IP address, baudrate, etc.
  • Modbus configurations: device ID etc.
  • Modbus server properties:
    • supported function codes
    • supported registers/coils and their values
    • overlapping of coil and register is supported
  • Modbus client behaviors:
    • requests to send to server(s)
    • support repeated request (single/multi request repeat)
    • support predefined delay before a request
  • Human friendly UI:
    • flexible YAML based configuration/request organization
    • supports verbose mode showing more details across the wire
    • supports print-out of request/response indexes
    • set and show measurements in its own type: 32-bit float for example


  • Make sure Cargo is installed. See the install page for details.
  • Install YAMS by cargo install yams.

Quick Demo:

DEMO (slightly outdated, but good enough as a demo :))

Configurable Items

See YAML based Configurations


  • implement Modbus TCP support
  • implement YAML configuration/request support
  • implement Modbus RTU support
  • implement support for repeated request(s)
  • implement support for delay before request(s)
  • implement error handling
  • implement one-shot mode without config files
  • implement verbose mode to print out more detail/data
  • implement request/response counts printout
  • implement all data support of all current functions, with tests
  • implement function code support below:
    • Read Coils
    • Read Discrete Inputs
    • Read Holding Registers
    • Read Input Registers
    • Write Single Coil
    • Write Single Register
    • Read Exception Status
    • Diagnostics
    • Get Comm Event Counter
    • Get Comm Event Log
    • Write Multiple Coils
    • Write Multiple Registers
    • Report Server ID
    • Read File Record
    • Write File Record
    • Mask Write Register
    • Read/Write Multiple registers
    • Read FIFO Queue
    • Encaptulated Interface Transport
    • CANopen General Reference Request and Response PDU
    • Read Device Identification


~155K SLoC