SYSEN 533 – Penn
Page 1 of 4
Deterministic Modeling and Simulation
1. (25 pts) The compound tank system shown in Figure 1 consists of a spherical tank of radius R 1 and a cylindrical tank of diameter D 2 . A liquid of constant density is fed at a volumetric rate F 1in into the top of a spherical tank and volumetric rate F 2in 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 F 1out = k 1 h 1 , while the volumetric flow rate out of the cylindrical tank into the pipe is given by F 2out = k 1 h 2 where h 1 and h 2 are the heights of the liquid in the spherical and cylindrical tanks respectively and k 1 is the common valve coefficient. The cylindrical tank also has a
drain on the right-hand side which has volumetric flow rate F 3out = k 2 h 2 where k 2 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, F 1in and F 2in , analytically determine the steady-state values of h 1 and h 2 . 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)
2.0 ft3 /s
1.0 ft3 /s
2.0 ft5/2 /s
3.0 ft5/2 /s
F 2out = k 1
Figure 1. Compound Tank SystemSYSEN 533 – Penn
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:
A1 + X 2 X
X + Y 2 Y
A5 + Y A2
X + Z A3
A4 + Z 2 Z
where X , Y , and Z represent the chemical species whose concentrations vary and A 1 , A 2 , A 3 , A 4 , and A 5 are chemical species whose concentrations are held fixed by large chemical reservoirs, serving to keep the system out of thermodynamic equilibrium. k i and k − i denote the forward and inverse reaction rates.
The system of differential equations that describe the concentrations x , y , and z (for chemical speciesX , Y , and Z ) are:
= x + ay
= b − cz + xz
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 ) – x orginal (t ) vs t , y (t ) – y orginal (t ) vs t , and z (t ) – z orginal (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
Page 3 of 4
3) (25 pts) A continuous stir tank reactor (CSTR) is used to produce a product P from chemicals A andB . The reaction is A + B P . A is in excess and the rate of decomposition of B is given by:
k 1 x 2
+ k x
where k 1 and k 2 are constants and x 2 is the product concentration. The equations describing the system are given by:
) u 1
) u 2
k 1 x 2
(1 + k x )2
The parameters are: C b1 = 24.9 , C b2 = 0.1 , k 1 = k 2 = 1 , and u 1 = u 2 = 1.
The initial conditions are: x 1 (0 ) = 10 and x 2 (0 ) = 0.
a) First, simulate the equation for x 1 only since it does not depend onx 2 . Note the steady-state value that you find for x 1 .
b) In the model for x 2 , initialize the integrator for x 1 to the steady-state value you found in part (a) and initialize x 2 (0) = 0. Run the simulation for 1000 seconds to determine x 2 (t ) and thesteady-state value of x 2 .
c) Repeat the simulation for x 2 using an initial value x 2 (0) = 10. Note the new steady-state value you find for x 2 .
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 x 2 and x 1 being x 2 = 2.793 and
x 1 = 100. This is an unstable steady state. Demonstrate this by setting the initial value of the integrator for x 2 to x 2 (0) = 2.80 and show that the simulation goes to the upper steady-state value. Repeat the simulation with x 2 (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 x 2 = 2.793 is unstable by linearizing the equation for x 2 about thesteady-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 ∆ x 2 .SYSEN 533 – Penn
Page 4 of 4
4) (25 pts) Consider the following linear system
G (s ) =
−8 s +6
2s 3 + 9s 2 + 13s + 6
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?