How to Use an External Axis¶
To use multiaxis PLCopen Function Blocks with an externally sensed axis as master axis the following structure can be used for the axis implementation:
The use of a feed forward filter Function Block is needed if the slave axis has to follow the position of the external axis. In this case there will be a time delay between sensing the position of the external axis and moving the follower axis along the sensed position. The filter Function Block will then add a certain distance to the external axis’ position depending of its speed.
The filter Function Block MATH_LINEAR_REGRESSION from the library MathFunctions_AC500_V23 can be used here.
For an axis which is following the external axis, the value “mcActualValue” for the input “MasterValueSource” for multi-axis PLCopen Function Blocks has to be used.
When the filter Function Block MATH_LINEAR_REGRESSION is used to process an actual position, 2 different purposes are fulfilled:
- A jitter or noise can be compensated
- It is possible to calculate a forecast-position to compensate for a delay in position measurement
Note
Process the actual position or any other master axis always before the slave axis.
Otherwise, an additional 1 cycle-delay is introduced.
The MATH_LINEAR_REGRESSION-block calculates the progress for a variable which is captured in equidistant periods of time and is assumed to follow a linear curve. It uses the Gauss “least squares” -algorithm to do so. The line is calculated in a way that the sum of squares for the distances from the measured points to the assumed straight line is minimized.
A noise or jitter influence of the value is compensated and a predictive value for the variable with an adjustable forecast horizon can be calculated.
Linear equation:
Sum of squares:
The gradient and offset for the line are calculated in a way that “sum” is minimized. Then these 2 values are used to calculate the forecast value:
FORECAST=0 would mean: value right now, no future or past considered.
When the ACTUAL value is a modulo value, for example a single turn encoder or a rollover axis, this has to be considered in the calculation. The 2 input values POSITIVE_LIMIT and NEGATIVE_LIMIT can be used to configure this. They define the upper and lower limit for ACTUAL. Also, the NEXT_BINARY will as a result be limited to these borders.
Example