PLC Runs a Fresh Batch With an Old Completion Flag? Add Transaction Identity
- PLC Play Ground
- 0
- Posted on
A completion bit left over from earlier work can incorrectly finish a new transaction. Compare the result with the request identity instead of assuming any true done flag belongs to the current operation.
Original asynchronous protocol example; implement through the supported interface.
What is happening?
Request and result lifecycles need an association. Clearing a bit can be part of the interface, but asynchronous updates and retries can race with that clearing. Sequence identifiers or equivalent documented handshakes make ownership explicit.
Check these five things
-
Identify how each new operation is distinguished.
-
Trace when completion is cleared and when results can arrive.
-
Check retries and late replies from earlier operations.
-
Accept results only according to the defined transaction contract.
-
Test delayed and duplicated responses offline.
Worked example
A teaching client issues request 42 while a delayed completion for request 41 arrives. A bare done bit cannot explain which request finished. A result carrying the matching identity lets the application reject the stale response and continue waiting for 42.
Quick diagnostic reference
| Result | Decision |
|---|---|
| Current identity | Evaluate outcome |
| Older identity | Stale result |
| Unknown identity | Interface diagnostic |
The mistake to avoid
Sequence numbers also wrap or reset. The protocol must define those boundaries rather than assuming every larger number is automatically newer forever.
How to verify the fix
Exercise new work, timeout, retry, late completion, and restart. Confirm no previous result can authorize completion of a different operation.
Field-work boundary: These are educational diagnostic guides. Use the exact equipment manuals and approved site procedures. Electrical testing and machinery changes belong to qualified, authorized personnel; control hazardous energy and validate affected functions before release.
Technical reference
Rockwell Automation: Tasks, Programs, and Routines. The examples and diagnostic tables above are original teaching material; they do not replace the product manual.
