With our PID System configured, it's time to run an Autotune to get the PID coefficients we will need for our system. Before doing autotune it is important that we make sure our system is PID ready so we will characterize our PID system first, then run an autotune.
Resources used in this series can be found here: https://library.automationdirect.com/click-plc-temperature-pid-tuning-resource-page/
Videos in this series:
Configure part A: https://youtu.be/Ak2eFFHkriM
Configure part B: https://youtu.be/f8X7prho8dU
AutoTune part A: https://youtu.be/8T1A0ryIGfo
AutoTune part B: https://youtu.be/bEpbia94W
Manual Tune part A
Manual Tune part B
Bonus: Sizing Fans:
Bonus: Freeze Bias:
Bonus: C-more PID Template part A
Bonus: C-more PID Template part B
In the previous video, we did a PI autotune. Let’s do a PID autotune and see if it’s any different. Here are the steps we need to get a successful autotune. But, since we are already at temperature and everything is stable and we’re in auto mode, we have already done a lot of this so we can skip all of these. All we have to do is just select the PID mode and hit start! I’ll fast forward through the autotune and we see the expected PID tuning cycle. I’ll fast forward through the same temperature steps that we used to test the PI tuning and we got very similar results – EXCEPT for two things. First, notice the PID result gives us a faster transition time and it’s quicker to settle out. You’ll find that in general, the PI algorithm tends to work for most industrial applications. PID, however, tends to work better with temperature applications. The second thing we notice is the output signal looks real noisy! Why is that? The PID algorithm is more sensitive and reactionary than the PI algorithm because of the D parameter, which reacts strongly to fast transitions. But we’re measuring temperature. There shouldn’t be any fast transitions except for one thing, noise. If you see this kind of messy output signal when using the PID algorithm, it’s a good indication that you have a noisy process variable. To prove that, let’s set the process variable filter to 20. Remember, a 100 let’s 100% of the signal fidelity through – including all the noise. The smaller the number the less high frequencies get through. Filter values in the range of 15 to 25 typically work well on most systems. Now that we have filtering in place, I’m going to fast forward through another autotune cycle and our usual temperature steps. Wow, big difference! This is with no filter, this is with Process Variable filtering enabled. I can’t emphasize enough the importance of having a clean process variable. Adding filtering should be the last resort. Try to keep your process variable as noise free as possible in your system design because filtering slows down and delays the PID response. If you do use filtering, keep the number as large as possible to minimize the effect on the PID response. The other way to handle noise is with the hysteresis we saw in the previous video. Let’s tell filtering to pass 100% of the signal, and set the hysteresis to a really small number and let it run for a minute so that we can see that we got the noisy signal back. Now let’s run an autotune. Uh oh – what happened? Autotune finished way too fast. And we didn’t get our usual autotune cycle. And if I fast forward we see that PID output is really struggling to maintain our temperature. I’m going to play with the vertical scaling a bit to zoom in on the signal. Ahh! Look! The noise is BIGGER than our 0.1 hysteresis we set! So autotune saw the process variable cross the setpoint plus the hysteresis, because of the noise, and then it saw the process variable cross the setpoint minus the hysteresis because of the noise several times and it assumed it was done! Of course, that gave us a really bad tuning and resulted in our system having a really hard time maintaining our enclosure temperature. I’m going to zoom out so we see plus or minus 1 degree around the setpoint. Looks like the noise is well within 1 degree, and even .5 degrees so a hysteresis percentage that gives us between .5 and 1 degrees would be great for this system. I’ll zoom back out to our operating range and set the hysteresis to .5 percent and re-run the PID autotune. Fast forward, and now we get the expected autotune cycle. Perfect. But if I zoom back out and fast forward for a few minutes, we see the PID output is still struggling to maintain a stable oven temperature. That tells us we need to add a little process variable filtering. Let’s crank that back up to 20% and fast forward a little bit. Hmm .. things are still a little rough, so let’s use a filter value of 10. Fast forward through an autotune … and fast forward through our usual steps and things are looking much better now. Nice clean setpoint transitions and minimal noise on the output. Perfect. So the bottom line is with process variable noise: first, minimize the noise in your system as much as possible with smart electrical design. Then if you still have issues, adjust your hysteresis to just above the expected noise level. And finally, add a little filtering to quiet things down. The best solution is always a little bit of each instead of a lot of one. Add too much of either will degrade your system's PID performance. Ok, let’s try a couple things. What happens if we cut P – the algorithm gain - in half. Fast forward and we see it takes PID a lot longer to get to the new setpoint and longer to settle out. That makes sense. What happens if we double the original gain? Fast forward through that. Interesting! It gave us a tighter response! But the output is struggling to keep up. Let’s double P again. Fast forward … Hmmm .. an even tighter response, but now the output is REALLY struggling! How are we able to get away with this? Well, it’s because of the D parameter and the form of the PID equation that the CLICK PLC is using. This block diagram in the PID setup dialog shows us that the CLICK PLC uses the dependent version of the PID algorithm. Every time we increase P, it also increases D and I. D has the effect of damping large and fast changes in P. So as we went crazy with P, D grew proportionally to counteract it. For example, I’ll set D to zero and fast forward and you can see what happens. The system starts to oscillate which we don’t want to see. Again, D helps to keep P under control. The point here is, think of autotune as a starting point. It often produces results that will get you up and running quickly and most of the time that’s good enough. But, if you need more performance don't hesitate to experiment. The CLICK PLC makes it super easy to do and as you saw in our little example you can be pretty aggressive with the changes. Try it, you may be surprised with what you find! We’ll cover a lot of the other things you can do in the loose ends video, so be sure to check that out. The bottom line is: Once were confident our system was PID ready, we then put it in manual mode, put our setpoint at the level we wanted to be at, manually drove the output to get the process variable to that level – we knew how much power to apply from our linearity chart and waited for the process variable to stabilize. While we waited, we made sure we were in bumpless mode 2 and populated the PID coefficients with known stable values. We then run autotune, verify you get the three cycles we expect and then run a few tests to verify it works to your satisfaction and you are done! Autotune is great, but if you have a system that has non-linearities or noise that autotune can’t handle, then it’s great to have a manual tuning method in your back pocket for those times when autotune struggles to get you a decent tuning. Join me in the next video where we will show you an easy way to do that. Click here to see all the videos in this CLICK PID series. Click here to learn more about AutomationDirect’s Free technical support options and click here to subscribe to our YouTube channel so you will be notified when we publish new videos.