XFC_TimeToPosition

XFC_TimeToPosition 1:

XFC_TimeToPosition calculates the time period within which an axis will reach a position, or the time that has elapsed since the axis passed this position.

The function extrapolates the time in relation to the current position and dynamics. Precise extrapolation is only possible over a short interval, since the axis dynamics may change.

The function block requires precisely one call in order to provide the result. It can therefore be used similar to a function, although as well as the time it may also return an error. This error must be analyzed in order to ensure that the calculated time duration is valid.

Inputs

VAR_INPUT
    Position    : LREAL;
    Options     : ST_NcTimeConversionOptions;
END_VAR

Position

Absolute axis position

Options

Data structure with options for position extrapolation.

Options.

SubIndex

For axes with more than one encoder the index (0..9) of the encoder to which the position refers can be specified in SubIndex.

Options.

InterpolationOptions

0: The position extrapolation is carried out with the current velocity, without taking into account the current acceleration.
1: The axis acceleration is included in the position extrapolation.

Options.

CompensationTime

additional compensation time

Outputs

VAR_OUTPUT
    Duration       : DINT; 
    TimeOfPosition : T_DCTIME32; 
    Error          : BOOL;
    ErrorID        : UDINT; 
END_VAR

Duration

Time duration in nanoseconds after which the position will be reached (> 0) or since the position was passed (< 0).
Duration is a differential value from two variables of the type T_DCTIME32 Distributed Clock System Time.

TimeOfPosition

Distributed clock system time at which the position will be reached or was reached.
DcTime contains the lower 32 bits of the complete DcTime and covers a time range of +/- 2 seconds around the current time.

Error

Becomes TRUE if an error occurs.

ErrorID

If the error output is set, this parameter supplies the error number

Inputs/outputs

VAR_IN_OUT
    Axis     : AXIS_REF;
END_VAR

Axis

Axis data structure

The axis data structure of type AXIS_REF addresses an axis uniquely within the system. Among other parameters it contains the current axis status, including position, velocity or error status.