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 HMI searches the existing ADS symbols and creates them automatically if the relevant attribute is present.

Available attributes:

Main attributes:

Attributes

Description

Version

'TcHmiSymbol.AddSymbol'

Mapping the variables in the HMI using the automap function.

>= 1.12.756.1

Additional attributes:

Attributes

Description

Version

'TcHmiSymbol.AddSymbol.Ignore'

Ignore the variables; underlying variables with AddSymbol attribute are still mapped.

>= 1.14.x.x

'TcHmiSymbol.AddSymbol.IgnoreRecursively'

Ignore the variables 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;

Mapped Symbols: ADS.PLC1._i

Adding a variable without subvariables

{ attribute 'TcHmiSymbol.AddSymbol' }
{ attribute 'TcHmiSymbol.AddSymbol.Ignore' }
fbTest   : FB_Test;
FUNCTION_BLOCK FB_Test
VAR
    { attribute 'TcHmiSymbol.AddSymbol' }
    _bData    : BOOL;
END_VAR

Mapped Symbols: ADS.PLC1.fbTest

Prevent a symbol and its subvariables from being added with AddSymbol.

{ attribute 'TcHmiSymbol.AddSymbol' }
{ attribute 'TcHmiSymbol.AddSymbol.IgnoreRecursively' }
fbTest   : FB_Test;
{ attribute 'TcHmiSymbol.AddSymbol' }
FUNCTION_BLOCK FB_Test
VAR
    { attribute 'TcHmiSymbol.AddSymbol' }
    _bData    : BOOL;
END_VAR

Mapped Symbols: -

Adding a variable that is hidden in the HMI.

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

Mapped Symbols: ADS.PLC1._i (Only visible in the expanded view)

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

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

Mapped Symbols: ADS.PLC1._i (read and write permissions only for "__SystemAdministrators and Operators").

Adding a variable with read permission for two user groups.

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

Mapped Symbols: ADS.PLC1._i (read permissions only for "__SystemAdministrators and Operators").

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:

When using the Automap Symbols function in Visual Studio / TcXaeShell, all symbols found are mapped from version TwinCAT.HMI.Engineering >= 14.3.244.
In older engineering versions, the function is limited to 1000 symbols.

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 write the AddSymbols symbol.
Automatic mapping of symbols is started by writing the symbol.

Parameter – AddSymbols

Name

Type

Description

Version

domain

string

Server domain on which AddSymbols is to be executed.

>= 1.12.756.1

path

string

Move the search entry point to sublevels.

"PLC1::MAIN::_fbMachine"

The search starts from _fbMaschine.

>= 1.14.x.x

namePrefix

string

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

>= 1.14.x.x

dryRun

boolean

Only searches for symbols without creating them.

>= 1.12.756.1

ignoreProblems

boolean

Continues the request if problems occur.

>= 1.12.756.1

Ignore

string []

Specified symbols are not taken into account during creation.

["ADS.PLC1.MAIN._axis"]

>= 1.12.756.1

skipExisting

boolean

Only symbols that do not yet exist are created.

>= 1.12.756.1

limit

int32

Limits the number of symbols that are searched for.

>= 1.14.x.x

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 since version 1.12.756.1.

Automap Symbols 4:

This functionality is only available with an ADS connection and not with a TMC file.

Automap Symbols 5:

The attributes do not currently work for methods or properties.