From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID tuning

Solved!
Go to solution

Hi everyone.

 

I have written a temperature control  program in labview and used the PID toolbox for that.

The input to the PID is the measured temperature and the output is a PWM signal fed to a Relay which turns a heater on and off.

 

The control is working but I want the temperature to be stable within a +-2% range.

Right now the temperature varies more than that.

Iam sure its the tuning of the PID.

 

Because I haven't worked with PID controllers Iam not exactly sure how to tune my system.

The easiest way I found is to zero I and D and make the system oscillate with P.

 

The only problem is that the temperature system is so slow that it takes quite a long time to reach the setpoint which in return would mean a lot of hours of just testing. 

 

Now Iam wondering if there is a faster way to tune the PID controller ? 

 

Thanks in advance , 

 

Best regards , 

Michael 

0 Kudos
Message 1 of 6
(3,919 Views)

For slow systems like a heater, I recommend the Cohen-Coon (or the similar Ziegler-Nichols open-loop) approach. The idea is that you take out the PID loop and manually set the PWM output. Wait until the temperature is stable, then change the output value and again wait until it's stable. Log the temperature and the output the whole time. Then, you calculate some values based on how long it took to reach a new stable value and how much the temperature changed relative to the change in PWM. Details for open-loop tuning methods are easy to find on the web or in the PID toolkit documentation.

0 Kudos
Message 2 of 6
(3,902 Views)

Hi and thanks for the reply!

That really seems like a faster method. 

Do you have any experience regarding the PWM? 

Should I just choose two values like 30% and 70% in example? 

 

I don't quite understand picture 3.4 in the manual. 

Is the Min value where my first chosen output has settled? 

 

Best regards, 

Michael 

 

0 Kudos
Message 3 of 6
(3,883 Views)

Hi again. 

 

One things I have missed to ask. 

If I would take out the PID (or set it to manual)  and set the output to lets say 50% duty cycle ,  wouldn't the temperature just keep rising without the control? 

 

Regards , 

 

Michael 

0 Kudos
Message 4 of 6
(3,864 Views)
Solution
Accepted by topic author MikeSv

I've used this method many times with slow heaters. It can take a long time to reach a stable temperature, but at least you don't need to monitor it constantly as it approaches that value.

 

In figure 3.4, yes, the Min value is the initial stable value. It's OK to start at an initial PWM output of 0, which speeds up the process if your heater is already at a stable temperature (the ambient temperature in the room).

 

In general, the larger the difference between the initial and final output values, the better your control will be (you'll get better results from going from 0 to 50% than to 5%), but it will also take longer to settle at a new value and of course you need to make sure you don't exceed the capabilities of your system. It's a good idea to have a separate alarm system in place than can shut off power to the heater if you exceed some temperature, especially if you plan to walk away from it while waiting for it to stabilize.

 

At a fixed duty cycle, the system will not continue to heat indefinitely unless you have perfect insulation with no heat loss - but, as I mentioned above, you do need to pick a value that won't cause the system to overheat.

0 Kudos
Message 5 of 6
(3,856 Views)

Great, thank you so much for your help. 

Can't wait to get some hands on 

😀

0 Kudos
Message 6 of 6
(3,852 Views)