Modbus Digital Twin

Virtual Modbus device simulation for industrial testing and development. Create TCP and RTU devices without physical hardware.

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

Why Virtual Device Simulation?

Develop and test industrial systems without physical hardware constraints

Development Without Hardware

Build and test Modbus client applications before physical devices are available. Eliminates hardware dependencies in early development phases.

Controlled Testing

Create reproducible test scenarios including error conditions, edge cases, and timeout situations that are difficult to trigger with real equipment.

Training Environment

Safe, repeatable environment for teaching industrial protocols. Students practice troubleshooting without risking actual equipment.

CI/CD Integration

Automated regression testing for Modbus systems. Virtual devices enable continuous integration pipelines for industrial software.

Protocol Support

Complete Modbus TCP and RTU implementation

Modbus TCP

Full TCP/IP implementation for Ethernet networks with multiple concurrent client connections.

  • 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

All standard Modbus function codes for reading and writing coils, discrete inputs, and registers.

  • 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

Complete Modbus memory model with configurable sizes and real-time data 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

Quick start with Modbus Digital Twin

TCP Device

Create a Modbus TCP device for Ethernet network testing

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

Configure a Modbus RTU device for serial communication

// 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

Implement realistic sensor behavior

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

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

Requirements

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

Standards

  • Modbus TCP: Full
  • Modbus RTU: Full
  • Exception codes: Complete

Get Started

Ready to simplify your Modbus testing workflow?

Contact us to learn more about Modbus Digital Twin and how it can accelerate your industrial software development.