Modbus-Simulator

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 6 Imported by: 0

README

Modbus Simulator image

go install github.com/LaysDragon/Modbus-Simulator modbus_simulator -mode tui

配置文件

本工具通過配置來表示各裝置參數以及連線組織

  • deviceType/** 目錄下存放各類型設備的參數配置
  • config.yaml 負責組織裝置連線

deviceType/SmartMeter.yaml

name: "SmartMeter"
parameters:
  - name: "Voltage"
    address: 0
    type: "uint16"
    function_code: 3 # Holding Register
    script: "random(220, 240)"
  - name: "Current"
    address: 1
    type: "float32"
    function_code: 4 # Input Register
    script: "random(0, 100) / 10.0"
  - name: "Status"
    address: 0
    type: "bool"
    function_code: 1 # Coil
    script: "true"

config.yaml

devices:
  - name: "Meter1"
    slave_id: 1
    type: "SmartMeter"
    # response_delay_script: "100" # ms
    monitored_parameters: 
    - Voltage
    - Status

connections:
  - name: "LocalServer"
    transport_type: "RTU_OVER_TCP"
    connection_mode: "DIAL"
    address: "localhost:1234"
    devices: 
    - Meter1

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL