Adem Control Project
Adem Control Project
Name id
Adem asfaw…………….1402397
Wubetu getaneh……………….
Semahegn yasab………………
Girma Sali………………………..1305539
Mikias gebru……………….
Contents
Physical setup
System equations
Design requirements
MATLAB representation
Physical setup
A common actuator in control systems is the DC motor. It directly provides rotary motion and,
coupled with wheels or drums and cables, can provide translational motion. The electric equivalent
circuit of the armature and the free-body diagram of the rotor are shown in the following figure.
For this example, we will assume that the input of the system is the voltage source ($V$) applied to
the motor's armature, while the output is the rotational speed of the shaft $\dot{\theta}$. The rotor
and shaft are assumed to be rigid. We further assume a viscous friction model, that is, the friction
torque is proportional to shaft angular velocity.
In general, the torque generated by a DC motor is proportional to the armature current and the
strength of the magnetic field. In this example we will assume that the magnetic field is constant
and, therefore, that the motor torque is proportional to only the armature current $i$ by a constant
factor $K_t $$ T = K_{t} i$$
The back emf, $e$, is proportional to the angular velocity of the shaft by a constant factor $K_e$.
In SI units, the motor torque and back emf constants are equal, that is, $K_t = K_e$; therefore, we
will use $K$ to represent both the motor torque constant and the back emf constant.
From the figure above, we can derive the following governing equations based on Newton's 2nd law
and Kirchhoff's voltage law.
1. Transfer Function
Applying the Laplace transform, the above modeling equations can be expressed in terms of the
Laplace variable s.
We arrive at the following open-loop transfer function by eliminating $I(s)$ between the two above
equations, where the rotational speed is considered the output and the armature voltage is
considered the input.
(7)$$ P(s) = \frac {\dot{\Theta}(s)}{V(s)} = \frac{K}{(Js + b)(Ls + R) + K^2} \qquad [ \frac{rad/sec}{V}] $
$
First consider that our uncompensated motor rotates at 0.1 rad/sec in steady state for an input
voltage of 1 Volt (this is demonstrated in the DC Motor Speed: System Analysis page where the
system's open-loop response is simulated). Since the most basic requirement of a motor is that it
should rotate at the desired speed, we will require that the steady-state error of the motor speed be
less than 1%. Another performance requirement for our motor is that it must accelerate to its
steady-state speed as soon as it turns on. In this case, we want it to have a settling time less than 2
seconds. Also, since a speed faster than the reference may damage the equipment, we want to have
a step response with overshoot of less than 5%.
In summary, for a unit step command in motor speed, the control system's output should meet the
following requirements.
1. Transfer Function
Model creation
We can represent the above open-loop transfer function of the motor in MATLAB by defining the
parameters and transfer function as follows. Running this code in the command window produces
the output shown below.
J = 0.01;
b = 0.1;
K = 0.01;
R = 1;
L = 0.5;
s = tf('s');
P_motor = K/((J*s+b)*(L*s+R)+K^2)
P_motor =
0.01 P_motor =
0.01
---------------------------
Open-loop response
First create a new m-file and type in the following commands (refer to the main problem for the
details of getting these commands).
J = 0.01;
b = 0.1;
K = 0.01;
R = 1;
L = 0.5;
s = tf('s');
P_motor = K/((J*s+b)*(L*s+R)+K^2);
Now let's see how the original open-loop system performs. Add the
following linearSystemAnalyzer command onto the end of the m-file and run it in the MATLAB
command window. You can access the Linear System Analyzer also by going to the APPS tab of the
MATLAB toolstrip and clicking on the app icon under Control System Design and Analysis. In the
command below, the string 'step' passed to the function specifies to generate a unit step response
plot for the system P_motor. The range of numbers 0:0.1:5 specify that the step response plot
should include data points for times from 0 to 5 seconds in steps of 0.1 seconds. The resulting plot is
shown in the figure below, where you can view some of the system's characteristics by right-clicking
on the figure and choosing from the C
harac
LTI model characteristics
Since our open-loop transfer function has the form of a canonical second-order system, we should
be able to accurately predict the step response characteristics observed above based on the transfer
function's pole locations. You can graphically see the location of the poles (and zeros) of the
P_motor system from within the Linear System Analyzer by right-clicking on the plot area and
selecting Plot Types > Pole/Zero from the resulting menu. Performing this action will change the
Linear System Analy
zer to
We can then import this new model into the Linear System Analyzer. This is accomplished by
selecting Import from the File menu at the top of the Linear System Analyzer window. From the
resulting window choose rP_motor from the Systems in Workspace area and then click the OK
button. The Linear System Analyzer will now show plots of both the original and the reduced transfer
functions. You can then switch back to step response plots by again choosing Plot Types using the
Characteristics submenu. You can also add a legend by clicking the legend icon on the toolbar. Now
the Linear System Analyzer should appear as shown below. the following map where the blue x's
identify the locations of poles.
Within this window set the End time (sec) to "5" and the Interval (sec) to "0.1". Then under the
System inputs section of the window, you can import an input signal, or design one from a select set
of choices. In this instance, click the Design signal button and choose a Signal type of Sine wave from
within the window that appears. Then change the Frequency (Hz) to "0.2" and leave the Amplitude
and Duration (secs) as their default values. Then click the Insert button at the bottom of the Signal
Designer window and the Simulate button at the bottom of the Linear Simulation Tool window. The
responses of our two currently identified systems to the sine wave input are then produced in the
Linear System Analyzer window. If you double-click on the y-axis of the plot, you can then change
the limits to match the figure shown below.
Drawing the open-loop root locus
The main idea of root locus design is to predict the closed-loop response from the root locus plot
which depicts possible closed-loop pole locations and is drawn from the open-loop transfer function.
Then by adding zeros and/or poles via the controller, the root locus can be modified in order to
achieve a desired closed-loop response.
We will use for our design the Control System Designer graphical user interface. This tool allows you
to graphically tune the controller via the root locus plot. Let's first view the root locus for the
uncompenstated plant. This is accomplished by adding the command
controlSystemDesigner('rlocus', P_motor) to the end of your m-file and running the file at the
command line or by going to the APPS tab of the MATLAB toolstrip and clicking on the app icon
under Control System Analysis and Design.
One window titled Control System Designer will open initially having the form shown in the figure
below. In the window, you will be able to see both the root locus plot and the closed-loop step
response of the transfer function passed via the controlSystemDesigner function. If the string 'rlocus'
is omitted from the function call, the default initial window includes the Bode plot, in addition to the
root locus plot and closed-loop
For a 1-radian step reference, the design criteria are the following.
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 these Comannds.
J = 3.2284E-6;
b = 3.5077E-6;
K = 0.0274;
R = 4;
L = 2.75E-6;
s = tf('s');
P_motor = K/(s*((J*s+b)*(L*s+R)+K^2));
Proportional control
Kp = 1;
for i = 1:3
C(:,:,i) = pid(Kp);
Kp = Kp + 10;
end
let's see what the step responses look like. Add the following code to the end of your m-file and
again run it in the command window. You should generate the plot shown in the figure below.
t = 0:0.001:0.2;
window. You should generate the plot shown in the figure below.
back to the block diagram at the top of this page to see the structure of
dist _cl = feedback(P_motor,C);
ow.
PI control
Let's first try a PI controller to get rid of the steady-state error due to the disturbance. We will set
$K_p$ = 21 and test integral gains $K_i$ ranging from 100 to 500. Change your m-file to the
following and run in the command window. You should generate a figure like the one shown below.
Kp = 21;
Ki = 100;
for i = 1:5
C(:,:,i) = pid(Kp,Ki);
Ki = Ki + 200;
end
sys_cl = feedback(C*P_motor,1);
t = 0:0.001:0.4;
title('Response to a Step Reference with K_p = 21 and Different Values of K_i') Let's first try a PI
controller to get rid of the steady-state error due to the disturbance. We will set $K_p$ = 21 and test
integral gains $K_i$ ranging from 100 to 500. Change your m-file to the following and run in the
command window. You should generate a figure like the one shown below.
Kp = 21;
Ki = 100;
for i = 1:5
C(:,:,i) = pid(Kp,Ki);
Ki = Ki + 200;
end
sys_cl = feedback(C*P_motor,1);
t = 0:0.001:0.4;
dist_cl = feedback(P_motor,C);
PID control
Adding a derivative term to the controller means that we now have all three terms of the PID
controller. We will investigate derivative gains $K_d$ ranging from 0.05 to 0.25. Go back to the m-
file and make the following changes. Running the altered m-file will generate a graph like the one
shown below.
Kp = 21;
Ki = 500;
Kd = 0.05;
for i = 1:3
C(:,:,i) = pid(Kp,Ki,Kd);
Kd = Kd + 0.1;
end
sys_cl = feedback(C*P_motor,1);
t = 0:0.001:0.1;
title('Step Response with K_p = 21, K_i = 500 and Different Values of K_d')
stepinfo(sys_cl(:,:,2))
ans =
RiseTime: 0.0046
SettlingTime: 0.0338
SettlingMin: 0.9103
SettlingMax: 1.1212
Overshoot: 12.1175
Undershoot: 0
Peak: 1.1212
PeakTime: 0.0122
From the above, we see that the response to a step reference has a settling time of roughly 34ms (<
40 ms), overshoot of 12% (< 16%), and no steady-state error. Additionally, the step disturbance
response also has no steady-state error. So now we know that if we use a PID controller with