In Part 1, we saw that our system was capable of maintaining 6 psi regardless of how many
valves we opened.
All we had to do was keep adjusting the motor frequency to compensate for the pressure changes.
In this video, we will tell PID to do that for us.
We put the PID setup in the remote configuration, so let’s switch over to that mode.
Remember from our block diagram, when we are in PID mode we can either manually control
the drive’s output or we can have PID automatically control it for us.
Let’s start by manually controlling the motor's frequency.
We set up remote mode’s run/stop to be controlled by a switch – not the keypad like we did
in local mode - so I’ll flip that switch to run.
We set up the frequency in remote mode to be controlled by the keypad – not the potentiometer
– so let’s adjust that to get our system to 6 psi.
And just like we saw in local mode, it takes about 40 hertz to do that.
So everything we did in the previous video in local mode, we could have done using this
manual bypass in remote mode – right?
Yeah, and that’s exactly what manual mode is for – so you can disable PID and test your
system.
Ok, but we want PID to automatically do that for us.
But how do we tell PID we want to be at 6 psi?
The GS20 understands frequency, it doesn’t know anything about psi.
Here’s how that works.
We told PID to use the frequency input as the setpoint.
When we flip over to remote mode PID no longer reads this as a frequency.
It uses it as a percent scale.
That is, it knows the frequency range we entered is 0 to 60 hertz, so if we enter 30 hertz,
it reads that as 50% of full scale.
50% of our 15 psi sensor range is 7.5 psi, so in effect, PID interprets that 30 Hz as
7.5 psi.
We want 6 psi, which is 40% of our 15 psi range.
40% of the 60-hertz frequency range is 24 hertz so that’s what we enter on the frequency
scale to represent our 6 psi setpoint.
The GS20 does it this way because it keeps everything ubiquitous.
It doesn’t matter if you are measuring temperature or psi or what the full range is.
You do everything exactly the same way because it’s all in percent.
Now you can see why I put 0 hertz in for the min frequency. If we had entered something
else here, then it would be 40% of this range.
Great, we are using the remote configuration which is where we put PID, we want to
automatically control the output frequency, and we have specified a setpoint which again
is 40% of our frequency range which tells PID to go to 40% of our sensor range -
which for us would be 6 psi.
I’ll switch to run and sure enough, PID automatically changes the motor frequency to get us to roughly
6 psi.
Why aren’t we at exactly 6 psi?
That’s because our system isn’t linear.
The GS20 has a number of ways to correct for that, but for now, we’ll just manually adjust
our setpoint to whatever it needs to be to get the system pressure to 6 psi.
Looks like it is around here.
I have the scope set up to show the process variable – our sensor value - in blue, the
setpoint – where we want the process variable to be - in green, and the error signal in red.
And we have the output frequency in yellow.
Notice that everything is in percent except the actual output frequency which is still
in hertz.
I’ll run the scope and open a valve and look at that!
The GS20 automatically adjusted the yellow drive frequency to get the blue system pressure
back to the green 6 psi setpoint!
I’ll open another valve and when the blue system pressure drops and PID sees that it
automatically increases the motor frequency again to get that blue system pressure back
to the green setpoint.
Open the last valve - same thing.
Perfect.
We can see the difference between the green setpoint and the blue process variable – which
we call the error signal – down here in red.
PID is always trying to get that difference – or error – to zero.
And it’s doing a pretty good job!
What if I rapidly close three valves like we did in Part 1?
PID sees that and automatically lowers the frequency to get the system back to 6 psi.
Exactly what we expect.
That’s really cool, but it’s taking around 5 seconds to do it.
While that’s a lot faster and more accurate than when we did it manually ourselves in
Part 1, you have to wonder if PID can do better than that.
I usually double P until things start to look unstable and then back off a notch.
Let’s try that.
I’ll start the scope and I’ll open a valve and close it again just to get a baseline.
Now let’s go to Parameter 8.01 and double P. Uh-oh!
What’s happening?
Well, we’ve entered too much gain and the noise in the system is causing things to oscillate.
Let’s change P back to 1.
That’s better, but if I stop the scope and zoom in, we see the system really is still
oscillating
which explains why this digital panel meter’s display is jumping around so much.
So let’s cut P in half.
Ahh, that’s looking better – the oscillations are about gone and the digital panel meter
reading is looking a lot more stable.
But, if I open and close a valve and stop the scope and measure that, the response
time has gotten a lot longer because we reduced the gain.
And remember – that also reduced the I term too because we are using the dependent version
of the PID algorithm where cutting P in half also cuts I in half.
So we need to double the integral term to get it back to where it was to compensate
for cutting P in half.
This is key – remember that in this implementation of PID a smaller I term gives a larger response,
so we really want to cut I in half to double the effect of the integral.
So, let’s go to Parameter 8.02 and reduce I to 0.5 to double the effect of the integral
portion of the algorithm.
Now if we start the scope, and open and close a valve and stop the scope and measure
that, it looks like we are recovering in just a couple seconds now.
So just for fun, let’s double the integral again by cutting I in half again.
I’ll start the scope - and open - and close a valve.
Holy cow!
Looks like PID is recovering from the pressure drop in just a little over 1 second.
That’s great!
The point here is you can fiddle with this as much as you want to get whatever system
performance you need.
And this GSOFT2 scope utility makes it super easy to visualize what’s going on and it’s
completely free – just download it from the automationdirect.com website.
If you are not familiar with GSOFT2, then check out this video where we walk you through
how to set up and use it.
We’ve only scratched the surface of PID in this video and as you can see, there is
a lot to keep track of.
If you would like to see more videos that dive deeper into setpoint options, process
variable options, how to linearize your process variable to get better results, how to reduce
system noise or any of this stuff, then leave a request on YouTube in the comments below
the video.
We use your comments and feedback to prioritize which videos we create.
Meanwhile, click here to see what videos we do have in the video tutorial library, click here to
subscribe to our YouTube channel so you will be notified when we publish new videos and
click here if you want to learn all about AutomationDirect’s free award-winning
support options.