LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID coefficient tuning

Hi all,

 

I have been trying for the last few days to fine tune my PID temperature controller...have made some progress, but I am still not satisfied and want to see if I can improve things even more.  Basically I am trying to maintain temperature at a setpoint of 80 C, by heating from room temperature.  Right now I can get steady convergence at 3-4 minutes, but I am shooting for a little quicker (heating from room temperature + settling at 80) in around 1` minute or so if possible.

 

The current PID coefficient values that give me the best results are (P = 2, I = 0.5, D = 0.1), and I have attached a Labview-generated Excel spreadsheet showing the results of heating for those values.  I am using a duty cycle of 0.95 at 4000 Hz.  Notice that there are two plots on the spreadsheet...the first one is the heating profile from 0-320 s, and the second one is a full 600 s (10 min) profile.  At 320 s I touched a piece of metal to the heated surface as a temporary heat sink, to see how fast the controller could adapt to the change and regain 80 C (you will notice a slight dip on the second graph at around 320s).

 

But basically, I would like to improve this controller to react a little faster, and I don't know if someone with a little more experience in PID tuning can give some suggestion based on the data values...any feedback appreciated!

 

Cheers,

T

0 Kudos
Message 1 of 8
(3,601 Views)

According to my experience, establishing time of target temperature from starting point depends not only on your pid setting, but also on the configuration of your furnace or hot plate or something like that. Two hints for your further experiments:

1) let heating element always 100% on, to see the maximum heating rate;

2) controlling quickness would drop the controlling quality; when you pursue speed, you have no choice but sacrifice precision. We called "鱼和熊掌不可兼得"in Chinese.

0 Kudos
Message 2 of 8
(3,595 Views)

How did you determine your PID gains - through experimentation, or through a tuning method such as Cohen-Coon or Ziegler-Nichols?  If you have not used one of those methods, I highly recommend trying one of them as a starting point.  For a relatively slow system such as this, an open-loop tuning algorithm is a good start.  You disable the controller, set the output to some fixed value, and record data continuously until the system reaches steady state.  You can then calculate good initial gains based on the rise time and final temperature.

 

Based on your graphs, it appears that your system is capable of reaching the setpoint much faster, and you want to minimize the overshoot.  To do this you'll need a much larger proportional gain and a much smaller integral gain.  If you're using the LabVIEW PID this actually means you to increase the integral time, because the integral gain is the reciprocal of the integral time (multiplied by the proportional gain).  Increasing the derivative gain will also help minimize overshoot, but can make the system sensitive to noise.

 

Also, I don't understand your comment "I am using a duty cycle of 0.95 at 4000 Hz."  What are you varying as the output - the duty cycle?  Are you trying to say that the maximum duty cycle is 0.95?  Why 4khz?  For a heating system like this, that sounds much faster than necessary, but I don't know anything about your hardware.

0 Kudos
Message 3 of 8
(3,585 Views)

Thank you both for your replies.  I ended up taking Nathan's advice and increasing the P value, as well as the I value.  The information about gain being the INVERSE of the time is very helpful, as I would not have known this otherwise.  With some tweaking, I was able to receive much better PID control.  I have attached a different Excel sheet with the new results (Gains values are P = 7, I = 0.6, D = 0.01 in case you are curious) and these parameters cut the converging time in about half.

 

I attempted one of the tuning methods (can't remember the name) which required to get the system to oscillate steadily and then use characteristics of the oscillations to obtain parameters, but I could never get my system to oscillate steadily!  So I kind of gave up on that and resorted to the traditional WAG (wild ass guess) method 😛

 

The duty cycle is updated dynamically, but the value of 0.95 is an initial value.  In that way, I can utilize full power at the beginning (nearly 24 V) and then decrease as the temperature approaches the setpoint.  And I chose 4000 Hz because the H-bridge setup that I am using suggested a value of between 2-8 kHz for the application, but as you can see, that is also a variable that I can tweak as I please 🙂

 

Thank you agin for your suggestions, it was a great help for a novice tuner such as myself!

0 Kudos
Message 4 of 8
(3,534 Views)

thimz wrote:

I attempted one of the tuning methods (can't remember the name) which required to get the system to oscillate steadily and then use characteristics of the oscillations to obtain parameters, but I could never get my system to oscillate steadily!  So I kind of gave up on that and resorted to the traditional WAG (wild ass guess) method 😛


That's why I suggested using an open-loop method such as Cohen-Coon (or open-loop Ziegler-Nichols).  Look it up and give it a try, it's not too difficult and the results are usually good.  One explanation of how to do this is supplied with LabVIEW - see the PID Manual (in the LabVIEW program folder, look for the PID document in the manuals folder).  Look for "Open Loop (Step Test) Tuning Procedure" in chapter 3.  It could be documented more clearly - I find it particularly confusing that they use Proportional Band (PB) and then include a note that says "Proportional gain (Kc) is related to proportional band (PB) as Kc = 100/PB." but you can work through it and figure it out.  Alternatively, search the web, which will bring up pages such as this one, which has a reasonably clear explanation.  It's important to know that the time units for the integral gain are minutes, not seconds (I've messed this up several times, wondered why my tuning didn't work, recalculated with correct units and suddenly it worked).

 

By the way, I wrote a long series of posts in this thread about the details of PID which you might find helpful to understand what's going on.

0 Kudos
Message 5 of 8
(3,532 Views)

@nathand wrote:
It's important to know that the time units for the integral gain are minutes, not seconds (I've messed this up several times, wondered why my tuning didn't work, recalculated with correct units and suddenly it worked).

When you say this, you are referring to the PID VI inputs right?  As in I would take the integral time value calculated in a tuning method and then divide by 60 and take the inverse?  Because I attempted to use the Cohen-Coon method as outlined in that link, and did not get very satisfactory results.  I let my system come to rest at 70 C, and then at 250 seconds, I increased the SP to 80 C and measured the values needed.  My system converged fairly fast to the new SP, so I am wondering if this will mess up the tuning method (since my parameters seem to already work decently).  As in, my t2 and t3 values are about one second apart...and since A and B are both 10 C, I get a K-value of 1.  This is probably okay, but perhaps my units are wrong?  I end up getting P,I,D values of 2.75, 3.55, and 0.577.

 

- T

0 Kudos
Message 6 of 8
(3,525 Views)

@thimz wrote:

When you say this, you are referring to the PID VI inputs right?  As in I would take the integral time value calculated in a tuning method and then divide by 60 and take the inverse?  Because I attempted to use the Cohen-Coon method as outlined in that link, and did not get very satisfactory results.  I let my system come to rest at 70 C, and then at 250 seconds, I increased the SP to 80 C and measured the values needed.  My system converged fairly fast to the new SP, so I am wondering if this will mess up the tuning method (since my parameters seem to already work decently).  As in, my t2 and t3 values are about one second apart...and since A and B are both 10 C, I get a K-value of 1.  This is probably okay, but perhaps my units are wrong?  I end up getting P,I,D values of 2.75, 3.55, and 0.577.


The units of the integral value (PID input) is minutes.  I think it's even labeled as such.  The derivative gain also has a unit in minutes or maybe 1/minutes, I don't remember off-hand and don't have the PID VI open.  You need to use the correct units (so minutes for the I value), as calculated by the tuning procedure, for those inputs.  Internally, the PID VI multiplies the proportional gain and the reciprocal of the I value to get the integral gain.

 

However, you've done the Cohen-Coon tuning completely wrong.  It's an open-loop method, meaning you disable the controller.  You don't set a setpoint in temperature units.  Instead you would start with, say, a duty cycle of 10%, wait until the temperature stabilizes, then increase the duty cycle to 50% (make sure to use values that won't overheat your system when held for a long time) and wait until it stabilizes at the new temperature.  Use that data to determine initial PID tuning values.

0 Kudos
Message 7 of 8
(3,521 Views)

Ah I see.  So basically remove the PID VI and just use a shifting duty cycle to determine the parameters?  I will try that and let you know how the performance is improved.  Thank you.

 

- T

0 Kudos
Message 8 of 8
(3,518 Views)