XFC_TimeToModuloPosition
XFC_TimeToModuloPosition calculates the time period within which an axis will reach a position, or the time that has elapsed since the axis passed this position. In this case the position is the nearest modulo position in the direction of travel.
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;
ModuloFactor : LREAL;
Options : ST_NcTimeConversionOptions;
END_VAR
Position |
Absolute axis position | |
ModuloFactor |
Modulo divider to be used for the calculation. ModuloFactor can be identical to the modulo factor of the axis, e.g. 360. However, a factor deviating from that can also be used. | |
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. |
Options. |
CompensationTime |
additional compensation time |
Outputs
VAR_OUTPUT
Duration : DINT;
AbsolutePosition : LREAL;
TimeOfPosition : T_DCTIME32;
Error : BOOL;
ErrorID : UDINT;
END_VAR
Duration |
Time duration in nanoseconds after which the position will be reached. |
AbsolutePosition |
Absolute position (not modulo) corresponding to the modulo position and the determined time. |
TimeOfPosition |
Distributed clock system time at which the Position will be reached or was reached. |
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.