Automap Symbols

Variables from the PLC can be automatically mapped in the human-machine interface using the automap function. To do this, attributes must be set on the relevant variables in the PLC. The human-machine interface searches the existing ADS symbols and creates them automatically if the relevant attribute is present.

Available attributes:

Attributes

Description

Version

'TcHmiSymbol.AddSymbol'

Maps the variable in the human-machine interface using the automap function

>= 1.12.756.1

'TcHmiSymbol.AddSymbol.Ignore'

Ignores the variable, but underlying variables with AddSymbol attribute are still mapped.

>= 1.14.x.x

'TcHmiSymbol.AddSymbol.IgnoreRecursively'

Ignores the variable and the underlying variables

>= 1.14.x.x

'TcHmiSymbol.AddSymbol.Hidden'

Hides the mapping (only visible when extended symbols are displayed)

>= 1.12.756.1

'TcHmiSymbol.AddSymbol.UserGroups'

Creates a read/write authorization for user groups

>= 1.12.756.1

'TcHmiSymbol.AddSymbol.UserGroups.Read'

Creates a read authorization for user groups

>= 1.14.x.x

Example – ST (variable declaration in the PLC)

Adding a variable

{ attribute 'TcHmiSymbol.AddSymbol' }
_i       : INT;

Adding a variable that is hidden in the human-machine interface

{ attribute 'TcHmiSymbol.AddSymbol' }
{ attribute 'TcHmiSymbol.AddSymbol.Hidden' }
_i       : INT;

Adding a variable, with read/write authorization for two user groups

{ attribute 'TcHmiSymbol.AddSymbol' }
{ attribute 'TcHmiSymbol.AddSymbol.UserGroups' := '__SystemAdministrators,Operators' }
_i       : INT;

Adding the automap symbols in Visual Studio/TcXaeShell

Automap Symbols 1:
1. Open the TwinCAT HMI Configuration window.
2. Go to the Server Symbols / All Symbols tab.
3. Right-click on ADS.
4. Start the automatic mapping via Map Automap Symbols.
After adding, a message about the number of symbols added or an error message appears.
Automap Symbols 2:

A maximum of 1000 symbols are currently mapped via Visual Studio/TcXaeShell.

Adding the automap symbols via JavaScript

1. Add a new JavaScript file to the project.
2. Open the JavaScript file you have created.
3. Call up the writeEx function and describe the AddSymbols symbol.
Automatic mapping of symbols is started by describing the symbol.

Parameter – AddSymbols

Name

Type

Description

domain

string

Server domain that AddSymbols will be executed on.

path

string

Move the search entry point to sub-levels.

"PLC1::MAIN::_fbMachine"

The search starts from _fbMaschine.

namePrefix

string

Adds the defined prefix to the beginning of the symbol name.

dryRun

boolean

Only searches for symbols without creating them.

ignoreProblems

boolean

Continues the request if problems occur.

Ignore

string []

Specified symbols are not taken into account during creation.

["ADS.PLC1.MAIN._axis"]

skipExisting

boolean

Only symbols that do not yet exist are created.

limit

int32

Limits the number of symbols that are searched for.

Example – JavaScript (start Automap Symbols, minimal data for request):

TcHmi.Symbol.writeEx('%s%AddSymbols|Timeout=5000%/s%', {domain: "ADS"}, function (data) {
    // callback value
    console.log(data);
    // number of found symbols
    console.log(Object.keys(data?.value).length);
});

Example – JavaScript (start Automap Symbols):

let config = {
    domain: "ADS",
    path: "PLC1::MAIN::_fbMachine",
    namePrefix: "AutoMapp.",
    dryRun: false,
    ignoreProblems: false,
    ignore: [
        "ADS.PLC1.MAIN._axis"
    ],
    skipExisting: true,
    limit: 3000
}
TcHmi.Symbol.writeEx('%s%AddSymbols|Timeout=5000%/s%', config, function (data) {
    // callback value
    console.log(data);
    // number of found symbols
    console.log(Object.keys(data?.value).length);
});
Automap Symbols 3:

This functionality is available from version 1.12.756.1.