FC_CSplineFromFile - General Information
Type: |
Function |
Available as of: |
SystemInterface_1.32.6.0 |
Versions: |
Current version |
Calculate the coefficients for a curve from a supporting point table.
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.
oVersion
The version of the cam point file must be 0 at this time.
oType in the input file
You can select from three spline types:
oSpline type = 0
Natural spline (second derivatives in boundary points = 0)
oSpline type = 1
Derivatives in boundary points are preset (such as FC_CSplineFromFile())
oSpline type = 2
Periodic spline
oLeft 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).
oRight 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).
oCam 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 |
FC_CSplineFromFile( i_sInFile:='Kurve1', i_sOutFile:='Kurve1' );
FC_CSplineFromFile( i_sInFile:='Kurve1.asc', i_sOutFile:='Kurve1' );