Delta Computer Systems Inc.
Edited by Leland E. Teschler
Speed and accuracy are both common goals for many motion-control systems. In this regard, some motion-control vendors now incorporate spline functions into their control algorithms. Such functions can simplify system design and tuning. Moreover, spline algorithms can help implement control regimes that involve ramping from one velocity to another.
Spline functions emulate flexible strips of wood that can bend smoothly between fixed points. Controllers that implement these functions are given a few position coordinates, as a function of time or as a function of another axis position, and then produce a spline profile running along these control points.
The controller is simple to program in that the system designer needn't calculate multiple velocities and acceleration rates along the profile.
HMI software typically prevents the user from inadvertently exceeding position, velocity or acceleration limits. System performance improves because a single spline function replaces many point-to-point motion steps.
Splines are particularly appropriate for acceleration feed-forward control regimes. Linear or trapezoidal ramps from one velocity to another shouldn't be used in acceleration feed-forward as there will be step jumps in the control output.
It can also be useful to explore why cubic-spline interpolation is more appropriate for motion control than, say, interpolations involving higher order polynomials. The primary reason is one of computational simplicity. A cubic spline interpolation can be expressed as a system of linear equations configured as what is called a tridiagonal matrix, one having nonzero elements only on the diagonal plus or minus one column. The software algorithm for solving a tridiagonal matrix is well known and relatively straightforward.
The inputs to the routine are the known points on the curve as a function of time or another axis. The basic routine can be enhanced to allow either the accelerations or velocities to be set to zero at the end points of the spline. Velocities at the end points of the spline (corresponding to the end points of the move) are, in fact, zero in most practical applications.
The first part of the routine uses entered positions and time intervals between the positions to calculate the acceleration at each point. The second part of the algorithm calculates a trajectory using the previously constructed table. A time value is used to index into the table. Usually, this time value will lie between two specified points. Another part of the routine calculates a cubic interpolation of position at that time, calculates a second-order interpolation to get speed, and a linear interpolation to calculate the acceleration.
A point to note is that the algorithm calculates the table for the entire spline at once. The amount of memory needed for the table rises arithmetically with the number of entered points. But cubic interpolation is well within the capabilities of most 16-bit microprocessors or DSPs.
One of the benefits of a cubic-spline interpolation is that the interpolation formula is smooth in the first derivative (i.e., no abrupt change in velocity when arriving and departing from a point on the curve) and continuous in the second derivative (acceleration).
One application for spline interpolation is in pouring molten metal from a crucible. If the flow of molten metal is to be kept relatively constant, the pouring motion will be nonlinear. A linear actuator tilts the crucible. The feedback variable in this case is the tilt angle of the crucible. The change in tilt angle with respect to time grows higher as more material pours out.
The typical approach to set up this application is to build a data table by manually jogging or tilting the crucible at specific angles between zero and 90°. At each point the developer records the linear position of the actuator tilting the crucible.
This data goes into defining a spline that converts tilt angles to linear position. When the user wants an angle that lies between two of the programmed points, the controller does a cubic interpolation to calculate the necessary linear actuator position.
Finally, it is interesting to note where interpolations using higher order polynomials have application. The benefit of trajectories specified via higher order polynomials is that they potentially let the developer specify more properties of the boundary conditions and points on the curve.
The cost, however, is computational complexity. For example, fifth-order splines are usually calculated on the fly as each point is passed. The interpolation is good only for the next four points. The algorithm requires less table space than a cubic spline, but more processing. Moreover, it may not be possible to state the equations in the form of a tridiagonal matrix. This is another way of saying the matrix manipulations can be lengthy and time consuming.