!!RETURN THIS SHEET WITH YOUR EXAM BOOK!! Chemical Process Dynamics and Control /Summer 2021 Instructors: Prof. Ronald Hedden and Dr. Matthew Titus Student Name: Exam #1 ● The exam is closed book – no calculators/laptops permitted. ● Answer all questions. Show all work for full credit. ● Write legibly, justify your answers, and state your assumptions. 1. The following system of tanks is found in a mixing/blending facility. Volumetric flowrates (m 3/min) are given the symbol “F” and the concentration of a dissolved salt (mol/m 3) is given the symbol “C.” Both tanks are well-mixed at all times. The gate valves both have a flow coefficient of Cv = 2.0 m2.5/min. F2 can flow either to the left or the right, depending on liquid levels. a. (8 pts.) Formulate the ODEs describing dh1/dt and dh4/dt, assuming Cin is held constant, but disturbances in Fin are possible. GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! b. (8 pts.) Formulate the ODEs describing dC1/dt and dC4/dt, assuming all liquid levels and flow rates are constant and remain at their steady-state values, but disturbances in C in are possible. c. (8 pts.) If Fin has a constant value of 1.0 m3/min and Cin has a constant value of 30 mol/m3, find the steady-state values of h1, F2, F3, and h4. GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! d. (10 pts.) Suppose disturbances in both Fin and Cin can occur. Classify each of the variables listed by circling the correct answer. For any variables that might be considered both states and outputs, please choose "State." No credit for answers with more than one choice circled! Variable Cv Input Output State Parameter Fin Input Output State Parameter F2 Input Output State Parameter F3 Input Output State Parameter A1 Input Output State Parameter Cin Input Output State Parameter C1 Input Output State Parameter C4 Input Output State Parameter h1 Input Output State Parameter h4 Input Output State Parameter GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! 2. A stirred tank reactor is running the exothermic reaction A 2B in the liquid phase, with equal inlet and outlet flow rates F. Liquid density is assumed constant, but temperature can vary with time. Using (system = liquid in the reactor), the following ODEs describe the time dependence of the state variables, CA and CB. dC A F in C A C A kC A dt VR dC B F in CB CB 2kC A dt VR Reactor performance also depends on temperature, so the energy balance is important to describe system dynamics. In order to remove heat from the reactor during operation, a cooling jacket is added, which removes heat at a rate of 𝑄̇. With the cooling jacket in place, the energy balance becomes: = ̇ + 𝐹 𝑇 −𝑇 − (𝑘𝐶 ) ΔHR is the heat of reaction, VR is the liquid volume in the reactor, “n” is the total number of moles in the reactor, Cp is molar heat capacity, and ρ is molar density; these quantities are taken to be constants (parameters). The kinetic rate constant is temperature dependent and has the following form: 𝐸 𝑘 = 𝑘 ∗ exp (− ) 𝑅𝑇 Additional parameters: Ea is an activation energy, R is the gas constant, and k 0 is a kinetic pre-factor. a. (10 pts.) Using the following definitions, convert the energy balance ODE to deviation variables to obtain dx3/dt = f3(x,u). in u1 C A C A, s in in u2 C B C B ,s u3 F Fs in x1 C A C A,s x2 CB C B , s 𝑥 =𝑇−𝑇 y1 x1 y 2 x2 𝑦 =𝑥 𝑢 = 𝑄̇ − 𝑄̇ 𝑦 =𝑘 𝑢 =𝑇 −𝑇 GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! b. (8 pts.) For the state-space model x Ax Bu , write the dimensions of the A, B, C, and D matrices (rows columns). A matrix: ( ) C matrix: ( ) B matrix: ( ) D matrix: ( ) GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! c. (8 pts.) Find the component A33 of the A matrix in the state-space model. d. (8 pts.) Find the component B33 of the B matrix in the state-space model. GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! 3. (32 pts.) The following MATLAB code describes a system of two tanks, but it contains errors. Once the script is debugged, it should produce the following plot, exactly as shown: Please correct the coding errors. Coding errors may include incorrect syntax, missing or extra characters, misplaced lines, math errors, etc. The number of incorrect lines is not given. Hint: no lines of code are completely missing. a. Circle the line number of each line that needs to be corrected or moved. No credit if instructions are not followed. b. Next to each incorrect line (or underneath it), write the corrected line of code, or else draw an arrow to where the line should be moved if a line is misplaced. GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! % Consider the following dynamic model for a 2-tank system % % h1dot = (1/A1)*Fi - (Cv/(2*A1*sqrt(h1bar))*h1 % h2dot = (Cv/2*A2*sqrt(h1bar))*h1 - (1/A2)*F2 % % The inputs to the system are volumetric flowrates Fi and F2 % The outputs are equal to the states, which are the tank levels h1 and h2 % We wish to plot the dynamic response of the system to step % changes in the inputs % %% Housekeeping 1 clc; 2 clear all; 3 close all; %% Parameter definitions 4 A1 = 1; % Cross-sectional area of tank 1 [m^2] 5 A2 = 1; % Cross-sectional area of tank 2 [m^2] 6 Cv = 1; % Valve coefficient [m^2.5/hr] %% Steady-state values of states and inputs 7 Fibar = 1; % Flowrate into tank 1 at steady-state [m^3/hr] 8 F2bar = 1; % Flowrate out of tank 2 at steady-state [m^3/hr] 9 h2bar = 1; % Level of liquid in tank 2 at steady-state [m] 10 F1bar = Fibar; % Flowrate out of tank 1 at steady-state [m^3/hr] 11 h1bar = (Fibar/Cv)^2; % Level of liquid in tank 1 at steady-state [m] %% State space model definition 12 A = [???]; 13 B = []; 14 C = []; GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! 15 D = []; %% Set-up simulation 16 tbeg = 0; 17 tend = 35; 18 tsim = tbeg:tend; 19 x0 = [0 0]; 20 tstepFi = 5; 21 tstepF2 = 10; 22 Fistep = 0.1; 23 F2step = 0.1; 24 Fi = zeros(length(tsim),1); 25 F2 = zeros(length(tsim),1); 26 for i=1:length(tsim)-1 27 if tsim(i) < tstepFi 28 29 Fi(i) = 0; else 30 31 Fi(i) = Fistep; end 32 end 33 for i=1:length(tsim)-1 34 if tsim(i) < tstepF2 35 36 F2(i) = 0; else 37 38 39 F2(i) = F2step; end end GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! %% Run simulation 40 tsol = [ ]; 41 xsol = [ ]; 42 for i=1:length(tsim) 43 u = [Fi(i);F2(i)]; 44 if i=1 45 46 47 (t_part,x_part) = ode45(@ssmodeleqn,[tbeg tend],x0,[],u); else (t_part,x_part) = ode45(@ssmodeleqn,[tsim(i) tsim(i+1)],x0,[],u); 48 end 49 tsol = [tsol;t_part]; 50 xsol = [xsol;x_part]; 51 end %% Convert deviation variables back to physical variables 52 hsol = xsol + [h1bar ; h2bar]; 53 Fi = Fi - Fibar; 54 F2 = F2 - F2bar; %% Plot simulation result % Give plot a 10% padding to avoid clipping by figure borders 55 min1X = min(tsol); 56 max1X = max(tsol); 57 min1Y = min(hsol); 58 max1Y = max(hsol); 59 pad1Y = 0.10*(max1Y-min1Y); 60 min2X = min(tsim); GOOD LUCK! !!RETURN THIS SHEET WITH YOUR EXAM BOOK!! 61 max2X = max(tsim); 62 min2Y = min([Fi;F2]); 63 max2Y = max([Fi;F2]); 64 pad2Y = 0.10*(max2Y-min2Y); 65 subplot(1,2,1) 66 plot(tsim,hsol) 67 axis([min1X max1X min1Y-pad1Y max1Y+pad1Y]) 68 title('Two-Tank System (Input Step Response)') 69 xlabel('Time [h]') 70 ylabel('Tank Level [m]') 71 legend('Tank 1','Tank 2','location','southeast') 72 subplot(1,2,2) 73 plot(tsim,Fi,'bo-') 74 hold on; 75 plot(tsim,F2,'r-') 76 axis([min2X max2X min2Y-pad2Y max2Y+pad2Y]) 77 legend('F_i','F_2','location','southeast') 78 xlabel('Time [h]') 79 ylabel('Flowrate [m^3/h]') 80 hold off; %% Function block 81 function dxdt = ssmodeleqn(t,x,u,A,B) 82 dxdt = Ax + Bu; 83 end GOOD LUCK!