Automatic Control System - Final Project
Automatic Control System - Final Project
Final Project
Lecture: Vu Van Phong
Sensor: This is a device that measures the process variable and provides input to the
control system.
Actual output: Actual output is an actual result after ending of procedure of the
system.
Set-point=30oC Actual
temperature
Thermostat Heater Water
temperature
Temperature
sensor
M1 and M2 are the mass; K1, K2, and K3 are the spring constants, and f v3
is the viscous friction coeffection of the dashpot. X 1(t) and x2(t) are the
displacement of mass M1 and M2 respectively and are output. f(t) is the
input.
2.1.1.1 Find the transfer function of the system.
X1 X2
*M1: *M2
Fk1 Fd Fd
Fk3
Fo M1 Fk2 Fk2 M2
8
Displacement (m)
-2
0 0.5 1 1.5 2
Time (seconds) 10 4
Electrical system
S 3S 2/S
R(s) C(s)
+
G(s)
-
H(s)
2.4.2 Please simulate the system using MATLAB/Simulink with inputs are
step signal R1 = 1, R2 = 1, L1 = 1, L2 = 1, C = 1.
G(s)
1
where G ( s )= , a is the last number of your student ID (if your last number of the
4 s+ a
student ID is zero, please select a=2).
3.2 Consider the Hubbe Space Telescope is modeled in Figure 3.2. Analyze
the behavior and response of this system.
The block diagram of the system
3.2.1. Ignore the effect of the disturbance, please determine the transfer
function between Y(s) and R(s).
3.2.2. Find K and K1 such that the overshoot is 15%, settling time with 5%
criterion is 4s.
There is a 2nd order function.
We have:
3.2.3. With obtained K and K1, please find the steady state error with the
unity step signal.
3.2.4. Simulating the system in MATLAB with input is a unity step signal.
*Code:
Q=tf([2.1025],[1 1.49 2.1025]);
T=tf([1],[1]);
hold on
step(T)
step(Q)
legend('Input','Actual ouput')
grid on
*Code:
Q=tf([2.1025],[1 1.49 2.1025]);
T=stepinfo(Q,'SettlingTimeThreshold',0.05);
3.3 Take into account the following system as shown in Figure 3.3.
+ s+5
2
R(s) 2 s + 4 s+3 C(s)
-
1
s +1
3.3.1. Find the poles and zeros of the closed-loop system in Figure 15.
*Closed-loop equation:
3.3.2. Plot the poles and zeros on the complex plane using MATLAB.
K=tf([1 5],conv([2 4 3],[0 1 1]));
pzplot(K)
grid on
Plot the poles and zeros on the complex plane using MATLAB.
3.3.3. Based on the position of poles on the complex plane, please check
the stability of the system.
System is stable because all poles locate on left hand side complex plane.
3.3.4. Simulate the system with unity step input by MATLAB/Simulink.
Analyze the obtained results.
*Code:
G=tf([1 6 5],[2 6 8 8]);
H=tf([1],[1]);
hold on
step(H)
step(G)
legend('Input','Actual ouput')
grid on
T=stepinfo(G,'SettlingTimeThreshold',0.05);
Km
G ( s )=
s ( Js +b ) (Ls + R)
G P ( s )=K p
*Characteristic equation:
The system is stable if:
3.4.2. Select two values of Kp, one satisfies the Routh-Hurwirtz condition
and another is not, then using Matlab to simulate above system with two
values of Kp. The input signal is unity step input signal. Based on the
simulation results, please evaluate the stability of the system with P
controller when the parameter of P controller is determined based on the
Routh-Hurwirtzcriterion.
With Km=50:
*Code:
G=tf([5],conv([1 20 0], [0.001 1]));
K=50;
H=series(G,K);
Q=feedback(H,1);
D=tf([1],[1]);
hold on
step(D)
step(Q)
legend('Input','Actual ouput')
grid on
T=stepinfo(Q,'SettlingTimeThreshold',0.05);
Step Response
1.2
Input
Actual ouput
1
0.8
Amplitude
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6
Time (seconds)
The value of input and actual output of the Disk Drive Read System with Km =50.
With Km=5000:
*Code:
G=tf([5],conv([1 20 0], [0.001 1]));
K=5000;
H=series(G,K);
Q=feedback(H,1);
D=tf([1],[1]);
hold on
step(D)
step(Q)
legend('Input','Actual ouput')
grid on
T=stepinfo(Q,'SettlingTimeThreshold',0.05);
1027 Step Response
8
Input
6 Actual ouput
2
Amplitude
-2
-4
-6
-8
-10
0 5 10 15 20 25 30
Time (seconds)
Figure 3.4.2.2: The value of input and actual output of the Disk Drive Read System
with Km =5000.
Km=50 Km=5000
Integral (I) response: Term ‘I” is integrate (with respect to time) to the actual
value of the error. It is generally used to decrease the steady state error. Integral
controller action continues to change until error becomes zero.
y(t) ∝ ∫ e(t)
y(t) = ki ∫ e(t)
where
1
G ( s )= 2 and input R(s) is the unity step signal.
s +3 s +5
4.2.1 Let Ki=0, Kd=0, using the Simulink to simulate the system with Kp=1, 5, 10, 200,
based on these simulation results, please give comments on the effects of Kp on the
response of the system.
Block diagram of the system in MATLAB.
+
GPID(s) G(s)
-
in which
1 1
G PID ( s )=K p (1+ +T D s) is PID controller and G ( s )= is the plant.
TI s s (s+2)(s+6)
4.3.2 Simulate the system without and with the PID controller and evaluate these
simulation results.
*Code:
Kp= 57.6;
Ti=0.905;
Td=0.22625;
Ki=Kp/Ti;
Kd=Kp*Td;
Gpid=pid(Kp,Ki,Kd)
G=tf(1,conv([1 2 0],[1 6]));
T=feedback(Gpid*G,1);
D=feedback(G,1);
Q=tf([1],[1]);
hold on
step(Q)
step(T)
step(D)
legend('Input','Actual output with PID','Actual output
without PID')
grid on
Step Response
1.8
Input
Actual output with PID
1.6
Actual output without PID
1.4
1.2
Amplitude
0.8
0.6
0.4
0.2
0
0 10 20 30 40 50 60 70
Time (seconds)
where E a(s) is the input voltage, and Θ m (s) is the position (output). The parameters of the DC
motor are
4.4.1 Simulating the system with and without the PID controller by Matlab/Simulink
and
Block diagram of the system with and without the PID controller in MALAB
The system with and without the PID controller
4.4.2 Apply auto-turning of Matlab/Simulink, design PID controller
Auto tuner:
Without the PID controller, the actual output of the system always increases and
strays from setpoint making the system be out of control. With the PID
controller, the quality of the system is perfect with the percent of overshoot is
low, the settling time is very fast and the steady-state error equals 0. The
system applied with a PID controller is sufficiently more reliable.
4.4.4 Design state feedback controller.
Pick a system:
[][ ][]
ẋ 1 0 1 0 0
ẋ 2 = 0 0 1 + 0 u
ẋ3 −4 −3 −2 4
[]
x1
y= [ 1 0 0 ] x 2
x3
To manipulate the system to have zero overshoot, I choose 3 poles that lie on the real axis
on the left side of imaginary axis.
Code script:
A = [0 1 0; 0 0 1; -4 -3 -2]
B = [0; 0; 4]
C = [1 0 0]
D = 0
model = ss(A,B,C,D)
poles = pole(model)
figure
step(model)
figure
rlocus(model)
END.