Before configuring the model, complete the procedure in Configure EtherCAT Network by Using TwinCAT 3.

To configure model slrt_ex_ethercat_beckhoff_aio for execution by
using the target computer as
master node, complete the procedure in Configure EtherCAT Init Block.
Before you use the EtherCAT Init block, configure the EtherCAT® network with TwinCAT® 3.
Before you start this procedure, familiarize yourself 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 by Using TwinCAT 3.
To include EtherCAT distributed clocks when PTP is enabled for the model, use EtherCAT bus shift mode.
To configure the EtherCAT Init block of model
slrt_ex_ethercat_beckhoff_aio:
Open model slrt_ex_ethercat_beckhoff_aio. In the MATLAB
Command Window, type:
open_system(fullfile(matlabroot, 'toolbox', 'slrealtime',... 'examples', 'slrt_ex_ethercat_beckhoff_aio'))
Double-click the EtherCAT Init block.
In 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.
Use 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.
Enter the Ethernet Port Number for the EtherCAT port that you are connecting to your EtherCAT network. See Install EtherCAT Network for Execution.
Take the default value Large model for
parameter DC Tuning.

To update the data in the EtherCAT Init block and propagate it to the other EtherCAT blocks, click Refresh Data.
Click OK.
Before beginning this procedure, you must have selected a valid ENI file in the EtherCAT Init block.
Before you start this procedure, familiarize yourself with TwinCAT 3 and its documentation.
To configure the EtherCAT PDO Receive blocks of
model slrt_ex_ethercat_beckhoff_aio:
Double-click the EtherCAT PDO Receive block labeled
EtherCAT PDO Receive.
Set parameter Device Index to the value set in the EtherCAT Init block.
From the Signal Name list, select the variable, here
Term 2 (EL3062).AI Standard Channel
1.Value.
Observe the value in seconds of parameter Sample Time.

Click OK.
Execute steps 1–5 for the EtherCAT PDO Receive block
labeled EtherCAT PDO Receive 1.
Before beginning this procedure, you must have selected a valid ENI file in the EtherCAT Init block.
Before you start this procedure, familiarize yourself with TwinCAT 3 and its documentation.
To configure the EtherCAT PDO Transmit blocks of
model slrt_ex_ethercat_beckhoff_aio:
Open model slrt_ex_ethercat_beckhoff_aio.
Double-click the EtherCAT PDO Transmit block labeled
EtherCAT PDO Transmit.
Set parameter Device Index to the value set in the EtherCAT Init block.
Select a Signal Name variable, here Term
3 (EL4002).AO Outputs Channel 1.Analog output.
Observe the value in seconds of parameter Sample Time.

Click OK.
Execute steps 2–6 for the EtherCAT PDO Transmit block
labeled EtherCAT PDO Transmit 1.
Before beginning this procedure, you must have selected a valid ENI file in the EtherCAT Init block. For more information, see Fixed-Step Size Derivation.
To configure the configuration parameters for model
slrt_ex_ethercat_beckhoff_aio:
Open model slrt_ex_ethercat_beckhoff_aio.
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.
In the Simulink® Editor, on the Real-Time tab, from the Prepare section, click Hardware Settings. Select Configuration Parameters > Solver.
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 the parameter to 0.010.

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