1 | #*------------------------------------------------------------------- |
---|
2 | * Biorrefinaria Petrobras |
---|
3 | *-------------------------------------------------------------------- |
---|
4 | * Nome do arquivo: stoic_reactor.mso |
---|
5 | * Projeto: Modelo integrado de producao de etanol 1G/2G |
---|
6 | * Conteudo: reator estequiometrico |
---|
7 | *--------------------------------------------------------------------*# |
---|
8 | |
---|
9 | #*------------------------------------------------------------------- |
---|
10 | * |
---|
11 | * Versao 2.2 |
---|
12 | * Data: 03/2016 |
---|
13 | * Autores: Anderson R. A. Lino e Gabriel C. Fonseca |
---|
14 | * |
---|
15 | *-------------------------------------------------------------------- |
---|
16 | *Descricao: modelo do reator estequiometrico que sera empregado |
---|
17 | *na biorrefinaria |
---|
18 | *-------------------------------------------------------------------- |
---|
19 | |
---|
20 | *-------------------------------------------------------------------- |
---|
21 | * Notas: Foram feitos dois flowsheets para averiguar os modelos |
---|
22 | *--------------------------------------------------------------------*# |
---|
23 | |
---|
24 | using "main_stream"; |
---|
25 | using "energy_stream"; |
---|
26 | |
---|
27 | Model stoic_reactor |
---|
28 | |
---|
29 | ATTRIBUTES |
---|
30 | Pallete = true; |
---|
31 | Icon = "icon/reactor"; |
---|
32 | Brief = "Basic Model for a Stoic Reactor"; |
---|
33 | Info = |
---|
34 | "== GENERAL == |
---|
35 | Modeling of a reactor based on a stoichiometric approach. |
---|
36 | The conversion of the reactions should be specified based on the |
---|
37 | liminting compound. Also, the limiting compound should have a |
---|
38 | stoichiometric coefficient equal to minus one. |
---|
39 | |
---|
40 | == ASSUMPTIONS == |
---|
41 | * All three-phases can be involved; |
---|
42 | * Steady-state. |
---|
43 | |
---|
44 | == SPECIFY == |
---|
45 | * Inlet stream: |
---|
46 | flow rate |
---|
47 | temperature |
---|
48 | pressure |
---|
49 | stream composition; |
---|
50 | * Conversion for each reaction based on the limiting compound; |
---|
51 | * Temperature of the reactor; |
---|
52 | * Reactor space-time or volume. |
---|
53 | |
---|
54 | == SET == |
---|
55 | * Number of reactions; |
---|
56 | * Stoichiometric matrix; |
---|
57 | * Limiting compound for each reaction; |
---|
58 | * Heat of reaction; |
---|
59 | * The density of the mixture in the reactor (for reactor volume |
---|
60 | calculations). |
---|
61 | "; |
---|
62 | |
---|
63 | #*------------------------------------------------------------------- |
---|
64 | #Parametros |
---|
65 | *--------------------------------------------------------------------*# |
---|
66 | |
---|
67 | PARAMETERS |
---|
68 | |
---|
69 | outer NComp as Integer (Brief = "Number of Chemical Components for the fliud Phase"); |
---|
70 | outer NCompS as Integer (Brief = "Number of Chemical Components for the Solid Phase"); |
---|
71 | NReac as Integer (Brief = "Number Of Reactions", Default = 1); |
---|
72 | stoic(NComp + NCompS, NReac) as Real (Brief = "Stoichiometric Matrix, Matrix Size = NComp+NCompS, NReac"); |
---|
73 | limit(NReac) as Integer (Brief = "Limiting Compound Index Number, Vector Size = NReac", Lower = 1); |
---|
74 | h(NReac) as heat_reaction (Brief = "Molar Heat of Reaction Based on Limiting Component, Vector Size = NReac"); |
---|
75 | density as dens_mass (Brief = "Mixture/Solution density"); |
---|
76 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
77 | outer PPS as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
78 | M(NComp) as molweight (Brief = "Component Mol Weight", Protected=true); |
---|
79 | MS(NCompS) as molweight (Brief = "Component Mol Weight", Protected=true); |
---|
80 | |
---|
81 | #*------------------------------------------------------------------- |
---|
82 | * Define o valor dos parametros declarados no modelo |
---|
83 | *--------------------------------------------------------------------*# |
---|
84 | |
---|
85 | SET |
---|
86 | |
---|
87 | M = PP.MolecularWeight(); |
---|
88 | MS = PPS.MolecularWeight(); |
---|
89 | |
---|
90 | #*------------------------------------------------------------------- |
---|
91 | * Declaracao de variaveis |
---|
92 | *--------------------------------------------------------------------*# |
---|
93 | |
---|
94 | VARIABLES |
---|
95 | |
---|
96 | in Inlet as main_stream (Brief = "Inlet Stream", PosX=0.0, PosY=0.2, Symbol="_{in}"); |
---|
97 | F as flow_mol (Brief = "Total Inlet Stream Flow", Protected = true); |
---|
98 | z(NComp + NCompS) as fraction (Brief = "Total Inlet Composition, Vector Size = NComp+NCompS", Protected = true); |
---|
99 | out Outlet as main_stream_PH (Brief = "Outlet Stream", PosX=0.5, PosY=1, Symbol="_{out}"); |
---|
100 | |
---|
101 | Q as heat_rate (Brief = "Heat"); |
---|
102 | r(NComp + NCompS, NReac) as Real (Brief = "Ratio between component (i) production/consumption for the limiting component, Matrix Size = NComp+NCompS, NReac"); |
---|
103 | conv(NReac) as fraction (Brief = "Reaction Conversion Based on Limiting Component, Vector Size = NReac", Symbol = "X"); |
---|
104 | V as volume (Brief = "Effective Reactor Volume", Upper = 1e6); |
---|
105 | reac_time as positive (Brief = "Reaction Space-time or Total Batch Time", Unit = 'h', Lower = 0, Upper = 1e6, Symbol = "\tau"); |
---|
106 | T as temperature (Brief = "Reactor Temperature"); |
---|
107 | |
---|
108 | #*------------------------------------------------------------------- |
---|
109 | * Equacoes do modelo |
---|
110 | *--------------------------------------------------------------------*# |
---|
111 | |
---|
112 | EQUATIONS |
---|
113 | |
---|
114 | "Ratio between component (i) production/consumption for the limiting component" |
---|
115 | r(1:NComp+NCompS,:) = stoic(1:NComp+NCompS,:) * conv * z(limit); |
---|
116 | |
---|
117 | if (NReac equal 1) then |
---|
118 | "Component Molar Balance (Fluid Phase)" |
---|
119 | Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) = |
---|
120 | Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + F * r(1:NComp,1); |
---|
121 | |
---|
122 | "Component Molar Balance (Solid Phase)" |
---|
123 | Outlet.Solid.F * Outlet.Solid.z(1:NCompS) = |
---|
124 | Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + F * r(NComp+1:NComp+NCompS,1); |
---|
125 | else |
---|
126 | "Component Molar Balance (Fluid Phase)" |
---|
127 | Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) = |
---|
128 | Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + F * sumt(r(1:NComp,:)); |
---|
129 | |
---|
130 | "Component Molar Balance (Solid Phase)" |
---|
131 | Outlet.Solid.F * Outlet.Solid.z(1:NCompS) = |
---|
132 | Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + F * sumt(r(NComp+1:NComp+NCompS, :)); |
---|
133 | end |
---|
134 | |
---|
135 | "Sum of Molar Fractions (Fluid Phase)" |
---|
136 | sum(Outlet.Fluid.z) = 1; |
---|
137 | |
---|
138 | "Sum of Molar Fractions (Solid Phase)" |
---|
139 | sum(Outlet.Solid.z) = 1; |
---|
140 | |
---|
141 | "Energy Balance" |
---|
142 | Outlet.Fluid.F * Outlet.Fluid.h + Outlet.Solid.F * Outlet.Solid.h = |
---|
143 | Inlet.Fluid.F * Inlet.Fluid.h + Inlet.Solid.F * Inlet.Solid.h + Q - F * sum(h * conv * z(limit)); |
---|
144 | |
---|
145 | "Total Inlet Composition (Fluid Phase)" |
---|
146 | F * z(1:NComp) = Inlet.Fluid.F * Inlet.Fluid.z; |
---|
147 | |
---|
148 | "Total Inlet Composition (Solid Phase)" |
---|
149 | F * z(NComp + 1: NComp + NCompS) = Inlet.Solid.F * Inlet.Solid.z; |
---|
150 | |
---|
151 | "Reactor Pressure" |
---|
152 | Inlet.P = Outlet.P; |
---|
153 | |
---|
154 | "Reactor Temperature" |
---|
155 | Outlet.T = T; |
---|
156 | |
---|
157 | "Total Inlet Stream Flow" |
---|
158 | F = Inlet.Fluid.F + Inlet.Solid.F; |
---|
159 | |
---|
160 | "Reactor Volume" |
---|
161 | V = Inlet.Fluid.Fw * reac_time / density; |
---|
162 | |
---|
163 | end |
---|
164 | |
---|
165 | Model exo_stoic as stoic_reactor |
---|
166 | ATTRIBUTES |
---|
167 | Pallete = true; |
---|
168 | Icon = "icon/reactor"; |
---|
169 | Brief = "Basic Model for a Exothermic Stoic Reactor"; |
---|
170 | Info = |
---|
171 | "== GENERAL == |
---|
172 | Modeling of a exothermic reactor based on a stoichiometric approach. |
---|
173 | The conversion of the reactions should be specified based on the |
---|
174 | liminting compound. Also, the limiting compound should have a |
---|
175 | stoichiometric coefficient equal to minus one. |
---|
176 | |
---|
177 | == ASSUMPTIONS == |
---|
178 | * All three-phases can be involved; |
---|
179 | * Steady-state. |
---|
180 | |
---|
181 | == SPECIFY == |
---|
182 | * Inlet stream: |
---|
183 | flow rate |
---|
184 | temperature |
---|
185 | pressure |
---|
186 | stream composition; |
---|
187 | * Conversion for each reaction based on the limiting compound; |
---|
188 | * Temperature of the reactor; |
---|
189 | * Reactor space-time or volume. |
---|
190 | |
---|
191 | == SET == |
---|
192 | * Number of reactions; |
---|
193 | * Stoichiometric matrix; |
---|
194 | * Limiting compound for each reaction; |
---|
195 | * Heat of reaction; |
---|
196 | * The density of the mixture in the reactor (for reactor volume |
---|
197 | calculations); |
---|
198 | * Basic composition (mass or molar); |
---|
199 | * Phase of the fluid entering the reactor; |
---|
200 | * Number of stream components(Ncomp/NcompS). |
---|
201 | "; |
---|
202 | |
---|
203 | VARIABLES |
---|
204 | out Outlet_q as heat_stream (Brief = "Inlet Heat Stream", PosX=0.0, PosY=0.8, Symbol="_{out}"); |
---|
205 | |
---|
206 | EQUATIONS |
---|
207 | "Equate Heat Stream" |
---|
208 | Outlet_q.Q = Q; |
---|
209 | end |
---|
210 | |
---|
211 | Model endo_stoic as stoic_reactor |
---|
212 | ATTRIBUTES |
---|
213 | Pallete = true; |
---|
214 | Icon = "icon/reactor"; |
---|
215 | Brief = "Basic Model for a Endothermic Stoic Reactor"; |
---|
216 | Info = |
---|
217 | "== GENERAL == |
---|
218 | Modeling of a endothermic reactor based on a stoichiometric approach. |
---|
219 | The conversion of the reactions should be specified based on the |
---|
220 | liminting compound. Also, the limiting compound should have a |
---|
221 | stoichiometric coefficient equal to minus one. |
---|
222 | |
---|
223 | == ASSUMPTIONS == |
---|
224 | * All three-phases can be involved; |
---|
225 | * Steady-state. |
---|
226 | |
---|
227 | == SPECIFY == |
---|
228 | * Inlet stream: |
---|
229 | flow rate |
---|
230 | temperature |
---|
231 | pressure |
---|
232 | stream composition; |
---|
233 | * Conversion for each reaction based on the limiting compound; |
---|
234 | * Temperature of the reactor; |
---|
235 | * Reactor space-time or volume. |
---|
236 | |
---|
237 | == SET == |
---|
238 | * Number of reactions; |
---|
239 | * Stoichiometric matrix; |
---|
240 | * Limiting compound for each reaction; |
---|
241 | * Heat of reaction; |
---|
242 | * The density of the mixture in the reactor (for reactor volume |
---|
243 | calculations). |
---|
244 | * Basic composition (mass or molar); |
---|
245 | * Number of stream components(Ncomp/NcompS). |
---|
246 | "; |
---|
247 | |
---|
248 | VARIABLES |
---|
249 | in Inlet_q as heat_stream (Brief = "Inlet Heat Stream", PosX=0.0, PosY=0.8, Symbol="_{in}"); |
---|
250 | |
---|
251 | EQUATIONS |
---|
252 | "Equate Heat Stream" |
---|
253 | Inlet_q.Q = -Q; |
---|
254 | end |
---|
255 | |
---|
256 | FlowSheet teste_endo_stoic |
---|
257 | |
---|
258 | #*------------------------------------------------------------------- |
---|
259 | * Declaracao de dispositivos (ou blocos contendo o modelo) |
---|
260 | *--------------------------------------------------------------------*# |
---|
261 | |
---|
262 | DEVICES |
---|
263 | SS101 as main_sourceR; |
---|
264 | R101 as endo_stoic; |
---|
265 | E101 as heat_sourceR; |
---|
266 | |
---|
267 | #*------------------------------------------------------------------- |
---|
268 | * Especifica as conexoes entre os modelos |
---|
269 | *--------------------------------------------------------------------*# |
---|
270 | |
---|
271 | CONNECTIONS |
---|
272 | SS101.Outlet to R101.Inlet; |
---|
273 | E101.Outlet_q to R101.Inlet_q; |
---|
274 | |
---|
275 | #*------------------------------------------------------------------- |
---|
276 | * Especifica variaveis definidas no modelo |
---|
277 | *--------------------------------------------------------------------*# |
---|
278 | |
---|
279 | SPECIFY |
---|
280 | SS101.Fluid.Fw = 13 * 'kg/h'; |
---|
281 | SS101.Solid.Fw = 0.045 * 'kg/h'; |
---|
282 | |
---|
283 | SS101.T = 303.15 * 'K'; |
---|
284 | |
---|
285 | SS101.P = 1 * 'atm'; |
---|
286 | |
---|
287 | SS101.CompositionOfSolid(1) = 0; |
---|
288 | SS101.CompositionOfSolid(2) = 0; |
---|
289 | SS101.CompositionOfSolid(3) = 0; |
---|
290 | SS101.CompositionOfSolid(4) = 0; |
---|
291 | SS101.CompositionOfSolid(5) = 1; |
---|
292 | SS101.CompositionOfSolid(6) = 0; |
---|
293 | SS101.CompositionOfSolid(7) = 0; |
---|
294 | SS101.CompositionOfSolid(8) = 0; |
---|
295 | SS101.CompositionOfSolid(9) = 0; |
---|
296 | SS101.CompositionOfFluid(1) = 0.8; |
---|
297 | SS101.CompositionOfFluid(2) = 0.2; |
---|
298 | SS101.CompositionOfFluid(3:25) = 0; |
---|
299 | |
---|
300 | R101.conv = [0.7]; |
---|
301 | R101.T = 303.15 * 'K'; |
---|
302 | R101.reac_time = 48 * 'h'; |
---|
303 | |
---|
304 | #*------------------------------------------------------------------- |
---|
305 | #Parametros |
---|
306 | *--------------------------------------------------------------------*# |
---|
307 | |
---|
308 | PARAMETERS |
---|
309 | PP as Plugin (Brief = "External Physical Properties", |
---|
310 | Type="PP", |
---|
311 | Project = "../Flowsheets/v2_2/Fluid_v2_2.vrtherm" |
---|
312 | ); |
---|
313 | PPS as Plugin (Brief = "External Physical Properties", |
---|
314 | Type="PP", |
---|
315 | Project = "../Flowsheets/v2_2/Solid_v2_2.vrtherm" |
---|
316 | ); |
---|
317 | |
---|
318 | NComp as Integer (Brief = "Number of chemical components in the fluid phase"); |
---|
319 | NCompS as Integer (Brief = "Number of chemical components in the solid phase"); |
---|
320 | |
---|
321 | #*------------------------------------------------------------------- |
---|
322 | * Define o valor dos parametros declarados no modelo |
---|
323 | *--------------------------------------------------------------------*# |
---|
324 | |
---|
325 | SET |
---|
326 | NComp = PP.NumberOfComponents(); |
---|
327 | NCompS = PPS.NumberOfComponents(); |
---|
328 | |
---|
329 | SS101.CompositionBasis = "Mass"; |
---|
330 | |
---|
331 | R101.NReac = 1; |
---|
332 | # Reaction 1: 1.Sucrose + 1.H2O --> 2.Glucose |
---|
333 | R101.stoic (:,1) = [-1, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0]; |
---|
334 | |
---|
335 | R101.h = [0] * 'kJ/kmol'; |
---|
336 | R101.density = 1000 * 'kg/m^3'; |
---|
337 | |
---|
338 | R101.limit = [2]; |
---|
339 | |
---|
340 | #*------------------------------------------------------------------- |
---|
341 | * Condicoes iniciais e opcoes de Solver |
---|
342 | *--------------------------------------------------------------------*# |
---|
343 | |
---|
344 | OPTIONS |
---|
345 | Dynamic = false; |
---|
346 | Integration = "original"; |
---|
347 | NLASolver (File = "nlasolver", AbsoluteAccuracy = 1e-1, RelativeAccuracy = 1e-2, MaxIterations = 100); |
---|
348 | end |
---|
349 | |
---|
350 | FlowSheet teste_exo_stoic # temperatura de chama adiabatica do metano |
---|
351 | |
---|
352 | #*------------------------------------------------------------------- |
---|
353 | * Declaracao de dispositivos (ou blocos contendo o modelo) |
---|
354 | *--------------------------------------------------------------------*# |
---|
355 | |
---|
356 | DEVICES |
---|
357 | SS101 as main_sourceR; |
---|
358 | R101 as exo_stoic; |
---|
359 | |
---|
360 | #*------------------------------------------------------------------- |
---|
361 | * Especifica as conexoes entre os modelos |
---|
362 | *--------------------------------------------------------------------*# |
---|
363 | |
---|
364 | CONNECTIONS |
---|
365 | SS101.Outlet to R101.Inlet; |
---|
366 | |
---|
367 | #*------------------------------------------------------------------- |
---|
368 | * Especifica variaveis definidas no modelo |
---|
369 | *--------------------------------------------------------------------*# |
---|
370 | |
---|
371 | SPECIFY |
---|
372 | SS101.Fluid.F = 1 * 'kmol/h'; |
---|
373 | SS101.Solid.F = 0 * 'kmol/h'; |
---|
374 | |
---|
375 | SS101.T = 298 * 'K'; |
---|
376 | |
---|
377 | SS101.P = 18 * 'bar'; |
---|
378 | |
---|
379 | SS101.CompositionOfSolid(1) = 1; |
---|
380 | SS101.CompositionOfFluid = [1,2,7.52,0,0]; |
---|
381 | |
---|
382 | |
---|
383 | R101.conv = [1]; |
---|
384 | R101.reac_time = 1 * 'h'; |
---|
385 | R101.Q = 0*'kW'; |
---|
386 | |
---|
387 | #*------------------------------------------------------------------- |
---|
388 | #Parametros |
---|
389 | *--------------------------------------------------------------------*# |
---|
390 | |
---|
391 | PARAMETERS |
---|
392 | PP as Plugin (Brief = "External Physical Properties", |
---|
393 | Type="PP", |
---|
394 | Components = ["methane","oxygen","nitrogen","water","carbon dioxide"], |
---|
395 | LiquidModel = "IdealLiquid", |
---|
396 | VapourModel = "Ideal" |
---|
397 | ); |
---|
398 | PPS as Plugin (Brief = "External Physical Properties", |
---|
399 | Type="PP", |
---|
400 | Components = ["water"], |
---|
401 | LiquidModel = "IdealLiquid", |
---|
402 | VapourModel = "Ideal" |
---|
403 | ); |
---|
404 | NComp as Integer; |
---|
405 | NCompS as Integer; |
---|
406 | |
---|
407 | #*------------------------------------------------------------------- |
---|
408 | * Define o valor dos parametros declarados no modelo |
---|
409 | *--------------------------------------------------------------------*# |
---|
410 | |
---|
411 | SET |
---|
412 | NComp = PP.NumberOfComponents(); |
---|
413 | NCompS = PPS.NumberOfComponents(); |
---|
414 | |
---|
415 | SS101.CompositionBasis = "Molar"; |
---|
416 | SS101.ValidPhases = "Vapour-Only"; |
---|
417 | |
---|
418 | R101.NReac = 1; |
---|
419 | R101.stoic (:,1) = [-1,-2,0,2,1,0]; |
---|
420 | |
---|
421 | R101.h = -882.0 * 'kJ/mol'; |
---|
422 | R101.density = PP.VapourDensity(R101.T,R101.Outlet.P,R101.Outlet.Fluid.z); |
---|
423 | |
---|
424 | R101.limit = [1]; |
---|
425 | |
---|
426 | |
---|
427 | #*------------------------------------------------------------------- |
---|
428 | * Condicoes iniciais e opcoes de Solver |
---|
429 | *--------------------------------------------------------------------*# |
---|
430 | |
---|
431 | OPTIONS |
---|
432 | Dynamic = false; |
---|
433 | Integration = "original"; |
---|
434 | |
---|
435 | end |
---|
436 | |
---|