Modbus Server

Modbus Server

ID: uniflow.plugin.modbusserver Category: Industrial & Communication Protocols Version: v1.5.0 Min Uniflow Version: Uniflow ≥ v1.4.0

Modbus Server Plugin Reference Manual

1. Overview

Plugin Name: Modbus Server

Type: Industrial Protocols

Identifier: uniflow.plugin.modbusserver

Description

Integration with Modbus TCP Clients (acts as Modbus Slave).

NOTE — Modbus Slave vs. Server Terminology

Modbus Server is the modern Modbus TCP/IP term for a Modbus Slave (traditional Modbus RTU/ASCII serial term).

As a Modbus Server (Slave), this plugin acts as a passive listener (by default on TCP port 502), exposing an internal memory table of coils and registers that external Modbus Clients (Masters) can query or write to.


2. Technical Architecture

The Modbus Server plugin acts as an industrial Modbus TCP slave listening on port 502 (or custom port). It hosts internal memory tables for Coils (0x), Discrete Inputs (1x), Holding Registers (4x), and Input Registers (3x), handles inbound Modbus function codes (FC01, FC02, FC03, FC04, FC05, FC06, FC15, FC16) from external masters, and synchronizes memory register updates with Uniflow catalog tags.

System Interaction

The Modbus Server plugin runs an embedded Modbus TCP Slave. It maintains holding registers, input registers, coils, and discrete inputs in memory, allowing external SCADA/HMI masters to query or write Uniflow values.

Register Memory Mapping & Data Types

In standard Modbus protocol, memory is structured into 16-bit register words (2 bytes per register) and 1-bit discrete values. Uniflow automatically manages multi-register data packing, allocation boundaries, and UTF-8 string memory resetting:

Memory Allocation Table by Data Type

Data TypeMemory AreaRegisters / Bits ConsumedAddress Range ExampleDescription
Bool  Coils (0x) / Discrete Inputs (1x)
1 BitAddress 0Single 1-bit discrete memory location.
Bool  Holding (4x) / Input Registers (3x)
1 Register (16-bit)Address 016-bit register word (0 = False, != 0 = True).
Int16  Holding (4x) / Input Registers (3x)
1 Register (16-bit)Address 016-bit signed integer (-32,768 to 32,767) occupying 1 single register.
UInt16  Holding (4x) / Input Registers (3x)
1 Register (16-bit)Address 016-bit unsigned integer (0 to 65,535) occupying 1 single register.
Int32  Holding (4x) / Input Registers (3x)
2 Registers (32-bit)Address 0 .. 132-bit signed integer combining 2 consecutive 16-bit registers (High Word, Low Word).
Int64  Holding (4x) / Input Registers (3x)
4 Registers (64-bit)Address 0 .. 364-bit signed integer combining 4 consecutive 16-bit registers.
Double  Holding (4x) / Input Registers (3x)
4 Registers (64-bit)Address 0 .. 364-bit IEEE 754 floating-point value combining 4 consecutive 16-bit registers.
String  Holding (4x) / Input Registers (3x)
120 Registers (240 Bytes)Address 0 .. 119UTF-8 encoded text string allocated across 120 consecutive registers (2 bytes per register).
IMPORTANT — Register Allocation Overlap & Boundary Checks

Uniflow enforces a built-in ModbusRegisterSanitizer during point configuration.

  • Overlap Prevention: If a point is assigned HoldingRegister 0 with Int32 (spanning Address 0..1), no other data point can be assigned to Address 0 or Address 1.
  • Allocation Boundary Limit: The maximum Modbus address is 65535. Defining a multi-register point (e.g., Int64 consuming 4 registers) starting at Address 65534 is automatically blocked because it would exceed the 65535 allocation table boundary.

Special Treatment for String Data Type (UTF-8 Capacity & Zero-Padding Reset)

When a Holding Register is configured as a String, Uniflow allocates a multi-register byte capacity (default 120 registers = 240 bytes, compliant with the standard Modbus TCP PDU receive buffer limit). Because UTF-8 character length can vary (1 to 4 bytes per character):

1. Automatic Zero-Padding Reset on Write: When writing a string shorter than the allocated capacity (e.g. writing "OK" = 2 bytes into a 240-byte / 120-register allocation), Uniflow automatically resets all remaining unused byte positions to null bytes (0x00).

2. Stale Data Prevention: Without zero-padding, writing a shorter string over a previously written longer string (e.g. writing "OK" over "TEMPERATURE_HIGH") would leave trailing garbage characters. Zero-padding ensures the entire memory block is clean and subsequent reads accurately return "OK".

Architecture Diagram

VISUAL ARCHITECTURE FLOW DIAGRAM
Rendering Flow Architecture Diagram...

3. Configuration Parameters

The following configuration fields are available in the User Interface for this plugin:

Configuration SettingDescription
Listening PortNumeric value specifying the listening port.
Unit IDSpecifies the unit id.

4. Exposed Routes & Data Types

This plugin exposes catalog fields across the following rule graph nodes:

Input Source

The Input Source node reads live values held inside the local Modbus server memory map.

Human-Readable Field NameData TypeDescription
Server Modbus Register / Coil  Int16` / `UInt16` / `Int32` / `Int64` / `Double` / `Bool` / `String
Value stored in local Modbus server memory space (Holding Register, Input Register, Coil, Discrete Input).
Auto-Generated Unit Point ({PointName}_Unit)  String
Read-only engineering unit metadata string (e.g., "%", "RPM", "V").

