Engineering tools

Modbus Digital Twin

Simulate Modbus TCP and RTU devices while developing and testing your software. Define registers, coils and device responses before the physical equipment is available.

Virtual Modbus Device Simulation Develop and test without physical hardware Physical Device Sensor PLC HMI Digital Twin Simulator Modbus TCP / RTU Virtual Device Sensor PLC HMI Hardware Simulation Engine Software
Benefits

Test your Modbus client before connecting equipment

Development without hardware

Start integration work while equipment is being procured. Use simulated devices to develop and check your Modbus client application.

Controlled testing

Repeat normal and fault scenarios, including timeouts and boundary values that can be difficult to reproduce on physical equipment.

Training environment

Practise Modbus configuration and troubleshooting on simulated devices without making changes to production equipment.

CI/CD integration

Use simulated devices in automated regression tests when physical equipment is not available to the build environment.

Protocol support

TCP, RTU and the Modbus data model

Modbus TCP

Simulate devices on an Ethernet network and accept connections from multiple clients.

  • Standard port 502
  • Multiple client connections
  • Transaction ID tracking
  • Unit identifier support

Modbus RTU

Serial communication support with automatic CRC calculation and configurable port settings.

  • Configurable baud rate
  • Parity and stop bit settings
  • Automatic CRC-16 calculation
  • Inter-frame timing

Function codes

Read discrete inputs and registers, and read or write coils and holding registers. Supported operations include:

  • Read Coils (0x01)
  • Read Discrete Inputs (0x02)
  • Read Holding Registers (0x03)
  • Read Input Registers (0x04)
  • Write Single Coil (0x05)
  • Write Multiple Registers (0x10)

Memory model

Configure the size and values of the four Modbus data areas, and update values during simulation.

  • Up to 65,536 coils
  • Up to 65,536 discrete inputs
  • Up to 65,536 holding registers
  • Up to 65,536 input registers
Code examples

Create and configure a simulated device

TCP device
using ULTRAMEGA.Modbus.DTS;

// Create TCP device on port 502
var device = ModbusDeviceFactory.CreateTcpDevice(
    deviceId: 1,
    port: 502
);

// Set initial values
device.SetHoldingRegister(0, 1234);
device.SetCoil(0, true);

// Start the device
await device.StartAsync();

// Device now responds to Modbus TCP requests
Console.WriteLine("Device running on port 502");
Console.ReadKey();
await device.StopAsync();
RTU device
// Create RTU device with serial settings
var device = new ModbusRtuDevice(
    deviceId: 2,
    portName: "COM3",
    baudRate: 9600,
    parity: Parity.None,
    dataBits: 8,
    stopBits: StopBits.One
);

// Configure timeouts
device.ResponseTimeout = TimeSpan.FromMilliseconds(500);

// Start the device
await device.StartAsync();
Custom simulation
public class TemperatureSimulator : ModbusTcpDevice
{
    private Random random = new Random();

    public override void SimulateData()
    {
        // Simulate 10 temperature sensors
        for (int i = 0; i < 10; i++)
        {
            float temp = 20 + (float)(random.NextDouble() * 15);
            SetHoldingRegister(i, (ushort)(temp * 10));

            // Set alarm if temperature exceeds threshold
            SetCoil(i + 100, temp > 30);
        }

        base.SimulateData();
    }
}
Technical specifications

Performance and requirements

Performance

  • Request rate: 1000+/sec
  • Memory: < 10MB
  • Thread-safe: Yes

Requirements

  • Runtime: .NET 6+
  • OS: Windows, Linux
  • Standalone application

Standards

  • Modbus TCP
  • Modbus RTU
  • Modbus exception responses

Performance figures are from internal benchmarks and depend on the host and simulation workload. Check the register map, timing and behaviour of your target device; simulation does not replace final testing with that equipment.

Discuss your Modbus test setup

Tell us which devices, register maps and test scenarios you need to simulate. We can discuss suitability, licensing and integration with your test environment.