Guy and Seth on Simulink

Plant Identification Using the PID Tuner

Posted by Guy Rouleau,

In R2014a, system identification capabilities have been added to the PID Tuner app to create a plant model, allowing you to do the plant identification and controller tuning all in one app.

I gave it a try with the new LEGO MINDSTORMS EV3 Support Package, and I was really impressed by how easy it is to use.

Let's see how it works.

Acquiring Data

To identify a plant model, your first need experimental data. In my case, I created the following simple model that applies power to a motor and measures the resulting motion.

Model to Acquire Data for System Identification

Using External Mode and To Workspace blocks, I acquire experimental data that will be used later.

Acquired Data for System Identification

Control Model

I want to control the motor in position, so I create the following model:

Control Model

I open the dialog of the Discrete PID block, I specify the type of controller I want, its sample time, and I click the Tune button to launch the PID Tuner app.

Dialog of the PID Controller block

Identifying the plant

As first guess, the PID Tuner tries to obtain a plant model by linearizing the blocks present in the model. Obviously, in this case this will not work because the Simulink model does not contain a plant.

To identify a plant based on the data previously acquired, select the Identify New Plant option:

Identifying new plant

A Plant Identification tab will appear where you will be able to import the previously saved data.

Import Data

Theoretically, a motor like this one should be modeled using a second-order transfer function, with integrator (See this tutorial for an example). However, based on past experience I know that the effect of the second pole is almost negligible for this Lego motor. In the Plant Identification tab I specify a one pole system with integrator and click the Auto Estimate button. As you can see, this does a pretty good job. I zoomed in on one of the transitions to show that the plant output is not exactly identical to the experimental data... which would be impossible.

Identified Plant

Tuning the Controller

Once you are satisfied with the identified plant, click the Save Plant button and switch to the PID Tuner tab. Play with the sliders until you get a satisfying response, and once this is done click Update Block to apply the tuned gains to the controller block in your model.

Tuned Controller(Click to enlarge)

Deploying the Controller

I tried running the control model on the EV3 and I was really impressed to see that the results were almost identical to what I could see in the PID Tuner:

Experimental results from tuned controller

Now it's your turn

This shows only a small part of what this app can do. Here are a few additional resources for you to learn more:

Try the PID Tuner app with integrated system identification capabilities for yourself and let us know what you think by leaving a comment here.

Add A Comment

What is 4 + 8?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.