Process Simulation

Computer Exersice 1
3UREOHP  0L[LQJ 7DQN (material balances and MATLAB) A stirred mixing tank has one inlets and one outlet. A model of the tank is developed in Example 1.1 to 1.5 in the lecture note. a) Put up the total material balance over the tank. Assume that the outlet flow is proportional to the volume (total mass) in the tank, T RXW = N RXW 9 . Assume the following data set: T  PV T  PV ρ  NJP NRXW 

b) Solve the dynamic problem numerically using ode23. Start the simulation with an empty tank and stop at t=100. Write the equation on VWDWHVSDFH IRUP in a Mfile in the following way seen below. Let us call this kind of M-file that contains the model description a 0RGHO ILOH. The command will be [tsol,msol]=ode23(’mixtankdyn’,[0 100],0); and the plot commad will be plot(tsol,msol) function dm = mixtank(t,m) … dm = … c) Solve the steady-state problem numerically using fzero. Write the equation on UHVLGXDO IRUP in a M-file in the following way seen below. This kind of M-file is also a 0RGHO ILOH. Note the similarities between the two model files. Guess a initial value on the mass variable. Assume that we guess mguess=2000. The command will be msol=fzero('mixtankstat',2000) function res = mixtank(m) … res = … 3UREOHP  0L[LQJ 7DQN (material balances and MATLAB) A stirred mixing tank has two inlets and one outlet. The volume is assumed to be constant (controlled). The first inlet is a fresh feed with high composition of a component A. The second inlet is a recycle stream with low composition of A. a) Develop a component mass balance and list our assumptions. Rewrite the component mass balance as a composition equation. Express it also as a concentration change equation. Assume the following data: 9  P T  PV [  NTNJ T  PV [  NJNJ ρ  NJP At the beginning (time zero) the mixing tank is full of recycled liquid. b) Solve the dynamic problem numerically using ode23. Write the composition equation in an M-file (0RGHO ILOH) in the following way.

x) … dx = … 3UREOHP  0L[LQJ 7DQN (energy balance) Assume that the mixing tank in Problem 2 is heated with steam in a jacket. The heat transfer of the jacket can be described as 4 NK$K 7V ± 7.function dx = mixtank(t.

The tank is open and has cylindrical geometry. The height in the tank changes and the cross section area is $WDQN  P The heating model and parameters are identical to Problem 3. b) Assume constant density and heat capacity and rewrite the energy balance into a temperature change equation. c) Solve the dynamic temperature equation for an initial value of  &.3 has two inlets and one outlet. The flow rates. 3UREOHP  %XIIHU 7DQN ZLWK +HDWLQJ (balance equations and MATLAB) The buffer tank similar to the tank form Problem 1. compositions and temperatures are as follows.. T  PV [  7  & T VLQ Z W. 9 $WDQN K.1 to 1. Assume the following data: &S  N-NJ& 7  & 7  & 7F  & NK  N:P& and $K  P a) Develop an energy balance over the mixing tank and list our assumptions.

.

c) Simulate the tank with one larger Z and one lower Z. Assume that Z . composition and temperature. Simulate the dynamic tank behaviour. b) Write a 0RGHO ILOH for the equation system in a). composition and temperature. PV [  7  & TRXW  PV &S  N-NJ& and ρ  NJP a) Develop mass balance component balance and energy balance over the buffer tank. . Discuss the result. Plot the height. Express the equation system in the states: height.

