Both OPC UA and IEC 61131-3 allow the definition of enumerations on a data type or on a variable instance.

In OPC UA the enumerated data types are defined as subtypes of Enumeration. The data has an EnumStrings Property that contains the possible string values. The value is transferred as integer on the wire where the integer defines the index into the EnumStrings array. The index is zero based and has no gaps. Another option is to provide the possible string values in the Property EnumValues. This option is used if individual integer values are assigned to the string. The used option depends on the way the string enumeration is defined in the Controller program. If integer values are assigned to the string values the Property EnumValues is used to represent the enumeration values. If the integer value is zero based and has no gaps the EnumStrings Property should be used since the processing on the client side is more efficient.

The definition on a variable instance is using the MultiStateDiscreteType Variable Type which defines also the EnumStrings or the EnumValues Property containing the enumeration values as string array.

Example for an enumerated data type declaration in IEC 61131-3:

TYPE

ANALOG_SIGNAL_TYPE : (SINGLE_ENDED, DIFFERENTIAL) ;

END_TYPE

Example for use of an enumeration in a Ctrl Variable instantiation in IEC 61131-3:

VAR

Y : (Red, Yellow, Green) ;

END_VAR

The IEC 61131-3 enumeration data type declaration is mapped to an OPC UA Enumeration data type. The representation in the address space is formally defined in Table 29.

Table 29 – Enumeration Data Type Definition

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the Enumeration defined in OPC 10000-5 i.e. inheriting the InstanceDeclarations of that Node.

HasProperty

Variable

EnumString

String [ ]

PropertyType

Optional

HasProperty

Variable

EnumValues

EnumValueDataType [ ]

PropertyType

Optional

The Property EnumString is defined in OPC 10000-5

The Property EnumValues is defined in OPC 10000-5.

The IEC 61131-3 enumeration in a Ctrl Variable declaration is mapped to a MultiStateDiscreteType Variable Type defined in OPC 10000-8.