Main Content

Modeling EtherCAT Networks

Ethernet for Control Automation (EtherCAT®) is an open Ethernet network protocol for real-time distributed control, for example in automotive and industrial systems. The EtherCAT protocol provides:

  • Deterministic and fast cycle times

  • Inexpensive I/O module cost

EtherCAT networks consist of one master node and several slave nodes. The Simulink® Real-Time™ EtherCAT sublibrary supports only the master node of an EtherCAT network. You cannot emulate slave nodes by using the blocks in the EtherCAT sublibrary. You can use these blocks to prototype multiple EtherCAT networks by using multiple Ethernet cards.

You model an EtherCAT network by using one of the third-party EtherCAT configurators: TwinCAT® 3 from Beckhoff® or EC-Engineer from Acontis.

To map the network model into a Simulink Real-Time model, become familiar with these mappings:

Blocks and Tasks

At a minimum, each EtherCAT model must contain an EtherCAT Init block. The EtherCAT Init block contains a reference to an EtherCAT Network Information (ENI) file. The ENI file describes the network, including the device variables of the network.

If you generate the configuration file by using TwinCAT 3, use the software to create at least one cyclic input/output task. Link this task to at least one input channel and one output channel on each slave device. If you generate the file by using Acontis EC-Engineer, the software creates one default task linked to all slave device input/output channels. The task rate equals the sample time of the EtherCAT blocks.

When you know the input/output cycle ticks, in the Model Configuration Parameters dialog box, set the Fixed-step size to a value that is consistent with these constraints:

  • The cycle tick of all EtherCAT slave devices.

  • The sample times of all other blocks in the Simulink model.

For more information, see Fixed-Step Size Derivation.

When you know the device variables that you are using in your model, add an EtherCAT PDO Receive or EtherCAT PDO Transmit block for every EtherCAT device variable. When you add these blocks to the model, the block obtains the list of device variables from the configuration file in the EtherCAT Init block. When you specify a device variable in the block dialog box, the software updates the block information with device variable information from the configuration file.

To transmit CANopen over EtherCAT (CoE) information through your network, add SDO/CoE blocks to your model. To transmit by using the SERCOS (SErial Real time COmmunication Specification) over EtherCAT (SoE) interface through your network, add SSC/SoE blocks to your model.

The SDO/CoE blocks and SSC/SoE block s come in two types, synchronous and asynchronous. From the EtherCAT perspective, there is little difference in the behavior of these types. The difference occurs during the execution of the real-time application. The synchronous blocks halt execution while the blocks wait for a response. The asynchronous blocks continue executing and poll the I/O module for a response.

To avoid a CPU overload, set the sample time for the synchronous blocks to a value at least three times of that for the PDO blocks.

To track the state of the network or force the network into a particular state, add an EtherCAT Get State or EtherCAT Set State block.

Order of Network Events

The EtherCAT Init block schedules network events in Phase 1 and Phase 2.

Phase 1

  1. Read data from EtherCAT variables from the last received frame into EtherCAT PDO Receive blocks.

  2. Use either of these blocks in any order:

    • EtherCAT PDO Receive — Processes data read from the last frame received from a slave device.

    • EtherCAT PDO Transmit — Buffers data to send in the next frame to a slave device.

  3. Use each of these blocks in any order. Synchronous upload and download take at least three ticks of the fastest PDO cycle tick to complete processing.

Phase 2

  1. Send the PDO frames followed by the next available queued SDO frames.

See Also

| | | | | | | | | | | |

Related Topics