10
\$\begingroup\$

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.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ PID controller is generally intended for linear systems. It is robust enough to control some non-linear systems as well around some "almost linear" operational point. If it is not the case, different techniques can be used to linearize the controlled plant (lookup "feedback linearization" or introduce some inner loops) \$\endgroup\$
    – Eugene Sh.
    Oct 30, 2015 at 15:34
  • \$\begingroup\$ Thanks for your comment. That is what I am trying to achieve: use a PID controller in an "almost linear" range of temperatures. I've already looked around with those keywords but without much luck. \$\endgroup\$
    – user42875
    Oct 30, 2015 at 15:36
  • 1
    \$\begingroup\$ Instead of training multiple models, can you feed the input value through a 'linearizing' function before passing it to the PID controller, and train it based on that? \$\endgroup\$ Oct 30, 2015 at 16:05
  • 1
    \$\begingroup\$ Your approach sound OK to me. You are going to adjust the gain and time constant depending on the temperature. You'll have to think about what happens at the cross over points. Have you built something that is not working as well as you'd like? A control loop can hide a lot of non-linearity. And maybe you'll be alright without getting fancy. \$\endgroup\$ Oct 30, 2015 at 16:53
  • \$\begingroup\$ Why the radiation is nonlinear? If the furnace leaks temperature, then the power loss is linear Q=mc*delta_T. If your sytem is just leaking, then almost every constants remain, like dead time, rise time, except gain is decreased. You could just make Kp variable Kp(T_actual) a linear fnction of Kp_initial and Kp_final. \$\endgroup\$ Oct 30, 2015 at 17:14

3 Answers 3

11
\$\begingroup\$

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.

Added

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.

\$\endgroup\$
3
  • \$\begingroup\$ Very interesting, thanks for presenting the linearisator approach. I am using hardware controllers that are directly wired to relays though, so unfortunately I have to do gain scheduling. Is my identification approach correct? It feels like it is not. \$\endgroup\$
    – user42875
    Oct 30, 2015 at 17:13
  • \$\begingroup\$ I have edited my question to clarify my issue - the two last paragraphs in particular. (still, +1) \$\endgroup\$
    – user42875
    Oct 30, 2015 at 18:25
  • \$\begingroup\$ I've asked the manufacturer of the controllers if I can insert a look up table with linear interpolation before the output - if that can be done, I'll definitely go for that option even if that means I'll have to forget about the usual tuning tools based on transfer function and such. It's elegant. If they don't, I'll have to do the very tedious gain scheduling, but apparently there is nothing wrong with my approach, which is what I wanted to check. \$\endgroup\$
    – user42875
    Nov 2, 2015 at 16:46
2
\$\begingroup\$

Remember that when you linearize a model, you are effectively assuming that the nonlinear model y = f(x) is replaced with y = A*(x-x0) + B. Notice that x0 is the linearization point. When you introduce ranges for x, you end up with multiple A's, B's and x0's. Either way, the input to your controller is going to be the error with respect to the current linearization point. However, you still offset the input signal (with B), so even if the error is 0 with respect to the current linearization point, you still will carry on a signal.

In your example then, even if the error is 0 degrees (at the 70 degree set point), the controller will still output a power larger than 0.

\$\endgroup\$
5
  • \$\begingroup\$ Thanks. I think you are onto something, but I don't really understand. Grossly said, I'm using basic PID controllers (analog-like), of which I can change the P, I, D terms in function of the temperature. I know that at once settled at 70°C, the power will not be zero even if the error is zero. It's the settling that worries me: I'm basically dropping the controller in at 70°C, and since it's t=0s for it, the integral term will take some time to kick in so I'll have an awful droop. It almost sounds like my method is wrong. \$\endgroup\$
    – user42875
    Oct 30, 2015 at 18:15
  • \$\begingroup\$ (The controller will demand very little power at the beginning, below the power required to stay at 70°C) \$\endgroup\$
    – user42875
    Oct 30, 2015 at 18:16
  • \$\begingroup\$ I have edited my question to clarify - the two last paragraphs in particular. \$\endgroup\$
    – user42875
    Oct 30, 2015 at 18:25
  • \$\begingroup\$ It's hard to give advice without more details regarding your process, but it sounds like you have a fairly unstable system around 70 degrees and that around that temperature most of the control happens due to intragral compensation (the I in the PID)? \$\endgroup\$ Oct 30, 2015 at 19:28
  • \$\begingroup\$ 70°C is just an example, I'll have probably 6 different temperature ranges to tune to. Very roughly said, I'm controlling the temperature inside of a thermos by heating the outside surface. \$\endgroup\$
    – user42875
    Oct 30, 2015 at 20:26
2
\$\begingroup\$

One approach to nonlinear control with PID controllers, an approach which is widely used in industry, is called 'gain scheduling'.

The nonlinear control problem is broken up into a series of linear-enough regions and the appropriate parameters are used for each region.

\$\endgroup\$
1
  • \$\begingroup\$ That is what I am trying to achieve, as can be read in my question ("The PID parameters would be automatically switched depending on the temperature of the process*" "*: It's effectively Gain Scheduling.") \$\endgroup\$
    – user42875
    Oct 30, 2015 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.