Start of trail EtherCAT Read navigation bar

Table of Contents

EtherCAT Master

Beta

This block is currently a beta version. If you are using this block, we would appreciate any feedback at tech@quanser.com.

Creates an EtherCAT master in the network subsystem.

Library

QUARC Targets Beta/Fieldbus/EtherCAT

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library_beta/Fieldbus/EtherCAT')

Description

EtherCAT Master

The EtherCAT Master block creates an EtherCAT master in the network subsystem. The EtherCAT master uses the XML configuration file to initialize itself and the EtherCAT slaves attached to the network card specified in the XML configuration file. The configuration file also contains the cyclic commands sent every sampling instant of the master and the initialization commands required for transition between the five EtherCAT states: INITIALIZATION, PREOPERATIONAL, BOOTSTRAP, SAFE OPERATIONAL, and OPERATIONAL.

This block reads the state of EtherCAT master each sampling instant of the block and outputs that EtherCAT state. The table below shows the states and their corresponding integral value:

EtherCAT State

Value

INITIALIZATION

1

PREOPERATIONAL

2

BOOTSTRAP

3

SAFE OPERATIONAL

4

OPERATIONAL

8

Limitations

Warning For performance reasons, functionality and parameters of this block are subject to change. This block will stabilize once the performance has been fully optimized.

Input Ports

This block has no input ports.

Output Ports

This block only has one output port: the current state of the master.

state

The current EtherCAT state of the master. See the description of the block above for the possible states and their values.

Data Type Support

The EtherCAT Master block outputs the state as a uint8. No other data types are currently supported.

Parameters and Dialog Box

EtherCAT Master

Go to EtherCAT blocks using this master

Opens a dialog that lists all the EtherCAT blocks in the model which are currently using the same master selected in the Master name parameter. The dialog may be used to go to another EtherCAT block in the model just by double-clicking on the name of the block in the dialog box.

Master name

The name of the EtherCAT master. This name is referenced by the other EtherCAT blocks to identify the EtherCAT Master block with which they are associated. This name must be unique throughout the model. No two EtherCAT Master blocks may have the same master name.

XML file

The XML configuration file for the master. This file is generated by the configuration utility and contains all the information about the master and the EtherCAT slaves attached to the network card. It also identifies the network card (by its Mac address).

Protocol type

The protocol to use when communicating with EtherCAT slaves via the network card. If EtherCAT is selected then the native EtherCAT protocol is used. This protocol is the most efficient and delivers the best performance. However, it should not be used on a local-area network because it may tax the rest of the network.

If UDP is selected then the UDP/IP protocol is used. This protocol may be used on a local-area network but is less efficient than the native EtherCAT protocol. In general, the native EtherCAT protocol should always be used with a dedicated network card for the EtherCAT segment because this configuration delivers the best performance in the highest sampling rates for the EtherCAT master.

Initial state

The EtherCAT master always starts out in the INITIALIZATION state. This parameter allows a new state to be requested immediately at model start. It is typically set to either SAFE OPERATIONAL or OPERATIONAL so that the EtherCAT master will proceed through the initialization commands necessary to bring the EtherCAT slaves up to the SAFE OPERATIONAL or OPERATIONAL state.

Stack priority

The priority to assign to the EtherCAT stack as it executes the master code. This parameter allows the priority of the EtherCAT stack to be assigned independent from the model. It is typically set to a priority higher than the model in order to deliver the most deterministic performance in the EtherCAT stack.

Priorities range from 0, the lowest priority, up to the maximum priority. The maximum priority depends on the operating system. For example, QNX allows a maximum priority of 255.

Stack sample time

The sample time at which to run the EtherCAT stack as it executes the master code. This parameter allows the simple time of the EtherCAT stack to be assigned independently of the model. It is typically set to -1 so that the sample time of the model is inherited by the EtherCAT stack. Otherwise it should be set to the be desired sample time in seconds. For example, set this parameter to 0.000100 to run the EtherCAT stack every 0.1 ms or 10 kHz.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time. Since this is a source block, only inherent the sample time when it is placed in a conditionally executed subsystem, like a Triggered or Enabled Subsystem, or in a referenced model.

The default sample time is set to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model. Hence, the default sample time is a discrete sample time with the same sampling time as the fixed step size of the model.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

No

No

Not currently supported.

QUARC Win64 Target

No

No

Not currently supported.

QUARC Linux Nvidia Target

No

No

Not currently supported.

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

No

No

Not currently supported.

QUARC Linux Raspberry Pi 4 Target

No

No

Not currently supported.

QUARC Linux RT ARMv7 Target

No

No

Not currently supported.

QUARC Linux x64 Target

No

No

Not currently supported.

QUARC Linux DuoVero Target

No

No

Not currently supported.

QUARC Linux DuoVero 2016 Target

No

No

Not currently supported.

QUARC Linux Verdex Target

No

No

Not currently supported.

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

No

No

Not currently supported. This block does nothing during rapid simulation.

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

No

No

Not currently supported. This block does nothing during normal simulation.

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar