Closed-loop tuning secrets revealed!
Figure 1. Structure of a typical control loop incorporating P, I, D, and velocity and acceleration feed forward factors.
Figure 2a. Plot of actual vs target motion. Here, the system uses proportional gain only and the actual speed and actual position differ significantly. The gap between the actual (red) and target (cyan) position curves is the error necessary to generate the proportional gain, which can be eliminated by proper use of feed forward terms.
Figure 2b. Velocity feed forward has been applied to the system. The position error (gap between the red and cyan curves) has been significantly reduced during the constant speed part of the move, but there is still position error during acceleration and deceleration (see inside ovals).
Figure 2c. Plot shows the same system, but with both velocity and acceleration feed forwards applied. The actual position plot now matches the target plot almost perfectly this is an optimally tuned system.
Figure 3. Adjusting system response using the Tuning Wizard slider bar.
By Peter Nachtwey, Delta Computer Systems, Inc.
Advances in closed loop control systems are enabling motion controllers to deliver the advantages associated with hydraulic power while meeting the more precise motion requirements of today's machine control applications. Control loops incorporating proportional, integral, and differential (P, I, and D) gain parameters have become standard functions of motion controllers, and control algorithms have evolved to include additional parameters such as feed forward gains to enable increased dynamic system responsiveness while decreasing positioning and velocity error. The result is higher performance machine control, with longer machine life, due to smoother motion.
Motion controllers use combinations of the P, I, and D gains in generating control outputs to reduce the error between the target and actual position. The proportional gain is simply multiplied by the instantaneous error between the target and actual position to generate the proportional contribution to the output during the next time period. The larger the error, the greater the output.
The integral gain is multiplied by the sum of position-errors over time to generate the integrator contribution to the output. Even if the error is very small at any instant, the sum of errors and the resulting output will eventually increase to the point where the error is reduced.
The differential gain is multiplied by the error between the target and actual velocities. The differential gain's contribution to the output is proportional to the rate of convergence or divergence between the target and actual positions. For simplicity, we will ignore the differential gain by assuming a system has sufficient damping factor.
Limitations of PID alone
One limitation with control using PID gains alone is that the proportional term requires an error to generate an output and the integrator term requires an error and time. The control output to the valve is always responding to the error between the target position and the actual position. In many cases, the error needs to be quite large to get the desired output if proportional gain were used alone. Adding an integrator element can cause the control output to grow by accumulating errors, but the winding up of the integrator component of the control output takes time.
Often, point-to-point moves need to happen so quickly that the integrator is of little use, because the integrator does not have the time to wind up. Even if the integrator does wind up, it may cause the system to overshoot the target position as it winds down.
An integrator winds down when the sign of the error between the target and actual position changes. This can't happen unless the actual position overshoots the target position by some amount, which is generally undesirable in a motion system. By incorporating feed forward components in the control loop, a motion controller can reduce the need for the integrator to wind up during moves.
Whereas feedback deals with deviations from desired behavior in the past, feed forwards are predictive elements that drive the system to exhibit a desired behavior. Feed forwards make use of the information generated by the motion controller's target or motion profile generator. Typically, high performance motion controllers operate on the principle of generating a target motion profile and then closing the loop to force the actual motion to follow the target motion. (Picture the proverbial carrot held out in front of the donkey).
The target motion is updated at consistent time periods, perhaps every millisecond. A target generator calculates the desired position, velocity, and acceleration before each PID update. Because the motion controller "knows" what the target velocity and acceleration are, it can immediately output the control signal needed to achieve the required velocity and acceleration for each loop update, instead of waiting for the PID to respond to the error developed between the target and actual position.
The amount of output is set by predictive parameters, called feed forward gains. Unlike PID gains, which are multiplied by the feedback error, feed forward gains are predictive gains that are multiplied by the target velocity and acceleration and summed together to generate a contribution to the output, Figure 1. The feed forward contribution to the control output is based on a simple calculation, below, where Kv is the velocity feed forward and Ka is the acceleration feed forward.
It is important to note that a desired motion can be achieved in different ways. As Figure 1 shows, several elements combine to form the control output to the valve. The output can come from the PID gains acting on feedback errors, from the feed forward calculations, or from a combination of the PID and feed forwards. In all cases, the same output under the same condition will result in the same speed. The system does not "care" if the output is due to the feed forwards or the PID elements. This can be observed in Figures 2a, 2b, and 2c.
So if the system is not moving fast enough, why not just increase the PID gains? Whenever feedback is used in calculations, the gains need to be limited in order to insure system stability. Often, it is simply not possible to increase PID gains enough to reduce errors to an acceptable level without causing oscillation or instability. The benefit of having the output come from the feed forwards is that the feed forward terms do not require an error to generate an output, whereas the PID equations do.
The key to producing a stable, easily-tunable system is to have the feed forward calculations generate as much of the output as possible and for the PID components of the control loop to output as little as possible. This results in the errors being as small as possible. We should rely on the PID elements to compensate primarily for the effects of environmental factors (e.g., temperature and humidity) on the system and for non-linear system response that may change from time to time (e.g., from varying loads things that aren't possible to predict in generating the feed forward values.
Moving the system
The velocity feed forward gains are used by the motion controller to calculate the control output needed to cause an actuator to move at a given velocity
A hydraulic cylinder moves as the result of oil being supplied to one side of the piston and being removed from the other side under the control of a servo valve. To move the piston at a given velocity requires a proportional amount of oil to keep the net force across the piston equal to the work done due to the load and frictional forces.
We can empirically estimate how much output it takes to move at each velocity. That is what the velocity feed forward term does automatically. Figure 2b shows how adding velocity feed forward gain can reduce positioning error.
For example, we can send a 10% control signal to a valve and measure how fast the actuator moves. If the actuator moves 1 in./sec at 10% output, we can estimate that this same system will take a 30% control signal to move the actuator at 3 in./sec. In other words, the open-loop gain of the system is such that it moves at 1 in./sec for a 10% control signal.
Because the feed forward gain should be set as the inverse of the open loop system gain, the feed forward will be 10% control signal for each in./sec of motion. The motion controller would then use this feed forward gain to calculate the control signal each time a new target velocity is calculated.
Tuning velocity feed forwards
The velocity feed forward gains can often be determined simply by observing the p e r f o r m a n c e during open-loop moves as described above; however, some actuators and some applications take more effort.
For example, single rod cylinders must be tuned for both the extend and retract directions. Because the different surface areas on the each side of the piston, a different set of PID and feed forward gains are required for extension and retraction. The good news is that a simple ratio exists between extend and retract gains that can be determined by observation from the ratio of the extend and retract velocity feed forwards.
We can determine the feed forward gains for each direction by first sending a +10% control signal to the valve and then a -10% control signal and noting the resulting velocities in each direction. Even if the actuator is symmetrical, some systems are inherently non-linear. One simple example is a heavy load suspended such that gravity assists in one direction and opposes in the other.
In an ideal world, a system could be operated entirely using feed forward gains that are set in this manner. Because real world systems have varying loads and are somewhat non-linear, motion controllers supplement the feed forward function with the PID gains. For example, if a more heavily loaded system requires 32% instead of 30% output to go 3 in./sec, the PID components of the control loop require only enough error to provide the 2% output component. The velocity feed forward's 30% output does most of the work.
Compensating for fluid compression
Acceleration feed forward gains are used by the motion controller to estimate the required control output as a function of acceleration. The acceleration feed forward gain parameters are necessary to compensate for the compressibility of the oil in the system.
A hydraulic system is similar to a mass (the piston) between two springs (the trapped oil in the cylinder). Ideally, all the energy (oil under pressure) applied to the cylinder goes into kinetic energy (moving the piston), but in reality, a certain quantity of the energy goes to increasing the pressure that provides the force necessary to move the mass.
This is similar to applying force on one end of a spring and compressing it until the mass on the other end of the spring starts to move. The spring absorbs energy as it compresses in the form of potential energy instead of transferring all the energy to the desired kinetic energy. It is this diversion of energy to potential energy instead of kinetic energy that causes cylinders to lag behind the target position while accelerating and establishes a need for acceleration feed forward.
Acceleration feed forward gains increase the control output to the valve during acceleration, so the valve allows more energy into the actuator and makes up for the energy absorbed by the compressing oil. Figure 2c shows how adding an acceleration feed forward gain element can optimize the system to eliminate lags and overshoots that can happen when velocities are changing.
The potential energy stored in the oil is released when decelerating. The spring expands, and potential energy that is released is converted into kinetic energy often causing undesirable over shoot. The acceleration feed forward helps here, too, because the acceleration gain is negative as the system slows down and is subtracted from the control output.
Feed forward tuning
If tuned correctly, the acceleration feed forward will cause the system to add the right amount of energy to compensate for energy absorbed by the oil during compression. It will also subtract the same amount of energy as the system approachesits target so that oil decompression does not cause overshoot. The challenge is calculating what value we should use for the acceleration feed forward.
One method is to perform a guided trial-and-error process by looking at graphs of the motion profile. If the actual position is lagging while accelerating and leading (over shooting) while decelerating, the acceleration feed forward value must be increased. If the position is leading while accelerating and lagging while decelerating, the acceleration feed forward value should be decreased.
Some motion controllers are supported with automated tuning tools to make the task of optimizing the PID and feed forward values much easier. For example, the Tuning Wizard, Figure 3, allows the user to adjust the responsivenessof the system by moving a slider bar on the computer screen.
The objective is to minimize the energy absorbed while accelerating and released while decelerating. Making the spring stiffer reduces the energy absorbed by the spring. In hydraulic terms, this means we should concentrate on increasing the natural frequency of the system by minimizing air in the oil and increasing the area of the pistons. Never use a hose between the valve and cylinder because a hose will absorb energy and contribute to instability. Mounting the valve on the cylinder also helps to make the "springs" shorter.
Feed forward component of output KV × Target velocity + Ka × Target acceleration