Modeling EtherCAT Networks

Ethernet for Control Automation (EtherCAT®) is an open Ethernet network protocol for real-time distributed control, for example for 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 using the blocks in the EtherCAT sublibrary. However, you can use these blocks to prototype multiple EtherCAT networks with multiple Ethernet cards.

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

The Beckhoff ET9000 configurator is no longer supported.

To map the network model into a Simulink Real-Time model, become familiar with the following 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 with 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 using Acontis EC-Engineer, the software creates one default task linked to all slave device input/output channels.

When you know the input/output cycle ticks, set the Fixed-step size in the Model Configuration Parameters dialog box to a value that is consistent with the following 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 Upload and SDO Download blocks to your model. The SDO blocks come in two types, synchronous and asynchronous. From the EtherCAT perspective, there is little difference in behavior of these types. The difference arises during the execution of the real-time application. The Sync SDO blocks halt execution while they wait for a response. The Async SDO blocks continue executing and poll the I/O module for a response.

To avoid a CPU overload, set the sample time for the synchronous SDO blocks to a value at least three times 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 two phases:

  1. Phase 1 — Reads data from EtherCAT variables from the last received frame into EtherCAT PDO Receive blocks.

  2. Either of the following blocks, in arbitrary 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. Each of the following blocks, in arbitrary order:

    • EtherCAT Sync SDO Upload — Queues an SDO frame with new value, waits for response.

    • EtherCAT Sync SDO Download — Queues an SDO frame with request for data, waits for response.

    • EtherCAT Async SDO Upload — Queues an SDO frame with new value, checks for response, continues execution.

    • EtherCAT Async SDO Download — Queues an SDO frame with request for data, checks for response, continues execution.

      Synchronous upload and download take at least three ticks of the fastest PDO cycle tick to complete processing.

    • EtherCAT Get State — Reads current state of EtherCAT network.

    • EtherCAT Set State — Queues request to change current state of EtherCAT network.

  4. Phase 2 — Sends the PDO frames, followed by the next available queued SDO frames.

See Also

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

Related Topics