IMDHMIControls LibraryShop main store

How-to

How to simulate a Modbus TCP SCADA link on one PC

SCADA and data logging Published 8 min read

Short answer

Yes — one PC can run the SCADA client and a Modbus TCP server simulator at once. Decide which side you are proving, keep exactly one client and one server in the arrangement, prove the server exists with an independent Modbus client, then align object type, offset and word order before trusting any value; a connected link proves transport only.

On this page
  1. Decide which side you are proving
  2. Keep exactly one client and one server
  3. Prove the server before opening the SCADA software
  4. Build the link in this order
  5. Align the register map before trusting a value
  6. Worked example: proving a 32-bit float in holding registers 40001 and 40002
  7. Swap in the real PLC and close out
  8. Questions asked

Yes — point the SCADA channel at 127.0.0.1 on TCP port 502, run a Modbus TCP server simulator on the same PC, and read holding register 40001 (function code 03, offset 0) with an independent Modbus client before the SCADA software ever connects: that is the whole one-PC simulation, and it is the fastest way to prove a Modbus TCP SCADA link before any hardware exists. Three decisions make the test clean. Name the side you are proving and simulate only the opposite role, because a Modbus transaction needs exactly one client and one server. Prove the server with that independent Modbus client first, so a connection fault lands on one component. Treat a connected link as transport only: align object type, offset and word order against one injected value before you trust any point. The sections below give the decision table, the build order, and a worked register-alignment example you can copy onto your bench.

Decide which side you are proving #

"Simulate" describes three different arrangements, and each one proves a different component. Pick the objective first, then give every running program its real protocol role and simulate only the opposite role.

You are proving Client in the test Server in the test A passing link proves
The SCADA configuration your SCADA software a server simulator on the PC channel setup, device polling, point addressing, value interpretation
The PLC endpoint an independent Modbus client tool the PLC endpoint (or the simulator) the server exists, answers requests, and serves the mapped data
The complete path your SCADA software the real PLC endpoint the integration the way it will run

Write the objective down before configuring anything. If you have no PLC at all yet, the same one-PC arrangement is the core of a virtual PLC test bench for protocol practice — the bench and this simulation differ only in how permanent you make them.

Keep exactly one client and one server #

The Modbus specification defines a client/server exchange: the client opens the TCP connection and issues read or write requests; the server holds the data and answers. A server never speaks first. Modbus TCP uses TCP port 502 as its registered port, so a simulator listens there unless you change it in its connection settings, and the client must then be pointed at the same port number. On one PC the destination address is the loopback address 127.0.0.1.

Two clients cannot exchange process data, because both only ask. Two servers both wait for a request that never comes, and the second one usually fails to bind port 502. Before you edit any address, list the running processes and mark each one client or server. When the client cannot reach a server, the symptom downstream is timeouts and question marks where numbers should be, which the page on why HMI values show question marks traces from the controller side.

Loopback traffic passes the host firewall on default settings; once the two ends sit on different PCs, an inbound rule for the server's port is the first thing to check.

Prove the server before opening the SCADA software #

An independent Modbus client settles the biggest unknown early: does a server actually exist at the address you plan to use? Modbus Poll is documented as a Modbus master/client simulator for testing slave devices, and the Simply Modbus TCP client tool turns a Windows PC into a Modbus TCP client. On the server side, the Modbus Server Simulation app for Windows is documented to simulate a Modbus TCP/IP server for testing against masters, PLCs and SCADA, and ModbusTCPTool offers both server and client modes over the four register types. Any tool with the right role works; what matters is that it is independent of the SCADA software you are testing.

Observation with the independent client Meaning Next check
Client connects and reads one mapped object server and path are sound move on to the SCADA channel
Client connects, SCADA does not fault is in the SCADA channel or device setup compare destination, port and unit identifier against the server's settings
Neither connects server not running, wrong port, or host security server state, listening address and port, firewall rule
Connects but reads fail object type, offset or quantity outside the map compare the full request with the server map

