LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pid control to cool instead of heat

Solved!
Go to solution

Hi everyone,

 

I had a quick question regarding the PID vi in labview. I am using it in an attempt to cool down a a box (measured with a thermocouple) and maintain it at a certain temperature. The PID controls a fan that changes speeds to cool the box. My problem is that when I ran it, I noticed that it seems to think that in order to cool the box it needs to spin less (in other words not spin). Whenever i set my desired temperature to be higher than the current temperature, the fan would work, but below it would not. 

 

The fan will always be in a setting where the instrument will be higher to or equal to the desired temperature. therefore the fan PID needs to work to push the temperature down, not up. As it is now it seems to think it is more of a heater. Does anyone know how to switch this?

 

Ed

0 Kudos
Message 1 of 5
(5,231 Views)
Solution
Accepted by topic author student530

Try a negative gain factor.  It will invert the action of the PID.

Message 2 of 5
(5,219 Views)

Thanks! That fixed it!

 

Im also interested in learning how/why that works if you don't mind sharing 🙂

 

0 Kudos
Message 3 of 5
(5,184 Views)

It's pretty simple when you look at the math behind PID. Let's start with simple Proportional control. The output is the error multiplied by the proportional gain. Error is the difference between setpoint and the process variable (Temperature, in your case).

 

Output = Pgain x (Setpoint - Temperature)

 

In this case, if the temperature is less than the setpoint and Pgain is positive, the output will be positive. If the temperature is greater than the setpoint, then the output is negative. This works well for a heater - when the temperature is below the setpoint, the output is positive and drives the heater. For cooling it should then be obvious that negating the Pgain will invert the response. When the temperature is greater than the setpoint, the error will be negative, and when multiplied by a negative gain it produces a positive output.

 

If you look at the implementation of the LabVIEW PID (either in the VI or in the manual) you will see that both the integral and derivative gains depend on the proportional gain (both the I and D values are actually times, which are multiplied or divided by P to get the gain), so negating the proportional gain inverts the action of all three components.

Message 4 of 5
(5,175 Views)

Posts like ^^ are why this forum rocks.

0 Kudos
Message 5 of 5
(5,169 Views)