1 | #*------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2008 ALSOC. |
---|
3 | * |
---|
4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
6 | * http://www.enq.ufrgs.br/alsoc. |
---|
7 | * |
---|
8 | * EMSO Copyright (C) 2004 - 2008 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | *-------------------------------------------------------------------- |
---|
16 | * Sample file for CSTR |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * Author: Argimiro R. Secchi |
---|
19 | * $Id: CSTR_noniso.mso 295 2008-06-15 19:48:17Z arge $ |
---|
20 | *--------------------------------------------------------------------*# |
---|
21 | |
---|
22 | using "types"; |
---|
23 | |
---|
24 | const_valv as positive(Brief = "Valve Constant", Default=1,Lower=0,Upper=100, Unit='m^2.5/h'); |
---|
25 | |
---|
26 | Model stream_cstr |
---|
27 | VARIABLES |
---|
28 | Ca as conc_mol; |
---|
29 | F as flow_vol; |
---|
30 | T as temperature; |
---|
31 | end |
---|
32 | |
---|
33 | Model CSTR |
---|
34 | |
---|
35 | PARAMETERS |
---|
36 | ko as frequency (DisplayUnit='1/h'); |
---|
37 | D as length; |
---|
38 | A as area; |
---|
39 | Ea as energy_mol (DisplayUnit='kJ/kmol'); |
---|
40 | R as Real (Unit='kJ/mol/K'); |
---|
41 | ro as dens_mass (DisplayUnit='kg/m^3'); |
---|
42 | Cp as cp_mass (DisplayUnit='kJ/kg/K'); |
---|
43 | U as heat_trans_coeff (DisplayUnit='kW/m^2/K'); |
---|
44 | Hr as heat_reaction (DisplayUnit='kJ/kmol'); |
---|
45 | pi as Real (Default = 3.141593); |
---|
46 | Cv as const_valv; |
---|
47 | |
---|
48 | VARIABLES |
---|
49 | At as area; |
---|
50 | T as temperature; |
---|
51 | Tw as temperature; |
---|
52 | x as fraction; |
---|
53 | V as volume; |
---|
54 | Ca as conc_mol; |
---|
55 | h as length; |
---|
56 | tau as time_h; |
---|
57 | rA as reaction_mol; |
---|
58 | k as frequency (DisplayUnit='1/h'); |
---|
59 | q as heat_rate (DisplayUnit='kJ/h'); |
---|
60 | qr as heat_rate (DisplayUnit='kJ/h'); |
---|
61 | in Inlet as stream_cstr; |
---|
62 | out Outlet as stream_cstr; |
---|
63 | |
---|
64 | SET |
---|
65 | A = pi * D^2 / 4; |
---|
66 | |
---|
67 | EQUATIONS |
---|
68 | |
---|
69 | "Overall Mass Balance" |
---|
70 | diff(V) = Inlet.F - Outlet.F; |
---|
71 | |
---|
72 | "Component Mass Balance" |
---|
73 | V * diff(Ca) = Inlet.F * (Inlet.Ca - Ca) - (-rA) * V; |
---|
74 | |
---|
75 | "Average Residence Time" |
---|
76 | tau * Inlet.F = V; |
---|
77 | |
---|
78 | "Energy Balance" |
---|
79 | ro * V * Cp * diff(T) = Inlet.F * ro * Cp * (Inlet.T - T) + qr - q; |
---|
80 | |
---|
81 | "Heat Transfer Rate" |
---|
82 | q = U * At * (T - Tw); |
---|
83 | |
---|
84 | "Reaction Heat Rate" |
---|
85 | qr = (-Hr) * (-rA) * V; |
---|
86 | |
---|
87 | "Reaction Rate" |
---|
88 | -rA = k * Ca; |
---|
89 | |
---|
90 | "Arrhenius Equation" |
---|
91 | k = ko * exp(-Ea/(R*T)); |
---|
92 | |
---|
93 | "Geometry" |
---|
94 | A * h = V; |
---|
95 | At = A + pi*D*h; |
---|
96 | |
---|
97 | "Valve Equation" |
---|
98 | Outlet.F = x * Cv * sqrt(h); |
---|
99 | |
---|
100 | "Perfect Mixture" |
---|
101 | Outlet.Ca = Ca; |
---|
102 | Outlet.T = T; |
---|
103 | end |
---|
104 | |
---|
105 | # Process with uncontrolled CSTR and multiple steady-states |
---|
106 | FlowSheet CSTR_no_control |
---|
107 | |
---|
108 | DEVICES |
---|
109 | FEED as stream_cstr; |
---|
110 | CSTR1 as CSTR; |
---|
111 | |
---|
112 | CONNECTIONS |
---|
113 | FEED to CSTR1.Inlet; |
---|
114 | |
---|
115 | SET |
---|
116 | # CSTR Parameters |
---|
117 | CSTR1.R = 8.3144 * 'kJ/kmol/K'; |
---|
118 | CSTR1.U = 300 * 'kJ/h/m^2/K'; |
---|
119 | CSTR1.ro = 1000 * 'kg/m^3'; |
---|
120 | CSTR1.Cp = 4*'kJ/kg/K'; |
---|
121 | CSTR1.Hr = -7000 * 'kJ/kmol'; |
---|
122 | CSTR1.Ea = 6e4 * 'kJ/kmol'; |
---|
123 | CSTR1.ko = 89 * '1/s'; |
---|
124 | CSTR1.D = 3.2 * 'm'; |
---|
125 | CSTR1.Cv = 2.7 * 'm^2.5/h'; |
---|
126 | |
---|
127 | EQUATIONS |
---|
128 | "Manipulated Variables" |
---|
129 | CSTR1.x = 1; |
---|
130 | CSTR1.Tw = 300 * 'K'; |
---|
131 | |
---|
132 | "Feed Stream" |
---|
133 | FEED.Ca = 300 * 'kmol/m^3'; |
---|
134 | FEED.F = 3.5 * 'm^3/h'; |
---|
135 | |
---|
136 | # Disturbance |
---|
137 | if time < 50 * 'h' then |
---|
138 | "Feed Temperature" FEED.T = 300 * 'K'; |
---|
139 | else |
---|
140 | "Feed Temperature" FEED.T = 350 * 'K'; |
---|
141 | end |
---|
142 | |
---|
143 | INITIAL |
---|
144 | "Concentration" CSTR1.Ca = 50 * 'kmol/m^3'; |
---|
145 | "Level" CSTR1.h = 1.7 * 'm'; |
---|
146 | "Temperature" CSTR1.T = 570 * 'K'; # increase to 580 K to change steady-state |
---|
147 | |
---|
148 | OPTIONS |
---|
149 | TimeStep = 1; |
---|
150 | TimeEnd = 100; |
---|
151 | TimeUnit = 'h'; |
---|
152 | DAESolver(File = "dassl"); |
---|
153 | end |
---|