Setting the time via Runtime utility center

Hello everyone.

How exactly does setting the time via Runtime utility center work and how accurate is it?


I need to synchronize the time between the PC and the PLC to perform some tests. I want to measure the duration of UDP communication between the PC and the PLC.

Hi,

this command sets the realtime clock on the PLC.
The RTC resolution is 1 second, and can jitter with “plus/minus a few seconds per day”.
A better synchronization could be reached when synching both devices with the same NTP server.
But for your use case, I’m not sure that using the RTC is.good enough.
I therefore would recommend a relative time measurement method, e.g. time between 2 packets received or similar. From my knowledge, best practice is a roundtrip measurement based on the PLCs microsecond counter, if possible.
That means:

  • implement a roundtrip by sending a packet to the PC, let PC answer the packet, and measure the time between send and response on the PLC
  • for time measurement, use AsIoTimestamp, and store the value when sending the request, and the value when receiving the response.
  • As AsIoTimestamp is a DINT, just substract the 2nd from the 1st value, and you have the rountrip time in milliseconds

Best regards.

That’s a great idea, thanks