Basic principles
Using the sample programs This document contains sample applications of our products for certain areas of application. The application notices provided here are based on typical features of our products and only serve as samples. The notices contained in this document explicitly do not refer to specific applications. The customer is therefore responsible for assessing and deciding whether the product is suitable for a particular application. We accept no responsibility for the completeness and correctness of the source code contained in this document. We reserve the right to modify the content of this document at any time and accept no responsibility for errors and missing information. |
TwinCAT clock hierarchy
The CE operating system uses a different system time. Using the DC clock is therefore recommended.
Basic principles
If EtherCAT components are used for external synchronization of TwinCAT, a time is provided for the local controller that matches the higher-level time. As the fieldbus, EtherCAT makes the necessary operating resources available, in particular EtherCAT’s own synchronization mechanism, distributed clocks. In other words,
- in the TwinCAT controller the EtherCAT slaves and the EtherCAT master are synchronized locally in TwinCAT (see also preceding pages).
- The controller is then adjusted based on the higher-level clock total as a slave clock with DC clock.
The procedure is as follows:
- The frequencies of the two time bases are synchronized
- The offset between the two time bases is determined and announced
Note the following:
- After TwinCAT has started, the slave clock controller adjusts the frequency of its distributed clock time based on the higher-level time:
- at the start of EtherCAT, the initial offset between the two times is determined.
- the subsequent adjustment keeps this offset constant and makes it known.
- the readjustment takes place continuously.
- In the case of failure of the synchronization (interruption of the connection, restart of one of the systems), the behavior is as follows:
- once slave clock control resumes, a new offset is calculated and announced.
- the application must therefore continuously observe this offset.
- A new offset is also calculated, if the control limit of ± 1 cycle time is exceeded.
- This does not affect the BIOS clock (motherboard) or the operating system clock (Windows).
- The TwinCAT clock also remains unchanged.
- The local DC time must still be used for tasks related to the respective station hardware (EtherCAT slaves, terminals).
- If the TwinCAT time is used in the application, the TcToDc offset between the TwinCAT clock and the DC clock must be taken into account.
Using the synchronized time In the adjusted station the "other" time from the master PC is known through: Synchronized DC time = local DC time + offset This synchronized time can now be used for data logging. The local DC time must still be used for tasks related to the respective station hardware (EtherCAT slaves, terminals). |
Cascading of synchronized TwinCAT systems
We advise against cascading of several time-synchronized TwinCAT systems. However, please note that simple cascading already occurs if a TwinCAT system is controlled by an external clock based on GPS and transfers its local time to a subordinate EtherCAT system via an EL6692 bridge terminal.
In the subordinate systems the respective DcToExt offset relative to the higher-level systems must be taken into account.
Synchronized DC time = local DC time + DcToExtOffset local + Σ DcToExtOffset higher-level
The respective higher-level DcToExtOffsets can be transported through network variables, ADS, via the EL6692 bridge terminal or any other channels. The subordinate system must take these offsets into account.