Deterministic Modeling and Simulation

Deterministic Modeling and Simulation

SYSEN 533 – Penn Exam 1 Page 1 of 4
SYSEN 533
Deterministic Modeling and Simulation
Exam 1
1. (25 pts) The compound tank system shown in Figure 1 consists of a spherical tank of radius R1 and a
cylindrical tank of diameter D2. A liquid of constant density is fed at a volumetric rate F1in into the
top of a spherical tank and volumetric rate F2in into the top of the cylindrical tank. The spherical and
cylindrical tanks interact through the pipe connecting them. The flow rates into the connecting pipe
depend on the heights of the liquid in the tanks. The volumetric flow rate out of the spherical tank
into the pipe is given by 1out 1 1 F kh = , while the volumetric flow rate out of the cylindrical tank into
the pipe is given by 2out 1 2 F kh = where h1 and h2 are the heights of the liquid in the spherical and
cylindrical tanks respectively and 1 k is the common valve coefficient. The cylindrical tank also has a
drain on the right-hand side which has volumetric flow rate 3out 2 2 F kh = where 2 k is the valve
coefficient for the right-hand side drain.
a) Obtain a dynamic model that describes the heights of the liquid in the tanks. Is this a linear or
nonlinear model?
b) For constant input flow rates, F1in and F2in, analytically determine the steady-state values of h1 and
h2. Do the shapes and dimensions of the tanks affect the steady-state values?
Note that you do not need to solve the differential equations for the steady state analysis.
c) Simulate the system and plot the heights of the liquid in the tanks versus time for constant input
flow rates using the values given in the table below. (Run the simulation for 2000 sec)
F1in 2.0 ft3
/s F2in 1.0 ft3
/s
R1 10.0 ft D2 20.0 ft
k1 2.0 ft5/2/s k2 3.0 ft5/2/s
h1(0) 4.0 ft h2(0) 4.0 ft
Figure 1. Compound Tank System
F1in
h1
R1
h2
F2in
D2
1out 1 1 F kh = 2out 1 2 F kh = 3out 2 2 F kh =
H=15
f
SYSEN 533 – Penn Exam 1 Page 2 of 4
2. (25 pts) Chaotic systems are ones for which small changes eventually lead to results that can be
dramatically different. The Rössler system is one of the simplest sets of differential equations that
exhibits chaotic dynamics. In addition to their theoretical value in studying chaotic systems, the Rössler
equations are useful in several areas of physical modeling including analyzing chemical kinetics for
reaction networks. Consider the reaction network:
1
1
2
2
3
3
4
4
5
5
1
5 2
3
4
2
2
2
k
k
k
k
k
k
k
k
k
k
AX X
XY Y
AY A
XZ A
AZ Z





