Configure EtherCAT Master Node Model

Before configuring the model, carry out the steps in Configure EtherCAT Network with TwinCAT 3.

To configure model xpcEthercatBeckhoffAIO for execution using the target computer as master node, execute the following steps.

Configure EtherCAT Init Block

Before you use the EtherCAT Init block, configure the EtherCAT® network withTwinCAT® 3.

This procedure assumes that you are familiar with TwinCAT 3 and its documentation.

As part of the configuration process, create and save an EtherCAT Network Information (ENI) file. See Configure EtherCAT Network with TwinCAT 3.

If you configure EtherCAT distributed clocks in master shift mode, using the IEEE 1588 Sync Execution block in the same model produces a build error. To include EtherCAT distributed clocks and IEEE® 1588 synchronized execution in the same model, use EtherCAT bus shift mode.

To configure the EtherCAT Init block of model xpcEthercatBeckhoffAIO, execute the following steps.

  1. Open model xpcEthercatBeckhoffAIO.

  2. Double-click the EtherCAT Init block.

  3. At the Config file (ENI) text box, browse to the EtherCAT Network Information (ENI) file that you created when you configured the network (here, 'BeckhoffAIOconfig.xml'). You can enter the file name with or without single quotes.

  4. Take the default value 0 for parameter Device index.

    If the model includes more than one EtherCAT network, enter a unique Device index for each network. Enter the same value for all blocks in each network.

  5. Enter the PCI bus and PCI slot for the EtherCAT port that you are connecting to your EtherCAT network. See Install EtherCAT Network for Execution.

  6. Take the default value Large model for parameter DC Tuning.

  7. To update the data in the EtherCAT Init block and propagate it to the other EtherCAT blocks, click Refresh Data.

  8. Click OK.

Configure EtherCAT PDO Receive Blocks

To configure the EtherCAT PDO Receive blocks of model xpcEthercatBeckhoffAIO, execute the following steps. You must have selected a valid ENI file in the EtherCAT Init block.

This procedure assumes that you are familiar with TwinCAT 3 and its documentation.

  1. Double-click the EtherCAT PDO Receive block labeled EtherCAT PDO Receive.

  2. Set parameter Device Index to the value set in the EtherCAT Init block.

  3. From the Signal Name list, select the EtherCAT network being accessed, here Term 2 (EL3062).AI Standard Channel 1.Value.

  4. Note the value of parameter Sample Time, which is in seconds.

  5. Click OK.

Execute steps 5–9 for the EtherCAT PDO Receive block labeled EtherCAT PDO Receive 1.

Configure EtherCAT PDO Transmit Blocks

To configure the EtherCAT PDO Transmit blocks of model xpcEthercatBeckhoffAIO, execute the following steps. You must have selected a valid ENI file in the EtherCAT Init block.

This procedure assumes that you are familiar with TwinCAT 3 and its documentation.

  1. Open model xpcEthercatBeckhoffAIO.

  2. Double-click the EtherCAT PDO Transmit block labeled EtherCAT PDO Transmit.

  3. Set parameter Device Index to the value set in the EtherCAT Init block.

  4. Select a Signal Name value consistent with the EtherCAT network being accessed, here Term 3 (EL4002).AO Outputs Channel 1.Analog output.

  5. Note the value of parameter Sample Time, which is in seconds.

  6. Click OK.

Execute steps 2–6 for the EtherCAT PDO Transmit block labeled EtherCAT PDO Transmit 1.

Configure EtherCAT Model Configuration Parameters

To configure the configuration parameters for model xpcEthercatBeckhoffAIO, execute the following steps. You must have selected a valid ENI file in the EtherCAT Init block. For more information, see Fixed-Step Size Derivation.

  1. Open model xpcEthercatBeckhoffAIO.

  2. Calculate the greatest common divisor (GCD) of the Sample Time values for the EtherCAT tasks and for all source blocks in the model. In this case, the GCD is 0.010.

  3. In the Simulink® Editor, on the Real-Time tab, from the Prepare section, click Hardware Settings. Select Configuration Parameters > Solver.

  4. Set the Type parameter to Fixed-step and Fixed-step size (fundamental sample time) to one of the following:

    • An integral divisor of the GCD value, in seconds.

    • auto, if all other source blocks in the model have defined sample times.

    In this case, set it to 0.010.

    The model configuration parameters dialog box looks like this figure.

  5. Click OK.

The next tasks are building, downloading, and executing the EtherCAT master node model.