IMDHMIControls LibraryShop main store

How-to

Measure PLC to SCADA command response time end to end

Industrial networks Published 8 min read

Short answer

Timestamp the button press and the observed status change with one monotonic PC clock, then split the interval into PC write handling, the PROFIBUS DP bus cycle, the PLC scan and tag acquisition with rendering. A healthy DP bus cycle is 1–10 ms, so a round trip of hundreds of milliseconds is almost all SCADA tag update cycles and screen redraw. Shorten the tag cycles you measured as the bottleneck, not the network.

On this page
  1. Define the two events before you time anything
  2. One clock, both endpoints on the PC
  3. Make each request identifiable
  4. The measurement procedure
  5. Where the milliseconds actually are
  6. A worked example with numbers
  7. What to change first
  8. Questions asked

Measure the delay with two timestamps from one monotonic PC clock — one taken in the button's action script immediately before the command is submitted, one when the status change is observed — then account for the four pieces in between: PC write handling, the PROFIBUS DP bus exchange, the PLC scan, and tag acquisition with screen redraw. On a healthy DP link the bus cycle is 1–10 ms and an S7-300 scan a few milliseconds, so when a color change takes half a second the network is not the delay; the SCADA's tag update cycles and redraw are. The procedure below produces a number for each piece, with the arithmetic to defend the split.

Define the two events before you time anything #

Latency is elapsed time between two defined events, so fix both before writing any code. The start event is the moment the application accepts the operator action — the point in the button script just before the write is issued — not the physical click of the mouse.

The finish event is a choice, and each choice measures a different interval:

Finish event The interval includes It proves
Echoed command sequence reaches the PC PC write handling, bus exchange, PLC scan, return acquisition The PLC processed this request
PLC output-state tag Echo path plus output update The program drove the output
Equipment feedback, e.g. a running contact Feedback path plus input processing The physical condition occurred
Status color visible on screen Chosen path plus redraw scheduling The operator sees the result

A command echo proves the request reached the PLC; it does not prove the motor started — only equipment feedback proves that. A run that ends when the SCADA receives a fresh value is also shorter than one that ends when the color is visible, because arrival precedes the next screen update. Pick one finish event and report it with the number.

One clock, both endpoints on the PC #

Use a monotonic clock — a source that advances steadily and ignores calendar corrections such as time-server steps — for both timestamps, in one unit, milliseconds. Confirm its resolution is small beside the interval you are studying; a clock whose step is comparable to a bus cycle cannot resolve one. Never mix clocks: the S7-300's millisecond counter has its own origin and drifts against the PC, so a PLC timestamp can never be subtracted from a PC one. Use that counter only for PLC-local intervals.

The harness needs four stamps, a request identifier and a timeout:

// Illustrative names — substitute your platform's monotonic millisecond source.
unsigned long  pressMs   = 0;     // PC clock when the button action fires
unsigned long  ackMs     = 0;     // PC clock when the echoed sequence is observed
unsigned long  statusMs  = 0;     // PC clock when the status tag changes
unsigned long  elapsedMs = 0;     // statusMs - pressMs, the reported figure
unsigned short seqOut    = 0;     // request identifier, wraps 65535 -> 0
unsigned short seqEcho   = 0;     // the value the PLC returns
unsigned long  timeoutMs = 3000;  // beyond this, log a timeout, never a latency
bool           awaiting  = false; // one outstanding request at a time

On the button action: increment seqOut, stamp pressMs, submit the command and seqOut together, set awaiting. On an observed tag change: if seqEcho equals seqOut, stamp statusMs, compute elapsedMs = statusMs - pressMs, log it, clear awaiting. If timeoutMs elapses first, log a timeout instead.

Two checks prove the harness before you trust it: with the PLC unreachable it must record only timeouts and no elapsed value, and live it must return nonnegative values below the timeout in a single unit, press after press.

Make each request identifiable #

A Boolean command alone cannot be timed reliably: request a start while the motor already runs and no feedback transition occurs, so you time a stale state or nothing at all. Add a sequence value to the command, and at the point where the PLC logic accepts the command, copy that value to an acknowledgement word. The observation counts only when the echo matches the request. Keep equipment feedback separate from the echo so acceptance is never read as proof of running, and allow one outstanding request with a timeout derived from what the machine is permitted to do. Each timed press is a real start command, so confirm the machine may be cycled and no one is exposed to the motion before the first sample.