+
+
+
+
+
?
?
?
?
?
where X, Y, and Z represent the chemical species whose concentrations vary and A1, A2, A3, A4, and A5
are chemical species whose concentrations are held fixed by large chemical reservoirs, serving to keep
the system out of thermodynamic equilibrium. and i i k k- denote the forward and inverse reaction rates.
The system of differential equations that describe the concentrations x, y, and z (for chemical species X,
Y, and Z) are:
dx
y z dt
dy x ay dt
dz b cz xz
dt
=- –
= +
=- +
a) Simulate this system for a=0.380, b = 0.300, and c = 4.280 with initial conditions x(0) = 0.1,
y(0) = 0.2, z(0) = 0.3. Run the simulation for 200 seconds using a fixed-step size algorithm with a step
size of 0.001 seconds. Plot the concentrations x, y, and z versus time on one figure with three
subplots. Additionally, in separate graphs, plot the phase-space plots: x versus y, x versus z, and y
versus z. Finally, make a 3-D plot of x vs y vs z using the Matlab graphics command “plot3”
b) Illustrate the sensitivity of the solution to variations in the initial conditions by repeating the
simulation of part (a) with x(0) = 0.0999 and then with x(0) = 0.1001 . (A 0.1% change in the value of
the initial condition in either direction.) Keep the initial conditions for y(0) and z(0) the same as in
part (a). Show the sensitivity by superimposing the plots for the new values you obtain for x(t), y(t),
and z(t) with the original plots for x vs t, y vs t, and z vs t. In addition, make plots of the differences:
x(t) – xorginal(t) vs t, y(t) – yorginal(t) vs t , and z(t) – zorginal(t) vs t.
c) Illustrate the sensitivity of the solution to variations in parameter values by repeating the simulation
of part (a) with c = 4.280001 . [Use the original initial conditions from part (a).] Show the sensitivity
with the same set of plots as in part (b).
Why is this system non-linear?
Qualitatively describe the sensitivity to initial conditions and parameter values.
SYSEN 533 – Penn Exam 1 Page 3 of 4
3) (25 pts) A continuous stir tank reactor (CSTR) is used to produce a product P from chemicals A and B.
The reaction is A + B ? P. A is in excess and the rate of decomposition of B is given by:
= +
1 2
2
2 2 (1 ) b
k x
r
k x
where k1 and k2 are constants and x2 is the product concentration.
The equations describing the system are given by:
=+-
=- +- –
+
1
12 1
2 1 2 12
12 22 2
1 1 22
0.2
( )( ) (1 ) b b
dx
uu x
dt
dx u u k x Cx Cx
dt x x k x
The parameters are: Cb1 = 24.9 , Cb2 = 0.1 , k1 = k2 = 1 , and u1 = u2 = 1.
The initial conditions are: x1(0) = 10 and x2(0) = 0.
a) First, simulate the equation for x1 only since it does not depend on x2 .
Note the steady-state value that you find for x1 .
b) In the model for x2 , initialize the integrator for x1 to the steady-state value you found in part (a) and
initialize x2(0) = 0. Run the simulation for 1000 seconds to determine x2(t) and the steady-state value
of x2.
c) Repeat the simulation for x2 using an initial value x2(0) = 10. Note the new steady-state value you
find for x2.
d) Both of the previous cases are stable. There is another steady state corresponding to everything else
being the same and the steady states for x2 and x1 being x2 = 2.793 and
x1 = 100. This is an unstable steady state. Demonstrate this by setting the initial value of the
integrator for x2 to x2(0) = 2.80 and show that the simulation goes to the upper steady-state value.
Repeat the simulation with x2(0) = 2.79 and show that it goes to the lower steady-state value. This
means that any small fluctuation will cause the system to fall to steady state of part (b) or rise to the
steady state of part (c).
e) Demonstrate that the steady state with x2 = 2.793 is unstable by linearizing the equation for x2 about
the steady-state values and showing that the linear system that results is unstable. You can do this
by either solving the differential equation or by simulating the system with a small initial ? x2 .
SYSEN 533 – Penn Exam 1 Page 4 of 4
4) (25 pts) Consider the following linear system
3 2
8 6 ( ) 2 9 13 6
s G s
ss s
– + = +++
For this problem, use a unit step input.
a) Create a model for this system using only integrators and run it for 10 seconds.
b) Replace the integrators with discrete integrators and investigate the effect of forward, backward,
and trapezoidal integrators with sampling times of 0.01, 0.1, and0.2 seconds.
Note that in the configuration parameters you will need to specify the step size and change the
integrator to discrete states only. Also, set all of the sampling times in the various blocks equal to
the discrete sampling time.
c) For each case, compare the true solution to the discrete solution in two ways:
(i) Plot the true solution (in blue) and discrete solution (in red) on a single plot.
(ii) Plot the difference between the true solution and the discrete solution.
If you want to be really fancy, use the subplot command to show both plots in a single figure.
d) Compute an estimate of the integral square error for each case and create a table of these
differences.
e) What conclusions can you draw regarding the accuracy of the different methods and step sizes?

Order from us and get better grades. We are the service you have been looking for.