Technical introduction
When external synchronization is applied, two system times meet:
- 1. The controlled/time-receiving TwinCAT system with its distributed clocks.
- 2. The time-sending system with its encoder clock.
Synchronization process:
- Two timestamps (one external and one internal) must be transferred periodically to the time-receiving TwinCAT system.
- To form a timestamp pair, the value of both times is recorded at the same time. The "internal clock" is always based on the system's own distributed clock time. The "external clock" is the time from the external, time-giving system.
- The timestamp pairs are determined periodically, e.g. every 100 ms.
- If these timestamp pairs are repeatedly sent to the receiving TwinCAT real-time system, the system is able to determine the deviation trend and can readjust itself until clock synchronization is achieved. The remaining offset is offered for linking through variables in the EtherCAT IO tree.
Essentially, TwinCAT synchronization is not designed to minimize or compensate the offset. If the initial difference between the two systems is large (weeks, months), this would mean a very long waiting time. The readjusting TwinCAT system therefore establishes clock synchronization within a few seconds and maintains the offset.
Offset step changes can occur if:
- The real-time behavior no longer permits tracking.
- Leap seconds/time changes etc. are received via the external time.
The readjusted control should be designed in such a way that it can cope with offset step changes.
The quality of the time control that can be achieved depends, among other things, on how accurately the external clock can be read and how the "new signal" event can be fed into the time-receiving system. The jitter-free nature of this external timestamp must be magnitudes better than the intended control objective.
Example: The jitter associated with the edge output of commercially available direct DCF77 receivers (German radio time on longwave) can be such that the readjustment is disturbed up to the ms range, even taking into account the missing 59th second. This leads to step changes in the offset display.