Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11)

Note

Attention! No plausibility check takes place!

The mentioned notes and information should be used advisedly.
The EtherCAT master automatically allocates settings that support reliable and timely process data acquisition.
User intervention at this point may lead to undesired behavior.
If these settings are changed in the Beckhoff TwinCAT System Manager, no plausibility checks are carried out on the software side. Correct function of the EtherCAT slaves with all conceivable setting options cannot be guaranteed!

Unless specified otherwise in the associated slave documentation, we strongly advise against changing the automatic settings.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 1:

Validity of the following settings

The setting options described below refer to Beckhoff TwinCAT 2.11 Build 1540. More recent editions can have a different user interface design; however, usage remains analogously the same.

With the launch of TwinCAT 2.11, new features are available in the System Manager and the PLC that make the commissioning of the Distributed Clocks slaves (DC slaves) simpler and clearer. These are

Statements made in this document in the context of TwinCAT 2.10 remain valid.

System Manager - display of the time of action

In the System Manager, from TwinCAT 2.11 on, an optional display allows the online offsetting when outputs are set from the point of view of the controller, or the time from when read inputs originate. The following information applies exclusively to Distributed Clocks slaves.

For basic understanding, a complete EtherCAT update cycle is explained here by way of an example – in the example a digital input will be read and output to a digital output. These are in both cases DC-based slaves, therefore an EL1202-0100 (input, yellow) and an EL2202-0100 (output, red) are used.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 2:
Topology and principle of operation used in the example

Introductory remarks:

New in TwinCAT 2.11 is the possibility to determine the time of CurTaskTime in the PLC online at runtime by calling the function F_GetCurDcTaskTime. The time at which the EtherCAT frame arrives at the first DC-capable device (Fig. Topology and principle of operation used in the example, B) is the central time to which the entire system is regulated. It corresponds to the CurTaskTime of the preceding cycle, which means: If the function F_GetCurDcTaskTime is called in PLC cycle A, it reports time B. This value remains constant even after repeated determination within this task cycle. From the point of view of the running PLC program this is the "now" time. From this "now" perspective the controller sees

The x or y times respectively are constant in each cycle if the EtherCAT system with Beckhoff TwinCAT EtherCAT Master is running stably.

However, this approach is only permissible because the DC system determines exactly when input data is read and output data is output; therefore, it cannot be used for slaves without DC functionality (such as EL200x or EL100x).

The x and y times are now available as pre-calculated values in the System Manager in TwinCAT 2.11 for linking to the controller:

Note

Based on the internal real-time, TwinCAT triggers the task/NC/PLC/... The aim of the control is to always let the (first) EtherCAT frame arrive at the first DC-capable EtherCAT slave at the cycle interval (e.g. 1 ms). This is made more difficult or impossible, if the PLC/task has a very irregular/fluctuating execution time, resulting in synchronization problems at the fieldbus. Appropriate buffer can be provided through the TwinCAT setting "percent of cycle time".

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 3:
TwinCAT EtherCAT master setting, section DistributedClocks

Die TwinCAT Echtzeitregelung versucht durch entsprechendes Triggern/Starten der PLC/NC/sonstige Task, trotz der evtl. schwanken Ausführungszeit

Sample

Let us consider the EL1202-0100 in the above example at a cycle time of 100 µs (100,000 ns) in the configuration.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 4:
Process data

Since it is configured like this, the terminal informs about the following in the online state:

Comments

The EL1202-0100 is an input terminal and thus in the ‘InputBased’ DC group - it works in a standard fashion, i.e. in sync with all of the DC input modules, the yellow symbols in Fig Topology and principle of operation used in the example. In addition, it has only input variables. Thus, especially useful is the consideration of the DcInputShift value:
From the point of view of the ‘now’ time of the controller, the input value Input= 1 i.e. 110,000 ns is ‘old’.

Note: The EL1202-0100 also provides the exact latch time as the NextLatchTime process parameter, a feature that not all DC slaves support.

