# Building PID predictive controls

The reactive controls we discussed in **Part 1** are driven entirely by error. This is a bit like driving a car while looking out the back window. Your mistakes may be obvious, but their realization may come a bit too late. By running controls strictly from the error signal, we are conceding that an error must occur.

Indeed, there will always be a bit of error, but wouldn't it be nice if we could guess the required power fast, and only use the remaining error to make up for relatively smaller inaccuracies in our guess?

Predictive controls do just this. Predictive controls do not care about the error, but simply watch the rabbit and try to predict the amount of power required to make the servo track it. Since they watch the rabbit, and are not in the feedback loop, they are both faster and more stable than reactive controls.

**The Rabbit Term**

Looking at the temperature rabbit curve of Figure 9-3 earlier, we begin to realize that there are two relationships between the rabbit and the required power that can be readily predicted.

The first relationship is that for any steady-state temperature, there will be a certain constant power required to overcome heat loss to the environment and maintain that temperature.

Let's call this the ** rabbit term**, and in the simplest case it is the product of the rabbit and the rabbit gain. For a temperature control this is the amount of power required to maintain any given temperature relative to ambient. For the drive motor of a robot, this will be the amount of power that is required to overcome drag and maintain a fixed speed.

The power required may not bear a perfectly linear relationship with the set point over its entire range. This rabbit gain will vary with factors such as ambient temperature, but if the operating temperature is several hundred degrees, and the ambient variation is only say 20 degrees, then this power relationship can be assumed to be a constant.

If the ambient temperature varies more appreciably, we could take it into account in setting the gain. (*Note that in some cases the relationship may be too nonlinear to get away with a simple gain multiplier. In these cases an interpolated look-up table or more complex mathematical relationship may be useful.*)

**The Rabbit Derivative and Second Derivative Terms**

The second relationship we can quickly identify has to do with the slope or derivative of the rabbit. For a position servo, the rabbit derivative is the rabbit velocity, and the rabbit second derivative is the rabbit acceleration.

If the rabbit is attacking positively, we will need to pour on the coals to heat the furnace up or to accelerate the robot. This term is thus proportional to the derivative of the rabbit, and we will call its gain the rabbit derivative gain or rabbit velocity gain.

If the rabbit is accelerating, then we will need even more power. This term is most commonly found in position controls and its gain is thus called the rabbit acceleration gain. If we perfectly guess these gains, then the servo will track the rabbit perfectly, with the minimum possible delay.

The big advantage to the rabbit derivative terms as opposed to the error derivative term is that, because they work from the nice clean rabbit command, they do not amplify system response noise.

**Combined Reactive and Predictive Controls **

Unfortunately, a predictive control of this type has no way of correcting for variables such as ambient temperature or payload. It is also unlikely that our perfectly selected gains will be as perfect for every unit we build. It is possible to learn these gains during operation, but this will be discussed later.

It is therefore not practical .to expect exact performance from a predictive control. Yet, the prediction may buy us a guess within say 10% of the correct value, and its output is instantaneous and stable.

For this reason, it is often optimal to combine terms of a conventional PID with those of a predictive control. Using our analog control as a metaphor, consider the configuration shown in **Figure 9-4 below**.

*Figure 9-4: Hybrid Predictive and Reactive Control.
*

In this configuration, the instantaneous rabbit value is multiplied by a gain to produce the rabbit term. This term is sometimes called the set point gain because at set point (quiescence) this term should produce the bulk of the output needed.

The second new function is a differentiator that provides a term proportional to the rate of change of the rabbit. When added to the rabbit term, this term gives us a much better guess at the power required during transitions of the rabbit.

Additionally, we have retained the proportional and integral terms driven by the error to make up for any inaccuracy in the prediction. The result is an extremely capable yet simple control architecture suitable for a wide range of applications.

Author

MARK ALAN 4/6/2013 11:24:57 PM

Author

sanjaac 8/25/2010 3:00:36 PM

Author

rdipaolo 8/19/2010 5:49:03 PM