Mapping of Variables

It is possible to map a single variable Data Source item to multiple OPC UA variable nodes.

Simple UA Variable with Built-in data type

A simple PLC variable with primitive data type is mappable to any OPC UA variable node with a matching Build-in data type according to following table. The instance names of the OPC UA and IEC variables can be different.

It doesn't matter whether the IEC variable belongs to a POU or is located as a member variable in an IEC structure.

OPC UA Build-in Data type

Primitive IEC Data type

Comment

Boolean

BOOL

ns=0;i=1

SByte

SINT

ns=0;i=2

Byte

USINT

ns=0;i=3

Int16

INT

ns=0;i=4

UInt16

UINT

ns=0;i=5

Int32

DINT

ns=0;i=6

UInt32

UDINT

ns=0;i=7

Int64

LINT

ns=0;i=8

UInt64

ULINT

ns=0;i=9

Byte

BYTE

ns=0;i=3

UInt16

WORD

ns=0;i=5

UInt32

DWORD

ns=0;i=7

UInt64

LWORD

ns=0;i=9

Float

REAL

ns=0;i=10

Double

LREAL

ns=0;i=11

String

STRING

ns=0;i=12

Byte

CHAR

ns=0;i=3

String

WSTRING

ns=0;i=12

UInt16

WCHAR

ns=0;i=5

DateTime

DATE_AND_TIME

ns=0;i=13

DateTime

DATE

ns=0;i=13

UInt32

TIME_OF_DAY

ns=0;i=7

Int64

TIME

ns=0;i=8

Int64

LTIME

ns=0;i=8

Int64

LDATE

For this IEC data type is no mapping supported.

Int64

LTOD

For this IEC data type is no mapping supported.

Int64

LDT

For this IEC data type is no mapping supported.

UA specific built-in data types

Additional to the data types mentioned above OPC UA introduces OPC UA specific Build-in data types like the LocalizedText type definition.

For some of these OPC UA specific Build-in data type definitions Lenze provides corresponding IEC type definitions which can be used in the PLC application. These IEC type definitions are distributed by the L_IOSP_OpcUaServer library.

A PLC variable with an OPC UA specific IEC data type is mappable to any OPC UA variable node with a matching data type according to following table.

OPC UA Build-In Data type

OPC UA specific IEC Data type

Comment

NodeId

L_IOSP_NodeId

 

QualifiedName

L_IOSP_QualifiedName

 

LocalizedText

L_IOSP_LocalizedText

It-s also possible to map a simple IEC String to an OPC UA Localized Text.

In this case the LocaleId is empty.

ByteString

L_IOSP_ByteString

 

Guid

L_IOSP_GUID

 

Simple UA Variable with structured DataType

Like the symbol configuration, OPC UA introduces structured DataTypes. In contrast to the Symbol configuration, it's possible to model just one simple Variable Node with a structured DataType definition for the Value Attribute. In this case no Nodes for the "member-variables" of the structure are available in the OPC UA model. For further Information how to model structured data see OPC UA complex Variables and stuctured DataTypes.

A structured IEC variable is mappable to an OPC UA variable Node, if -

  • - the structured data type definitions match and

  • - the member variable (symbolic) names are the same.

This means that the member variables of the data type structure, down to the last leaf, are of the same name and primitive type according to chapter Mapping of Variables.

OPC UA Data type

IEC structured Data type

Comment

EUInformation

L_IOSP_EUInformation

 

Range

L_IOSP_Range

 

For some of these OPC UA structured data type definitions Lenze provides corresponding IEC type definitions which can be used in the PLC application. These IEC type definitions are distributed by the L_IOSP_OpcUaServer library.

Complex UA Variable with structured DataType

Like the symbol configuration, OPC UA introduces structured DataTypes. In OPC UA it is possible to present a structed Value in only one Variable Node (see Structured DataType for a simple variable).

But it is also possible to model it as a complex Variable Node with Sub-Variable Nodes for individual data access of the elements of the structure. For further Information how to model structured data see Structured DataType for a complex variable.

As described in chapter Mapping of Variables, a structured IEC variable is mappable to an OPC UA variable Node. Additional it is possible to map the individual member variables of the IEC structure to the corresponding OPC UA (Sub-) Variable Nodes. In this case the member variables, down to the last leaf, must be of the same primitive type according to chapter Mapping of Variables.

If an IEC member variable isn't mapped to an OPC UA Sub-Variable Node, the value of the IEC member variable isn't available by the OPC UA Sub-Variable Node. This means that there isn't an OPC UA Server internal mapping from the structured value of the parent Node to the child nodes. This is shown in the following example with the UA Expert as an OPC UA Client connected to the Lenze OPC UA Server with mapped user specific information model.

Ein Bild, das Text, Screenshot, Software, Zahl enth-lt.

Automatisch generierte Beschreibung

Arrays

Arrays can be represented as variables in OPC UA and in the PLC using Symbol Configuration. In OPC UA the ValueRank Attribute of a Node is defined to indicate if the DataType is used as scalar value (-1), as array (1) or as multidimensional array (>1). The ArrayDimensions Attribute specifies the maximum elements of each array dimension.

It is possible to map PLC array variables to OPC UA array variables with matching DataType definition and array dimensions and size.

The array sizes must not yet be known in the prepared OPC UA information model. The array size can be taken over automatically from the mapped PLC variable. In this case the value 0 must be entered at the ArrayDimensions Attribute of the OPC UA Node.

The symbol configuration as data source can publish an array variable with maximum 3 dimensions and 65536 elements in sum (over all dimensions).

Enumerations

Enumerations can be represented as variables in OPC UA and in the PLC using Symbol Configuration. Any IEC enumeration with a maximum size of 32bit can be mapped to OPC UA enums. All enum fields must match in terms of number, enumeration and name between the IEC and OPC UA enum.