The branch decision: a valid client response proves an endpoint exists, so a failing connection sends the work to the server process, its binding and host security — not to the point definitions.

  1. Write down the component to prove. Give it its real role and simulate only the opposite role.
  2. Start exactly one server: the simulator with its register map, or the real PLC endpoint. Note the listening address and port from its settings.
  3. Connect one independent client and request one mapped object: read holding registers (function code 03), one register at offset 0, is the usual first read. A valid answer proves the server.
  4. If the server accepts only one client session, disconnect the test client before starting the SCADA driver.
  5. Point the SCADA channel at the same destination address and port.
  6. Configure one point that mirrors the client's request: same function code, same object type, same offset, same quantity. Derive the offset from the addressing convention below, not from the displayed digits.
  7. Change the value on the server side and confirm the raw SCADA value follows before adding scaling or any multi-register interpretation.
  8. Add the remaining points, then swap in the real endpoint, changing only the destination and mappings that genuinely differ.

One safety note: keep write function codes out of the bench until the destination is deliberately chosen, because a write point aimed at a live device can drive real outputs.

Align the register map before trusting a value #

A connected link proves transport only. The Modbus data model has four blocks: coils, discrete inputs, input registers and holding registers. Read coils with function code 01 and write them with 05 or 15; read discrete inputs with 02; read input registers with 04; read holding registers with 03 and write them with 06 or 16. Match the function code to the block your point actually needs — an exception reply usually names the wrong block faster than any configuration screen.

Display references are 1-based within each block: coils from 00001, discrete inputs from 10001, input registers from 30001, holding registers from 40001. Protocol offsets are 0-based, so holding-register display address 40001 is offset 0 and 40002 is offset 1. Some tools show six-digit references — 400001 for the same offset 0 — so copy the object type and offset, never the displayed digits alone. Derive each request offset as the display reference minus the block base.

Symptom Likely cause Action
every request rejected with an exception object type, offset or quantity outside the server map compare the full request with the server map
some points work, their neighbours fail quantity or offset boundary error read one known object at a time
values update but are numerically wrong word order, byte order, signedness or scaling compare raw words against one injected value, as below
values static with no errors wrong object, or the data never changes force a controlled change on the server side

Worked example: proving a 32-bit float in holding registers 40001 and 40002 #

Inputs, with their sources:

  • Register convention: holding-register display reference 40001 is offset 0 (documented Modbus addressing convention).
  • Register map: the value occupies offsets 0 and 1 as a 32-bit IEEE 754 floating-point number, placed there in the simulator's register grid (illustrative bench setup).
  • Injected test value: 12.5 in the application's engineering units (illustrative).
  • Words returned by the independent client for that value: 0x4148 at offset 0 and 0x0000 at offset 1 (the IEEE 754 encoding of 12.5, split into two 16-bit words).
  • Request from the SCADA point: holding registers, display address 40001, quantity 2.

The rule in words: the request offset is the display reference minus the block base, so 40001 − 40001 = 0 with quantity 2, reading offsets 0 and 1. The raw value combines the two words, high word first, into one 32-bit pattern; that pattern decodes as a sign bit, 8 exponent bits with a bias of 127, and a 23-bit mantissa.

The arithmetic:

  • Combine: 0x4148 × 65,536 + 0x0000 = 1,095,237,632 = 0x41480000.
  • Sign: bit 31 is 0, so the value is positive.
  • Exponent: 0x82 = 130; 130 − 127 = 3.
  • Mantissa: 0x480000 / 0x800000 = 4,718,592 / 8,388,608 = 0.5625, so the significand is 1.5625.
  • Value: 1.5625 × 2³ = 12.5 — the SCADA display matches the injected value.

The wrong-order check sets the threshold: with the words swapped, the pattern is 0x00004148 with an exponent field of 0, which decodes as a subnormal — 16,712 × 2⁻¹⁴⁹ ≈ 2.34 × 10⁻⁴¹, effectively zero.

