CMU
UM


Example: PID Design Method for the DC Motor

Proportional control
PID control
Tuning the gains

From the main problem, the dynamic equations in state-space form are the following:

and the system schematic looks like:

For the original problem setup and the derivation of the above equations and schematic, please refer to the Modeling a DC Motor page.

With a 1 rad/sec step reference, the design criteria are:

* settling time less than 2 seconds
* overshoot less than 5%
* steady-stage error less than 1%

Now let's design a PID controller and add it into the system. First create a new m-file and type in the following commands(refer to main problem for the details of getting those commands).

Recall that the transfer function for a PID controller is:

Proportional control

Let's first try using a proportional controller with a gain of 100. Add the following code to the end of your m-file:

To determine the closed-loop transfer function, we use the cloop command. Add the following line to your m-file: Note that numac and denac are the numerator and the denominator of the overall closed-loop transfer function.

Now let's see how the step response looks, add the following to the end of your m-file, and run it in the command window:

You should get the following plot:

PID control

From the plot above we see that the steady-state error and the overshoot are both too large. Recall from PID tutorial page that adding an integral term will eliminate the steady-state error and a derivative term will reduce the overshoot. Let's try a PID controller with small Ki and Kd. Change your m-file so it looks like:

Tuning the gains

The settling time is now too long. Let's increase Ki to reduce the settling time. Go back to your m-file and change Ki to 200. Rerun the file and you should get the plot like this:

Now we see that the response is much faster than before, but the large Ki has worsened the transient response (big overshoot). Let's increase Kd to reduce the overshoot. Go back to the m-file and change Kd to 10. Rerun it and you should get this plot:

So now we know that if we use a PID controller with

Kp=100,
Ki=200,
Kd=10,

all of our design requirements will be satisfied.


User Survey
Your anonymous answers to the following questions will help us to improve future versions of these tutorials.
How useful was this example?
Very useful Useful Somewhat useful Not very useful A waste of time
How was the level of the example?
Too simple About right Too difficult
How much time did you spend on it?
Less than 30 mins. 30 - 60 mins. More than 60 mins.
How much of the Matlab code did you run?
None Some Most

We would like to hear about suggestions you have for improvement, difficulties you had with the tutorials, errors that you found, or any other comments that you have. This feedback is anonymous.

If you would like to receive a response, send your comments or questions to ctm-feedback@umich.edu


PID Examples
Cruise Control | DC Motor | Bus Suspension | Inverted Pendulum

DC Motor Examples
Modeling | PID | Root Locus | Frequency Response | State Space

Tutorials

Basics | PID | Modeling | Root Locus | Frequency Response | State Space | Examples

8/28/96 YS