Skip to main content

Editing Data Source Variables

At runtime, the remote data is saved to the data source variables. The data source variables and their mapping to the remote variables are displayed in the data source editor below of the Variablen tab. If the local and remote variables have the same names and the same data types, then the data is mapped 1:1. The variables and the data types are created automatically. That is the regular procedure.

You can also map to existing variables. This is necessary, for example, if a visualization includes a data type in an interface. Then the same data must be passed to this visualization. In this case, the declared local variable and the remote variable have the same data type, for example from one library. Moreover, you can map a local variable with a conforming data type to a remote variable. The data type can be created on the Type Mappings tab.

The specifically created variables and data types are declared in the DataSources_Objects folder. For each data source, a global variable list of the same name as the data source is declared there. Moreover, the data source variables usually have the identical or type-compliant data type as the remote control variable and they are declared as user-defined data types (DUT objects). Considering all data sources, multiple declaration of the same data types is avoided.

Do not edit the data interface in the DataSources_Objects folder manually. It is created initially when adding a data source. Changes can be made later in the editor of the data source.

For more information, see: Updating the Data Interface

Selecting variables for data transfer

You can edit the selection of the data source variables.

Requirement: The remote device and its application are running. A data source manager is already inserted below the local application with a data source.

  1. Open the editor of the data source.

  2. Select the Variables tab.

  3. Click Update Variables.

    The Browse Variables dialog opens.

  4. Activate the variables that should be transferred and click OK to close the dialog.

    The data source variables are modified according to the selection. The declaration of variables and data types is also modified.

    The Variables tab shows the modified selection. Moreover, the mapped remote variable is listed in the Remote variable column.

Mapping remote variables to a new variable

_comm_icon_create_new_variable.png

You need to map a remote variable to a global implicit variable that is created new. That is the regular procedure for transposing data source to 1:1.

Requirement: A project is open. A data source manager and a data source below it are located in the device tree of the local application.

  1. Open the editor of the data source.

  2. Select the Variables tab.

    The data source variables are listed.

  3. Select a variable and click the _comm_icon_create_new_variable.png symbol in the Create or map column.

  4. Specify a name in Local variable.

    A variable is declared automatically and it contains the same value as the mapped remote variable.

Mapping remote variables to an existing variable

_visu_icon_map_to_existing_variable.png

You need to map a remote variable to an existing variable.

Requirement: A data source manager and a data source below it are located in the device tree of the local application. The remote data that should be transferred is displayed in the editor of the data source in the Variable tab.

  1. Open the editor of the data source.

  2. Select the Variables tab.

  3. Select a variable and click the _visu_icon_map_to_existing_variable.png symbol in the Create or map column.

    A variable contains the same value as the mapped remote variable.

Mapping remote variables to local variables with a conforming data type

_comm_icon_create_to_existing_variable.png

First, create a conforming data type and then use it for a variable.

Requirement: A data source manager and a data source below it are located in the device tree of the local application. The remote data that should be transferred is displayed in the editor of the data source in the Variable tab.

  1. Open the editor of the data source.

  2. Select the Type Mappings tab.

  3. Select the data type in the list that you want to edit.

    The elements of the data type are listed in the window below the data type list.

  4. Specify a name for the data type. Example: DataType_A. Select the name for the remote data types to which the local type should conform.

    Example: Library1.DataTyp_A

  5. Modify it in the window below the data type list and remove the elements that are not necessary for the data transfer.

  6. Click the _comm_icon_create_to_existing_variable.png symbol for this data type in the Create or map column.

    The data type DataType_A is declared in the DataSources_Objects folder.

  7. Select the Variables tab.

  8. Specify a name in the Local variable column. Example: Var_A

  9. Click the _comm_icon_create_new_variable.png symbol in the Create or map column.

  10. Specify the data type DataType_A in the Mapping type column.

  11. Select the remote variable with the data that should be transferred. Example: appPLC_A.Data_A. Use the input assistance for this.

    A variable Var_A is declared automatically with the user-defined data type DataType_A. During data transfer, it receives the data of the mapped remote variables.

Example

Example 6. Library SnakeUtil

The example demonstrates how variables of the data source are created. At this time, new variables are created, data is mapped to existing data types and their variables, and new data types are created with type-conforming mapping.

The remote PLC uses POU instances from the SnakeUtil library and the HMI device displays these POU instances. This is why the HMI application requires a variable in the user interface that has a data type appropriate for a visualization template. As a result, the SnakeUtil library is linked integrated into the HMI application and the HMI variables instantiate the SnakeUtil.SnakeVisu visualization function block.

. The following library function blocks from the SnakeUtil library are used in the remote PLC:
  • SnakeUtil.Snake function block: Equipped with a lot of logic and calling from external functions

  • DUT SnakeUtil.PositionInfo: Two values (of the variables x and y)

  • DUT: SnakeUtil.DrawingInfo: Image ID

  • The SnakeUtil.SnakeVisu visualization function block with transfer parameter SnakeUtil.Snake displays the Snake function block.

The following settings are entered in the editor of the Type Mappings tab:

_visu_ds_example_type_mapping.png

In the visualization, a frame is inserted with a reference to SnakeUtil.SnakeVisu. This expects to have the type SnakeUtil.Snake.

The SnakeUtil.PositionInfo and SnakeUtil.DrawingInfo data types are mapped to existing data types (_visu_icon_map_to_existing_variable.png symbol in the Create or map column). The data types are small and contain data only.

The SnakeUtil.Snake function block is very complex and calls external functions that are not available in the HMI visualization. The function block with code is not required in the visualization. You need a less extensive but compatible and conforming type in the HMI visualization. Therefore, do not create the original data type directly. Instead, first modify the original data type and remove the unnecessary elements. In the Create or map column, then click the _comm_icon_create_to_existing_variable.png symbol to create the new Snake data type.