Decision: when the point shows the injected 12.5, transport and alignment for this object are proven, and you can add scaling one point at a time. If it shows a number orders of magnitude from the injected value — 2.34 × 10⁻⁴¹ instead of 12.5 here — the words are swapped: change the word order in the point's data-format setting and re-read. Never touch the network settings for a value fault; the connection is already proven.

Swap in the real PLC and close out #

Replace the simulator with the real endpoint and change only the destination and the mappings that genuinely differ; keep the request structure you validated. If that endpoint is a ControlLogix, reading Modbus TCP from a ControlLogix PLC without a gateway walks through the PLC-side setup. Before you trust the link in operation, read a known low value, a known high value and a value that changes, and alarm the link itself — how to create a SCADA PLC communication alarm for link loss gives the pattern.

When the bench is proven and the client runtime moves from your desk into the cabinet, the computer that runs it at the machine — an industrial panel PC for the SCADA client — is the hardware decision at that point.

The decision for each case: proving SCADA configuration, pair your client with a simulator; proving the PLC endpoint, pair an independent client with the real server; proving the complete path, run the real pair and retire the simulator. Commit the objective before you start, and a fault always lands on one side.

Questions asked

Which function codes should a bench test cover?

Cover read holding registers (function code 03) and read input registers (04) first, since most SCADA points read those. Add read coils (01) and read discrete inputs (02) for status bits, and write single register (06) or write multiple registers (16) once the destination is safe. A request carrying a code the server does not implement returns exception 01, Illegal Function, which names the mismatch directly.

How many registers fit in one request?

The Modbus specification caps read holding registers and read input registers at 125 registers per request, read coils and read discrete inputs at 2000 bits, and write multiple registers at 123. A request beyond the cap gets exception 03, Illegal Data Value, from a compliant server. Keep bench polls small, then tune quantity and interval against the real device's response time.

Why does a healthy link show zero or a tiny decimal?

Usually word order on a multi-register value: the worked example's words decode to 12.5 in one order and about 2.34 × 10⁻⁴¹ in the other. Signedness is the second suspect — raw 65535 read as a 16-bit signed integer shows −1, unsigned shows 65535. Fix it in the point's data-format setting, never in the network settings.

Do you still need the real PLC before go-live?

Yes. The simulator proves your client configuration, addressing and interpretation, but its answers arrive instantly from a map you drew, so it cannot prove the PLC's real register map, its response time under load, or its connection limits. Keep the validated request structure, change only the destination and the mappings that differ, and repeat the low, high and changing-value checks on the real endpoint.

Keep reading

  • How-to

    How to build a virtual PLC test bench for protocol practice

    One laptop runs the whole bench: a Modbus TCP server simulator, a master test client, a Node-RED OPC UA server and a SCADA trial connect over loopback, so you can practice addressing, sessions, scaling, alarms and fault diagnosis without a PLC. Work through three bounded projects and finish with seven pass criteria you can defend.

    Industrial networks

  • Troubleshooting

    Commissioning CP1L Host Link serial reads to SCADA

    CX-Programmer going online proves only the programming path, not the SCADA read. Set the CP1L serial port to Host Link, enter its unit number (0 to 31) as the driver's device address, match baud, data bits, parity and stop bits, prove the cable end to end, and free the computer port of other software. Read one known word before adding tags: a timeout means no valid reply arrived; a PLC protocol error proves the link works.

    SCADA and data logging

  • How-to

    How to create a SCADA PLC communication alarm for link loss

    Create the SCADA-to-PLC communication alarm from the data server's diagnostic item, not from a PLC bit. Browse to IsPresent under the PLC shortcut's Diagnostic Items folder, create a digital alarm in FactoryTalk Alarms and Events with IsPresent = 0 as the active condition, and it activates about 20 seconds after the link drops; IsPresent(10) shortens that to about 10 seconds. A heartbeat bit cannot do this because it travels over the link it monitors and goes unreadable exactly when the link fails.

    SCADA and data logging