Cheng-Liang Chen
PSE
LABORATORY
Department of Chemical Engineering
National TAIWAN University
Chen CL
MATrixLABoratory
1
Chen CL
Simulink
2
Chen CL
3
The Simulink Library Browser
Chen CL
4
Simulink Solution of y = 10 sin(t)
˙
Check Results on Screen dy = 10 sin(t) dt 13
⇒ y(t) =
y(0) = 0, 0 ≤ t ≤ 13
(10 sin(t))dt + y(0)
0
Note: y(t) = 10(1 − cos(t)) (exact solution)
Chen CL
5
Simulink Solution of y = 10 sin(t)
˙
Exporting to MATLAB dy = 10 sin(t) dt 13
⇒ y(t) =
y(0) = 0, 0 ≤ t ≤ 13
(10 sin(t))dt + y(0)
0
Note: y(t) = 10(1 − cos(t)) (exact solution)
Chen CL
6
Simulink Solution of y = −10y + 2 sin(4t)
˙
dy
= −10y + 2 sin(4t) dt 3
⇒ y(t) =
y(0) = 1, 0 ≤ t ≤ 3
(−10y + 2 sin(4t))dt + y(0)
0
Chen CL
7
Linear State-Variable Models
Simulink Model of A Two-Mass System
5¨1 + 12x1 + 5x1 − 8x2 − 4x2 = 0 x ˙
˙
3¨2 + 8x2 + 4x2 − 8x1 − 4x1 = f (t) x ˙
˙
(m1 = 5, M − 2 = 3, c1 = 4)
(c2 = 8, k1 = 1, k2 = 4)
(x1(0) = 0.2; x1(0) = 0; )
˙
(x2(0) = 0.5; x2(0) = 0; )
˙
Let z1 ≡ x1, z3 ≡ x2
⇒ z1 = z2 ,
˙
z3 = z 4 ,
˙
z2 = (−5z1 − 12z2 + 4z3 + 8z4)/5
˙
z4 = (4z1 + 8z2 − 4z3 − 8z4 + f (t))/3
˙
Chen CL
8
0
z1
0
0
4
8
0
5
5 z2
z + 0 f (t)
0
1 3
1
4 z4 − 8
−3
3
3
z1
1 0 0 0 z2
+ 0
0 0 1 0 z3
0
z4
0
1 z1
−1 − 12
z2
d
5
=
0
dt z3
0
8
4 z4 3
3
x1 x2 =
Chen CL
9
Process Simulation
Simulation of A Gas Process
Consider the gas tank shown below. A fan blows air into a tank, and from the tank the air flows out through a valve. Suppose the air flow delivered by the fan is given by fi(t) = 0.16mi(t) where fi(t) is gas flow in scf/min, (scf is cubic feet at standard conditions of 60oF and 1 atm); mi(t) is signal to fan, %. The flow through the valve is expressed by