How to Tune IEC 60870-5-104 k, w and t1, t2, t3 Timers
When an IEC 104 session connects fine but keeps resetting under load, or dies quietly during idle periods, the answer is almost always in five small numbers: k, w, t1, t2, and t3. They govern how much data may be in flight unacknowledged and how long each side waits before giving up, and a mismatch between the two ends - or between the settings and the link's real latency - produces exactly the flaky-session symptoms that get blamed on the network. This guide explains what each parameter does and how to set them deliberately.
IEC 104 k w t1 t2 t3 in one line: To tune IEC 104 protocol parameters, remember what each controls: k is how many I-frames a sender may have unacknowledged before it must stop, w is how many received I-frames may accumulate before an acknowledgment must be sent, t1 is how long a sender waits for acknowledgment before dropping the connection, t2 is how quickly a receiver acknowledges when traffic is one-way, and t3 is the idle interval after which test frames probe the link. Set t1 above the link's worst honest round trip, keep t2 well below t1, and make both ends agree.
What You Need
You need the current parameter values from both ends - master and outstation configure these independently, and the standard's defaults (k of 12, w of 8, t1 of 15 s, t2 of 10 s, t3 of 20 s) are only a starting point that both ends may or may not still be using. You also need an honest picture of the link: its round-trip time under load, its loss behavior, and its idle patterns, measured rather than assumed - the measurement approach in round-trip time for SCADA polling applies directly.
The parameter roles in one view:
| Parameter | Standard default | What it controls | Symptom when wrong |
|---|---|---|---|
| k | 12 APDUs | Max unacknowledged I-frames sent | Sender stalls in bursts (too low); slow loss detection (too high) |
| w | 8 APDUs | Received frames before an ack is due | Ack storms (too low); sender hits k and stalls (too near k) |
| t1 | 15 s | Wait for ack before connection reset | Resets under load on slow links (too short) |
| t2 | 10 s | Ack delay for one-way traffic | Peer's t1 expires if t2 is not well below it |
| t3 | 20 s | Idle time before TESTFR probe | Dead links linger, or NAT entries expire (too long) |
Keep the table's relationships in mind: w must stay comfortably below k, and t2 must stay comfortably below t1, on both ends.
Set the Flow Control Pair: k and w
k caps exposure: how many information frames a sender will risk without acknowledgment. On a clean low-latency network the default is generous; on a slow or lossy link, a large k means a stall or reset discards more in-flight data, while a small k throttles bursts - an outstation replaying a big buffered backlog will send k frames and stop dead until acknowledged, so undersized k turns backlog recovery into a crawl. Set k from the link's capacity to actually carry frames within t1, and resist making it huge to look fast: the number in flight is the number at risk.
w decides how lazily the receiver acknowledges: it must ack after w frames, so w near k means the sender flirts with its stall limit during one-way bursts. The conventional relationship keeps w around two-thirds of k, preserving acknowledgment headroom. The failure this prevents is subtle and common: transfers that run smoothly in trickles but hiccup rhythmically during event storms, as the sender repeatedly fills its window and waits.
Set the Timers: t1 Above the Real Round Trip, t2 Below t1
t1 is the connection's patience: if an acknowledgment does not arrive within t1 of sending, the connection is presumed dead and reset. Every spurious reset under load traces to t1 shorter than the link's honest worst-case round trip - satellite hops, congested cellular, or a peer that batches acks near its t2 all stretch response time, and a t1 set for LAN expectations resets a connection that was merely slow. Measure the real round trip at busy hour, add the peer's t2 (the longest it may legally sit on an ack), and set t1 above the sum with margin.
t2 is how fast you acknowledge when traffic flows one way. It exists so pure listeners still tell senders they are alive; setting it close to or above the peer's t1 starves the sender of acks and causes the peer to reset a healthy session. Keep t2 well under half of the peer's t1 as a working rule. And remember these are per-end settings: the classic mismatch is one end tightened during a maintenance window while the other kept old values, producing resets that only occur in one traffic direction.
Set t3 for Idle Supervision
t3 governs the quiet times: after t3 without receiving anything, an end sends a test frame to prove the link still works. Shorter t3 detects dead links faster and - usefully on cellular - keeps NAT and firewall state alive with its heartbeat; longer t3 saves bandwidth on metered links at the cost of slower dead-link detection. The trap is a t3 (plus its response timeout) longer than a middlebox idle timeout in the path: the NAT entry dies first, the test frame then fails, and the session resets on every idle period, a pattern easily mistaken for carrier flakiness.
Note that timers supervise the session, not the data: a session kept alive by test frames is proven alive but not proven flowing. Supervisory data-level checks - watching that expected measurements actually update - belong on top, which is the same layering argument as a comms-fail alarm distinguishing transport health from data health.
Verifying the Result
Verify against the three regimes: idle, normal, and storm. Idle: leave the session quiet past several t3 cycles and confirm test frames flow and no resets occur. Normal: confirm routine data moves without the sender ever stalling. Storm: trigger a worst-case burst - an interrogation of everything, or an outstation replaying a deep backlog after an outage - and watch for window stalls and t1 expiries at exactly the moment the link is busiest, which is where undersized parameters reveal themselves.
In a capture, the tells are explicit: receive-ready supervisory frames arriving just in time versus the sender pausing at its window limit, test frame exchanges bracketing idle periods, and the STARTDT and sequence state around any reset - the startup sequence itself is covered in STARTDT and STOPDT. A week without an unexplained reset across all three regimes is the acceptance test.
Frequently Asked Questions
Do both ends of an IEC 104 link need identical k, w, t1, t2, t3?
They need compatible values, and identical is the easiest way to be compatible. The dangerous relationships are cross-end: your t2 must sit well below the peer's t1, and each side's k governs its own sending. Asymmetric tuning can be legitimate on asymmetric traffic patterns, but it must be deliberate and documented - accidental asymmetry after a one-sided change is a leading cause of direction-dependent resets.
Why does my IEC 104 session reset exactly during event bursts?
Because the burst is when acknowledgments are slowest and the sender's exposure is highest: the sender fills its k window, waits, and if the ack does not land within t1 - delayed by congestion or a receiver coasting toward its t2 - the connection resets and the burst re-sends after reconnection. Raise t1 toward the measured busy-hour round trip plus the peer's t2, and check w is not set lazily close to k.
What is a reasonable t3 on a cellular link?
Short enough that the test-frame heartbeat refreshes carrier NAT state before it expires, long enough not to burn metered data pointlessly - which makes it site-specific arithmetic between the carrier's observed idle timeout and your data budget. If sessions die after quiet periods and revive on reconnect, the NAT timer is winning; shorten t3 or add application-level traffic until idle sessions survive.
Automation services
Need help turning this into a working system?
Merobix integrates SCADA, programs Allen-Bradley and Siemens PLCs, and designs and fabricates industrial control panels.
Meeting requests are reviewed before confirmation.