Real-Time PLC–PC Communication: Sub-Millisecond Response with UDP
For the camera decision to reach the PLC without delay we use our own UDP-based protocol instead of TCP. Why and how?

On fast lines, the later the camera decision reaches the PLC, the later the reject pusher fires and the wrong product is rejected. OPC UA and TCP-based protocols are reliable, but connection management and acknowledgements make latency variable.
Why UDP?
UDP is connectionless and unacknowledged, which is an advantage for "now or never" data such as a camera decision. We add a sequence number and timestamp to every packet to detect lost packets and fall back to the last known safe state if needed. Result: consistent latency below 1 ms on the same network.
Implementation
On the Siemens S7-1500 and Beckhoff TwinCAT side we use open UDP blocks, on the PC side our own library. Non-critical data such as recipes and parameters still go over OPC UA, so speed and reliability are each used where they belong.