Event Input

The Event Input node intercepts master access requests and memory update triggers emitted by the local Modbus server listener.

Human-Readable Event NameEvent Type IdentifierEvent CategoryData TypeExposed Schema Ports & Data TypesDescription
Master Write Received  modbus.master_write_received
Server EventEvent Object
Address (Int32)
Value (String)
Area (String)
Timestamp (DateTime)
Emitted when a remote master writes to a server register or coil.
Master Read Received  modbus.master_read_received
Server EventEvent Object
Address (Int32)
Count (Int32)
Area (String)
Timestamp (DateTime)
Emitted when a remote master queries server registers.
Register Updated  modbus.register_updated
Memory EventEvent Object
Address (Int32)
Value (Variant)
Area (String)
Timestamp (DateTime)
Internal memory table update event.

Data Source

The Data Source node provides secondary query access to all local Modbus server registers and their auto-generated engineering unit metadata points ({PointName}_Unit).

Human-Readable Field Name / ItemData TypeDescription
Server Modbus Points  Int16` / `UInt16` / `Int32` / `Int64` / `Double` / `Bool` / `String
Accessible snapshot values of any defined Modbus server register or coil.
Auto-Generated Unit Point ({PointName}_Unit)  String
Supplementary engineering unit metadata string (e.g., "%", "RPM", "V").

Output Target

The Output Target node acts as an action sink node to set or overwrite register and coil values inside the server slave memory map.

Target NameData TypeAssociated ParametersParameter Data TypeRequiredDescription
Writable Server Register / Coil  Int16` / `UInt16` / `Int32` / `Int64` / `Double` / `Bool` / `String
ValueInt16 / UInt16 / Int32 / Int64 / Double / Bool / StringTrueValue payload to write to local server memory address.
Direct Access  String
Type (Type)StringTrueTarget memory area (Coils, Discrete Input, Holding Register, Input registers).
Address (Address)Int32TrueMemory offset address.
Value (Value)StringTrueValue to write into server register memory.

4.1 Auto-Generated Engineering Unit Points ({PointName}_Unit)

For every defined Modbus data point (e.g. HoldingRegister_200) that specifies a non-empty engineering unit (e.g., %, RPM, V), Uniflow automatically generates and exposes a secondary string data point suffixed with _Unit (e.g., HoldingRegister_200_Unit).

NOTE

Conditional Generation: The secondary {PointName}_Unit data point is generated only when the Unit field is populated in the point configuration editor. If the Unit field is left empty or blank, Uniflow intentionally omits the _Unit entry to keep the catalog clean and avoid clutter in the Rule Engine point picker.

  • Catalog Exposure: Automatically listed in the Source Manager catalog alongside primary data points when Unit is set.
  • Rule Engine Accessibility: Fully readable in both Input Source and Data Source rule graph nodes.
  • Dynamic Unit Inspection: Allows rules to extract, evaluate, or log raw engineering units alongside telemetry values for dynamic formatting and automated alerting.
  • 5. Usage Examples

    Scenario A: OPC UA Tank Level Value Mirrored to Local Modbus Server Holding Register for SCADA Polling

    Workflow Overview:

    Uniflow reads real-time tank level telemetry from an OPC UA Client node (TankLevelPercent). Whenever the level updates, Uniflow writes the value into the Modbus Server memory map (Holding Register 200). An legacy external SCADA system polls Holding Register 200 via Modbus TCP to display the tank level on plant floor HMIs.

    Rule Node Configuration:

    1. Input Source Node: OPC UA Client

  • Node Identifier: ns=2;s=Process.TankLevelPercent (Double)
  • 2. Logic Pass-Through Node: Identity / Scale

  • Processing: Direct numeric value pass-through
  • 3. Output Target Node: Modbus Server Memory

  • Action Target: Direct Access
  • Type: Holding Register
  • Address: 200
  • Value: TankLevelPercent
  • Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...

    Scenario B: External SCADA Coil Write Event Triggers Avigilon Alarm & Camera Bookmark

    Workflow Overview:

    When an external SCADA system issues a Modbus FC05 Write command setting local Modbus Server Coil 5 to True (Master Write Received / modbus.master_write_received), Uniflow intercepts the write event and triggers a high-priority alarm (AlarmId: 501-SCADA-PANIC) in Avigilon Control Center.

    Rule Node Configuration:

    1. Event Input Node: Modbus Server Listener

  • Filter Event: Master Write Received (modbus.master_write_received)
  • Exposed Schema Fields: Address (Int32), Value (String), Timestamp (DateTime)
  • 2. Logic Filter Node: And Condition

  • Expression: Address == 5 AND Value == "True"
  • 3. Output Target Node: Avigilon ACC Action

  • Action Target: Alarms (avigilon:alarm)
  • AlarmId: 501-SCADA-PANIC
  • Action: TRIGGER
  • Notes: Panic trigger written by SCADA Master on Modbus Server Coil 5
  • Logic Flow Diagram:

    VISUAL ARCHITECTURE FLOW DIAGRAM
    Rendering Flow Architecture Diagram...
    Architecture Flow Diagram — Full Preview