Initialize EtherCAT Master node with data in the EtherCAT Network Information (ENI) file
Simulink Real-Time / EtherCAT
The EtherCAT Init block initializes the EtherCAT® master stack. The block specifies the Ethernet interface cards in the network.
Before you use this block, create and save an EtherCAT Network Information (ENI) file. You export the ENI file from the Beckhoff® TwinCAT® or the acontis EC-Engineer. See Configure EtherCAT Network by Using TwinCAT 3.
To find the ENI file, click Browse. To read the ENI file and store the data in the EtherCAT Init block, click Refresh Data.
The Simulink® Real-Time™ software supports multiple EtherCAT networks. To use multiple networks:
Use a different Ethernet card interface for each EtherCAT network.
In the model, use one EtherCAT Init block for each network.
To include EtherCAT distributed clocks when PTP is enabled for the model, use EtherCAT bus shift mode.
Status — Status information about the EtherCAT network
Status vector contains these values:
ErrVal— Error status:
Error: Value less than
ErrValshows the latest error status, the propagation of errors can hide the original error. To find the original error, add an EtherCAT Get Notifications block and use the
slrealtime.EtherCAT.filterNotificationscommand to print the status codes that the EtherCAT stack transmits.
MasterState— Operating state of the EtherCAT network.
State Value Description
1 Initialization — The system finds terminal devices and initializes the communication controller.
2 Preoperational — The system uses the communication controller to exchange system-specific initialization data. In this state, the network cannot transmit or receive signal data.
4 Safe operational — The network is running and ready for full operation. The supervisor sends input data to the terminal device. The terminal device output remains in a safe state.
8 Operational — The network is in full operation. The supervisor sends input data to the terminal device. The terminal device responds with output data.
DCErrVal— DC error status for the master shift controller:
No DC Error for master shift controller:
DC error for master shift controller: Value from EtherCAT Init Block DC Error Values.
When you select master shift controller mode, the value
0indicates successful clock distribution. The
DCErrValdoes not apply when the distributed clock is disabled.
MasterToNetworkClkDiff— Time difference, in nanoseconds, between the master stack clock and the clock on the first slave device that has enabled DC.
DCInitState— Operating state of the distributed clock:
DC not enabled, not initialized, or single EtherCAT DC slave:
DC has been started and the EtherCAT DC slaves are in sync with each other:
NetworkToSlaveClkDiff— Time difference, in nanoseconds, between the clock on the first EtherCAT slave device and the least closely locked clock on the remaining slave devices.
This value applies only to slave devices that have enabled DC. If only one device on the network has enabled DC, this value is
Config file (ENI) — ENI file from the EtherCAT configurator
Specify the ENI file that you exported from the EtherCAT configurator.
You can specify the absolute path name or a relative path name from the current folder. If you specify only the file name, the software searches for the file in the current folder and on the MATLAB® path. If more than one file with that name exists on the path, MATLAB displays a message box that indicates a clearer file specification is needed.
Clicking Browse inserts a full, editable path name.
Device index — EtherCAT network identifier
A unique integer in the range
0–15 that identifies the Ethernet card
for an EtherCAT network.
For each EtherCAT network, the software generates a unique device index. The software inserts that device index as Device index into the EtherCAT Init block that represents the network. For more information about Speedgoat Target Machine settings, see Install EtherCAT Network for Execution.
Ethernet Port Number — Port number in target computer
The first port reserved for EtherCAT by the
speedgoat.configureEthernet function is port 1 here. For more
information, see the description of the
function in Speedgoat documentation. For more
information about Speedgoat Target Machine settings, see Install EtherCAT Network for Execution.
DC Tuning — Distributed clock initialization parameter
Enter the distributed clock initialization parameter from one of these values:
Large model(default) — Sends
16,000timing initialization packets and allows
1second of settling time. Provides best initial synchronization between multiple slaves that have DC enabled.
Medium model— Sends
8,000timing initialization packets and allows
0.3seconds of settling time. The model reaches operational state about a second earlier than it does with the
Small model— Sends
2,000timing initialization packets and allows
0.2seconds of settling time. The model reaches operational state earlier than it does with the other settings.
Monitor device synchronization at the moment that the model enters the operational state. If the ENI file enables DC, make sure that the devices are synchronized closely enough for your application.
Enable EtherCAT Log for Debugging — Access to debugging and logging block parameters
The selections choose:
Off— Skip all except fatal errors in log.
Warning— Include warnings and fatal errors in log.
Info— Include information displays, warnings, and fatal errors in log.
Verbose— Include sequencing information from EtherCAT stack, information displays, warnings, and fatal errors in log.
All— include low level debugging information and all other categories in log.
All logging levels
can produce so much data that it can cause overloads at fast task
The target log file name is
%d is the device id value.