Learning PID loop tuning from an expert
Hands-on experience helps accelerate the PID learning curve.
Soon after graduating from college, I got a job at a chemical plant as an electrical and instrumentation technician. Being a young guy with little experience, my supervisor paired me up with a grizzled veteran named Tim. Of the many things I learned from Tim, one of the most valuable was a simple process for tuning a proportional, integral, and derivative (PID) control loop. I learned about basic control systems and how they worked as part of my education. Unfortunately, all of my experience with PID loops had been in textbooks. I never had the firsthand experience of tuning a PID control loop in the field.
My first chance at tuning a PID loop came during a trip with Tim to the ethylene production area on the west side of the chemical plant. An operator in the ethylene control room had placed a trouble call for a 500 gal chemical tank that was not maintaining an accurate level (see Figure 1). Tim reminded me that PID control loops can be found in a variety of applications that require constant control of liquid level, pressure, flow, temperature, or tension, to name a few. In this case, the operator was trying to keep a constant level in a 500 gal chemical additive tank that was a part of a chemical line process, but it was not working properly (see Figure 2).
First things first
The first thing Tim taught me about PID control systems was the basic components. “The first thing you need is a setpoint signal,” he said. In our situation, the setpoint signal was a 0-10 Vdc signal from a potentiometer in the control room that the operator used to set the level he wanted to maintain in the tank. “The second thing you need in your system is a feedback signal,” said Tim. The feedback device in this case was a liquid level transducer that provided a 4-20 mA signal based on the level of the liquid in the tank. Tim explained that the last item required in the system is the actual PID controller.
Although it has been quite a few years since I graduated from college, at that time, the controller was a self-standing module that received the setpoint and feedback signals and performed the PID number crunching. It provided a 4-20 mA output signal that controlled a valve that fed the tank. It also had a built-in small strip chart recorder that showed the liquid level over long periods of time. You can still purchase stand-alone PID control modules today, but the software can also be found in VFDs, and most commonly in PLCs and building control systems (see Figure 3). PID control loop software can be found inside of the PLC that runs an entire control room and provides a sophisticated graphical look of the entire control system on a variety of monitors and control desks. Even though today’s PID graphics look much better than that old strip chart recorder, the PID control method used today is basically the same.
The proof is in the testing
When we got to the job site, the first thing we did was test the liquid level sensor, which provided feedback to the controller. After a few minutes, we determined the sensor was in good working order because it provided 4 mA at low level and 20 mA at high level. The next thing we checked was the setpoint signal. Tim stood in the control room and adjusted the potentiometer from minimum to maximum while I measured the signal where it connected to the PID module. The potentiometer was functioning properly and measured 0 Vdc at minimum and 10 Vdc at maximum. The last thing we checked was the valve itself. We connected a small variable milliamp supply that provided 4-20 mA to the valve and watched it open and close without a problem. So the culprit in our nonfunctioning PID control system appeared to be the PID module itself. A quick trip to the parts depot provided us with an identical replacement module and we headed back to the ethylene control room. I figured we would swap the module; adjust the proportional, integral, and derivative selector switches to the same settings as the old one; do a quick test of the system; and be back at the shop in time for lunch.
The PID module we used had three selector switches on the side: one for the proportional gain setting, one for the integral time setting, and one for the derivative time setting. In most cases, we would have set the selector switches on the new module to the identical settings of the old module and called it a day. But Tim thought we could improve on the performance of the control loop and saw a chance to teach me some of the finer points of PID loop tuning.
PID optimization experiments
In our experiment to obtain the optimum settings for the PID control loop, we set the integral and derivative times to zero. The factory setting of the proportional gain selector switch was 1.0, with a maximum of 2.0, a minimum of 0.0, and adjustment points broken into 0.25 increments. We adjusted the proportional gain selector switch to its lowest nonzero setting of 0.25. The proportional gain is a simple multiplier with higher settings increasing the response and lower settings reducing it. By adjusting the integral time and the derivative time to zero, we took the integral and derivative effects out of the control loop and would see only the effect of the proportional gain setting. Tim’s first lesson for me was to work on only one adjustment at a time. “If you start making changes to all three controls at once, you can easily get disoriented,” he said.
We started the system with the tank empty and a setpoint of 50% full. We watched the liquid level indication move slowly toward the 50% setpoint on the strip chart as the tank filled. It took a little more than 10 min for the liquid level to reach the 48% mark and maintain that level. We felt that the result of our first experiment was not acceptable. While the liquid level never overshot the setpoint, which was a good thing, the gain was set so low that it took a very long time to fill the tank to its setpoint. Also, the liquid level came close to the setpoint, but it never really reached it. Tim explained that it is typical to have some error—2% in this case—when running a control loop with only proportional control. This error is called offset.
Next, we adjusted the proportional gain setting to 0.50 and ran the experiment again. This time, the liquid level reached the 50% setpoint in a little more than 2 min, but the level shot right past the setpoint and reached 55% before it corrected itself and headed back down toward 50%. As I watched the strip chart, the liquid level signal oscillated back and forth between 52% and 48% for the next 2 min, reducing the overshoot with each cycle, and then settled just below the setpoint at about 48%. We were happy that it took only 2 min for the level to reach the setpoint, but were disappointed with the overshoot and the oscillations.
For our next experiment, we adjusted the proportional gain to 0.75. This time the liquid level reached the 50% setpoint in a little less than 1 min, but the overshoot reached 70% and then oscillated between 60% and 40% for 4 min, reducing the overshoot with each cycle, and then settled just below the setpoint at about 48%. It appeared that this adjustment was taking us in the wrong direction, so we changed the proportional gain setting back to 0.50. Tim’s second lesson for me was: the proportional gain controls how quickly the process races toward the setpoint. “If you set a very high gain, expect to reach your setpoint quickly but be prepared for the possibility of drastic overshoot and oscillations,” he said. “If you set a very low gain, you can prevent the overshoot, but it may take a long time to reach your setpoint. Start with the integral time, derivative time, and proportional gain all at zero. Then increase the proportional gain value in small increments until oscillations occur, then reduce the setting.”
The next thing we did was to add some integral time into the control loop. Tim explained to me that integral time was like an “error eater” and would go to work on eliminating some of the oscillation we had experienced. He also said that adding some integral time would get our system to actually track the setpoint and eliminate the offset we had experienced earlier. The factory setting of the integral time selector switch was 50 sec, with a maximum of 100 sec and a minimum of 0 sec, and adjustment points divided into 10 sec increments. Hoping to improve on the performance, we adjusted the integral time selector switch to 10 sec and ran the experiment again. This time the liquid level reached the setpoint in about 2 min, but continued to increase to about 70% before correcting itself; then it continuously oscillated between 60% and 40% and never stopped. The overshoot had stayed the same, but we had picked up a ringing oscillation, which meant the short integral time was making the system unstable.
We adjusted the integral time selector switch to provide 30 sec of integral time for our next experiment. We ran the system again and the liquid level reached the setpoint in about 2 min, but continued to increase to 55% before correcting itself. The liquid level signal oscillated between 54% and 46%, reducing the overshoot with each cycle, and then settled at the setpoint of 50% within 1 min. While the loop performance was much better than our last experiment, the biggest difference was the time it took for the system to stabilize. Earlier, when we used proportional only control, the system had stabilized in 2 min with an offset error. In this experiment, the oscillation was gone in about a minute without an offset error.
We ran the experiment again with the integral time set at 50 sec and watched as the liquid level reached the setpoint in about 2 min and overshot to only 52% before correcting itself. The liquid level signal oscillated between 52% and 48%, reducing the overshoot with each cycle for about 10 sec, and then settled at the setpoint of 50%. This adjustment had produced some very good results, we were happy with the progress that we had made, and I realized we would be back at the shop before lunch after all. Tim’s third lesson for me was that the integral time acts like an error eater. It can help reduce the oscillation time and remove the offset, but mis-adjustment can cause an increase in overshoot as well as lead to the system having oscillations. Increase the integral time value in small increments until the oscillations and the offset have been eliminated.
The last adjustment was for the derivative time. Tim explained that the derivative time acts somewhat like a braking system to help prevent overshoot. However, if derivative is misadjusted, it could severely reduce the responsiveness of the system. We thought for a second about the experiments we had run that morning and how we had systematically improved the control loop’s performance. In many PID loops, such as HVAC systems, the derivative control is not used because a little overshoot typically would not produce detrimental effects. But in situations where overshoot could be dangerous, derivative control can be useful.
With our last experiment showing only a 2% overshoot and oscillating for only about 10 sec, we thought we had done a pretty good job of tuning the PID loop. But we thought we should try one last experiment to see if we could do even better. The factory setting of the derivative time selector switch was at the minimum, 0 sec (disabled) with a maximum of 5 sec and adjustment points divided into 0.5 sec increments. I adjusted the derivative time to the 0.5 sec setting on the selector switch and we ran the experiment again. We watched as the liquid level reached the setpoint in about 2 min, smoothly rolled into the 50% setpoint with only a hair of overshoot, showed one small dip below the 50% mark, and then tracked the setpoint perfectly. This was by far the best performance we had seen from the liquid level PID control loop that morning. I adjusted the liquid level setpoint to 60% and watched the system correct and track accurately. Then I reduced the setpoint to 40% and saw the same results. Tim’s fourth lesson for me was that the derivative time provides a braking action to the control loop and is not required in most applications where a little overshoot is allowable. If it is needed, derivative control can reduce overshoots but could also lead to a lack of responsiveness. Increase the derivative time value until the response to process changes is optimized.
Happy with the performance of the PID control loop, Tim and I packed our gear and headed to lunch. It has been a number of years since I worked with Tim, but this experience is one I have always remembered. Using the basic techniques he taught me has helped me tune PID control loops in a number of applications.
Tim’s PID control loop rules of thumb
- Work on only one adjustment at a time. If you start making changes to all three controls at the same time, you can easily get disoriented.
- Proportional gain controls how quickly the process races toward the setpoint. If you set a very high gain, expect to reach your setpoint quickly but be prepared for the possibility of drastic overshoot and oscillations. If you set a very low gain, you can prevent the overshoot, but it may take a long time to reach your setpoint. Start with the integral time, derivative time, and proportional gain all at zero. Increase the proportional gain value in small increments until oscillations occur, and then reduce the setting.
- The integral time acts like an error eater. It can help reduce the oscillation time and remove the offset, but improper adjustment can cause an increase in overshoot as well as lead to the system having oscillations. Increase the integral time value in small increments until the oscillations and the offset have been eliminated.
- The derivative time provides a braking action to the control loop and is not required in most applications where a little overshoot is allowable. If it is needed, derivative control can reduce overshoots but could also lead to a lack of responsiveness. Increase the derivative time value until the response to process changes is optimized.
John A. Autero is the manager of technical training services at Yaskawa America Inc. He has been involved with industrial automation for more than 28 years, 25 of which have been with Yaskawa. He developed the Yaskawa Engineering Summer Intern and Co-Op Program, and advanced Yaskawa’s Technical Training Services into an IACET Authorized Provider to offer CEUs for its students. He holds a BS in industrial engineering technology from Southern Illinois University.
– See other articles from the supplement below.