12 Mapping of DataTypes ToC Previous Next

12.2 Primitive DataTypes ToC Previous Next

12.2.7 Duration DataType ToC Previous Next Duration DataType used for TimeSpanT ToC Overview ToC

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 (1/ 2 32 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.

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:

OPC UA Duration= IO-Link TimeSpanT *∙ 10 3

2 32*

If the OPC UA Duration value is bigger than the maximum IO-Link TimeSpanT value (≈ 2 64 −1) converted to milliseconds (≈ (2 64 −1) ∙ 10 3 ), 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:

IO-Link TimeSpanT= OPC UA Duration*∙ 2 32

10 3* Duration DataType used for values coded with 1 byte ToC

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”.

Previous Next