# What am I trying to control?

• I have a container with approximately 3*2*6 meters (width, height, length).
• I am controlling through PID the Temperature 2 (temperature inside a tubing system) to get Temperature 1 and 3 (temperatures near floor and celling of the container) to the desired values (see graphs below).
• Temperature 2 is coming from a sensor inside a tube system through which the air is circulating and Temperature E. is coming from a wooden box inside the container.
• Box and tubing is a closed system with some minimal temperature leaks.
• The PID’s output is connected to PWM of triacs which heat the air in the tubing system.
• EO% is describing how much % of 1 second (the PWM period) the triacs will be set to True = therefor making heat. So if EO is 50, then the triacs will be making heat exactly 0.5 seconds

Sketch of my system:

Step response of the system (X axis format is HH:MM:SS):

## What have I tried so far?

• I am running the software on PLC from local distributor (not an Arduino board) where I have implemented this PID model from Arduino library.. But in the future I will be using Beckhoff PLC's.
• I have tried implementing the basic PID controller with little accuracy.
• Then I have tried implementing PID controller with proportional on measurement and derivative on measurement and my accuracy went higher (link is to a blog talking about the two methods).
• Now I can control temperatures with precision to almost 0.5 °C and little oscillation.
• PWM frequency is 1 HZ and PID sample time is 2 seconds.

## What is the problem?

• You can see on the pictures below that I slowly increment my PID setpoint through time (PID’s setpoint is the black line).
• When my system has a temperature in a range from 20 to 55 °C my accuracy is quite good.
• But once I get above 55 °C, PID’s is not able to control the temperature accurately anymore and the PID output always result in a spike and therefor even larger inaccuracy.

## Other observations:

• I think the problem lies in the I component of the PID controller.
• When the temperature is low the P component manages to control the temperature just right. But when the error is getting bigger and bigger the I component is cumulating and then it overshoots.
• When I am running the PID on all temperatures (25, 40 even 58 °C) the accuracy is as I said 0.5 °C and oscillation is minimum. The problem only occurs when I slowly increment the PID’s setpoint and therefore increase the temperature.

# Pictures (X axis format is HH:MM:SS):

Picture 1 and 2 (temperatures and the PID's output):

Picture 3 and 4 (temperatures and the PID's output):

• Do you expect the temperature set point to change often? And if yes, will you set a rate, or will you try to change as fast as possible? Feb 1 at 18:16
• I agree with NMech's observations. If you want a quick fix to the overshoot, reduce the ramp rate and/or low-pass-filter the input. I described some aspects of saturation-recovery logic (aka ARW in an off-the-shelf controller) here. Besides that you should know that PI control will very often overshoot even if not saturated, but it can be fixed with other types of control loops. Feb 1 at 19:50
• Hi, Jakub. Take a step back. Have a read of my answer to Understanding the flow of a PI Controller and see if that clarifies anything for you. Maybe read it twice - once out loud! Feb 1 at 19:50
• @JakubSzlaur, regarding What am I trying to control: nothing. you are just getting a feel for the limitations of the system. Also you can use that graph to setup your PI controller. Also, I would highly recommend Transistor's post. He has a lot of experience in the field (much more than me anyway). Feb 1 at 19:59
• also, what is PWM frequency? the symptoms are consistent with the possibility of PWM being too fast, in which case the triac's zero-crossing behavior would result in bang-bang control at double the power line frequency when not saturated. Feb 1 at 20:27

IMHO the problem you observe is mainly related to limitations of your system.

Notice, that up until 55 degrees C the heating element can follow the gradient of temperature wrt to time.

Just after 55 degrees C, the system is unable to heat fast enough the wooden box. (probably the insulation is not sufficient). So beyond that point, the error accumulated and the $$I$$ term is activated.

If the set temperature changed instantly in most cases you would see the following graph like the following :

However, there are some cases where the system cannot cope with the set point. Imagine driving a small city car, and suddenly deciding to set the target speed to 300 [kph]. No matter, how much throttle you use, you would never achieve that speed. (To be more attuned to your problem, the analogy should be about matching the acceleration, not speed. However, I felt the example with speed is more intuitive.)

Knowing that there are a few things you can try. You can make changes to the the system e.g. you can try to :

• increase the heating element,
• improve the insulation - however the latter might create problems when you are trying to cool things
• set a limit to the heating gradient.

Another path you could take, is to make changes to the PI controller (IMHO the D part for me is not contributing so I wouldn't bother with it). However, I believe that the overshoot is due to thermal inertia in the system. This would be very difficult to overcome, with just the basic PID scheme. I would probably look into techniques like feedforward, which might require some coding.

PS: if you do a step response, you will get a much better glimpse of your system's limitations. (If you haven't already looked at it, have a look at First Order Plus Dead Time -FOPDT- systems and their setting up). You can also post that in your original request so that other people might give you a better answer.

• 1) after 55 degrees C, the system is unable to heat fast enough the wooden box I completely agree with you on this one but at the moment I am unable to upgrade the heating component. 2) improve the insulation I have already tried this and to my skill I can't improve this further. 3) What do you mean by set a limit to the heating gradient.? 4) In the meantime I will look into thermal inertia and feedforward. Feb 1 at 16:50
• + I am not using the Arduino platform. I am using industrial PLC controller. I have rewritten the Arduino library to IEC61131-3 structured text. Because I was uncertain with using the build in PID's when I don't know how they work inside. Feb 1 at 16:52
• Right now you are applying a ramp for the target temperature. The temperature change rate is $\frac{\Delta T}{\Delta t}$. For exampe it seems that the temperature is about 27C at 3:00:00 and 50 around 8:00:00. However, I can't tell if that's hours or minutes. But the rate is $\frac{50-27}{5:00:00}=\frac{23}{5:00:00}=4.6 [C/ time unit]$ Feb 1 at 17:00
• Ok, I hope, the heating gradient is more clear now. My advice is PROVIDED ALL SAFETY AND FIRE PRECAUTIONS ARE GUARANTEED to do an experiment where you turn full on your heating element and see how long it takes to reach an equilibrium, and update your answer to include a graph. Feb 1 at 17:07
• you can try one at 80% or 50% of the full throttle if that will reach above 60C. Just aim get past your working temperature. Feb 1 at 18:10

I suggest that your problem is between the PID (I assume you're using only P & I like 99% of industrial uses) and the physical limitations of your system. Of course you're going to overshoot, because you don't have instant feedback. Air in the box has to mix and then return to the inlet of your measuring point. I seriously doubt it has anything to do with high temperature - it's just the system reaching it's setpoint.

You've also made no mention of how you have attempted to tune the loop. You can measure how your system reacts to setpoint changes and tune accordingly.