0% found this document useful (0 votes)
8 views18 pages

Simulation Lab File

The document outlines a lab manual for the Modelling and Simulation Lab at Sant Longowal Institute of Engineering and Technology, detailing various experiments related to ordinary differential equations and chemical engineering processes. Each experiment includes objectives, theoretical background, and coding instructions for simulations using methods like Euler, Newton-Raphson, and interval halving. The manual emphasizes the application of mathematical modeling in real-world chemical engineering scenarios, including tank dynamics, heat exchangers, and continuous stirred-tank reactors (CSTRs).
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
8 views18 pages

Simulation Lab File

The document outlines a lab manual for the Modelling and Simulation Lab at Sant Longowal Institute of Engineering and Technology, detailing various experiments related to ordinary differential equations and chemical engineering processes. Each experiment includes objectives, theoretical background, and coding instructions for simulations using methods like Euler, Newton-Raphson, and interval halving. The manual emphasizes the application of mathematical modeling in real-world chemical engineering scenarios, including tank dynamics, heat exchangers, and continuous stirred-tank reactors (CSTRs).
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
ob eed seb gesddddbbsad »paY ———" ee vuevvurs SANT LONGOWAL INSTITUTE OF ENGINEERING AND TECHNOLOGY, LONGOWAL, (Deemed to be University, CFTI under MHRD) Department of Chemical Engineering Lab Mannual Programm: Undergraduate Subject Name: Modelling and simulation Lab Sub Code: CH-711 ist of lab experiments _ ordinary differential equation Exp. No.5: Exp. No.6: Exp. No.7: Prepared By: Lab In charge: Avinash Thakur iment on the accuracy and numerical stability of Euler method to solve the To develop a Mathematical model for a liquid filled tank whose outlet flow is a nonlinear function of tank height. Determine the time for the tank height to reach a certain level. Find the Bubble point temperature and vapour composition of a binary system using Newton Raphson algorithm | Find the Bubble point temperature and vapour composition of a binary system using | interval halving algorithm. _ ae i To find the steady state outlet temperature of Hot Fluid and Cold Fluid flowing in a Counter current heat exchanger using explicit convergence method To Simulate a nonisothermal CSTR using Euler and Fourth order Runge -Kutta and compare the maximum step size and computation time that provides 0.1% accuracy. Simulate the manipulated concentration fed to the first CSTR of the three isothermal CCSTRs put in series (Closed Loop using proportional integral feedback controller) to | find the dynamic changes in the outlet concentration of reactant from third CSTR | (Assuming first order reaction in all CSTRs) : Bi Simulate the batch reactor where a proportional Feedback controller is used to control the steam and cold fluid flow rate into the jacket. cian: Mr. Ravinder Kumar 5466666464666 Ce ae ee) veecuns ee weeevee Experiment No. 1 Title: Comment on the accuracy and numerical stability of Euler method to solve the ordinary differential equation ax —=1-x dt Theory: Suppose we have a system that is described by the ODE with v = 0 att = 0 xw=i-et A FORTRAN digital computer program using Euler is given below for reference. An integration step size (DELTA) of 0.05 is used: Euler Method: For solving ODE = fx0 with initial condition *() ~ *0, Using the step size of At, nth value of x can be obtained as dx tome (Ge) At To the (n+1)st step in time tha = Gy tat Fairly small steps must be taken (<0.1) if an accurate dynamic curve of iz) is desired. Fairly large steps can be taken, but the solution is not accurate.. The physical system or process is not unstable. The Euler algorithm has the property that if the steps are made small enough to achieve reasonable accuracy ( Four to five significant figures), the solution is stable. These steps sizes scale directly with the time constant t. If t were 10, we could take steps that were 10 times bigger. So the maximum stable step size for Euler integration is twice the time constant. Algorithm write the algorithm and code in C++ or Matlab Code for obtaining the results. Plot the result in Excel and comment, —— CETL Leese ell ee Title: To develop a Mathematical model for a liqui flow is a nonlinear function of tank height. Determine height to reach a certain level. Theory: The ODE resulted from force balance on the outlet line is @ Total continuity equation on the liquid in the tank gives dh A; —- = Fo—F ii 1 gp = Fo w@ Using the relationship F = vA,and substituting the numerical values of parameters into Equation (i) and (ii) give dv Rod eA qe 7 9. 0107h— 0.002050 (itt) ah 4.311 ~0.0624 i ate o (iv) Using the explicit first order Euler algorithm is used for solving V and H as a function of time, the right-hand sides of Equations (iii) and (iv) are the derivative functions coded as VDOT and HDOT in the program. At the nth Step in Time (VDOT), = 0.0107(H), ~0.00205|(V),|?_— (v) (HDOT), = 0.311 ~0.0624(V) (vi) The new values of H and V at the (n+1)st step are calculated from the Euler Algorithm with a step size of DELTA. (nia = (Hq + DELTA(HDOT),, (vii) usr = (Vm + DELTA(VDOT), (viii) Using Euler method, write the code in for obtaining the results in C++ or Matlab Code. bob d dese eee l eds ds bbb et ff ve Srrer er reese Experiment No. 3 Title: Find the Bubble point temperature and vapour composition of a bina system using Newton Raphson algorithm Theory: Newton-Raphson amounts to using the slope of the function curve to extrapolate to the correct value. Using the bubble point problem as a specific example, let us define the function f(T) insta 7% © We want to find the value of Tthat makes, /(T), equal to zero; i.e., a) find the root of f(T) . b) Guess a value of temperature Ty and ¢) Then we evaluate the function at7, , f d) Next evaluate the slope of the function at To, fx,) Which can be given as fire we. al Solving for 7, gives _ fire (iii) T; in Eq. (iii) is the new guess of temperature. If the curve f(T) were a straight line, it would converge to the correct solution in just one iteration We get the recursive iteration Algorithm as —fe fn (iv) Ty, =New guess of temperature T, =old guess of temperature fy =Value of f(T) atT =T, a I, = value of derivative of a atl = 7, aT Evaluating the derivatives of the function i ae G2.s2 fry = Past? — P = xe) 4 (4 jer *8?) _ —x)A2P3 =-xA1 pj US 4aPs Using Newton Raphson method, write the code in for obtaining the results in ebb dll lblddddddicscddesetiece ti eevevve Experiment No. 4 Title: Find the Bubble point temperature and vapour composition of a binary system using Interval halving algorithm. Theor Interval halving technique is quite simple and easy to visualize and program. It is not very rapid in converging to the correct solution, but it is rock-bottom stable (it won't blow up on you numerically). It works well in dynamic simulations because the step size can be adjusted to correspond approximately to the rate at which the variable is changing with time during the integration time step. fon = PES =P @ Figure shows sketches the interval-halving procedure graphically. An initial guess of temperature To is made. P{° is calculated from Eq. (i) . Then P&*"" is compared to P. A fixed increment in temperature AT is added to or subtracted from the temperature guess, depending on whether PA" is greater or less than P. (a) T, Correct value of T alt Temperature We keep moving in the correct direction at this fixed step size ee a change in the sign of the term (P - P*" ). This means we have cros cart the correct value of T. Then we back up halfway, i.e., we halve the Lied AT. With each successive iteration we again halve AT, always moving either up or down in temperature. PRPPPPP ©eeeevv, eeeuUugaeeuuUuBVUeeeeegeececeevueesusesvrrrvr"rrv"v” Experiment No. 5 Title: To find the steady state outlet temperature of Hot Fluid and Cold Fluid flowing in a Counter current heat exchanger using explicit convergence method Theory: For some systems of equation, itis possible to guess a value of avariable Xguess and then use one of the equations to solve explicitly for a new calculated value of the same variable, xqic- Then the calculated value and the original guess are compared, and a new guess is made. The new guess can be simply the calculated value (this is called successive substitution). Convergence may be very slow because of {1) A very slow rate of approach of Xcatc tO Xyuess (2) an oscillation of xcqie back and forth around Xguess- The loop can even diverge. Therefore, 2 convergence factor f can be used to speed up or slow down the rate at which X,uess is permitted to change from iteration to iteration, Cpctedeew = Cegecen nce +B [cus — (pues) as] @ Cooling water 170.5 gpm 80°F The steady state equations for heat transfer are a Q = VA(AT),y = (120)(879)(4T) im wi Q = (70000) (0.5)(250 — Ty2) id) Q = (170.5)(60)(8.33)(Tc2 — 80) (iv) (ory ~280= Tad = C= 80)} o Procedure: We have four equations and four variables: Q, (AT)im> Tea» Tu2: Using the data given in figure, write the code in C++ to obtain the results Using the following iterative procedure as 1, Guess a value for the oil outlet temperature Taye**(which must be greater than 80°F, for physical reasons). Calculate Q: From Eq. no (iii) Calculate Tc. from Eq. no (iv) Calculate the LMTD driving force (AT), from Eq. No (v) Calculate a new heat transfer rate Q, from Eq. no (ii) Substitute the value of Qzinto (iii) and calculate a Tz Compare 7/7," and T)i3"° Reguess 7){'°** using Eq. No (i) oo >-—e? eee 8 O0OoHnHv ee ov ne 079722389898 Ot CLUE CLELELEEEEEEELLEEE eee ebdediadd Experiment No 6 Objective: To Simulate a no- isothermal CSTR using Euler and Fourth order Runge -Kutta and compare the maximum step size and computation time that Provides 0.1% accuracy Theory: The jacketed Exothermic CSTR provides a good example of the simulation of very nonlinear ODEs. Both flow rates and holdups will be variable. A Proportional level controller manipulates the liquid leaving the tank, F, as a linear function of the volume in the tank F = 40—10(48-V) @ A second controller manipulates the liquid leaving the jacket, in direct proportion to the temperature in the reactor. F, = 40 - 10(48 - Vv) (iw) Constant holdup and perfect mixing are assumed in the cooling jacket. Disturbances in inlet feed flow rate Fy and feed concentration Cyo are step changes at time equal zero. The ODEs describing the system are Bee ad aah (iid) da(VC, VG) _ FoCao— FC, — ViCy (iv) dt a(VT) AVKC, UA cieeee Ole Me are oo iD) @) @) i i ii) and The algebraic equations describing the system are equations (i) and (ii) the following k= ae~#/Ar Algorithm write the algorithm and code in C++ or Matlab Code for obtaining the results. Using the table wherein values of parameters and steady state conditions have been provided. The variables with overseas or bars over them are steady state values. Note that the time basis used in this problem is hours. Plot figures using excel to show results for disturbances in fed composition and feed flow rate. Show the effect of decrement in controller gain to 2.5 for larger feed disturbance PPPPERO pppoe, COLE C EEE EECEELLEC EC TCESSC ESS oe eo edddssce Experiment No, 7 Objective; Simulate the manipulated concentration fed to the first CSTR of the three isothermal CSTRs put in series (Closed Loop using proportional integral feedback controller) to find the dynamic changes in the outlet concentration of reactant from third CSTR (Assuming first order reaction in all CSTRs) Theory: The equations describing the series of three isothermal CSTRs were developed de, 1 Ae = | (Cao ~ Car) ~ KEar 0) dy, 41 Bete Ca = Can) ~ kan (ui) de, 1 de z (Cae Can) ~ KCny (ui) The initial conditions are Caro, Caro), Cayo) kgmol of component A/m! The forcing function is Cao Assume that at time zero Cy is set at 1.8kgmol of A/m! and held constant, The parameter tis set equal to 2 min and the value if kis 0.5 min, The right-hand sides of the ODEs (i), (li)and(iil)respectively are the functions f(x,t), Let us call these derivatives CA1DOT, CA2DOT, and CA3DOT, at the nth step in time, (CALDOT), © *[(Ca0)n(Cavnrk(Carn (wv) (CA2DONy = *[(Cay)n(Car nb-K(Ca2)n @) (CA1D07), = : [Cnado(Caa)nbk(Cas)n (wd, na Then to step to the next point in time, using Euler integration with a step size DELTA (CAI) nix = (CA1)y + DELTA(CA1DOT), (vii) (CA2)ns1 = (CA2), + DELTA(CA2D0T), (vii) (CA3)n41 = (CA3), + DELTA(CA3DOT), (vii) For closed Loop System the controller looks at the product concentration leaving the third tank C,3 and makes adjustments in the inlet concentration to the first reactor Cyo in order to keep C,3 near its desired set point value Cis‘ The variable C,y is a disturbance concentration and the variable Cay is 2 manipulated concentration that is changed by the controller. We assume that Cao = Cam + Cap (iid) Feedback controller &) Outlet flow. Process Feedback conteoller Reactant rich stream # : point CZ @) Figure: Closed Loop Three CSTR Process (a) idealized System and (b) Actual System 7 CPPPISIISIPP PPP Ooo Pe ppee a a ee ee ee eee en ee The feed back controller has proportional and integral action to change Cam based on the magnitude of the error (the difference between the setpoint and CA3) and the integral of this error. iL Cue 0.8+K.(E+— | Eq ae) (ix) where E= CxS — Cay K, = feedback controller gain ( dimensionless) t1 = feedback controller integral time constant or reset time( minutes) Algorithm write the algorithm and code in C++ or Matlab Code for obtaining the results. Plot the result in Excel and comment. Experiment No 8 Title: Simulate the batch reactor where a proportional Feedback controller Is used to control the steam and cold fluid flow rate into the jacket, Theory: foe 1 temp |_*e controller Steam s Pry - CHPCEECCECCCCCOCOTrA fe] "_ Consider the Batch reactor in which steam is initially fed into the jacket to heat up the system to temperature at which the consecutive reactions begin. ~™ ~ ~~ 9 2 The output signal of the temperature controller goes to two split-ranged valves, a steam valve and a water valve. The instrumentation is all pneumatic, ‘50 the controller output pressure P. goes from 3 to 15 psig. The valves will be adjusted so that the steam valve is wide open when the controller output pressure P; is at 15 psig and is closed at P. = 9 psig. The water valve will be closed at P, =O psig and wide open at P, =3 psig. The reason for hooking up the zt In this manner is to have the correct fail-safe action in the event of an air failure. The steam valve take air pressure to open it and therefore it will fail closed and call this an ‘air-to-open’ (AO) valve. On the other hand, the water takes air pressure to close it and therefore it will fail ‘open. This is ‘air-to-close' (AC) valve. In case of emergency it is desired to remove the source of heat and go to full cooling. Controller output range(psig) 3 9 15 Steam valve fraction open Xs: (Closed) 1 (Open) Water valve fraction open Xu: (open) (Closed) The equations for the reaction liquid inside the tank and the vessel metal can be described as WA = hcg @ oo teyey— k2Cy (id) a Fe hats (ii) Qu-hA(T-Tw) ) dTy w) "de & The equations for the jacket are different for the three pases of the batch cycle. A. With steam in the jacket(35psia supply pressure steam): dp, 1am, wo MP, ie aL OS vii Ps* R(T, + 460) ub Avp yi P, = exp ten + Poy) (viii) oF DOP PPAPPFPAPHFPPAPAPFOLEPLKPPPPPETTPPPPPP | PD SD Oe Ne i eee a ee ee ee ee ee Ta eee ae w, = Cy.X, [35 (ix) Q = —hoAos(Ty ~ Tu) (~) 4 Hah (xi) B. During filling with water (20 psig water header pressure): Ao ae Ag= (32) vy, (xii) Vs cotat dv, ee ae = Fwo (xiii) d(V,T)) Qs 7 de = Fwol yo + aig) (xiv) Q) = RowAo(Tu ~ T)) (xv) Fwo = CywXwV20 (xvi) C. When the jacket is full of water: g V0; at, dt ane —T))+ (xvi) J The tempreture transmitter has a range of SO to 250°F, so its out put pneumatic pressure signal goes from 3 psig at 50°F to 250°F 12 Prr = 34 (7-50) (xvii) A propotional feedback controller is used with its output biased at 7psiglie, its output pressure is 7psig when is zero error). Pe =7+K_(P%* — Pyz) (xviii) The setpoint signal PS“ comes from a pneumatic function generator. when the Process tempreture gets upto 200°F the P**‘signal is ramped slowly downward to prevent too much loss of componenet 8 PS*t = 12 — RAMP(t — f299) (xix) where RAMPz=rate of P°*' change with time , psi/min t = batch time, min t= time when process tempreture T reaches 200°F Algorithm write the algorithm and code in C++ or Matlab Code for obtaining the results. Plot the result in Excel for batch reactor and comment. Use the da’ table given below. Parameters for hatch reactor ta in the & Ht 729,55 min~* 6567.6 min™! 15,000 Btu/lb : mol 20,000 Btu/lb - mol —8744.4°R 15.70 0,80 Ib: mol A/ft? 80°F ‘LO psi/psi 112 1b,,/min psi** 1000 Btu/h °F ft? 400 Btu/h °F ft? 160 Btu/h °F ft? 56.5 NF 939 Btu/lb.. 18.83 ft? 100 gpm/pai?* 80°F 56.5 Nh? — 40,000 Btu/lb» mol ~ 50,000 Btu/lb- mot 1 Buuflb,, °F 42.5 1? 50 Ib,,/? 0.12 Btu/lb,, °F 9.42 3 512 Ib,,/ft? 62.3 Ib, Mt? 1 Btu/lb,, °F ————— Daan a

You might also like