Overview

TE1401 TwinCAT Target for MATLAB®

With TwinCAT 3 Target for MATLAB®, functions developed in the MATLAB® script language can be used in TwinCAT 3. The functions are automatically compiled in C/C++ code with the aid of the MATLAB® Coder™ and transformed into TwinCAT objects with the TwinCAT 3 Target for MATLAB®.

These objects can be seamlessly integrated into TwinCAT 3 Engineering. For example, they can be expanded into a complete project using PLC source code, debugged, and linked to fieldbus devices. This allows existing MATLAB® functionality to be integrated into TwinCAT Engineering and TwinCAT runtime workflows without having to reimplement the domain-specific algorithm.

Overview 1:

The automatically generated modules can be integrated into a TwinCAT solution in two ways:

  1. TcCOM object
  2. PLC function block

In addition, a TcCOM wrapper FB can be created to call a TcCOM module from PLC code or to use its data directly from within the PLC.

The inserted modules are then loaded into the TwinCAT 3 runtime together with the entire TwinCAT project and executed there, like all other objects, within the real-time environment.

TwinCAT 3 Target for MATLAB® supports both 32-bit and 64-bit Windows targets, as well as TwinCAT/BSD and Beckhoff RT Linux® (only starting with TwinCAT Build 4026).

Typical procedure

The basic workflow with the TE1401 is as follows:

  1. Functions are developed in MATLAB®.
  2. MATLAB® Coder™ automatically compiles these functions into C/C++ code.
  3. The TwinCAT 3 Target for MATLAB® converts the generated code into TwinCAT objects.
  4. The generated modules are integrated into a project in TwinCAT 3 Engineering.
  5. They are then transferred to the TwinCAT 3 runtime along with the TwinCAT project and executed there in the real-time environment.

Integration methods in TwinCAT 3 Engineering

Depending on the use case, the generated modules can be integrated into the project in different ways:

All methods can be seamlessly integrated into TwinCAT 3 Engineering and combined with other TwinCAT functions.

Further Information

Technical short video

Product description

Web page for MATLAB® and Simulink® with TwinCAT 3