DEV Community

Cover image for Host Computer vs Field Device: Splitting an Industrial Control System
Hollson
Hollson

Posted on Edited on Originally published at hollson.github.io

Host Computer vs Field Device: Splitting an Industrial Control System

A room needs automatic temperature and humidity control: sensors collect, a computer decides, air conditioners and humidifiers act. These three are not peers. Who decides and who acts determines how the system layers.

"Host computer" and "field device" (literally upper machine and lower machine) are the two words for that split. It sounds obvious, yet the most common rework in real projects comes from this boundary being drawn badly.

๐Ÿงญ 1. The Two Roles

The host layer is "watch and think": an industrial PC, server, or ordinary desktop running the UI, SCADA configuration, algorithms, and database. It talks to people and makes decisions.

The field layer is "sense and act": PLCs, microcontrollers, sensors, VFDs, actuators. It sits next to equipment and signals, sampling and acting on a fixed cycle.

Dimension Host Field device
Typical carrier Industrial PC, server, desktop PLC, MCU, meters, actuators
Time scale Seconds to minutes Millisecond scan cycle
Main job Display, store, analyze, decide Sample, filter, logic, drive
Serves People and upper systems Equipment and signals
Failure means Cannot see or compute Cannot stop or move

The test is not "is it a PC". A PLC running scheduling logic can act as the host; a desktop doing only protocol translation can be the field side. Judge by responsibility, not hardware.

๐Ÿ—๏ธ 2. Why the Split

Different real-time needs. A PLC scans in milliseconds; a button press to cylinder action must complete within tens of milliseconds. UI refresh and database writes are second-scale. Put motor control on the UI thread and a stalled interface becomes a runaway machine.

Different safety boundary. The field device can enter a safe state on its own: network loss, emergency stop, and over-limit conditions are all judged locally, without depending on the host being online. If the host dies, equipment stops at worst; it must not hurt anyone.

Different replaceability. Swap the vision algorithm without touching PLC code; swap an actuator without touching the UI. Each layer's change cost stays local.

Different ownership of detail. Sampling rate, unit conversion, and filtering belong to the field device; storage, statistics, and alerting belong to the host. Where conversion happens must be written into the interface contract, or the same temperature reads 0.3 degrees apart in two systems.

๐Ÿ”— 3. The Typical Chain

The minimal loop is four segments: field device โ†’ field controller โ†’ link โ†’ host. Database and dashboards sit above that.

Sensors (temperature, humidity) โ†’ PLC/MCU โ†’ RS485 or Ethernet โ†’ host (SCADA / HMI / service) โ†’ history store and dashboards; control commands travel back down the same link to actuators.

Some designs wire sensors straight to the host: with few points and loose real-time needs, Modbus TCP direct is simplest. The cost is that the host must handle sampling and disconnects itself, and it collapses as point count grows.

๐Ÿ”Œ 4. Communication Options

Method Physical layer Typical scene Traits
Modbus RTU Two-wire RS485 Legacy devices, meters, sensors Simple, half-duplex, one master many slaves
Modbus TCP Ethernet PLCs, power meters, gateways 7-byte MBAP header, port 502
OPC UA TCP Cross-vendor integration Semantic model and security, heavy but standardized
MQTT TCP Multi-site remote Weak-network friendly, not real-time
Proprietary Serial or custom Specialized equipment Flexible, hard to maintain

Nine out of ten sites still run Modbus, for a plain reason: it is simple enough to debug with a serial terminal โ€” capture a hex frame and you know whether the other end answered.

๐Ÿ” 5. Data Flow and Control Flow

Sampling has three modes: polling, event reporting, and subscription. Polling is the most universal โ€” the host asks on a timer. Event reporting lets the device push, saving bandwidth but requiring support. Subscription is the MQTT and OPC UA style.

The poll interval must match the device's refresh rate. If the host asks once a second while the device refreshes every 100 milliseconds, nine samples are lost forever. For trend analysis, compute extremes on the device side first and upload those.

