1 | #*--------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 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 - 2007 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 | * Model of a stoichiometric reactor |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * |
---|
19 | * Description: |
---|
20 | * Modeling of a reactor based on a stoichiometric approach. |
---|
21 | * |
---|
22 | * Assumptions: |
---|
23 | * * steady-state |
---|
24 | * |
---|
25 | * Specify: |
---|
26 | * * inlet stream |
---|
27 | * * extent of reactions or |
---|
28 | * * conversion of a key component |
---|
29 | * |
---|
30 | *---------------------------------------------------------------------- |
---|
31 | * Author: Rodolfo Rodrigues |
---|
32 | * $Id$ |
---|
33 | *--------------------------------------------------------------------*# |
---|
34 | |
---|
35 | using "tank_basic"; |
---|
36 | |
---|
37 | |
---|
38 | #*--------------------------------------------------------------------- |
---|
39 | * only vapour-phase |
---|
40 | *--------------------------------------------------------------------*# |
---|
41 | Model stoic_vap as tank_vap |
---|
42 | PARAMETERS |
---|
43 | NReac as Integer (Brief="Number of reactions", Default=1); |
---|
44 | stoic(NComp,NReac) as Real (Brief="Stoichiometric matrix"); |
---|
45 | |
---|
46 | VARIABLES |
---|
47 | out Outlet as vapour_stream; # Outlet stream |
---|
48 | |
---|
49 | rate(NComp) as reaction_mol (Brief="Overall component rate of reaction"); |
---|
50 | conv(NComp) as Real (Brief="Fractional conversion of component", Default=0); |
---|
51 | |
---|
52 | EQUATIONS |
---|
53 | "Outlet stream" |
---|
54 | Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*V; |
---|
55 | |
---|
56 | "Mechanical equilibrium" |
---|
57 | Outlet.P = Outletm.P; |
---|
58 | |
---|
59 | "Energy balance" |
---|
60 | Outlet.F*Outlet.h = Outletm.F*Outletm.h; |
---|
61 | |
---|
62 | "Steady-state" |
---|
63 | Outlet.F = Outletm.F; |
---|
64 | |
---|
65 | for i in [1:NComp] |
---|
66 | if (Outletm.z(i) > 0) then |
---|
67 | "Molar conversion" |
---|
68 | Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i)); |
---|
69 | else if (Outlet.z(i) > 0) then |
---|
70 | "Molar conversion" |
---|
71 | conv(i) = 1; # ? |
---|
72 | else |
---|
73 | "Molar conversion" |
---|
74 | conv(i) = 0; # ? |
---|
75 | end |
---|
76 | end |
---|
77 | end |
---|
78 | end |
---|
79 | |
---|
80 | |
---|
81 | #*--------------------------------------------------------------------- |
---|
82 | * only liquid-phase |
---|
83 | *--------------------------------------------------------------------*# |
---|
84 | Model stoic_liq as tank_liq |
---|
85 | PARAMETERS |
---|
86 | NReac as Integer (Brief="Number of reactions", Default=1); |
---|
87 | stoic(NComp,NReac) as Real (Brief="Stoichiometric matrix"); |
---|
88 | |
---|
89 | VARIABLES |
---|
90 | out Outlet as liquid_stream; # Outlet stream |
---|
91 | |
---|
92 | rate(NComp) as reaction_mol (Brief="Overall component rate of reaction"); |
---|
93 | conv(NComp) as Real (Brief="Fractional conversion of component", Default=0); |
---|
94 | |
---|
95 | EQUATIONS |
---|
96 | "Outlet stream" |
---|
97 | Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*V; |
---|
98 | |
---|
99 | "Mechanical equilibrium" |
---|
100 | Outlet.P = Outletm.P; |
---|
101 | |
---|
102 | "Energy balance" |
---|
103 | Outlet.F*Outlet.h = Outletm.F*Outletm.h; |
---|
104 | |
---|
105 | "Steady-state" |
---|
106 | Outlet.F = Outletm.F; |
---|
107 | |
---|
108 | for i in [1:NComp] |
---|
109 | if (Outletm.z(i) > 0) then |
---|
110 | "Molar conversion" |
---|
111 | Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i)); |
---|
112 | else if (Outlet.z(i) > 0) then |
---|
113 | "Molar conversion" |
---|
114 | conv(i) = 1; # ? |
---|
115 | else |
---|
116 | "Molar conversion" |
---|
117 | conv(i) = 0; # ? |
---|
118 | end |
---|
119 | end |
---|
120 | end |
---|
121 | end |
---|
122 | |
---|
123 | |
---|
124 | #*--------------------------------------------------------------------- |
---|
125 | * 1. extent of reactions are known |
---|
126 | *--------------------------------------------------------------------*# |
---|
127 | Model stoic_extent_vap as stoic_vap |
---|
128 | ATTRIBUTES |
---|
129 | Pallete = true; |
---|
130 | Icon = "icon/cstr"; |
---|
131 | Brief = "Model of a generic vapour-phase stoichiometric CSTR based on extent of reaction"; |
---|
132 | Info = " |
---|
133 | Requires the information of: |
---|
134 | * extent of reactions |
---|
135 | "; |
---|
136 | |
---|
137 | VARIABLES |
---|
138 | extent(NReac) as flow_mol (Brief="Extent of reaction"); |
---|
139 | |
---|
140 | EQUATIONS |
---|
141 | "Rate of reaction" |
---|
142 | rate*V = sumt(stoic*extent); |
---|
143 | end |
---|
144 | |
---|
145 | Model stoic_extent_liq as stoic_liq |
---|
146 | ATTRIBUTES |
---|
147 | Pallete = true; |
---|
148 | Icon = "icon/cstr"; |
---|
149 | Brief = "Model of a generic liquid-phase stoichiometric CSTR based on extent of reaction"; |
---|
150 | Info = " |
---|
151 | Requires the information of: |
---|
152 | * extent of reactions |
---|
153 | "; |
---|
154 | |
---|
155 | VARIABLES |
---|
156 | extent(NReac) as flow_mol (Brief="Extent of reaction"); |
---|
157 | |
---|
158 | EQUATIONS |
---|
159 | "Rate of reaction" |
---|
160 | rate*V = sumt(stoic*extent); |
---|
161 | end |
---|
162 | |
---|
163 | |
---|
164 | #*--------------------------------------------------------------------- |
---|
165 | * 2. conversion of a key component is known |
---|
166 | *--------------------------------------------------------------------*# |
---|
167 | Model stoic_conv_vap as stoic_vap |
---|
168 | ATTRIBUTES |
---|
169 | Pallete = true; |
---|
170 | Icon = "icon/cstr"; |
---|
171 | Brief = "Model of a generic vapour-phase stoichiometric CSTR based on conversion of a key component"; |
---|
172 | Info = " |
---|
173 | Requires the information of: |
---|
174 | * conversion of a key component |
---|
175 | "; |
---|
176 | |
---|
177 | PARAMETERS |
---|
178 | KComp as Integer(Brief="Key component", Lower=1, Default=1); |
---|
179 | |
---|
180 | VARIABLES |
---|
181 | kconv as Real (Brief="Molar conversion of key component"); |
---|
182 | |
---|
183 | EQUATIONS |
---|
184 | "Reaction rate" |
---|
185 | rate*V = sumt(stoic)/abs(sumt(stoic(KComp,:)))*Outletm.F*Outletm.z(KComp)*kconv; |
---|
186 | end |
---|
187 | |
---|
188 | Model stoic_conv_liq as stoic_liq |
---|
189 | ATTRIBUTES |
---|
190 | Pallete = true; |
---|
191 | Icon = "icon/cstr"; |
---|
192 | Brief = "Model of a generic liquid-phase stoichiometric CSTR based on conversion of a key component"; |
---|
193 | Info = " |
---|
194 | Requires the information of: |
---|
195 | * conversion of a key component |
---|
196 | "; |
---|
197 | |
---|
198 | PARAMETERS |
---|
199 | KComp as Integer(Brief="Key component", Lower=1, Default=1); |
---|
200 | |
---|
201 | VARIABLES |
---|
202 | kconv as Real (Brief="Molar conversion of key component"); |
---|
203 | |
---|
204 | EQUATIONS |
---|
205 | "Reaction rate" |
---|
206 | rate*V = sumt(stoic)/abs(sumt(stoic(KComp,:)))*Outletm.F*Outletm.z(KComp)*kconv; |
---|
207 | end |
---|