Skip to main content

Editing the Type Mapping

The type mappings of the remote data types to the local data types are shown in the editor of the data source: Type Mappings tab.

Example 3. Example
Figure 1. Datasource editor
Datasource editor
  • (1): Standard mapping with _comm_icon_create_new_variable.png from CommManagerVars

    See also: Tab: Type Mappings

  • (2): Symbol which indicates that the local data type CommManagerVars has been generated automatically and matches the remote data type (_comm_icon_create_new_variable.png)

    With each click, the mapping type changes to the next: _comm_icon_create_new_variable.png_visu_icon_map_to_existing_variable.png_comm_icon_create_to_existing_variable.png.

  • (3): List of variables which have the data type selected above (highlighted in blue)

  • (4): Communication takes place via the OPC UA Server.





The symbols displayed under Create or map show the mapping type of the local data type:

  • _comm_icon_create_new_variable.png (default):

    Mapping to an automatically declared data type (in the DataSources_Objects folder) which matches the remote data type to be mapped.

  • _visu_icon_map_to_existing_variable.png

    Mapping to a manually selected local data type

  • _comm_icon_create_to_existing_variable.png

    Mapping to a manually selected data type which completely replaces the remote data type (also in the DataSources_Objects folder)

Use case for mapping type _comm_icon_create_new_variable.png

"Create new"

With this variant of Create or map, the remote data is automatically read and unique data types are automatically created for all elements. This is easy to use and good at first.

Example 4. Example

The data was read from an OPC UA Server: station1, station2

_comm_img_data_source_tab_variables.png

Standard mapping:

_comm_img_data_source_tab_type_mapping_default.png

A special data type is automatically created for each variable which is read, even though pumpA, pumpB, and pumpC have the same type on the remote data source. This means that a separate data type is created for each mapping. Also for compatible data types. This is probably not what is wanted. In this example, the type mapping is not ideal.



Tip

You can change the local types manually.

Procedure. Procedure
  1. In the data source editor, open the Type mappings tab.

  2. Click in the Local type column and change the local data type manually.

    Because pumpA, pumpB, and pumpC are all of the same type on the OPC UA Server, it makes sense that they are also the same type locally.

    _comm_img_data_type_mapping_2.png

Use case for mapping type _visu_icon_map_to_existing_variable.png

"Map existing"

With this variant of Create or map, no new data types are created in your project, but you simply select the desired type (under Local type).

Use this mapping type if it is necessary to use specific local data types. One reason for this can be, for example, that the data types are to be transferred to visualizations from libraries and therefore the data type is defined.

Use case for mapping type _comm_icon_create_to_existing_variable.png

"Create existing"

With this variant of Create or map, it behaves the same way for _visu_icon_map_to_existing_variable.png. No new data types are created.

Use this mapping type if your project depends on an existing data type can not or must not be changed. This is the case, for example, when the data type originates from a library and parts of this library, such as visualizations with this type, should be used together. Then it may be desirable to map the data from the data source to this existing type and overlap it.

This mapping type is basically for similar use cases as "Map Existing". You can use this mapping type if a mapping to the existing data type is unsuitable.

This may be necessary for the following reasons, for example:

  • For library types with external calls which are not available on the data source controller.

  • For library types which compile too many other unused function blocks.

Example 5. Example

The project contains two function blocks (Pump_I_Must_Use and Station_I_Must_Use) which must be mapped to:

_comm_img_devices_objects_i_must_use.png

A visualization which depends on such a data type is a common use case.

_comm_img_visu_i_must_use.png
Procedure. Procedure
  1. In the Datasource editor, open the Type mappingtab.

  2. Click in the Remote type column and change the type so that it matches the type which you need.

    Then the recently created local types are overwritten and the VAR_IN_OUT variables used in the visualization elements work.

    If you look at the data type created, then you can see the overwriting:

    {attribute 'signatureoverload' := 'Station_I_Must_Use'}
    {attribute 'signatureoverload' := 'Pump_I_Must_Use'}