The measurement procedure #

Rehearse the harness on the bench first: simulating a Modbus TCP SCADA link on one PC proves the timestamps, the sequence match and the timeout logic against a live controller image, with no motor attached.

  1. Record the connection as built: bus transmission rate, the PC interface and driver, the PC's role on the network, and how command and feedback data traverse it.
  2. Read the bus cycle from the project: on a segment carrying only DP traffic, treat the node's Ttr typical value as the bus cycle time — in the STEP 7 hardware configuration it appears when you double-click a node — and note that the configured Ttr target rotation time bounds it.
  3. Read the acquisition settings of the command, echo and status tags and write down each configured update cycle instead of trusting an undocumented default.
  4. Record the CPU's cycle-time diagnostics during normal operation so a scan excursion during the test is visible.
  5. Confirm the network is healthy: no active communication faults, no repeated exchanges, configuration matching the physical plant. A fault adds delay; a healthy network can still show variable response because application tasks run at unrelated times.
  6. Start the log and press the command ten to twenty times at normal operating pace.
  7. For each press, log pressMs, ackMs, statusMs, the echoed sequence and the PLC-local request-to-ack interval.
  8. Compute the elapsed values and the minimum, median and maximum; verify every value is nonnegative, in one unit, below the timeout.
  9. Repeat once at a busier hour before concluding anything about the plant.

Where the milliseconds actually are #

Siemens documents that on a DP-only segment the bus cycle time is the Ttr typical figure, limited by the Ttr value in the bus parameters; on a normally loaded segment at 1.5 Mbit/s it comes out in the low single-digit milliseconds, and 1–10 ms covers typical installed configurations. The transmission rate sets how fast bits move, not how fast a button changes color: at 1.5 Mbit/s one bit occupies 1 / 1 500 000 s = 0.667 µs, and at 187.5 kbit/s it is 5.33 µs, and neither number has any bearing on a poll-scheduled color change. The PROFIBUS manual offers an estimation formula for hand calculation, but the figure worth quoting is the tool-computed Ttr typical.

For a sense of scale, applications that stream drive references over PROFIBUS commonly pace them at 50–100 ms, so a supervised start with a visible color change has no reason — and no mechanism — to beat that over polled tags. A value that arrives just after a poll waits nearly a full update cycle before the SCADA sees it, the same poll-dominated queueing that motivates speeding up Modbus RTU writes behind polled reads, and it is why the median and the maximum will differ by about one update cycle.

A worked example with numbers #

Illustrative inputs, chosen to match a typical panel: PROFIBUS DP at 1.5 Mbit/s with Ttr typical 2.4 ms; PLC scan 5 ms typical; echo tag on a 100 ms update cycle; status tag on a 500 ms cycle; running feedback from a contactor auxiliary contact about 30 ms after the output; screen redraw taken as up to 100 ms. The PLC-local request-to-ack interval measured 7 ms. Medians over ten presses: echo observed 148 ms after the press, status observed 443 ms after the press.

Piece Value Basis
PC write path, press to telegram 86.2 ms remainder of the 148 ms segment
Bus exchange, write and return 4.8 ms two bus cycles, 2 × 2.4 ms
PLC request to echo 7 ms PLC-local counter
Echo poll lag 50 ms half the 100 ms cycle, on average
Echo observed (t1) 148 ms measured median
Contactor, input, scan, bus 37.4 ms 30 + 5 + 2.4
Status poll lag 250 ms half the 500 ms cycle, on average
Status observed (t2) 443 ms measured median

Arithmetic: total to observed status is 443 − 0 = 443 ms. The echo segment closes: 86.2 + 4.8 + 7 + 50 = 148 ms. The feedback segment is 443 − 148 = 295 ms, of which 30 + 5 + 2.4 + 250 = 287.4 ms is accounted and the remaining 7.6 ms is driver and runtime queueing. Network plus PLC contribute 4.8 + 7 + 2.4 = 14.2 ms of 443 ms, about 3 %.

