Tuning a PID Controller | Getting Started with Simulink, Part 4
From the series: Getting Started with Simulink
Learn how to quickly change PID gain values using the PID controller block in Simulink®. Update the gain coefficients in your block by adjusting sliders or using the PID automatic tuning tool in Simulink Control Design™, and then instantly see the results of your changes.
Published: 23 Oct 2017
Let's start tuning the PID controller, for example, so that we can better steady state early enough.
So we could change the PID gain values here.
Yeah.
Its default are 1, 1, and 0. So, I don't know, what do you think?
We can either--
5, 5, 5?
--manually do it. Yeah, we can manually try doing it, but like Michael suggested, I just inserted 5, 5, 5 for each of the gains. And if I run my simulation, it's better than the previous.
Yeah, that's better.
Yeah.
But I bet we could do better.
Yes. It's not the best. So--
And we want the best.
Yes. And you might spend some time to find the best possible combination, but I like to use this tune button, which invokes a PID tuning tool. It's a part of submitting controlled design product. And when I click that, it opens up a nice UI, where it visually shows me how the response should look like.
OK. So just to be clear, this PID controller block is included in the Simulink, but if you want to open up this automated tuning tool that's here, that's available if you have Simulink controlled design.
Exactly. And as you can see here, the dotted line is what our block is currently doing. And the solid line is how we want our block to perform. And we can adjust those the way that we want the block to perform by moving these slider values up here.
Yeah, let's make it a little faster.
Yeah. So that way, it reaches steady state faster.
OK.
And once we are happy with this response, we can simply click on Update Block, and I think that's the best part of this tuner, is--
So that changes the parameters in the block itself, right?
Yes. We had 5, 5, 5. Now, it's these values, which would have been--
I guess we weren't that close. Huh?
Yes. It would have been extremely difficult to guess for a specific response that we want to look at.
Yeah, without that tuning button, I would most likely have just kept changing values, pressing OK, pressing Play, and just keep iterating back and forth.
Exactly.
So this just makes it easier than doing that.
So once we have that, we can verify that in simulation, whether that response is--
Nice.
--showing in simulation as well for that plan we chose. So that's basically how you would tune your controller and look at the results.