Example: Root Locus Design for Digital DC Motor Position Control

Continuous to Discrete Conversion
Root Locus Design

In this example, the controller will be designed by a Root Locus method. A digital DC motor model can obtain from conversion of analog DC motor model, as we will describe. According to the Modeling a DC Motor Page, the open-loop transfer function for DC motor's position is as shown.

where:

*electric resistance (R) = 4 ohm
*electric inductance (L) = 2.75E-6 H
*electromotive force constant (K=Ke=Kt) = 0.0274 Nm/Amp
*moment of inertia of the rotor (J) = 3.2284E-6 kg*m^2/s^2
*damping ratio of the mechanical system (b) = 3.5077E-6 Nms
*input (V): Source Voltage
*output (sigma dot): Rotating speed
*The rotor and shaft are assumed to be rigid

The design requirements are:

Continuous to Discrete Conversion

The first step in the design of a discrete-time system is to convert a continuous transfer function to a discrete transfer function. MATLAB can be used to convert the above transfer function to discrete transfer function by using the c2d command. The c2d command requires three arguments: system, a sampling time (T) and a type of hold circuit. In this example we will use the zero-order hold (zoh). Refer to the Digital Control Tutorials page for more information.

From the design requirement, let the sampling time, T equal to 0.001 seconds, which is 1/100 of the required time constant or 1/40 of the required settling time. Let's create a new m-file and add the following MATLAB code:

MATLAB should return the following: As noticed above, both the numerator and the denominator of the discrete transfer function have one extra root at z = 0. Also, we can get rid of the leading zero coefficient in the numerator. To do this add the following code to cancel out extra pole and zero to avoid numerical problems in MATLAB. Otherwise it will consider both the numerator and denominator to be fourth-order polynomials.

Therefore, the discrete-time transfer function from the motor position output to the voltage input is:

We would like to see what the closed-loop response of the system looks like when no controller is added. First, we have to close the loop of the transfer function by using the feedback command. After closing the loop, let's see how the closed-loop stairstep response performs by using the stepand stairs commands. The step command will provide the vector of discrete step signals and stairs command will connect these discrete signals (click here for more information). Add the following MATLAB code at the end of previous m-file and rerun it.

You should see the following plot:

Root Locus Design

The main idea of root locus design is to obtain the closed-loop response from the open-loop root locus plot. By adding zeroes and poles to the original system, the root locus can be modified, to a new closed-loop response. First let's see the root-locus for the system itself. In your m-file, add the following commands and rerun it. You should get the root-locus plot as shown below.

To get the zero steady-state error from the closed-loop response, we have to add an integral control. Recall that the integral control in the continuous- time is 1/s. If we use the backward difference approximation for mapping from the s-plane to the z-plane as described by s = 1/(z-1), one pole will be added at 1 on the root locus plot. After adding the extra pole at 1, the root locus will have three poles near 1. Therefore the root locus will move out to the right, and the closed-loop response will be more unstable. Thus, we must add one zero near 1, inside the unit circle, to cancel with one pole and pull the root locus in. We will add a zero at z = 0.95. In general, we must at least add as many poles as zeroes for the controller to be causal. Now add the following MATLAB commands in to your m-file.

Recall from the Digital Control Tutorial page, the zgrid command can be used to find the desired region (satisfying the design requirements) on the discrete root locus plot. The zgrid command requires two arguments: the natural frequency (Wn) and the damping ratio (zeta). From the design requirement, the settling time is less than 0.04 seconds and the percent overshoot is less than 16%. We know the formulas for finding the damping ratio and natural frequency as shown:


where:

OS: the percent overshoot
Ts: the settling time

The required damping ratio is 0.5 and the natural frequency is 200 rad/sec, but the zgrid command requires a non-dimensional natural frequency. Therefore Wn = 200*Ts = 0.2 rad/sample. Add the following MATLAB code into the end of your m-file and rerun it.

You should get the following plot:

From the above root locus plot, we can see that system is unstable at all gains because the root locus is outside the unit circle. Moreover, the root locus should be in the region where the damping ratio line and natural frequency cross each other to satisfy the design requirements. Thus we have to pull the root locus in further by first canceling the zero at approximately -0.98, since this zero will add overshoot to the step response. Then we have to add one more pole and two zeroes near the desired poles. After going through some trial and error, one more pole is added at 0.61 and two zeroes are added at 0.76. Add the following commands to your m-file and rerun it in the MATLAB window.

The system will have a pole at 0.61 instead of -0.98. You should get the following root locus plot:

From the above root locus plot, we see that the root locus is in the desired region. Let's find a gain, K, on the root locus plot by using the rlocfind command and obtain the stairstep response with the selected gain. Enter the following commands at the end of your m-file and rerun it.

In the MATLAB window, you should see the command asking you to select a point on the root-locus plot. You should click on the plot as the following:

The selected gain should be around 330, and it will plot the closed-loop compensated response as follows.

From the above closed-loop response, the settling time is about 0.05 seconds which is satisfy the requirement, but the percent overshoot is 22% which is too large due to the zeroes. If we select the gain to be larger, the requirements will be satisfied. On the other hand, the problem will be unrealistic and a huge actuator is needed, you can try this yourself by picking a larger gain on the previous root locus plot which will yield an unrealistically sudden step response. So we have to move both one pole and two zeroes a little further to the right to pull root locus in a little bit more. The new pole will be put at 0.7 and two zeroes will be at 0.85. Go back to your m-file and change only numc and denc as shown below and rerun it in MATLAB window.

Then you should see the following root locus plot.

On the new root locus, you should click on the plot to select a new gain as the following:

The selected gain should be around 450, and then it will plot the closed-loop compensated response as follows:

Now we see that the settling time and percent overshoot meet the design require ments of the system. The settling time is 0.04 seconds and the percent overshoot is about 10%.

Now let's take a look at a disturbance response of the closed-loop system. We need to cancel the selected gain, the integral transfer function and controller's transfer function from the closed-loop transfer function. So add the following code into your m-file and rerun it.

MATLAB should return the following plot:

We can see that a response to the disturbance is small (3.3% of the disturbance ) and settles within 2% of the disturbance after 0.04 seconds and eventually reaches zero.


Digital Control Examples
Cruise Control | Motor Speed | Motor Position | Bus Suspension | Inverted Pendulum | Pitch Controller | Ball and Beam

Motor Position Examples
Modeling | PID | Root Locus | Frequency Response | State Space | Digital Control | Simulink

Tutorials
MATLAB Basics | MATLAB Modeling | PID Control | Root Locus | Frequency Response | State Space | Digital Control | Simulink Basics | Simulink Modeling | Examples