Decision on these numbers: move the status tag from its 500 ms cycle to 100 ms. The average poll wait falls from 250 ms to 50 ms, so the expected median becomes about 443 − 200 = 243 ms, with the visible change under 343 ms once redraw is included. Halving the echo cycle to 50 ms buys another 25 ms. After that the residual is the 86 ms PC write path — an event-driven write instead of a cyclic queue — and the bus needs nothing.

What to change first #

  • Echo-to-status dominates: shorten the status and echo tags' update cycles, leave bulk data where it is, then remeasure.
  • Press-to-echo alone is in the hundreds of milliseconds: the write path in the runtime and its driver queue is the target, not the wiring.
  • Values erratic and cycle-time diagnostics show excursions: the program is delaying itself.
  • Communication faults or repeated exchanges present: fix the network fault first; only then does bus timing matter.
  • Everything measures under about 50 ms and the operator still complains: the remainder is redraw and input handling on the display side.
  • Shorter cycles overload the driver: move acquisition off the SCADA server entirely, the same tradeoff as choosing a PLC data concentrator instead of a SCADA server for RTU polling.

Questions asked

How many presses do I need for a trustworthy number?

Take at least ten at normal operating pace and report minimum, median and maximum. One sample can land anywhere inside a poll cycle and mislead by a factor of several; the median is what the operator usually experiences, and the spread between median and maximum is roughly one update cycle of the slowest polled tag. If minimum and maximum differ by much more than that, something besides polling is varying, so look at the write path and the PLC scan diagnostics before blaming the network.

Does raising the PROFIBUS transmission rate help?

No, not for the color change. At 12 Mbit/s one bit takes 1 / 12 000 000 s, about 83 ns, against 0.667 µs at 1.5 Mbit/s, but the scheduled bus cycle on a normal segment is already only 1–10 ms of a round trip measured in hundreds of milliseconds. Change the transmission rate to satisfy cable length and node count for the installation, never to fix operator-perceived latency.

What does a negative or enormous elapsed value mean?

A negative value means the two timestamps came from different clocks or different units. An enormous value almost always means the status you matched was stale: the sequence echo was not checked, so the observation belongs to an earlier request. Fix the clock source and the sequence match, and enforce the timeout so a missing reply is logged as a timeout, never recorded as latency.

Which tags actually need the faster update cycle?

Only the echo sequence and the running feedback shown on the screen the operator watches. Group just those tags and leave bulk data on the slower cycle, because every halving of an update cycle doubles that tag's share of driver and network load. In the worked example, moving the status tag from 500 ms to 100 ms cut the median from 443 ms to about 243 ms without touching the bus at all.

How do I time the moment the color is actually visible?

Inside the SCADA you can stamp the moment the animation logic evaluates the new value, which sits between tag arrival and painting. For the true visible instant you need an instrument outside the PC, such as a high-frame-rate camera pointed at the screen, compared against the press. For engineering decisions, arrival time plus one redraw period bounds the visible moment closely enough.

Keep reading

  • Troubleshooting

    SCADA gateway cycles Connecting and Disconnected: subnet fix

    When one SCADA gateway cycles between Connecting and Disconnected while another reaches the same PLC, the endpoints disagree about addressing. In the case behind this article a /16 site network met a PLC still set to /24: the test gateway reached the PLC, but the PLC sent its replies to a router that was not there. Compare both masks with the AND arithmetic shown, then test the PLC's TCP service port from the gateway host instead of ping.

    Industrial networks

  • Selection guide

    Choosing PLC to SCADA communication over long distances

    For PLC-to-SCADA communication over long distance, choose the transport by reach and connection behavior: fiber Ethernet for a continuous long link (one span rated 2 km), RS-485 where serial fits, extenders or radio on existing pairs, dial-up or leased-line modems on phone service. Direct copper Ethernet fails at 100 m per segment; the SCADA driver or OPC service, not the PLC's ASCII modem commands, carries the protocol.

    Industrial networks

  • Selection guide

    Connecting SLC 500 processors to Ignition SCADA

    For a serial-only SLC 5/03 that already feeds a PanelView, put a DF1-capable serial gateway with Ethernet upstream on the serial line and let Ignition share it in DF1 full-duplex. Swap in a 5/05 when the machine is due processor work anyway, because Ignition then gets a dedicated Ethernet channel. Use RSLinx Classic OPC-DA as a pilot when it is already licensed, and skip the DeviceNet-plus-LabVIEW route.

    Industrial networks