Parameterization of the code generation in Simulink®

Within Simulink® a large number of settings can be made for the configuration of the TwinCAT objects to be generated (TcCOM and function blocks). For this purpose the tree structure under Code Generation is extended by several entries (see entries starting with TC) as soon as you have selected the TwinCatGrt.tlc as System target file.

Parameterization of the code generation in Simulink® 1:

Configure View

Due to the wide range of configuration options, it is possible to switch the view. After installation, the configuration level is set to Standard, which displays only the most frequently used parameters. You can also increase the configuration level to Advanced to be able to make significantly more settings.

Use the MATLAB® Command Window to set the view:

TwinCAT.ModuleGenerator.Settings.Change('ConfigurationLevel', 'Advanced')
TwinCAT.ModuleGenerator.Settings.Change('ConfigurationLevel', 'Standard')

The setting made is initially only temporary. To save them, use the Save command:

TwinCAT.ModuleGenerator.Settings.Save;

If you run the code generation and build process on different systems, make sure that the configuration level is identical on both systems.

Overview of the configuration parameters

An overview of all configuration parameters can be found in the documentation in section Overview table of all configuration parameters.

Parameterization of the code generation in Simulink® 2:

Read the tooltips

Hover with the cursor over the text fields of the dialog boxes to bring up a detailed description of the option as a tooltip.

Change the software setup

To change the default settings of the TwinCAT target, you can access a dialog in the MATLAB® Console as follows:

TwinCAT.ModuleGenerator.Settings.Edit

Here you are offered various entries that you can store as default values.

Parameterization of the code generation in Simulink® 3:

Accept changes

1. Enter the new default settings in the dialog box.
2. Confirm with the Save button.
3. Restart MATLAB®.
The changes have been adopted.

Change configurations after build

Many settings selected in the Configuration parameters can be changed again in TwinCAT 3 at the level of the TcCOM instances, so that, for example, it is defined for the class of a model that it is to be called via a cyclic task, but the individual instance can also be configured subsequently for calling from the PLC.