Distributed Clocks settings

Basic principles

The EL2212 has a special feature in DC mode: usually the DC unit in the ESC is managed by the EtherCAT master. In the case of the EL2212, however, the local controller manages the start time and sets appropriate values in the ESC.

Distributed Clocks settings 1:
EL2212 DC schematic

The controller (B) receives timestamps, activation and target states as normal process data from the ESC (A). It parameterizes the ESC to the next start time. At the set time the ESC informs the controller of this via the SYNC signal and the controller then activates the output stages accordingly.

For this reason the corresponding DC entries cannot be changed in the TwinCAT System Manager despite DC mode, but the EL2212 can nevertheless be used as a ReferenceClock.

Distributed Clocks settings 2:
EL2212 DC settings

Determination of the current Distributed Clock time

If an up-to-date statement of the Distributed Clock time is needed in a PLC cycle, this can be linked via the input variable of the EtherCAT master.

Distributed Clocks settings 3:

Functions for data types with 64-bit width

A selection of functions for handling 64-bit numbers is available under Beckhoff TwinCAT in the TcUtilities.lib library. Longer execution times are required here than is the case with standard, 32-bit data types. A data type with a width of 64 bit is defined in TcEthercat.lib as T_DCTIME or in TcUtilities.lib as T_LARGE_INTEGER.

The EtherCAT master can display a copy of the current master distributed clock. To do this, activate the setting "Show DC System Time (64-bit)" in the EtherCAT deviceEtherCAT tabAdvanced Settings Distributed Clocks (see corresponding figure).

Distributed Clocks settings 4:
Activation of the master distributed clock display

The process image of the EtherCAT master now looks as shown in the figure below:

Distributed Clocks settings 5:
Extended process image of the EtherCAT master
Distributed Clocks settings 6:

SYSTIME

The EtherCAT master value DcSysTime is to be used with care and should serve only as a coarse indication as to which time zone (order of magnitude: 1-2 task cycles) the Distributed Clocks system is currently in.
This is due to the fact that the local time in the terminal is read into associated buffers several µs before retrieving frame. The EtherCAT strand then requires some time for transporting the process data to the master. Due to the character of the visualization, the online display in the TwinCAT System Manager is accurate at best to a three-figure millisecond range. Within a PLC the SysTime process data may also be outdated to a certain degree: depending on when the analysis takes place in the program code, the process data may be several µs/ms older. If responses of an EtherCAT segment (e.g. an EL2212 output terminal) are to be based on a SysTime read in this way, 2-3 PLC cycles should be taken into account as a buffer.

It is more appropriate to use an EL2212 with other EtherCAT slaves that generate a time stamp based on ambient influences, such as the EL1252.

Alternatively, functions can also be called at NC/PLC runtime that immediately return the current DC time, e.g. F_GetCurDcTickTime. Refer to the notes on the TwinCAT time sources in the EtherCAT system documentation (link).

Process data

For the operation of the EL2212 the activation of the process data provided for this is necessary.

Example of a sequence with activated Distributed Clocks

The following sequence is to be adhered to when using the EL2212 with activated Distributed Clocks:





Distributed Clocks settings 7:

  1. Calculation of the output time:
    • Determination of the current Distributed Clock time in 64-bit format, e.g. through the activated DC System Time of the EtherCAT master
    • Calculation and writing of the desired output time Start time with 64-bit operations
  2. Setting of the desired output states of the digital signals:
    • Output data Output and Tristate of channel 1 and 2
    • at the same time Activate must be 0
  3. Transmission of these output data to the EL2212 by the EtherCAT cycle
  4. In the subsequent cycle: activation of the output time:
    • Set Activate to 3 (transition from 0 to 3 activates the start time)
  5. The EL2212 now waits as described above until the start time occurs and then send the output data to the power stage
    • until the switching event occurs, Activate and the output bits Outputs / Tristate must be maintained in accordance with the target state
    • in the event of a power loss of the terminal being switched off, the start time is lost and must be reset by the control system
  6. Optional: Comparison of the input and output data:
    • Compare the feedback byte with the desired output image in order to register the switching operation
    • if necessary, check whether the start time has already elapsed, if the writing of the start time took place too time-critically
  7. Deactivation of the start time:
    • Set Activate to 0 in order to prepare for the subsequent activation phase

Therefore, only one switching event can be defined for each EL2212, which affects all 4 output variables Output and Tristate of channel 1 and 2 at the same time.

For each EtherCAT cycle only one switching event can be defined.

It is permissible to carry out the writing of the output data target output states, start time and Activate = 0 in the same EtherCAT cycle.