Learn how to setup and tune a PID loop in a GS4 Variable Frequency Drive (VFD). Video series VFD PID Demo Part 1: 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.
In the first video we setup the drive and did some system testing In the second video we Learned how important it is to get a clean feedback signal, and then we setup PID using the trial and error method. In this video we are going to setup PID using some formulas that don't require all the trial and error guesswork. Before we can do that, we need to linearize the system feedback. It’s really important to understand that PID works best when the manipulated variable tracks one for one with the Process Variable That is, when the Frequency output is at 50%, the feedback signal is at 50%. When the Frequency is at 60%, the feedback is at 60%. Etc. It will be rare that you get a system that cooperative and as we saw in the first video, ours is no different. Let’s take a couple quick measurements and see where we stand. Normally you would turn PID off and simply vary the drive frequency and watch the result on the feedback signal. BUT, that would require entering the frequency in Hertz and then converting it to percent. And since we already have PID setup with P, I and D all set to zero, this stuff isn’t doing anything. So, we can just modify the output frequency by adjusting the offset – and it is already in percent so we don’t have to do any conversions. We know from the first two videos that the drive needs to operate in this frequency range to maintain a system pressure of 6 psi. That’s this percentage range so how about we run our measurements from 45 to 70 percent of the drive’s 60 Hertz range. Let’s monitor the feedback signal using the GSOFT2 Scope Function. Start recording and set the drive frequency to 45%, 50%, 55%, 60%, 65% and 70 percent. You might want to use finer steps, but for our demo every 5% is fine. Now we can read the process variable level for each step. If I bring up a spreadsheet, enter my frequency percentage range in the first column, and make the second column equal the first column – we’ll call that “line” and do a scatter plot we get the straight line we would LIKE for our system to be. Let me modify the chart axis just a bit to show just the range we are interested in. That’s better. Now if we enter measured feedback in percent, copy that column and paste it into our plot, we see our system is nowhere near linear. So, let’s modify the measured data by a slope and an offset. So, our modified data will be this guy times the slope plus the offset. And we need to make sure those are fixed values so I’ll put dollar signs in here. And repeat that for all rows. Copy that column and add it to the plot. If we bump the offset up a little bit we see our new data moves away from the measured data. I’m just going to mess with the slope and offset until I get a line that is as close to the straight line as I can. That’s pretty good. So, by multiplying the feedback signal by this slope and adding in this offset, we get a new feedback signal that is close to linear over the frequency range we care about. That will make PID really happy. Now we just take those and put them in Parameter 4.12 which is the slope – or gain for analog input 1 … and parameter 4.10 which is the offset for analog input 1. Parameter 4.11 enables that offset – don’t forget that one – the offset won’t work without it! Ok, the feedback signal in percent should now be tracking the output frequency in percent. Let’s see if it is. If we go back to the main screen, we see that the feedback signal is now roughly 51.8% which is exactly what our current offset is. Perfect! If we bump that offset up to 56% and then to 61%, then we see on the scope that the feedback signal also went to roughly 56 and 61 percent. Exactly what we want to see. A reasonably linear system where the feedback signal tracks one for one with the frequency output signal. If this blue frequency trace wasn’t in hertz and it was in percent? Then guess what? We would see that laying right on top of thit yellow feedback signal trace, wouldn’t we? Now, because we changed the feedback signal, we need to change the Setpoint, right? Before we knew we needed 40% here because 40% of the sensors 15psi range is 6 psi. So we put 24hz here which is 40% of the drives frequency range. That doesn’t work anymore because we modified the feedback signal. So, what should this be? Well, we know we need 51.8% here to get 6psi with one valve open, right? And we just linearized the sensor feedback to basically match the drive frequency in percent, so we need 51.8% here too. Which is this in Hertz. That’s easy – whatever we put here, we also put here. Now that we have a linear system, we can do the Formula method for PID. To do that we just measure a couple things, plug them into a formula and we are done. And the best part is we do all of this open loop – that is PID is NOT enabled during these measurement’s so you are not risking sending your system into oscillation! Normally you start this process by measuring the process gain, which is how much does the process variable change when we change the manipulated variable. But since we just linearized our system so a change in the manipulated variable gives us the same answer in the process variable, our process gain is 1. So we can skip that step. The next step is to verify your hysteresis. That is, does the process return to its original value when you step away and back again? We know ours does so our hysteresis is zero and we can skip that step. For these two guys, you step the frequency output and make measurements on the feedback signal. We just did that a minute ago when we verified the modified feedback signal linearity, so let’s bring that plot back up and use it for our measurements. We only need to measure two things: When do we reach 25% and 75% of the desired output. We see the difference between one step and the next is this, so 25% of that is this and 75% is this. We just move the cursor to the 25% level and note the time and move to the 75% mark and note that time. Given those measured values, we calculate the Time Constant using this formula, and the Dead time using this formula. And given those, we calculate the three numbers we need using these formulas. The process gain is 1, but what are these A and B numbers? For those, you go to this chart and pick the ones you want. First you choose which algorithm you will be using: P only, P and I or P, I and D. We’ll use the P and I row so we have an apples-to-apples comparison with the previous video that didn’t use D. Do we have a system that has a changing load or changing set point? We are changing the load – we are opening and closing valves. So that means we want these A and B constants. Plug everything in and we have our answer. I used this spreadsheet that does everything for me. I just enter the two measurements here and I get the PID numbers here. Easy. Wait a minute … this P value is DOUBLE what we got in the last video. In that video the system went berserk at a P of 4 and was starting to oscillate at 3.5, so we backed off to a P value of 3. How can this possibly be right? Well, I triple checked my measurements and number crunching, so let’s just give it a shot. Go to parameter 7.13 and enter P, then go to parameter 7.14 and enter I. I’m going to re-zoom everything so we can see the whole picture – start recording - and open and then close the valves. Holy cow. That’s gorgeous! The drive is now automatically adjusting the blue output frequency to maintain the yellow system psi at our green setpoint. And all we did was linearize the system and take two open loop measurements. That’s incredible! So ... why did this large P work here but it didn’t work in the previous video? Because we linearized the feedback signal. Remember we said PID REALLY likes to have a linear system, right? Well, now you see the dramatic result. Would we have gotten similar results in the previous trial and error video if we had linearized the system first? Sure! Looks like I needs to be more aggressive, let’s take it all the way down to the same number we had in the previous video. Run that, and open the valves ad close the valves. Yeah, that looks a lot better. Why did we have to adjust I? Because we had filtering turned on when we did our measurements. You are supposed to turn that off before doing the time measurements, but our signal was so bad I skipped that step, and I knew I could just adjust I when we were done. So, you must be wondering, where did these magic formulas come from? This presentation was an adaptation of something called the PID Blueprint. Now BEWARE! That is NOT an AutomationDirect product so please don’t call Tech Support and ask any questions about it – they won’t be able to help you. Instead go to this website to learn all about it or contact the author. I do need to warn you – don’t try what I did here on any random PID tuning process. What you saw here was tailored for this project. The PID Blueprint is a much broader scope and covers a much wider range of PID loop styles. I plan to do some more videos showing the other PID variations in the future so be sure to click here to subscribe to our YouTube channel so you will be notified when those are published. Click here to learn more about the GS4 family of variable frequency drives and click here to learn about AutomationDirect’s Free award-winning support options.