System Dynamics
Prof. Davide Manca – Politecnico di Milano
Dynamics and Control of Chemical Processes
Solution to Lab #2
SE2
E1 – Dynamics of a tank
Given the tank in the picture:
F
iF
oA
h
1. Evaluate the dynamics of the level of the tank considering a step increase on the inlet flowrate, so that it results half of its initial value.
2. Evaluate the level dynamics considering a linear decrease of the inlet flowrate in 30 seconds (ramp variation) up to the half of the initial value.
Remark : the tank is at steady state before the disturbances occur.
Model of the system
i
dh h
A F
dt r
F
iF
oA
h
2
3
2
30 m
7.5 m s 0.4 s m
i
A F r
0
sh h
Data: I.C.:
Solution procedure question (1)
1. Assessment of the steady state solution:
2. Assignment of the step disturbance on the inlet flowrate:
3. Evaluation of the system dynamics by integrating the differential equation of the model. The steady state represents the initial conditions.
0
i s i
3 m
dh h
A F h r F
dt r
3
2 3.75 m s
new old
i i
F F
MATLAB implementation
h0 = r * Fi0;
Fi = Fi0/2;
[t,h] = ode45(@(t,y)Sisdif(t,y,A,Fi,r),tSpan,h0,options);
function dy = Sisdif(t,y,A,Fi,r)
dy(1) = (Fi – h/r)/A
Main
Sisdif
Dynamics in case of a step disturbance
0 20 40 60 80 100
1 1.5 2 2.5 3 3.5
Tempo [s]
A lte zza li q u id o [ m ]
Liquid level [m]Time [s]
0 20 40 60 80 100 3
4 5 6 7 8
Tempo [s]
Portata [m3 /s]
Resolution procedure question (2)
• Evaluation of system dynamics by integration of the model differential equation.
The inlet flowrate varies with time:
0
0
2
30
i
i i
F F F t
0
i i
2
F F
If t 30 s
Else
Time [s]
Flowrate [m3 /s]
MATLAB implementation
h0 = r * Fi0;
[t,h] = ode45(@(t,y)Sisdif(t,y,A,Fi0,r),tSpan,h0,options);
function dy = Sisdif(t,y,A,Fi0,r) h = y(1);
if(t < 30)
Fi = Fi0 - (Fi0/2)/30 * t;
else
Fi = Fi0/2;
end
dy(1) = (Fi – h/r)/A
Main
Sisdif
Dynamics in case of a ramp disturbance
0 20 40 60 80 100
1 1.5 2 2.5 3 3.5
Tempo [s]
A lte zza li q u id o [ m ]
Time [s]
Liquid level [m]
E2a – Dynamics of two non interacting tanks
Given the two tanks in the picture:
F
ir
1A
2h
2A
1h
1r
2Evaluate the dynamics of the level of the two tanks in case of a step disturbance on the inlet flowrate, such that halves the initial flowrate.
Remark: the tanks are in steady state before the disturbance occurs
System model
Fi
r1
A2
h2
A1
h1
r2
1 1
1
1
2 1 2
2
1 2
i
dh h
A F
dt r
dh h h A dt r r
Data: I.C.:
2 2
2 2
50 m 0.7 s m A
r
Tank 2:
2 1
2 1
30 m 1.2 s m A
r
Tank 1:
9.4 m s
3F
iSteady state conditions
Resolution procedure
1. Assessment of the steady state conditions:
2. Assignment of the step disturbance on the inlet flowrate:
3. Evaluation of the system dynamics by integrating the differential equation of the model. The steady state represents the initial conditions.
1 1
1
1 1
1
2 1 2 2 2
2
1 2
0 11.28 m
6.58 m 0
i s
i s
i
dh h
A F
h r F
dt r
dh h h h r F
A dt r r
3
2 4.7 m s
new old
i i
F F
MATLAB implementation
h0 = [r1*Fi0 r2*Fi0];
Fi = Fi0/2;
[t,h] = ...
ode45(@(t,y)Sisdif(t,y,A1,A2,r1,r2,Fi),tSpan,h0,options);
function dy = Sisdif(t,y,A1,A2,r1,r2,Fi) dy = zeros(2,1);
h1 = y(1);
h2 = y(2);
dy(1) = (Fi – h1/r1)/A1;
dy(2) = (h1/r1-h2/r2)/A2;
Main
Sisdif
Dynamics of two non interacting tanks
0 100 200 300 400 500
2 4 6 8 10 12
Tempo [s]
A lte zza li q u id o [ m ]
Serbatoi non interagenti
Serbatoio 1 Serbatoio 2
Time [s]
Non interacting tanks
Tank 1 Tank 2
Liquid level [m]
E2b - Dynamics of two interacting tanks
Given the two tanks in the picture:
F
ir
1A
2h
2A
1h
1r
2Evaluate the dynamics of the level of the two tanks in case of a step disturbance on the inlet flowrate, such that it halves the initial flowrate.
Remark: the tanks are in steady state before the disturbance occurs
System model
1 1 2
1
1
2 1 2 2
2
1 2
i
dh h h
A F
dt r
dh h h h
A dt r r
Data:
2 2
2 2
50 m 0.7 s m A
r
Tank 2:
2 1
2 1
30 m 1.2 s m A
r
Tank 1:
9.4 m s
3F
iFi
r1
A2
h2
A1
h1 r2
I.C.: Steady state conditions
Resolution procedure
1. Determination of steady state conditions:
2. Assignment of the step disturbance on the inlet flowrate:
3. Evaluation of the system dynamics by integration of the differential equation of the model. The steady state represents the initial conditions.
1 1 2
1
1 1 2
1
2 1 2 2 2 2
2
1 2
0 17.86 m
6.58 m 0
i s
i s
i
dh h h
A F
h r r F
dt r
dh h h h h r F
A dt r r
3
2 4.7 m s
new old
i i
F F
MATLAB implementation
h0 = [(r1+r2)*Fi0 r2*Fi0];
Fi = Fi0/2;
[t,h] =
ode45(@(t,y)Sisdif(t,y,A1,A2,r1,r2,Fi),tSpan,h0,options);
function dy = Sisdif(t,y,A1,A2,r1,r2,Fi) dy = zeros(2,1);
h1 = y(1);
h2 = y(2);
dy(1) = (Fi – (h1-h2)/r1)/A1;
dy(2) = ((h1-h2)/r1-h2/r2)/A2;
Main
Sisdif
Dynamics of interacting tanks
0 100 200 300 400 500
0 5 10 15 20
Tempo [s]
A lte zza li q u id o [ m ]
Serbatoi interagenti
Serbatoio 1 Serbatoio 2
Time [s]
Liquid level [m]
Interacting tanks
Tank 1 Tank 2
Comparison
0 100 200 300 400 500
0 5 10 15 20
Tempo [s]
Altezza liquido [m]
Tank 1, case: non interacting tanks Tank 1, case: interacting tanks Tank 2, case: non interacting tanks Tank 2, case: interacting tanks
Time [s]
Liquid level [m]