DCS Lab 5 Report (Zain, Umer, Abdullah)
DCS Lab 5 Report (Zain, Umer, Abdullah)
Lab #5 Report
Objectives:
Theory:
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.
We will assume that the input of the system is the voltage source ( ) applied to the motor's
armature, while the output is the rotational speed of the shaft . 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.
System equations
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 by a constant
factor . This is referred to as an armature-controlled motor.
From the figure above, we can derive the following governing equations based on Newton's 2nd
law and Kirchhoff's voltage law.
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 between the two above
equations, where the rotational speed is considered the output and the armature voltage is
considered the input.
Lab Tasks:
1. Write MATLAB script file and determine the transfer function of the given system using the
following parameters.
J = 0.01;
b = 0.1;
K = 0.01;
R = 1;
L = 0.5;
MATLAB Code:
% Task 1
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)
zpk(P_motor)
Ts = 0.05;
dP_motor = c2d(P_motor,Ts,'zoh');
zpk(dP_motor)
sys_cl = feedback(dP_motor,1);
[y,t] = step(sys_cl,12);
stairs(t,y);
xlabel('Time (s)')
ylabel('Velocity (rad/s)')
title('Stairstep Response: Original')
MATLAB Output:
P_motor =
0.01
---------------------------
0.005 s^2 + 0.06 s + 0.1001
ans =
0.0020586 (z+0.8189)
---------------------
(z-0.9047) (z-0.6066)
MATLAB Code:
%% Task 2
Kp = 100;
Ki = 150;
Kd = 10;
C = Kp + Ki/s + Kd*s;
dC = c2d(C,Ts,'tustin')
sys_cl = feedback(dC*dP_motor,1);
[x2,t] = step(sys_cl,8);
stairs(t,x2)
xlabel('Time (seconds)')
ylabel('Velocity (rad/s)')
title('Stairstep Response: with PID controller')
rlocus(dC*dP_motor)
axis([-1.5 1.5 -1 1])
title('Root Locus of Compensated System')
z = tf('z',Ts);
dC = dC/(z+0.819);
rlocus(dC*dP_motor);
axis([-1.5 1.5 -1 1])
title('Root Locus of Modified Compensated System');
sys_cl = feedback(0.8*dC*dP_motor,1);
[x3,t] = step(sys_cl,8);
stairs(t,x3)
axis([0 8 0 1.5])
xlabel('Time (seconds)')
ylabel('Velocity (rad/s)')
title('Stairstep Response: with Modified PID controller')
MATLAB Output:
C =
--------------------
---------------------------
z^2 - 1
sys_cl =
-------------------------------------------------