Data types
The IEC 61131-3 data types are mapped to OPC UA data types in accordance with the PLCopen mapping specification. The following table shows the specified mapping.
PLC | OPC UA |
---|---|
BOOL | Boolean |
SINT | SByte |
INT | Int16 |
DINT | Int32 |
LINT | Int64 |
USINT | Byte |
UINT | UInt16 |
UDINT | UInt32 |
ULINT | UInt64 |
REAL | Float |
LREAL | Double |
TIME | Int64 |
LTIME | Int64 |
TIME/LTIME For the TIME and LTIME data types, there are special features to observe with regard to mapping between PLC and OPC UA data types, see the following section. |
TIME and LTIME
In the PLCopen mapping of IEC 61131-3, both TIME and LTIME are mapped to the Int64 data type. The data areas of the IEC61131-3 data types UDINT and ULINT, on the other hand, correspond to UInt32 and UInt64.
Data type | Lower limit | Upper limit | Mapping in time |
---|---|---|---|
TIME (UDINT) | 0 | 4294967295 | 49d17h2m47s295ms |
LTIME (ULINT) | 0 | 18446744073709551615 | 213503d23h34m33s709ms551us615ns |
Int64 | -9223372036854775808 | 9223372036854775807 | - |
The behavior of the server when handling these two data types is explained in the following list:
TIME
- The possible value range can be seen in the table.
- For all other values (<0 and >4294967295), the server returns the status code BadOutOfRange when written by an OPC UA client.
LTIME
- The possible value range can also be seen in the table.
- For all values <0, the server returns the status code BadOutOfRange when written by an OPC UA client.
- Values >9223372036854775807 cannot be mapped with the value range of Int64 and therefore cannot be written via OPC UA. However, they can be written in the PLC. In this case, the value of the affected OPC UA variables in the server becomes zero. In addition, the StatusCode of the variable is set to BadOutOfRange.