12.2.7 Duration DataType

12.2.7.1 Duration DataType used for TimeSpanT
12.2.7.1.1 Overview

The IODD data type TimeSpanT is mapped to the OPC UA DataType Duration.

The IODD data type TimeSpanT consists of 8 bytes representing fractions of a second (seconds). See IODD Specification for more details.

The OPC UA DataType Duration consists of a Double variable representing the number of milliseconds. Fractions can be used to represent fractions of milliseconds. See OPC 10000-3 for more details.

The following rules for conversion apply. Implementers shall ensure that the time span value mappings are done as exactly as possible.

12.2.7.1.2 Conversion from IO-Link TimeSpanT to OPC UA Duration

As the range of the OPC UA Duration values is bigger than the IO-Link TimeSpanT value, the following conversion formula can be applied without restrictions:

12.2.7.1.3 Conversion from OPC UA Duration to IO-Link TimeSpanT

If the OPC UA Duration value is bigger than the maximum IO-Link TimeSpanT value () converted to milliseconds (), the IO-Link TimeSpanT value has to be the maximum value for 64-bit unsigned integer 0xFFFFFFFFFFFFFFFF.

If the OPC UA Duration value fits into this range, the following conversion formula shall be applied:

12.2.7.2 Duration DataType used for values coded with 1 byte

IO-Link uses in several places an octet to represent a duration in ms (e.g. MasterCycleTime and OffsetTime). As a time base and a multiplier is used, not all possible values are represented. The OPC UA DataType Duration uses a higher resolution.

If the client writes a value that cannot exactly be mapped, the server shall use the next possible lower value.

If the client tries to write a value outside the allowed range (either because of the larger size of the DataType or based on further limitations defined by the IO-Link Specification), the server shall return the error code “Bad_OutOfRange”.