# Control System – How to Tune a PID Controller to a Nonlinear Process

controlcontrol systemtemperature

I have a nonlinear thermal process (nonlinear radiation becomes more and more present as temperature goes up) that I would like to tune a PID controller to. I'd like to control the temperature as accurately as I can.

I have planned to divide the temperature range in N pseudo-linear ranges (to be defined), and for each of these temperature ranges: fit a first order model using a small temperature step, and calculate the PID parameters to suit this model. The PID parameters would be automatically switched depending on the temperature of the process*.

My issue is the following: consider the 70°C checkpoint for example. P watt are already flowing to reach this temperature. I'll inject dP watt to increase the temperature by 1°C. I'll then make a note of the time constant, and the steady state gain will be 1/dP °C/W. [Please can you take a moment to think about whether this is right?] Finally, I'll tune the PID to that plant to get the parameters for that temperature range, and move on to the other ranges.

Now, assume the process reaches 70°C. The new parameters are loaded and the integral counter reset. The error may be 1°C, but the power required is much more than that to reach 21°C, it is certain the controller will demand less than P watt. This means the temperature will droop a lot before the integral term demands P watt, and only then will the dP additional watt eventually bring the process to 71°C (and it will certainly overshoot). The bigger P is compared to dP, the worse it gets.

It almost seems like the heaters should be driven with the sum of the controller output, and the power required to stay at the current "reference temperature" (e.g. 70°C). But off the shelf controllers do not offer that, so there must be another way.

What am I missing? What's the proper way?

*: It's effectively Gain Scheduling.

How to tune a PID controller to a nonlinear process?

You don't. You linearize the process, then have the PID controller work on the linear values.

By "linearize the process", I don't mean to actually make the process itself linear. That usually can't be done due to physics. However, you can put something non-linear between the output of the PID controller and the process input so that the PID output linearly controls the process from the PID controller's point of view.

Such a linearizer doesn't need to be very accurate since it is inside the feedback loop. It's purpose is to give the appearance of roughly constant gain across the control dynamic range. A simple and general way is a piece-wise linear table-based function. 16 or 32 segments is usually enough for anything but very highly non-linear processes.

The worst case example I've run into was controlling the current thru a electron tube by changing how hard the cathode filament was driven. The function of cathode temperature to electron beam current is highly non-linear, and the system controlling the cathode filament current was somewhat non-linear too. In this case it was too hard to predict this whole mess, so I used a calibration procedure during production that stepped thru the filament drive control values, measured beam current for each, then computed a 32 segment lookup table from that. It worked very well, and we were able to tune the beam current PID controller for good response across the whole range.

Without a linearizing function in front of the process, you have to tune the PID controller for stability at the highest incremental gain point of the process. This then results in very damped behavior at other points.

Nothing in your updated question says anything about why the method above isn't still a good idea and applicable. You say you're using a analog controller. My first reaction is "The 1980s are long gone, don't do that." However, the PID controller and plant linearizer can be independent.

Apparently the plant input is power and output is temperature. Measure the typical steady state temperature at a range of power levels. From that you can compute the function that converts linearized "power" to actual plant power input. The analog PID controller is presumably putting out a voltage proportional to power. All you have to do is insert a black box in line with that voltage that does the linear measure to actual power level translation.

Normally you'd do this with a microcontroller that has a built-in A/D. Doing this table lookup and linear interpolation between points is trivial. It then outputs the result in a way that eventually gets converted to a voltage. Since the plant is slow compared to a microcontroller, this could be as easy as filtering and buffering a PWM output. Or you could drive a D/A directly, although that doesn't sound like it's necessary in this case.

In keeping with the 1980s theme of your controller, you could do this with a A/D, memory, and D/A for that retro feel.

In any case, the PID controller is now effectively controlling a linear plant as far as it knows, and tuning it to good performance should be possible.

Doing a piecewise linear transform on the plant input in one place is easier than tweaking 3 values inside the PID controller over the output range. The latter is a kludge, while the former addresses the problem directly. It is also a lot easier to measure the data for the linearizing function than to determine the P, I, and D gains at various points. Even if you did that, you still have transient issues, since the right gains are not immediately applied to the situation. Again "gain scheduling" is a kludge.