Skip to Main Content Skip to Search
Product Documentation

Model-Based EtherCAT Communications

EtherCAT Protocol

The Ethernet for Control Automation (EtherCAT®) is an open, high-performance Ethernet network protocol for real-time distributed control. You can use an EtherCAT network instead of an Ethernet network because the EtherCAT protocol provides:

EtherCAT networks consist of one master node and several slave nodes. The xPC Target EtherCAT sublibrary supports only the master node of an EtherCAT network. In other words, you cannot emulate slave nodes using these blocks. However, you can prototype multiple EtherCAT controllers, with multiple Ethernet cards, using these blocks.

This topic assumes that you:

Compiler Support Limitations

You can build models that contain EtherCAT blocks with xPC Target supported compilers, except for:

Before You Start

  1. Provide a dedicated Ethernet card on your target PC. A dedicated Ethernet card is to be used only for model-based EtherCAT communications and not for communication between the host PC and target PC. This requirement means that your target PC must have at least two Ethernet cards, one for host PC to target PC communications, and one for model-based EtherCAT communication. The xPC Target software model-based EtherCAT communication blocks support the following Intel (Vendor ID 0x8086) chipsets:

    Device IDChip Description
    0x1229Intel PRO/100 M Desktop Adapter: 82557, 82558, 82559, 82550, 82551
    0x1209Fast Ethernet Controller: 82551xER, 82551IT
    0x1059Fast Ethernet PCI Controller: 82551QM
    0x2449Integrated 10Base-T/100Base-T TX Ethernet Controller: 8x559ER
    0x103ALAN Controller: 82562ET, 82562EZ, 82563ET, 82801DB
    0x1039LAN Controller: 82562ET, 82562EZ, 82562VE, 82562VM
    0x1050Pro/100 VE Network Connection: 8201EB, 8201ER
    0x27DCIntel PRO/100 VE Desktop Adapter: 82562V

  2. Download or purchase the Beckhoff ET9000 EtherCAT configurator software, available at:

    http://www.beckhoff.com/english.asp?ethercat/et9000_et9200_et9300.htm

  3. Navigate to http://www.mathworks.com/programs/ethercat/ and follow the download instructions to download a zip file. This zip file enables you to build and download EtherCAT models to the target PC. Failure to download the zip file prevents you from building and downloading EtherCAT models. You can create EtherCAT models without downloading the zip file.

  4. Design and configure an EtherCAT network.

  5. Create an EtherCAT configuration XML file for this network. The xPC Target EtherCAT blocks require this configuration XML file.

EtherCAT Data Types

The xPC Target EtherCAT blocks support the following EtherCAT data types:

EtherCAT Data TypeData Type Size (bits)Converted Simulink Data Type
bit1uint8
bit88uint8
bitarr8 (bit array)uint8
bitarr1616 (bit array)uint16
bitarr3232 (bit array)uint32
BOOL1Boolean
int88int8
int1616int16
int3232int32
int6464Not available
uint88uint8
uint1616uint16
uint3232uint32
uint6464Not available
float32real32_T
double64real_T

Accessing the xPC Target EtherCAT Blocks

The xPC Target EtherCAT blocks are not available in the standard xPC Target library. Instead, to access these blocks, from the MATLAB Command Window, type:

xpcethercatlib

The EtherCAT block library is displayed.

Basic Workflow

This topic describes a basic workflow for using the xPC Target EtherCAT sublibrary. It assumes that you:

See Before You Start for more information.

  1. Connect to the EtherCAT network.

  2. Use the Beckhoff ET9000 configurator to configure the EtherCAT network.

    This step produces a network configuration file, contained in an XML file.

      Note   The xPC Target documentation does not describe how to use Beckhoff ET9000 configurator software.

  3. From the Beckhoff ET9000 configurator, export the XML configuration file.

  4. In the xPC Target model for the EtherCAT master, add an xPC Target EtherCAT Init block.

  5. Double-click the Init block and enter the configuration file name from step 3 in the EtherCAT configuration file parameter. Use single quotes around the configuration file name.

    Configure the rest of the block.

  6. Add and configure other EtherCAT blocks, such as the EtherCAT Rx Var and EtherCAT Tx Var blocks. At the very least, each model must contain the EtherCAT Init, EtherCAT Rx Frames, and EtherCAT Update blocks. Add an EtherCAT Rx Var or EtherCAT Tx Var block for every EtherCAT device variable that is linked to a variable in an ET9000 task.

    When you add EtherCAT blocks to the model, the blocks automatically obtain the list of variables from the XML configuration file specified in their associated EtherCAT Init block. The parameter dialog boxes of these blocks are updated with the configuration information.

  7. Repeat steps 1 to 6 for each EtherCAT network that you want. Use a different Ethernet card interface for each EtherCAT network.

Execution Priority

The EtherCAT blocks have the following execution priority, from first to last:

  1. EtherCAT Init

  2. EtherCAT Rx Frames

  3. EtherCAT Rx Var, EtherCAT Tx Var

  4. EtherCAT Update

  5. EtherCAT COE Read, EtherCAT COE Write, EtherCAT Get State, EtherCAT Set State

Using the Beckhoff ET9000 EtherCAT Configurator for xPC Target Applications

This topic lists the configurator components that have corresponding xPC Target elements. It does not describe how to use the configurator. See the Beckhoff ET9000 EtherCAT Configurator for documentation on how to use the tool.

ET9000 EtherCAT Configurator ComponentCorresponding xPC Target Component
Execution rate of EtherCAT taskSample Time/Task Rate
Scalars and vectorsDimension
BitSizeType Size (see EtherCAT Data Types)
Data Type+BitSizeSignal Type (see EtherCAT Data Types)
BitOffs − 80Signal Offset
EtherCAT device variable that is linked to a variable in an ET9000 taskEtherCAT Rx VarSignal Name
Task schedulingEtherCAT UpdateTask priorities
TasksEtherCAT UpdateTask Id List
Each device variable in Process Image entityDepending on purpose, EtherCAT Rx Var or EtherCAT Tx Var block

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS