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 main device node and several subordinate device nodes. The Simulink® Real-Time™ EtherCAT sublibrary supports only the main device node of an EtherCAT network. You cannot emulate subordinate device 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 subordinate device . If you generate the file by using Acontis EC-Engineer, the software creates one default task linked to all subordinate 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 subordinate 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.
Read data from EtherCAT variables from the last received frame into EtherCAT PDO Receive blocks.
Use either of these blocks in any order:
EtherCAT PDO Receive — Processes data read from the last frame received from a subordinate device.
EtherCAT PDO Transmit — Buffers data to send in the next frame to a subordinate device.
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.
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.
EtherCAT Sync SSC/SoE Upload — Queues an SSC/SoE frame with new value, waits for response.
EtherCAT Sync SSC/SoE Download — Queues an SSC/SoE frame with request for data, waits for response.
EtherCAT Async SSC/SoE Upload — Queues an SSC/SoE frame with new value, checks for response, continues execution.
EtherCAT Async SSC/SoE Download — Queues an SSC/SoE frame with request for data, checks for response, continues execution.
EtherCAT Get State — Reads current state of EtherCAT network.
EtherCAT Set State — Queues request to change current state of EtherCAT network.
Send the PDO frames followed by the next available queued SDO frames.
EtherCAT Init | EtherCAT PDO Receive | EtherCAT PDO Transmit | EtherCAT Sync SDO Upload | EtherCAT Sync SDO Download | EtherCAT Async SDO Upload | EtherCAT Async SDO Download | EtherCAT Sync SSC/SoE Upload | EtherCAT Sync SSC/SoE Download | EtherCAT Async SSC/SoE Upload | EtherCAT Async SSC/SoE Download | EtherCAT Get State | EtherCAT Set State