FB_AxisExtrapolateValues
This function block is used for extrapolating kinematic axis parameters. The set position (and optionally the set velocity) are extrapolated based on the set velocity (and set acceleration) around the specified correction time.
By default, the parameter for using the set acceleration for extrapolating the velocity and position is _activated_. Accordingly, adequately smooth, i.e. noise-free and spike-free acceleration values (e.g. analytical values from PTP axes) have to be present in the AxisIn structure. Encoder axes do not meet these acceleration requirements through sampling and dual position differentiation. Application of the acceleration has to be deactivated by setting parameter stAxisExtrapolateParameters.bUseAccForExtrapolation=FALSE.
Description
Beat effects described in the introduction lead to loss or duplicate reading of sent information. If this information contains set values for axes, the result are step changes in the kinematic variables (set position and set velocity). In axes that are operated directly with these variables, this will cause periodic disturbance. The situation can be rectified by correcting the set values using higher derivative terms (set velocity or set acceleration) and a correction time. The latter is configured (see FB_TimeSync) to ensure that beat effects and set value fluctuations can be compensated through the extrapolation.
Figure 1 shows the received (continuous line) and the corrected (dashed line) position, with the axis being driven with the position interface of the uncorrected values. This results in increasing fluctuations of the actual velocity (dotted line). Figure 2 shows an overview of the situation.


Extrapolation of the set values
Two techniques that differ in terms of detail are available for extrapolation of the set values. The first technique only uses the set velocity for extrapolating the set position:
AxisOut.fPosSoll:=AxisIn.fPosSoll + AxisIn.fVeloSoll * fTimeCorrection;
AxisOut.fVeloSoll:=AxisIn.fVeloSoll;
Furthermore, the set acceleration may also be used for extrapolating the set position and set velocity:
AxisOut.fPosSoll:=AxisIn.fPosSoll + AxisIn.fVeloSoll*fTimeCorrection+ 0.5 * AxisIn.fAccSoll *fTimeCorrection^2;
AxisOut.fVeloSoll:=AxisIn.fVeloSoll + AxisIn.fAccSoll *fTimeCorrection;
Requirements:
Depending on the main mode in which the axis is to be operated, certain requirements have to be met, and the associated mode has to be activated. The corresponding combinations are shown in Table 1.
Main axis operating mode | Parameters required in AxisIn | Parameters | Comment |
---|---|---|---|
Position interface | Set position Set velocity (set acceleration) | stAxisExtrapolateParameters .bUseAccForExtrapolation=FALSE
(=TRUE) |
Acceleration can optionally be added as a parameter. (The acceleration requirements described above must be met.) |
Velocity interface | Set position Set velocity Set acceleration | stAxisExtrapolateParameters .bUseAccForExtrapolation=TRUE | Analytical acceleration behaviour required, i.e. no encoder axes, for example |
Operating modes:
In addition to set value extrapolation, further operating modes are available. Two of these (bypass mode and PT1 mode) are mainly used in cases where no correction time is available for the extrapolation. If the function block FB_TimeSync is used this is the case during the initialization phase or if synchronization fails for other reasons. This block can also be used with an optional time mode that enables a correction time for avoiding fluctuations to be determined during initialization without knowledge of the beat frequency.
The following operating modes are available:
Mode | Description |
---|---|
E_Sync_ExtrapolateMode_Bypass | All received set values are directly copied to the output, i.e. without modification of the kinematic variables and so without reduction of beat effects. |
E_Sync_ExtrapolateMode_PT1 | In PT1 filter mode the input position is transferred to the output via a configurable PT1 filter (see stAxisExtrapolateParameters). Beat effects can thus be reduced. |
E_Sync_ExtrapolateMode_Sync | Sync mode is the standard block mode. The kinematic set values are extrapolated according to the correction time as described above. |
E_Sync_ExtrapolateMode_Time | In the event of data being read twice/missed, the correction time is calculated such that the influence on the set values are minimised. In contrast to sync mode, the set values are not corrected across the whole range between the beat effects. |
Safety procedures
This distance can be limited, in order to avoid the difference between the original-set values and the calculated variables becoming too large in the event of the correction time being calculated incorrectly. The maximum difference is defined through the position or velocity change that can be achieved with the current set velocity or set acceleration in stAxisExtrapolateParameters.fMaxPositionDiffFactor cycles. If the difference exceeds this value, the configurable fallback mode is activated. Bypass of PT1 mode is available for this purpose (see description above).
VAR_INPUT
VAR_INPUT
fCorrectionTime : LREAL;
fTaskCycleTime : LREAL;
eMode : E_Sync_ExtrapolateMode;
eFallBackMode : E_Sync_FallBackMode;
stAxisExtrapolateParameters : ST_AxisExtrapolateParameters;
END_VAR
fCorrectionTime :Extrapolation correction time [s]
fTaskCycleTime :Receiver cycle time [s].
eMode : Pre-selected mode, can automatically be changed through safety procedures (fallback). The actual mode used is displayed as eState output.
eFallBackMode : Mode if the deviation of the calculated set values from the original set values exceeds the value described by the parameter stAxisExtrapolateParameters.fMaxPositionDiffFactor.
stAxisExtrapolateParameters : Structure with configuration parameters
VAR_OUTPUT
VAR_OUTPUT
bError : BOOL;
iErrorId : DINT;
eState : E_Sync_ExtrapolateState;
stAxisExtrapolateDiagnostic: ST_AxisExtrapolateDiagnostic;
END_VAR
bError : TRUE in the event of a fault
iErrorId: Error code (E_Sync_ErrorCodes)
eState : Mode used (E_Sync_ExtrapolateState)
stAxisExtrapolateDiagnostic: Structure with extended diagnostic outputs
VAR_IN_OUT
VAR_IN_OUT
AxisIn : NCTOPLC_AXLESTRUCT;
AxisOut : NCTOPLC_AXLESTRUCT;
END_VAR
AxisIn : Received original axis structure
AxisOut : Axis structure for avoiding beat effects with modified set values