Sequence by way of an example

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 5:
EtherCAT Update (schematic)

In this example, the digital input B is to be read and immediately output again on a digital output J. We follow the sequence (blue):

The tasks B and J, which are critical for the user, can always be set by the specifications DcInputShift (M) and DcOutputShift (N) in relation to the now-time (P).

Note: The function SeparateInputUpdate currently (2015-06, TwinCAT 3.1 b4018) has no automatic effect on the calculation of DcInputShift/DcOutoutShift. The (input) shift times of the corresponding terminals should be adjusted manually, as applicable.

Checking the effectiveness of DC from the point of view of the controller

The above-mentioned values DcInputShift and DcOutputShift are theoretical values which are valid if the EtherCAT system is running stably. The default settings in the System Manager are defined such that these values are reliably adhered to in virtually all cases.

Typical reasons why they are occasionally or systematically not complied with in the application are:

Nevertheless, it can be useful in the field to check the actual number of read/write operations that have taken place, for example, during commissioning or the manual optimization of DC slaves. As a check, the following are recommended:

System Manager – Shift Time settings

With respect to the shift time, very similar dialogues can be found in the advanced dialogue of EtherCAT masters and slaves, for which reason they are discussed here together.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 6:
Local slave shift time

The term ‘shift time’ in the settings dialogs differs in meaning from the above-mentioned DcInput/OutputShift; compare with Figs. EtherCAT Update (schematic) und Local slave shift time!

The following applies for setting: effective shift time = master shift time + slave shift time

In the EtherCAT master:

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 7:
EtherCAT master setting

Among other things, on the basis of the cycle time, TwinCAT has shifted the group of output modules from the point of view of CurTaskTime by 37.6 µs into the future here; the input modules, conversely, will read their inputs 10 µs before the CurTaskTime. These two times correspond to A/B from Fig. Local slave shift time. If necessary, they can be modified by means of additional entries.

In the EtherCAT slave:

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 8:
EtherCAT slave setting

The shift time is displayed from the (default) point of view of the output modules in the slave dialogue - the EL1202-0100 shown here is an input module; it will therefore be automatically specified to BasedOnInputReference and its SYNC signal will thus be (-37.6 - 10 µs) ahead of the output modules.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 9:
Shift calculation in the slave dialogue

When a slave is to be ‘shifted’ manually, consistent values can be entered in the UserDefined field.

Displaying the shift time

The display of the individual slave shift times is possible via the advanced settings of the slave.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 10:
Displaying the DC shift times

Advanced Settings

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 11:
Continuous setting

If activated, TwinCAT cyclically measures the runtimes between the EtherCAT devices. It is recommended to retain this setting. Deactivation can create space for cyclic data in the case of a very short cycle time, because the NOP datagram is then dispensed with.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 12:
Runtime Measuring
Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 13:
DevState input

A cyclic BRD command on 0x092C (system time difference) is used for this.
The information is only usable if the first EtherCAT device also contains the master clock.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 14:
DcSysTime inputs

Distributed Clocks diagnosis

The TwinCAT System Manager offers the possibility in an online state to make a preliminary statement about the quality of the current real-time.

Sequence:

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 15:
Online DC diagnosis

Criterion

Good

Bad

Asymmetry

An asymmetry of positive and negative deviations is required. This represents the drift ratio between the master clock and the TwinCAT clock.

If the ratio is 0:100 or 100:0, the DC system is inoperative.

Distribution of the deviation

The deviation values should be predominantly at low levels, see Fig. Online DC diagnosis - adjustment required

If exclusively values in the class "> = 500 µs" occur, the DC system is inoperative.

A system according to Fig. Online DC diagnosis - adjustment required, for example, is not suitable for fast EtherCAT applications with a cycle time of, say, 100 µs and may require adjustments.

Distributed Clocks settings in the Beckhoff TwinCAT System Manager (2.11) 16:
Online DC diagnosis - adjustment required