TB_Spline

Representation in FBD

General Information

This module creates a data point table with normalized cam data points from given points. A cubic spline is used for this purpose. It is ensured that each data point is reached. This data point table can then be executed with TB_CamStretch.

The data points take the form of x/y positions. Here, x is the master position and y the accompanying axis position. The module then creates a normalized data point table with 512 data points from this. This can then be executed directly with TB_CamStretch. The cubic spline used ensures jerk-free traversal and the reaching of every data point.

Calculation occurs in one cycle and requires approx. 10 ms (SH03-30 and 10 data points). The calculation should occur in a cyclical task. A new cam can be calculated and accepted online.

Note: A new cam should only be transferred to TB_CamStretch at the beginning (with x_Execute), as it uses the connected data points (not a local copy) directly. Otherwise, a jerk or impact can occur during setpoint generation.

Recommended task: Cyclic
Libraries used: TECH_TYPES_xxbd05 or higher
TECH_TOOLS_xxbd00 or higher

InOut Parameter

Marking: Data type: Description:
_Spline SPLINE_DATA Table of cam points. The x-values must be specified in ascending order. The y-values can be selected as desired. Both values are specified in the selected user units. Up to 256 points can be specified. The x-points do not need to be equidistant. In the following example, a spline cam is generated, which positions the axis from 0 degrees to 360° and back while the master has moved from 0 to 100 mm.
a_CamTable CAM_TABLE Data point table of the normalized cams.

Input Parameter

Marking: Data type: Description:
x_Execute BOOL A positive edge starts the cam calculation and executes it in one cycle. The execution time is approx. 10 ms with an SH03-30 and 10 data points.
ui_CamId UINT Position of the first normalized cam data point in a_CamTable. 512 data points are generated. The position can be selected between 8192 and 15872. It makes sense to use a multiple of 512.
di_k1_Num DINT Numerator of cam slope at beginning of cam.
di_k1_Denum DINT Denominator of cam slope at beginning of cam
di_knNum DINT Numerator of cam slope at end of cam.
di_knDenum DINT Denominator of cam slope at end of cam.
di_yMax DINT Max value of cam (for scaling)

Output Parameter

Marking: Data type: Description:
x_Done BOOL TRUE: Calculation was successful. Normalized cam data points created.
x_Error BOOL TRUE: An error was identified during calculation.
w_ErrorId WORD Error number. See error table.
w_ErrorId Description:
0 No error active.
100 Selected CamId reserved. The CamId must be between 8192 and 15872.
101 Selected CamId too large. The CamId must be between 8192 and 15872.
105 x-value error. The x-values must be sorted in ascending order.
110 No technology license. Use PLC with technology license.
999 No technology license. Use PLC with technology license.