Learn how to setup and tune a PID controller loop in a GS4 Variable Frequency Drive (VFD). Video series VFD PID Demo: Part 1: VFD PID Setup and System Test; Part 2: Sensor signal filtering and Trial and Error tuning; Part 3: System Linearization and Formula method for tuning; Part 4: Loose ends
where we back up and cover things we glossed over in the previous three videos.
Check out all of our videos at https://www.AutomationDirect.com/Videos
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.
These are the things we glossed over or skipped in the previous videos that we will cover in this video. When we setup PID we had to choose between independent or dependent PID implementations. We chose independent because it which makes tuning the PID loop much easier. In the dependent mode the error is multiplied by P and then that is passed to I and D. Which means every time you adjust P, you have to go back and adjust I and D. So, I and D are dependent on P. This is how the old analog systems worked, where P is essentially the system gain. So every time you adjusted the System gain, it changed how I and D worked. If given the choice you will almost always want to choose the independent mode so you can adjust each parameter independently. While we are here let’s review these extra parameters that we didn’t use in the previous videos. This one prevents the integral from getting too big. This is especially helpful if you have long integral times. For example, If I set the I parameter to 1 second, and start the drive with PID enabled, we see PID forcing the drive to its max frequency to get the motor moving. And because the integral summed all of these large error values the system pressure went way past the setpoint we wanted and then eventually settled out once the large values aged out of the sum. Since the normal errors are in the 3 to 4 percent range, let’s limit the integral to 5% and run the test again. Now the integral doesn’t get so big and the system can react much quicker to changes. While we didn’t use it in our demo, this is something that you will almost always want to use in your system. And while there isn’t a PID specific lower frequency limit, you can limit the lower frequency using the drive’s lower frequency limit Parameter 6.26. Most of the time you will want PID to speed up or slow down the drive to compensate for load changes. It is rare that you will want it to change the motors rotation direction. So, this parameter limits the drive to only run the motor in one direction. That way if PID goes nuts, your system won’t be inadvertently slammed into reverse which could damage a lot of things. If you do need PID to control both directions, then change this to a 1. Parameter 7.21 determines what the drive should do if it loses a 4-20mA feedback signal. When the drive sees there is no current flowing for a period longer than the time in parameter 7.20, then it can continue, ramp to stop, coast to stop, operate at the last known frequency, or issue a warning and run at whatever frequency you put in parameter 7.22. This feature is turned off if parameter 7.20 is a zero and of course it doesn’t work on voltage inputs. The GS4 allows you to limit the PID output frequency. For example, when we start the drive, the Output frequency goes straight to the full 60Hz to try and force the motor to get up to speed as quickly as possible. But, maybe you want to limit the stress on a motor or system. If we set the max output frequency to 75%, then sure enough the maximum output PID is allowed to use is limited. Of course, that also limits PID’s ability to perform so it takes longer to achieve the desired result. The D parameter dampens fast transitions. You can see that in the spreadsheet from the previous video. We used the PI numbers, but look over here at the PID numbers. P is larger, because we added D to dampen any overshoot. This is the step response from the previous video with only P and I … and this is the step response with the P,I and D numbers from the spreadsheet. In our system it really doesn’t make a lot of difference, but it does start to introduce a little oscillation, so we it’s really pushing to the edge of instability. The D parameter is usually not worth messing with in drive applications, but if you need to full optimize your system, then know you have the option available. We saw in an earlier video that the feedback signal in our demo had a lot of noise. Why was that? There are a bunch of noise reduction techniques mentioned in chapter 2 of the user manual, but none of those were the problem here. The problem was system design. If you look at this the feedback sensor is located right next to a junction that was generating turbulence. It’s also in the main flow of the water. By adding a stub pipe like this, you can get the sensor out of the main flow so it’s not getting beat to death by the water. I wired the second sensor to analog input 2 so we can compare side by side. For the record, I had to switch the terminal board switch for analog input 2 to volts, and I setup analog input 2’s parameters like this. And look how much the noise is reduced simply by putting the sensor in a better location. The rule of thumb I like to use is place the sensor at least 5 pipe diameters way from any turbulence generating junction. So, if this is one pipe diameter, then we should place the sensor somewhere around here. But just for fun, I used this clear PVC so we could see what the water flow is doing. Here you can see the PVC flecks I put in the water screaming by, but down here they are just gently floating around. So really, we probably could have put the sensor someplace up here and been fine. One other thing I was curious about was how does this stub pipe get filled when it is empty? Well, here is the answer. It fills and settles out rather quickly. Cool. When you do need to use filtering to calm a feedback signal down, make its duration as short as you can. Why? Because in addition to smoothing out the feedback signal it also delays and slows down the process. Here we see one sensor with no filtering and the other with the quarter second filter we had in the previous videos. It does filter out the noise, but look how much longer it takes the filtered signal to reach its level. If we increase the filtering to half a second it looks even worse and at a filter length of 1 second the signal is almost un-recognizable. So be really careful when using filtering. Filtering should really only be used as a final tweak and a last resort AFTER proper system design and wiring has been done. Filtering really shouldn’t be used as a total noise solution. Acceleration and deceleration ramps override the output frequency and make it difficult for PID to operate. For example, Here is the step response from the last video. And this is what it looks like with a 1 second acceleration and deceleration ramp. Here it is with 2 second ramps and again with 5 second ramps. The ramps completely destroy PIDs ability to adapt to the signal changes. Now I know some folks use small acceleration and deceleration values to dampen oscillations, but honestly, if they are having to do that, then they probably didn’t tune the loop right in the first place. In all of our demos we used the GS4 drives native percent units. You can change that to show the setpoint and feedback results in psi or any other units you want. You just set parameter 8.00 to show the feedback – we had already done that in the previous videos so that’s fine. Parameter 8.01 to decide what should appear at the top of the display – frequency setpoint is what we want, so that’s fine. Parameter 8.02 sets the units you need. In the user manual you ju st look up the code for the units you want. We want psi with 2 decimal places, so we go to parameter 8.02 and enter that. And finally, use parameter 8.3 to set the range. This one is a little tricky because we have been adjusting the gains and offsets. I usually just mess with this until I get what I want. Let’s try the sensors max value of 15 psi. Now we know this setpoint should read 6 psi, so 15 wasn’t the answer, was it. How about 10 psi? Nope too low. Well, given these data two points, we know the slope of the line is this, and if I use one of the data points we get the offset is this. Given that equation of a line, we just tell it we want 6psi and it tells us the max value we need is 11.6. So, I’ll enter that into parameter 8.03, and sure enough, my setpoint is now showing 6 psi and when I run the drive I can see the process variable, or feedback, is tracking at 6 psi, even when I open and close the valves. Cool. One caution, setup PID using the percentages THEN convert to your units. Converting to units first, just adds one more level of complexity that you really don’t need when setting up PID. I should also point out that this only worked because we had linearized the system so both the process variable and the setpoint were on the same scale. So be sure to linearize your system like we did in the 3rd video if you want this to work. The most common PID applications are integrating and self-regulating. In the last video we did a self-regulating example. That’s where when you run the motor at a fixed frequency, the feedback signal rises to a value and levels off. In an integrating PID loop the feedback signal will continue to rise while the motor runs at a fixed frequency. For example, when filling a tank – the motor runs at a fixed frequency and the fluid level in the tank continues to rise – it never levels off. I’m hoping to do a video showing how to tune an integrating loop and a bunch of other PID examples so be sure to subscribe to our YouTube channel so you will be notified when those are available. Click here to learn more about the GS4 drive and click here to learn about AutomationDirect’s free award-winning support options.