Learn how the PID algorithms work with hands-on real world demos instead of theoretical math. In this video we will experiment with the PID coefficients to help give you a better feel for how they work together and how to adjust them to give you the best possible PID tuning.
Check out this playlist to see all of the videos in this series: https://www.youtube.com/playlist?list=PLPdypWXY_ROpXvgmlUuKDKViOFFW8YnoV
Download resources used in these videos here: https://library.automationdirect.com/weg-vfd-pid-resource-page/
Check out all of our videos at https://www.AutomationDirect.com/Videos
Or go to the Automation Video Cookbook at: https://www.AutomationDirect.com/Cookbook
To subscribe: https://www.youtube.com/user/automationdirect?sub_confirmation=1
**Prices were valid at the time the video was released and are subject to change.
Let’s repeat the test we did in the Quick Start video with the default coefficients but this time let’s also watch the process variable on an oscilloscope trace. We are at 6 psi and the drive output is at about 33.4 hertz. I’ll open a valve and we see the pressure drop and then slowly climb back up to 6 psi over 10 to 15 seconds. I’ll close the valve quickly and we see the abrupt pressure increase and then it slowly settles out back at 6 psi over 10 to 15 seconds. Each of these divisions is three quarters of a psi so it looks like the pressure dropped maybe a half psi when we opened the valve and rose two and a half psi when we closed the valve abruptly, which makes sense. Opening a valve just relaxes things. Closing a valve quickly creates a very sudden change in the process so you get that big jump in pressure. To optimize that I just double the gain until the response starts to oscillate. The gain is in parameter 931, so let’s double that to a 2. Now if I open that same valve we have a much faster recovery time. Cool. BUT, when I close the valve the recovery drops past 6 psi by about a half a psi so now it takes longer for a valve closing to recover. Interesting. Let’s double P again to 4 and open a valve. Wow, the valve opening recovers in only one and a half seconds! But the valve closing is now overshooting the 6 psi goal by over 1 psi so it is taking even longer to recover. If you don’t have abrupt valve closings, then this won’t be an issue and a P of 4 would work great for you. We’ll assume we do care so let’s keep going and double P again to see what happens. I’ll open the valve and wow, the system recovered so fast the pressure drop is almost non-existent. But the abrupt valve closing is now causing a 1.5 psi overshoot. And worse, we are starting to see some oscillation showing up in the recovery. When you start to see oscillations like this, you know you are pushing things too hard and it’s time to back off to the previous setting. Just for fun, let’s ignore that and double the gain again to 16. Uh-oh, now the whole system is starting to oscillate. The gain is set so high that the noise is forcing PID to overshoot in one direction and the correction is overshooting in the other direction so the system can’t ever settle out. This is an unstable system. If I open a valve you can’t even see the pressure change because the oscillations are so bad, and when I close the valve we see the expected response. This system is on the verge of falling apart, so just for fun let’s push it even harder and double the gain again. If I turn up the sound, you can even hear the water pulsing. OK, enough of that. I’m going to turn the gain back down to something stable like a 2 before something breaks. I’ll open... and close a valve and sure enough we are back to our super stable reasonable response. I kinda like this because it is faster than the 10 to 15 seconds we were seeing with the default PID values, and the overshoot here isn’t any worse than the pressure drop here. That’s a pretty good compromise. Ok, that gives us a good feel for how P affects things. How does the I term affect things? Let’s go to parameter 932 and find out. The default I is 5. Let’s turn it off by entering a zero. Uh-oh. What happened? Our pressure dropped by over 3 psi. Well, that’s a key point to understand about PID. The P term by itself can never get you all the way to your target because once the error gets really small, the P term becomes too small to affect change in the motor speed. Some systems P-only will get you really close, but in pumping systems like this one the effect is really pronounced. The way we get around that is by adding the I term. I’m assuming you are familiar with this diagram which just says measure the current process level – our system psi in this example – and compare it with where you want to be – the setpoint. If there is a difference, or error, then modify the output of the drive to compensate. How much we modify the output is determined by this guy. What’s in that box depends on the type of PID your system is using. In the automation industry there are lots of variations, but the two most common are: the independent or parallel version of the PID algorithm, and the dependent or ISA version of the algorithm. You will find the independent version in a lot of modern digital controllers because you can adjust each term independently without affecting the others. Most industrial controls tend to use the dependent version because it works a lot like the old analog systems where when you change the gain of the system, it also changes everything else. The WEG PID uses the dependent version. And that’s important because every time we doubled P in the previous example, we were also doubling I and D which is currently set to zero. And we can use that to our advantage. P just multiplies the error by a gain and uses that to increase or decrease the output. As we just saw, the problem is once the error gets small, the P term doesn’t have any effect. The I term sums all of those little errors that are too small for P and when that sum gets large enough, it pushes the process to the ultimate target. In the WEG PID implementation, increasing the I coefficient increases the effect I has. In some systems decreasing the I term increases the effect. So, it’s important to know which kind of system you have. Let’s see how that works. I defaulted to 5, but what happens if we set it to a 1? Look! It is summing all of those little errors and slowly pushing our process towards the target. I’ll speed that up so we don’t have to wait and it took almost a minute to get to our 6 psi target. I’ll change I back to the 5, open … and close the valve and sure enough we get the faster response we expect. Ok, let’s double I to 10 and open and close the valves. Ahh, look! The I term seems to be the one that’s impacting the overshoot on the valve closing! And since we were doubling it every time we doubled P, it kept getting worse! So that begs the question. Could we reduce I and increase P to get a faster response with a smaller overshoot? Sure! Let’s cut I in half and run a quick test. Yep, no overshoot, but it is taking about eight or nine seconds to settle. Now let’s double P – which is also doubling I back to its original value - and sure enough we are now settling in 2 to 3 seconds and have minimal overshoot on the valve closing with no oscillating on the response. That’s a pretty solid compromise. Keep in mind this is how my system reacted. Yours will be different, but hopefully now that you see what the coefficients do and how they work together, you will be more comfortable with trying to optimize your system. What about the D term? It’s rare that you will ever need the D term in an industrial application that uses AC motors. The D term is more important in high speed application like robotics, and also temperature. It allows you to push the P and I terms right up to being unstable because the D term moderates fast changes. It looks at how fast things are changing and slows them down a little when they get too large. The point here is start with the recommended default values in the WEG programming manual and then don’t be afraid to try experiments like this. It’s how you learn what your system is capable of and how hard you can push it to get the best possible performance. But what if you don’t have an oscilloscope? Well, guess what? The FREE WEG Programming Software has a built-in PID wizard that displays the process variable AND the setpoint AND the control output in real time for you! No O-scope required! You just need a communications module for the drive so the WPS software can talk to it. How about that! Hopefully this video gave you a better feel for how PID works in a WEG Drive. Click here to see all of the videos in this series. Click here to subscribe to our YouTube channel so you will be notified when we publish new videos and click here to learn about AutomationDirect’s Free award winning support options.