In the previous video,
we measured our systems dead time and time constant and built our simulation by inserting a PID instruction and setting up the process
simulator. We left the simulation running but not doing anything because the PID coefficients were all zero.
Now remember, the simulator only runs for sixty minutes at a time. Why?
Because it's a real PLC that does everything a hardware Do-more plc does and it can even communicate via the PC serial port.
Since Do-more designer is free, the time limit just prevents folks from using it as a free PLC,
so toggling it off and back on again gives us another hour to play
Let's do exactly what we did on the real hardware in the previous video.
To run Auto-Tune, we need to get the enclosure up to the hundred and ten degrees
we want to maintain, which I'll mark with the setpoint. The setpoint isn't doing anything, we're just using it to show the temperature we are trying to get to.
We know it takes around 37% heater power on the real system to do that,
so let's force the simulated PID output to 37% and see what happens. Now
remember, we're overriding the PID instruction to give us manual control of the PID output right now
There was a few second delay and a temperature started to rise, just like the real hardware. Cool!
This is going to take a while. So I'll fast-forward to video
Okay, that took a little over 20 minutes and look at that.
Exactly the kind of response we expected and it's similar to our real system. Cool!
Well, let's toggle the simulator to stop and back to run to buy us another hour of simulator playtime.
Now the problem is,
restarting a simulator reset the process variable and we don't want to wait another hour to get it back to 110 degrees,
so let me show you a trick. To get this simulated enclosure back to 110 degrees quickly,
I'm just gonna minimize the dead time and the time constant.
The process variable quickly gets back up 210 degrees and then we restore the dead time and a time constant and
And just like that, we saved ourselves an hour of waiting for this simulated oven to heat up again. How about that?
Okay, we're back and the process variable is just under 110 degrees. So we're perfectly positioned to start Auto-Tune
Hit Auto-Tune. These options are all fine, so just do it.
Let's rescale this so it's easier to see the Auto-Tune results and I'll fast forward it
so we don't have to wait around a couple minutes and look at that. There's a typical Auto-Tune cycle
we expect to see for a closed loop Auto-Tune, and here are the resulting coefficients
Remember, these are for an ideal system. Will they be the same as the ones we get on a real system?
Well, no,
of course not
They're quite a bit different than these coefficients that we got from that last tuning we did on the real hardware,
aren't they? The Auto-Tune cycle looks pretty similar though,
which tells us we did a good job of measuring the dead time and the time constant
But will these coefficients work?
Now before we find out, we can go back to whatever the ladder logic says to do or
we can drop directly into either override mode.
Let's drop back into the ladder logic, which has the PID instruction in auto mode at all times.
Notice that the coefficients automatically got updated in the PLC when we exited the dialog but we
haven't put them in our ladder code yet,
have we, so before we forget,
let's bring up the dedicated first scan task and add those coefficients to a PIDINIT instruction,
so now those values will be properly loaded into the PID instruction when we start up the PLC.
Except, save, right to the PLC.
Okay, time to find out if Auto-Tune worked on our simulated system. Let's move the setpoint up to 115 degrees,
fast forward and sure enough
PID automatically adjusted the heater power to get us there as fast and as efficient as possible
Drop down to a hundred degrees. Let me readjust the scaling so we can see that better.
And again, PID automatically adjusted the heater power to get to that temperature quickly and efficiently. And let's get back to 110 degrees
Wow, that looks perfect. A little overshoot and then it settles right out. That's exactly what I like to see.
Let's add some noise to our simulation. On the
PLC simulator, click on sim then set up the process simulator. After playing around a bit
I found this gaming noise similar to our real hardware. Ah,
look. The process variable got a lot noisier, didn't it? I'll zoom in a little bit, so we have a better view of that.
Now we know from the previous video that Auto-Tune struggles with noisy signals.
Let's see how it deals with this one. Auto-Tune. Let er rip!
Well, guess what? Auto-Tune finished way too fast, didn't it?
Just like it did in the previous video and we didn't get the three closed loop Auto-Tune cycles
We expect, did we? In the previous video, we've filtered the process variable to fix that. In this video,
we're going to keep the noisy signal and instead
we're just going to increase the dead band
Now remember, closed loop Auto-Tune increases the output until the process variable crosses the setpoint.
Then it turns the output off and waits for the process variable to cross a setpoint in the other direction. And it repeats that three
times.
The problem is Auto-Tune sees the noise crossing and it thinks it's done.
The dead band says wait until the process variable crosses the setpoint plus a little bit on the way up and
wait until it crosses the setpoint plus a little bit on the way down.
This is the dead band. It's basically a hysteresis thing and it's just a percentage of the setpoint.
For our demo, since we happen to be near a hundred degrees, these numbers basically cancel,
so whatever we enter for the dead band is what we're gonna get.
Looks like our peak noise,
about 0.35 degrees above and below our set point, so I'll put a point four in for the dead band.
Again, we don't have to do any math because our setpoint happens to be near 100. Don't assume that's the case for your system.
Now if we run Auto-Tune, the noise doesn't trip us up and we get the three closed loop cycles we expect. And
if we zoom in a bit,
we can see the output didn't change until the noise crossed roughly 0.4 degrees above the setpoint and
roughly 0.4 degrees below the setpoint.
Exactly what we asked for. And
if we zoom back out and change the set point a couple times, the process variable tracks just like before.
Perfect.
So using the dead band is another way to avoid noise issues in Auto-Tune,
but you'll want to keep the dead band as small as possible
because a large dead band means Auto-Tune has to wait longer for the threshold crossings which will result in PID
coefficients that are slower to respond to your system changes. Just know you have two options when dealing with noise and Auto-Tune:
Filtering and dead band and the best solution might be to use a little bit of both. It
all depends on your system and what you're trying to accomplish.
Let's turn off the noise,
put the dead band back at the default of 0.1 and
run Auto-Tune one more time to get back to our original PID coefficients.
Let's get a baseline. I'll change the setpoint a couple times just so we can see how the normal PID coefficients react.
Great. Now, what happens if we double P the game?
Change the setpoint a couple times and we get a little faster response with a little bit of ringing.
Exactly what we expect.
What if we double P again? Ah!
This system Is oscillating and it can't seem to settle out. Well, that's not good. So
what if we cut P to half the original Auto-Tune value?
Move the setpoint a few times and we get a much slower response with a larger overshoot,
because PID couldn't react fast enough. The game was too low. Again, exactly what we would expect.
So how cool is that? Using this process simulator,
you can now safely play with adding noise to the signal, with the different PID algorithms, the effect dead band has on filtering noise,
changing the coefficients, and all these other options without having to take your real hardware offline or
worrying about damaging your hardware.
Then once you feel confident with this,
you can apply that knowledge to your real hardware,
run one final Auto-Tune to tweak things on the real hardware and you're good to go.
Nice.
Auto-Tune on the Do-more PLC works really well,
but it can only do so much
Things like system noise can have an enormous impact on Auto-Tune
and if you have an odd system response like this, well Auto-Tune may not be able to give you optimum results. In
situations like these, it's really helpful to know how to manually tune a PID loop. In the next video,
We'll show you a quick easy and reliable way to manually tune a PID loop. It uses an open loop tuning method
so we'll also take a look at the Do more open loop tuning for comparison.
Click here to see the other videos in this PID playlist
Click here to learn more about our award winning tech support options and click here to subscribe to our Youtube channel
so you'll be notified when we publish new videos.