Configuration of data access to data of a TcCOM object

In the TC TcCom Interface area, you configure the way in which data of certain variable groups can be accessed. ADS access and the process image type can be configured as required. These settings affect how the variables in a group are linked with other process images in the TwinCAT development environment, and how they can exchange data.

Variable groups

Depending on the Simulink® model, there are several groups of internal variables in addition to the input and output variables.

The following groups can be configured:

Group

Description

Naming of the DataArea (default)

Naming of the DataArea ("classic" option)

Input

Model inputs

<ModelName>_U

Input

Output

Model outputs

<ModelName>_Y

Output

BlockIO

Global output signals of Simulink® blocks: internal signals for which a "test point" has been defined.

<ModelName>_B

BlockIO

Parameters

Model-specific parameters: Parameters of Simulink® blocks that are tunable.

<ModelName>_P

Model parameters

ContState

Continuous state variables

<ModelName>_X

ContStates

DWork

Time-discrete state variables

<ModelName>_DW

DWork

DataStore

Data Store Memory

<ModelName>_DW_<DataStoreName>

<ModelName>_DW_<DataStoreName>

Under TC TcCom Interface, the option Mapping between variable names and ADS symbols can be used to influence the naming of the DataAreas. By default, they are given the same name as the associated C++ variable. This is specified by the Simulink CoderTM. With the "Classic" setting, the names are abbreviated to that of the variable group, as known from earlier TE1400 versions 1.2.x. The inputs are then combined, for example, in the DataArea "Input" and not in "<ModelName>_U".

Configuration of data access to data of a TcCOM object 1:

TcCOM with multiple task contexts

If a TcCOM is created that has more than one task context (see Multitask, Concurrent Execution and OpenMP), the DataAreas are automatically separated. There are several inputs or Dwork DataAreas, for example.

Configuration interface in Simulink®

Configuration of data access to data of a TcCOM object 2:

The Data Access can be defined individually for each variable group named above. Selection options for DataAreas and module parameters are summarized in the following table:

Data Access

Access via ADS

Access via mapping

Access via Data Pointer

None

No

No

No

Module parameters

Yes

No

No

Input Destination DataArea

Yes

Yes (with Output Source)

Yes

Output Source DataArea

Yes

Yes (with Input Destination)

Yes

Internal DataArea

Yes

No

No

Standard DataArea

Yes

No

Yes

Retain Source DataArea

Yes

Yes (with Retain Handler)

No

Unlike DataAreas, Module parameters are not intended for cyclic (process) data exchange with other modules or I/Os. They are generally read or written asynchronously, e.g. via ADS. The parameters on the Parameters (Init) tab have an initial value that can be configured in the project and is written when the TcCOM instance is started. The parameters on Parameter (Online) on the other hand, have no configurable initial value and are typically used to monitor internal states.

Configuration of data access to data of a TcCOM object 3:

DataAreas can be found on the TcCOM instance on the DataArea tab. The exact type of the DataArea is also displayed here. Internal DataAreas are not created as process data image in the development environment.

Configuration of data access to data of a TcCOM object 4:

Properties of the parameterization

The access via ADS is usually ReadOnly. Only the Inputs and Parameters groups can also be written via ADS.

Independently of this, it is possible to set for each group whether ADS symbol information (Create ADS Symbols) should be created for the respective group. If no ADS symbol information is available, the data can only be accessed by ADS via IndexGroup and IndexOffset.

Via the option "Input: Initial values" you get an entry under "Parameter (Init)" in addition to the DataArea (for the cyclic data exchange). This way initial values for inputs can be realized. These values apply if the corresponding inputs have not been linked. Without these parameters, unlinked input values are always 0.

Via the option "Parameter: Initial values", the parameters of the Simulink® model are also created as module parameters (structure <ModelName>_P) in addition to the DataArea setting.

Configuration of data access to data of a TcCOM object 5:

Special case: DataArea for model parameters

If the code interface is set to Reusable function (default), then no DataArea is created for model parameters, since the parameters are kept global for this case and thus shared between multiple instances. If "Parameter: Initial values" is selected, the parameter "<ModelParameterName>_Sharing" is created in addition to the entry for the model parameters at Parameter (Init). This parameter can only be set to "Define" for an instance of this TcCOM module class.

All further instances must use "Inherit". Since all instances share the parameters in this case, they all work with the parameter set in the "Definer". The model parameter settings of the other instances are ignored.
See also Parameterization of several module instances.

Monitor Execution Time: Creates a module parameter at Parameter (Online) and in the block diagram (right side). The execution time of the TcCOM can be read via this parameter. The measurement is updated with each call of the TcCOM, so that, for example, the execution time can be tracked precisely for each call via the TwinCAT Scope.

Create ExecutionInfo output: Creates an additional Output Source DataArea with information about the module call, see Exception handling.

DataStores: Variables from a Data Store Memory Block are stored in DWork by default. You can create an additional addressing of these variables when you create a DataArea for DataStores. No DataArea is created by default. For an example, see Shared memory between TcCOM instances.

Further Descriptions: