SkillAgentSearch skills...

OpenModSim

Open ModSim is a Free Modbus Slave (Server) Utility

Install / Use

/learn @sanny32/OpenModSim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Open ModSim

GitHub all releases GitHub release (latest by date) License

Open ModSim is a free implimentation of modbus slave (server) utility for modbus-tcp and modbus-rtu protocols.

<img width="1292" height="759" alt="image" src="https://github.com/user-attachments/assets/5e3bb093-1d12-48e6-89fa-e688d08fa0be" /> <img width="1292" height="759" alt="image" src="https://github.com/user-attachments/assets/2e5ca631-b219-44a6-9983-9a3367d71d51" />

Features

The following Modbus functions are available:

  • Discrete Coils/Flags
    0x01 - Read Coils
    0x02 - Read Discrete Inputs
    0x05 - Write Single Coil
    0x0F - Write Multiple Coils
  • Registers
    0x03 - Read Holding Registers
    0x04 - Read Input Registers
    0x06 - Write Single Register
    0x10 - Write Multiple Registers
    0x16 - Mask Write Register

The following simulations are available:

  • Discrete Coils/Flags
    Random - simulate flag randomly
    Toggle - simulate flag on/off periodicaly
  • Registers
    Random - simulate register randomly
    Increment - simulate register from Low Limit to High Limit with a given Step
    Decrement - simulate register from High Limit to Low Limit with a given Step

Modbus Logging

<img width="1292" height="759" alt="image" src="https://github.com/user-attachments/assets/4bfad217-2d0c-4d14-a8c2-f434d7ac93e4" />

Extended Featues

  • Modbus Message Parser
<img width="674" height="463" alt="image" src="https://github.com/user-attachments/assets/774e3ff1-1bf2-46a6-a685-e6702e2e7fe5" />
  • Modbus Definitions
<img width="416" height="346" alt="image" src="https://github.com/user-attachments/assets/2dc6c13e-e4be-434b-9266-1de4f3ccda4a" />
  • Error Simualtions
<img width="416" height="346" alt="image" src="https://github.com/user-attachments/assets/af1701d9-d576-4f1f-9bf9-7e70e85cd9da" />

Scripting

From version 1.2.0 Open ModSim supports scripting. Qt runtime implements the ECMAScript Language Specification standard, so Javascript is used to write code.

<img width="1288" height="749" alt="image" src="https://github.com/user-attachments/assets/6f37b58a-798c-4b45-ad88-165ad5a373c2" />

Scripts can be launched in two modes: Once or Periodically. If you run script in Once mode the script will stop after it finishes executing. In Periodically mode, the script will start after a certain period of time until the user stops it or the method is called

Script.stop();

Here is an example of using the script in the Periodically mode

/**************************************************************************/
/*
/* Example script that store value after 3 seconds
/*
***************************************************************************/

/* Set the server address base starts from one (1-based) */
Server.addressBase = AddressBase.Base1;

let deviceId = 1;
let address1 = 1;
let address10 = 10;

function reset()
{
    /* Write to a Holding register at address1 zero value */
    Server.writeHolding(address1, 0, deviceId);
}

/* init function */
function init()
{
    reset();

	/* Print server error if occured and stop script execution */
	Server.onError(deviceId, (error)=> {
		console.error(error);
 		Script.stop();
	});   

    /* Runs when Hodling register value at address1 was changed */
    Server.onChange(deviceId, Register.Holding, address1, (value)=>
    {
        if(value === 1)
        {
            /* Runs after 3 seconds and increase Holding register value at address10 
             * Then reset register value at address1 and stop script execution
             */
            Script.setTimeout(function()
            {
                Server.writeHolding(address10, Server.readHolding(address10, deviceId) + 1, deviceId);
				reset();
                Script.stop();
            }, 3000);
        }
     });
}

/* Runs once when script started */
Script.onInit(init);

Building

Building is available via cmake (with installed Qt version 5.15 and above) or Qt Creator. Supports both OS Microsoft Windows and Linux.

Microsoft Windows Building

The minimum supported version of Microsoft Windows for building OpenModSim from sources is Windows 10.

  1. Install latest git version
  2. Run Windows PowerShell terminal as an Administrator
  3. Clone OpenModSim sources from github repository
git clone https://github.com/sanny32/OpenModSim.git
  1. Go to OpenModSim folder
cd OpenModSim
  1. Allow script execution in PowerShell terminal
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  1. Run the build script
.\build.ps1

If you need to specify Qt framework major version (5 or 6), you can do it in the parameters

  • .\build.ps1 -qt5 or .\build.ps1 -qt6

