The function calculates the coefficients for a cubic spline interpolation in the controller from a cam point table. Cubic spline interpolation provides jerk-free acceleration regardless of the number of cam points. A cam point just consists of a Y value; the X values are assumed equidistant and calculated by the system.
The cam points and some extra information are transferred via i_sInFile, which has to be created beforehand.
The output of the coefficients is carried out through FC_CSplineFromFile in the i_sOutFile.
The "Infile.dat" file is created using the IEC file services. It contains:
Meaning |
Data type |
Range |
---|---|---|
Version |
DINT |
0 |
Type |
DINT |
0 ... 2 |
Left boundary slope |
LREAL |
-infinite to +infinite |
Right boundary slope |
LREAL |
-infinite to +infinite |
Cam points (Y values) |
LREAL |
YFactor should be normalized to 1.0 |
The data to be interpolated can be provided in a binary or an ASCII file. If the input is to come from an ASCII file, it must have the "*.asc" extension. The other files are interpreted as binary files.
Version
The version of the cam point file must be 0 at this time.
Type in the input file
You can select from three spline types:
Spline type = 0
Natural spline (second derivatives in boundary points = 0)
Spline type = 1
Derivatives in boundary points are preset (such as FC_CSplineFromFile())
Spline type = 2
Periodic spline
Left boundary slope
The value of the derivative at the start point. This value is ignored for spline types 0 (natural spline) and 2 (periodic spline).
Right boundary slope
The value of the derivative at the end point. This value is ignored for spline types 0 (natural spline) and 2 (periodic spline).
Cam points
Values must be normalized to –1.0 ... +1.0. The number of cam points may vary from 3 to 10,000 values.
Input |
Data type |
Description |
---|---|---|
i_sInFile |
STRING[80] |
Name of the input file (*.dat or *.asc) (Maximum number of characters = 8 + file name extension, for example abcdefgh.dat) |
i_sOutFile |
STRING[80] |
Name of the output (/coefficient) file (*.pp3) (Maximum number of characters = 8 + file name extension, for example abcdefgh.dat) |
Data type |
Description |
---|---|
DINT |
0: OK -1: Number of supporting points >10,000 or <3 -2: Pole position in function -3: File cannot be opened -4: Invalid type -5: Error detected in the header -6: Parameter exceeds the limit value -7: System error detected -8: File name is too long -9: Not enough memory available |