STVariable is a structure defined by:

Name

Type Name

Description

etNodeDataType

BYTE

A user–defined variable type.

pbyBuffer

REF_TO ANY

Reference to application variable.

etNodeDataType

Configure etNodeDataType with an OPC UA build-in data type. See the OPC UA Online Reference at:

https://reference.opcfoundation.org/v104/Core/docs/Part6/5.1.2/

The following OPC variable types correspond to the IEC 61131-3 data types:

Type

Value

Description

UATypeNull

0

-

UATypeBool

1

BOOL

UATypeSByte

2

 

UATypeByte

3

BYTE

UATypeInt16

4

INT

UATypeUInt16

5

UINT

UATypeInt32

6

DINT

UATypeUInt32

7

UDINT

UATypeInt64

8

 

UATypeUInt64

9

 

UATypeFloat

10

REAL

UATypeDouble

11

 

UATypeString

12

STRING (in this case the code resolves the shorted size between source and destination variable)

UATypeDateTime

13

DT

NOTE: The DT format is server dependent. For example, some servers can return:
  • UATypeUInt64 with the internal encoding of IEC 1131 DT in Control Expert (BCD encoding). typically BMENUA0100 service or OFS UA server.

  • IEC 1131 Date&Time string literal, typically in OFS UA. This format is activated in the configuration.

You will need to refer to the server documentation to determine which DT format is used.

REF_TO ANY

The variables values are given directly through an ANY Type : REF_TO ANY.

REF_TO ANY is a new type defined in Control Expert. It can be used to define a reference on any type of variable. For example, it could be used as type of variable or an element of DDT.

The initialization of the reference (i.e., the variable to which it refers) can be done only via initial value in the data editor.

To simplify the code generation the following syntax is not permitted:

(e.g. VAR_REF : REF_TO ANY) in ST VAR_REF = REF (Var_ANY_TYPE).

A function block considers REF_TO ANY as a buffer of BYTE and knows the size of the buffer in order not to overwrite or over-read the variable.