kout=0. In function dm=mixtankdyn(t.$ 6ROXWLRQ 3UREOHP  a) Assumptions: • Well-mixed vessel means the same density in the whole tank and in outlet GP Gρ9 GP = = Z1 + Z2 − ZRXW = ρT1 + ρT 2 − ρT RXW ⇒ = ρ (T1 + T 2 − T RXW ) GW GW GW + Acc GP $ G[ Z) Z ( Z + Z5 ) Z) [) + Z5 [5 = Z0 [0 + [) + 5 [ 5 − ) [ ⇒ = GW GW P P P Z is mass flow. w1=rho*q1. w2=rho*q2.Computer Exersice 1 . wout=rho*kout*V. q1=0.3. >WVROPVRO@ RGH PL[WDQNG\Q > @ .m) = Out ( Z + Z5 ) G[ Z Z + E[ = D where D = ) [) + 5 [ 5 and E = ) GW P P P G[ D H EW + EH EW [ = H EW D ⇒ ∫ G [HEW = ∫ H EW DGW ⇒ [H EW = H EW + &1 E GW D D D [ (W ) = + &1H −EW ⇒ [(W = 0) = + &1 = [0 ⇒ &1 = [0 − E E E ( Z) + Z5 ) ( Z + Z5 ) − − ) W W D ( Z [ + Z5 [5 )  1 − H P  + [0H P [ (W ) = 1 − H −EW + [0 H −EW = ) )   E ( Z) + Z5 )   ( ) ( ) % MIXTANK is a well-stirred tank model % with two inlets and one outlet. % Constant density. % parameters rho=1000. [ is composition of A b) An example of a dynamic (state space) model file.1. % mass balance on dynamic state space form dm = w1 + w2 – wout.1. q2=0. % equations V=m/rho.

 SORW WVROPVRO.

.

% Constant density. % parameters rho=1000. w1=rho*q1.1. q1=0. % equations V=m/rho. kout=0. % mass balance on residual form res = w1 + w2 – wout.4000 3500 3000 2500 2000 1500 1000 500 0 0 10 20 30 40 50 60 70 80 90 100 ( Z + Z5 ) G[ Z Z + E[ = D where D = ) [) + 5 [ 5 and E = ) GW P P P G[ D H EW + EH EW [ = H EW D ⇒ ∫ G [HEW = ∫ H EW DGW ⇒ [H EW = H EW + &1 E GW D D D [ (W ) = + &1H −EW ⇒ [(W = 0) = + &1 = [0 ⇒ &1 = [0 − E E E ( Z) + Z5 ) ( Z + Z5 ) − − ) W W D ( Z [ + Z5 [5 )  1 − H P  + [0H P [ (W ) = 1 − H −EW + [0 H −EW = ) )   E ( Z) + Z5 )   c) An example of a steady-state (residual) model file. q2=0.1. wout=rho*kout*V. w2=rho*q2.3. PVRO I]HUR PL[WDQNVWDW . ( ) ( ) function res=mixtankstat(m) % MIXTANK is a well-stirred tank model % with two inlets and one outlet.

msol = 4.0000e+003 .

w1=rho*q1.3UREOHP  a) Assumptions: b) The component balance is written in mixtank M-file. The model is solved using ode23.1. q1=0. % parameters V=4. x1=0. rho=1000. % Constant volume and density.1.3. type mixtank function dx=mixtank(t. >W[@ RGH PL[WDQN > @. % component balance dx = (w1*x1+w2*x2)/m -(w1+w2)/m*x.9. % equations m=rho*V. w2=rho*q2. q2=0.x) % MIXTANK is a well-stirred tank model % with two inlets and one outlet. x2=0.

 SORW W[.

15 0.25 0. 0.35 0.1 0 5 10 15 20 25 30 35 40 45 50 3UREOHP  a and b)Assumptions: .3 0.2 0.

W\SH KHDWWDQN function dTemp=heattank(t. % equations m=rho*V.• • • Constant volume and density means constant mass and that outlet mass flow is equal to the sum of the inflows Well-mixed vessel means the same enthalpy in the whole tank and in outlet Constant heat capacity (Note that the temperature differential equation is mathematically idential with the component balance in Problem 1. q2=0.18.3. rho=1000. K is enthalpy K = & S (7 − 7UHI ) ⇒ In G& S (7 − 7UHI ) = = Out ⇒ ( Z + Z5 ) GK Z) Z N $ = K) + 5 K5 + K K (7V − 7 ) − ) K GW P P P P ( Z + Z5 ) Z) Z N $ & S (7) − 7UHI ) + 5 & S (75 − 7UHI ) + K K (7V − 7 ) − ) & S (7 − 7UHI ) GW P P P P ( Z + Z5 ) ( Z + Z5 ) N $ Z G7 Z) Z Z = &S & S7) + 5 & S75 + K K (7V − 7 ) − ) & S7 −  ) & S7UHI + 5 & S7UHI − ) & S7UH P P GW P P P P  P N $ ( Z + Z5 ) G7 Z) Z = 7) + 5 75 + K K (7V − 7 ) − ) 7 GW P P & SP P >WWHPS@ RGH KHDWWDQN > @. kh=5. T1=10. + Acc G (PK) Z) K) + Z5 K5 + 4 = Z0 K0 + GW Z is mass flow. volume and density. % Constant heat capacity. Ts=95. Cp=4. q1=0. It can be written as G[GW  D [ E! c) heated tank model is as follows.1. w2=rho*q2. Ah=75.Temp) % HEATTANK is a well-stirred heated tank model % with two inlets and one outlet. % component balance dTemp = (w1*T1+w2*T2)/m +(kh*Ah)/(m*Cp)*(Ts-Temp)-(w1+w2)/m*Temp. w1=rho*q1. % (pressure-volume work neglected) % parameters V=4. T2=50.

 SORW WWHPS.

.

q1=0. Atank=6. x1=0. Cp=4.3+0.05*sin(w*t). Ts=95. kh=5. rho=1000. T1=10.50 45 40 35 30 25 20 15 10 0 5 10 15 20 25 30 35 40 45 50 3UREOHP  See the solution in the lecture notes or in the Process Simulation compendium. %level x=y(2). qout=0.4. w1=rho*q1. q2=0. w2=rho*q2.05. Ah=75. . W\SH EXIIHUWDQN function dy=buffertank(t.9. wout=rho*qout.%temperature % parameters w=0. % Constant heat capacity and density.1. % equations m=Atank*z*rho.1. Q=kh*Ah*(Ts-Temp). % states z=y(1). x2=0.18. T2=50.y) % BUFFERTANK is a well-stirred open tank model % with two inlets and one outlet. %composition Temp=y(3).

>W\@ RGH EXIIHUWDQN > @>@.% balances dz = (w1+w2-wout)/(rho*Atank).dx. dx = (w1*x1+w2*x2)/m -(w1+w2)/m*x. dy=[dz.dTemp]. dTemp = (w1*T1+w2*T2)/m +Q/(m*Cp)-(w1+w2)/m*Temp.

 SORW W\ .

.

1.2 1.25 1.4 1.05 1 0 20 40 60 80 100 120 140 160 180 200 .15 1.1 1.3 1.35 1.

Sign up to vote on this title
UsefulNot useful