Control is a closed loop, not a single write:

  1. Host โ†’ device: read input registers (temperature, humidity).
  2. Device โ†’ host: data frame.
  3. Host computes deviation against the setpoint.
  4. Host โ†’ device: write holding register (target temperature).
  5. Device โ†’ host: acknowledgement.
  6. Host โ†’ device: read back to confirm.
  7. Device โ†’ host: current setpoint.
  8. Host logs the command and its result.

Reading back after writing is the cheapest insurance in the chain. If the read-back differs from what you wrote, the command did not take effect โ€” resend or raise an alarm.

๐Ÿงช 6. Modbus in Practice

Modbus has four data areas: coils, discrete inputs, input registers, holding registers. Reads use function codes 01, 02, 03, 04; writes use 05, 06, 0F, 10.

Addressing is where mistakes live. A manual says "40001", but tools count from 0, so the address is 0. There is no 4xxxx prefix in the packet โ€” that is a human-facing numbering convention.

On the Python side, use pymodbus. Since 3.10 the slave argument is device_id; earlier versions called it slave. When you get an error, check this first:

from pymodbus.client import ModbusTcpClient

HOST, PORT, UNIT = "192.168.1.10", 502, 1

def read_env():
    client = ModbusTcpClient(HOST, port=PORT, timeout=3)
    if not client.connect():
        raise ConnectionError("PLC unreachable")
    try:
        rr = client.read_input_registers(address=0, count=2, device_id=UNIT)
        if rr.isError():
            raise RuntimeError(f"read failed: {rr}")
        temp = rr.registers[0] / 10.0   # device convention: 0.1 degree per unit
        humi = rr.registers[1] / 10.0
        return temp, humi
    finally:
        client.close()
Enter fullscreen mode Exit fullscreen mode

Writing a setpoint is just as short, and reads back once:

def set_temperature(target: float):
    client = ModbusTcpClient(HOST, port=PORT, timeout=3)
    if not client.connect():
        raise ConnectionError("PLC unreachable")
    try:
        value = int(round(target * 10))
        client.write_register(address=100, value=value, device_id=UNIT)
        back = client.read_holding_registers(address=100, count=1, device_id=UNIT)
        if back.isError() or back.registers[0] != value:
            raise RuntimeError("setpoint did not take effect")
    finally:
        client.close()
Enter fullscreen mode Exit fullscreen mode

Glue the two together and write the decision rules yourself: humidity below the floor turns the humidifier on, temperature above the ceiling lowers the setpoint. Simple rules use thresholds; smooth behavior uses PID. Do not put control logic inside UI event handlers.

๐Ÿ›ก๏ธ 7. Designing for Stability

Timeouts and retries. One to three seconds per attempt, two retries, then declare offline and alert. Silent failure is more dangerous than an error: a curve that stopped an hour ago and nobody noticed is the real incident.

Idempotent writes. Repeating a setpoint write is harmless. Action commands (start, reset) need a sequence number or state read-back, or a retry actuates the machine twice.

Timestamp at the sampling end. Timestamping on receipt bakes link latency into the data, and every time-series analysis carries that offset.

Offline buffer. Keep recent data in a local ring buffer and backfill after reconnecting; one loose cable should not cut a curve in half.

Manual/auto interlock. When an operator and an algorithm write the same register, last write wins. Resolve such conflicts with a mode bit or an interlock table, not with a convention.

๐Ÿšฉ 8. Boundaries and Selection

A handful of points that only need a number displayed: one RS485 meter plus a script is enough. Adding SCADA is waste.

Standalone equipment: a PLC plus a touch panel is a complete loop; add a host only when you need archiving, remote access, or cross-device coordination.

Multi-site remote: the host degrades into an edge gateway that keeps the control loop local and sends data to the cloud over MQTT. The cloud going down must not affect the site โ€” that is what a correct design looks like.

Millisecond interlocking: hand it to the PLC or a motion controller. Keep the host out of that loop. It is good at thinking, not at racing.

One line: the host watches and thinks, the field device senses and acts. Draw that boundary well and swapping hardware or algorithms never requires rewriting the other side.

๐Ÿ“Ž 9. References

Top comments (0)