The build script supports building the application only for 64-bit architecture.

Linux Building

  1. Install git for your Linux distribution
  2. Run the following commands from the console:
git clone https://github.com/sanny32/OpenModSim.git
cd OpenModSim
./build.sh

If you need to specify Qt framework major version (5 or 6), you can do it in the parameters

  • ./build.sh -qt5 or ./build.sh -qt6

About supported operating systems

The following minimum operating system versions are supported for OpenModSim:

  • <img src="docs/icons/logo_windows7.svg" width="16" height="16" /> Microsoft Windows 7
  • <img src="docs/icons/logo_debian.svg" width="16" height="16" /> Debian Linux 11
  • <img src="docs/icons/logo_ubuntu.svg" width="16" height="16" /> Ubuntu Linux 22.04
  • <img src="docs/icons/logo_mint.png" width="16" height="16" /> Mint Linux 22
  • <img src="docs/icons/logo_zorin.png" width="16" height="16" /> Zorin OS 18
  • <img src="docs/icons/logo_fedora.svg" width="16" height="16" /> Fedora Linux 41
  • <img src="docs/icons/logo_rocky.png" width="16" height="16" /> Rocky Linux 9.7
  • <img src="docs/icons/logo_opensuse.svg" width="16" height="16" /> OpenSuse Linux 15.6
  • <img src="docs/icons/logo_alt.png" width="16" height="16" /> Alt Linux 11
  • <img src="docs/icons/logo_astra.png" width="18" height="18" /> Astra Linux 1.7
  • <img src="docs/icons/logo_redos.png" width="16" height="16" /> RedOS 8

Install from binary distributions

Below are the methods for installing the OpenModSim for different OS

<img src="docs/icons/logo_windows.svg" width="16" height="16"> Microsoft Windows

Run the installer:

  • For 32-bit Windows: qt5-omodsim_1.12.0_x86.exe
  • For 64-bit Windows: qt5-omodsim_1.12.0_x64.exe or qt6-omodsim_1.12.0_x64.exe

<img src="docs/icons/logo_debian.svg" width="20" height="20"> Debian / <img src="docs/icons/logo_ubuntu.svg" width="20" height="20"> Ubuntu / <img width="20" height="20" src="docs/icons/logo_mint.png" /> Mint / <img src="docs/icons/logo_zorin.png" width="20" height="20"> Zorin / <img width="22" height="22" src="docs/icons/logo_astra.png" /> Astra Linux

Install

Install the DEB package from the command line:

sudo apt install ./qt6-omodsim_1.12.0-1_amd64.deb

or if you want to use Qt5 libraries:

sudo apt install ./qt5-omodsim_1.12.0-1_amd64.deb

Remove

To remove the DEB package run:

sudo apt remove qt6-omodsim

or for Qt5 package:

sudo apt remove qt5-omodsim

<img src="docs/icons/logo_redhat.svg" width="24" height="24"> RedHat / <img src="docs/icons/logo_fedora.svg" width="20" height="20"> Fedora / <img src="docs/icons/logo_rocky.png" width="20" height="20"> Rocky / <img width="20" height="20" src="docs/icons/logo_redos.png" /> RedOS Linux

Install

Install the RPM package from the command line:

sudo dnf install ./qt6-omodsim-1.12.0-1.x86_64.rpm

Remove

To remove the RPM package run:

sudo dnf remove qt6-omodsim

<img src="docs/icons/logo_alt.png" width="24" height="24"> Alt Linux

Install

Install the RPM package from the command line as root user:

apt-get install ./qt6-omodsim-1.12.0-1.x86_64.rpm

Remove

To remove the RPM package run as root user:

apt-get remove qt6-omodsim

<img width="20" height="20" src="docs/icons/logo_suse.png" /> SUSE / <img src="docs/icons/logo_opensuse.svg" width="24" height="24" /> OpenSUSE Linux

Install

Import qt6-omodsim.rpm.pubkey to rpm repository:

sudo rpm --import qt6-omodsim.rpm.pubkey

Install the RPM package using Zypper:

sudo zypper install ./qt6-omodsim-1.12.0-1.x86_64.rpm

Remove

To remove the RPM package run:

sudo zypper remove qt6-omodsim

MIT License

Copyright 2023-2026 Alexandr Ananev [mail@ananev.org]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PAR

View on GitHub
GitHub Stars201
CategoryDevelopment
Updated4d ago
Forks27

Languages

C++

Security Score

100/100

Audited on Mar 26, 2026

No findings