Electronic – PID Tuning Issue

control systemembeddedpid controller

I'm having issues tuning a PID controller – specifically the I-term. First – here's a little info about my system:

I'm heating a coil (R ~= 1.8 Ohms) to 750°F. My power delivery system is working fine. I'm applying a maximum of 12V to the coil, so there's about 7A going through the heater. I'm monitoring temperature with a k-type thermocouple. I've double-checked with another thermocouple and DMM to make sure my microcontroller is reading the right temperature data. It is. If you have clarifying questions about the system hardware I'd be happy to answer but I'm pretty sure my issue is coming from my tuning method.

I'm following these Ziegler-Nichols PID tuning tutorials:
1
2
3

I set my I-term and D-term gain to zero and slowly increased my P-term gain until I got stable oscillations:

P Gain = 5
P Gain = 6
P Gain = 7
P Gain = 7.5
P Gain = 8.0

After achieving stable oscillations and choosing a P-term gain of 8.0, I calculated my new P-term and I-term values per the equations in the tutorials (P Gain = 3.63, I Gain = 0.42):

P Gain = 3.63, I Gain = 0.42

As you can see, although the oscillations are much more centered, they have not diminished as they do in the first tutorial. When I calculate and implement the D-term gain, I still get unsatisfactory behavior:

PID

My Question is this: where do I go from here? Should I start over with a new P-term? Change I-term and keep everything else the same? Change D-term and keep everything else the same? Any input is welcome.

From 130°F with error term:

From 130°F

Best Answer

Update: See the update 3 at the bottom. After re-reading the answer I realized that some of my statements below are not applicable to thermal systems.

One thing strikes immediately as suspicious, on all P-only graphs the oscillation is happening under setpoint. That is not how P term works. In order to oscillate it must cross setpoint.

So, figure out this part, and I think it will go well with the rest.

Update 1: most important here are thermal inertia, timing and continuous linear control action. For example, if output power cuts-off at some low value you can see oscillations under setpoint.

Regardless of that, in a context of PID tuning the "stable oscillations" that you need to achieve as first tuning step should go way beyond setpoint.

Also, before introducing I-term make sure you added anti-windup measures. This is extremely important in thermal control systems due to inherently slow response.

Update 2: I just recalled this article, which I used to write my own auto-tuning library long time ago. It did not work well for me because my mechanical system had strict acceleration restrictions. But I think it should be very good for a system with slow response, such as yours.

Update 3: There is inherent complexity to P-term response due to the nature of thermal systems. Unlike typical servo applications the downward slope cannot be controlled by reversing control command, it happens naturally and depends on environment conditions. The consequences are:

  • There is no or very limited overshot due to P-term, no matter how big it is. So typical PID tuning methods like Ziegler–Nichols might not work as expected.
  • The I-term requires aggressive anti-windup measures, especially taking into account non-symmetrical slopes.
  • Rather then improving response the D-term might cause instability, especially if feedback is noisy.
  • Output power should be considered an additional process variable for the purpose of tuning. You can achieve more or less stable temperature, but if your output power continues to oscillate widely your system is not actually stable.

One of the tricks of thermal control systems is to closely match power plant to the process. Meaning - if your heater is too powerful it will be harder to tune.

If you have very fine control over power output your proportional band can be quite narrow, meaning P-term only applies to the limited range near setpoint and works as On/Off switch otherwise.

Another trick is to always change only one term at a time, but make big changes (like double or halve the term) at least initially. Thermal systems do not respond to small changes as servos do.