Data type assignment TwinCAT <=> OPC UA
The following three tables provide an overview of the assignment of TwinCAT data types (IEC61131-3) and their corresponding OPC UA data types (Built-In types) as defined in the OPC UA Core Namespace http://opcfoundation.org/UA/.
![]() | TwinCAT 3 library - Tc3_OpcUa When installing the editor via TcPkg, the Tc3_OpcUa library is installed. This contains some type definitions that can be used in combination with the editor. |
The following table assigns each TwinCAT data type to its OPC UA BaseDataType (Built-In) according to the PLC-Open specification. Please note that there is no OPC UA data type for the TwinCAT data type BIT. In addition, the TwinCAT special data types are treated separately.
TwinCAT data type | OPC UA BaseDataType (Built-In) |
|---|---|
__XINT (x64: LINT | x86: DINT) | (see below for platform specific type) |
__UXINT (x64: ULINT | x86: UDINT) | (see below for platform specific type) |
__XWORD (x64: LWORD | x86: DWORD) | (see below for platform specific type) |
BIT | - |
BOOL | Boolean |
SINT | SByte |
USINT | Byte |
INT | Int16 |
UINT | UInt16 |
DINT | Int32 |
UDINT | UInt32 |
LINT | Int64 |
ULINT | UInt64 |
BYTE | Byte |
WORD | UInt16 |
DWORD | UInt32 |
LWORD | UInt64 |
REAL | Float |
LREAL | Double |
TIME | Int64 |
LTIME | Int64 |
DATE | DateTime |
LDATE | Int64 |
TIME_OF_DAY / TOD | UInt32 |
LTIME_OF_DAY / LTOD | Int64 |
DATE_AND_TIME / DT | DateTime |
LDATE_AND_TIME / LDT | Int64 |
STRING | String |
WSTRING | String |
The following table assigns the possible TwinCAT data types to each OPC UA BaseDataType (Built-In). Please note that there is no TwinCAT data type (yet) for some OPC UA data types.
OPC UA BaseDataType (Built-In) | TwinCAT data type |
|---|---|
Boolean | BOOL |
SByte | SINT |
Byte | USINT, BYTE |
Int16 | INT, WORD |
UInt16 | UINT, WORD |
Int32 | DINT, DWORD |
UInt32 | UDINT, DWORD, TOD |
Int64 | LINT, LTIME, LDATE, LTOD, LDT |
UInt64 | ULINT, LWORD |
Float | REAL |
Double | LREAL |
String | STRING, WSTRING |
DateTime | DATE, DT |
Guid | - |
ByteString | Tc3_OpcUa.UA_ByteString |
XmlElement | - |
NodeId | Tc3_OpcUa.UA_NodeId |
ExpandedNodeId | - |
StatusCode | UDINT |
QualifiedName | - |
LocalizedText | Tc3_OpcUa.UA_LocalizedText |
ExtensionObject => (i=22 | Structure) | Abstract type. See below for a selection of concrete examples. |
DataValue | - |
Variant => (i=24 | BaseDataType) | Abstract type. |
DiagnosticInfo | - |
The following table assigns the appropriate TwinCAT data types to each OPC UA BaseDataType (not Built-In) from the OPC UA Core specification.
OPC UA BaseDataType (not Built-In) | TwinCAT data type |
|---|---|
EUInformation [ExtensionObject] | Tc3_OpcUa.UA_EUInformation |
Range [ExtensionObject] | Tc3_OpcUa.UA_Range |
TimeZoneDataType [ExtensionObject] | Tc3_OpcUa.UA_TimeZoneDataType |
UtcTime [DateTime] | Tc3_OpcUa.UA_UtcTime |
OptionSet [ExtensionObject] | Tc3_OpcUa.UA_OptionSet & |
