Defining description, comment, JSON string or type for variables or data types

Syntax
VAR | VAR_INPUT | VAR_OUTPUT | VAR_IN_OUT | VAR_GLOBAL | VAR_EXTERNAL | VAR_TEMP
name_1, name_2, ..., name_n : data-type := initial-value {
description := "string";
comment := "string";
customDataJson := 'Json-String';
concreteType := data-type; (* only relevant for vendor blocks with 'ANY' inputs used in other vendor blocks' *)
};
...
END_VAR
 
TYPE
name_A : <Datentyp-Deklaration> := initial-value {
description := "string";
comment := "string";
customDataJson := 'Json-String';
};
...
name_B: STRUCT
name_e1 : type := initial-value {
description := "string";
comment := "string";
customDataJson := 'Json-String';
};
...
END_STRUCT; 
END_TYPE

Meaning

specification of the following pieces of additional data (= data elements) for a →variable, a →data type or a structure element (= language element):

  • a description (also known as long name) = data element description

  • a comment = data element comment

  • a →JSON-string = data element customDataJson

  • a concrete data type = data element concreteType

Implementer-specific realization

According to the →IEC-standard, these data elements are an i mplementer-specific realization of a →pragma.

The specification of the data elements is necessary in front of the concluding character ; of the language element but after all optional items (e.g. the →initial value). The specification starts with the character { and is terminated with the character }, each data element is terminated with the character ;. You are able to specify one, 2 or all data elements per language element. In case of 2 or 3 data elements, observe the order according to the syntax.

The text for the description, comment and the JSON-string must be a character string literal within a →pragma.

Examples for character string literals within pragmas

Character string literals in pragmas consist of zero or more characters prefixed and terminated by the single quote character ' or by the double quote character ".

Description

Examples

literal with single quote

'' (empty literal), 'OK', 'ABCDEF', 'B', ' ' (only a blank within the literal)

literal with double quote

"" (empty literal), "OK", "ABCDEF", "B", " " (only a blank within the literal)

You are able to directly enter special characters, such as umlauts or €, but $ excepted, within the literal in ' as well as in ".
As alternative, you are able to enter the special characters as a three-character combination of the dollar sign ($) followed by two hexadecimal digits. This is analogous to the input within character string literals.

Examples:

  • Instead of "Änderung" or 'Änderung', you are able to enter "$C4nderung" or '$C4nderung'.

  • Instead of "€300" or '€300', you are able to enter "$80300" or '$80300'.

See the glossary article "→Character string literal" for more examples on these combinations and informative links.

Moreover, the following specifications are possible for character string literals in pragmas:

Specification

Meaning

Example

'$''

in ': literal with single quote character '

'This is $'just$' a test.'

'$"'

in ': literal with double quote character "

'This is $"just$" a test.'

'"'

in ': literal with double quote character "

'This is "just" a test.'

"'"

in ": literal with single quote character '

"This is 'just' a test."

""""

in ": literal with double quote character "

"This is ""just"" a test."

"$""

in ": literal with double quote character "

"This is $"just$" a test."

"$'"

in ": literal with single quote character '

"This is $'just$' a test."

Moreover, the following specifications are possible for character string literals in ' as well as in ":

Specification

Meaning

$$

literal with dollar sign $

$L or $l

literal with line feed

$N or $n

literal with newline

$P or $p

literal with form feed (page)

$R or $r

literal with carriage return

$T or $t

literal with tabulator

$0A

literal as a three-character combination of the dollar sign ($) followed by two hexadecimal digit (e.g. for special characters – as mentioned above)

If you need the character " within the text for a JSON-string, best practice is to enter the text within ' (see example below).

The data elements for the description, comment and JSON-string are typically evaluated by a system integrator. Within logi.CAD 3, description and comment of a variable are also visible within the interface editor.

The data element for a concrete data type is only required in the case of the declaration of an →instance of a →vendor block, if this vendor block contains one or several inputs with a →generic data type and the declaration of the instance is done in a vendor block (so the vendor block with the ANY inputs is being used in another vendor block). The additional specification of concreteType and the data type data-type for an instance provides the required type information when the application is built.

The specification of the data elements is possible within these sections:

Section

The specification is possible for this language element:

VAR ... END_VAR

internal variable (see "Declaration of internal variables in ST")

VAR_INPUT ... END_VAR

input variable (see "Declaration of input variables in ST")

VAR_OUTPUT ... END_VAR

output variable (see "Declaration of output variables in ST")

VAR_IN_OUT ... END_VAR

in-/output variable (see "Declaration of in-out variables in ST")

VAR_GLOBAL ... END_VAR

global variable (see "Declaration of external variables in ST", "Declaration of global variables in global-object and its usage in ST" and "Declaring global variables for resource or configuration and using them")

VAR_EXTERNAL ... END_VAR

external variable (see "Declaration of external variables in ST")

VAR_TEMP ... END_VAR

temporary variable (see "Declaration of temporary variables in ST")

TYPE ... END_TYPE

data type with named values (see "Declaration of a data type with named values (enums) in ST"),
array data type (see "Declaration of an ARRAY data type in ST"),
directly derived data type (see "Declaration of a directly derived data type in ST"),
structure element (see "Declaration of a structured data type in ST")

Example: Description, comment and JSON-string for a local variable
VAR
Var1 : INT {description := "This is the long name for the variable.";
comment := "This is the comment for the variable.";
customDataJson := '{
"glossary": {
"title": "Variable (local)",
"ID": "Var1"
}
}';
};
END_VAR
Example: Description and comment for a function block instance
VAR
Inst1 : Control {description := "This is the long name for the function block instance.";
comment := "This is the comment for the function block instance."; };
END_VAR
Example: Description or comment for a structure element
TYPE
complex : STRUCT
re : REAL {description := "This is the long name for the 1st structure element.";};
im : REAL {comment := "This is the comment for the 2nd structure element.";};
END_STRUCT;
END_TYPE