Friday, June 11, 2010

PID Tuning

Just about all of our products here at Bemco involve a PID control loop somewhere. Whether you're controlling temperature, humidity, vacuum or flow odds are a PID loop is behind it somewhere. For those of you who aren't familiar, a PID control loop is a method of calculating an output (throttle), based on an input (process value) and a set point. An example that most are familiar with is cruise control on a car, the input is the speedometer, the output is the gas pedal, and the set point is whatever you set your speed at. Your car's electronics use a PID algorithm to calculate the gas pedal's position based on your speed and the set point.

PID stands for proportional, integral and derivative, these are the three parameters that are used to make the calculation. In simple terms, the proportional band looks at where the system is currently, the integral band looks at where it has been, and the derivative looks at where it's going. Let's apply this to the cruise control example. Say your speed is set at 50mph and you're currently traveling at 30mph. With a proportional setting of 10mph, your car will floor the gas pedal until it gets within the proportional band (40mph to 50mph). Once it reaches the proportional band it will decrease the throttle proportionally, so if you're at 45mph, it will throttle at 50% because you're half way through the proportional band. The problem with proportional control alone is that
the car will stabilize at some speed slower than your set point (maybe 46mph). At 50 mph, proportional control will call for 0% throttle, and we know from experience that to maintain 50 mph we need to have some throttle (proportional control alone does work in cases where drag / friction doesn't apply). This is where integral comes in. This parameter looks back in time by a settable value (fixed in car electronics). If that value is 30 seconds, the controller will calculate how are off the car has been from its setting over the last 30 seconds, and increase the throttle to compensate for it. The derivative band is also set with a value of time, but looks into the future that far. It calculates how fast the car will be going based on its current rate of acceleration, and will decrease the throttle if it will overshoot the setting of 50 mph.

The hardest part is coming up with PID settings that lead to stable control of a system. Every chamber or chiller that we build here at Bemco is so different from the last that they all require different settings. I've come up with my own version of the Ziegler Nichols tuning method that seems to work for most of our products:

Start with I & D off (off = 0) and a large proportional band (maybe 25F for a temperature application). Enter a set point and observe the system's response. Gradually decrease the proportional band in small increments, and each time enter a new different set point (different by several times the proportional band, in our case maybe 70F) to observe the system's response. Eventually, when the proportional band is small enough, the system will oscillate around the set point in a continuous sine curve shape. For instance if your set point is 100F and the chamber bounces from 107F down to 93F and back to 107F repeatedly. Once this is noticed, record the proportional value that caused this as well as the cycle time (peak-to-peak) of the oscillation.

Use a proportional setting of 2.5 times the value recorded above, and use an integral cycle of about 80% of the cycle time recorded above (remember integral is typically entered as cycles / minute in most controllers). Derivative is typically not needed in most of our equipment, however some can be added to minimize overshooting if desired.

We do our best to tune our controller's here at the Bemco factory, however often times we are unable to simulate the exact dynamics of the customer's application. For instance if your testing a massive part with a large thermal mass. In other cases the customer's application changes, and so must the PID parameters. For this reason I thought I would share this technique. For more information visit the Bemco website at www.bemcoinc.com



1 comment:

  1. Interesting article. I enjoyed the section on tuning a PID controller and will utilize it if necessary when I set up my system. I have analyzed PID controllers to generate system response curves but have never really thought about how to tune the system to achieve desireable performance.

    ReplyDelete