source: trunk/BioModel/reactors/stoic_reactor_modelo1.mso @ 1008

Last change on this file since 1008 was 1008, checked in by Argimiro Resende Secchi, 21 months ago

Adding BioModel? to the MSO library.

File size: 14.0 KB
Line 
1#*-------------------------------------------------------------------
2*
3* Versao 2.1
4* Data:    03/2016
5* Autores:   Anderson R. A. Lino e Gabriel C. Fonseca
6*
7*--------------------------------------------------------------------
8*Descricao: modelo do reator estequiometrico que sera empregado
9*na biorrefinaria
10*--------------------------------------------------------------------
11*--------------------------------------------------------------------
12* Notas: Foram feitos dois flowsheets para averiguar os modelos
13*--------------------------------------------------------------------
14*--------------------------------------------------------------------
15*Hipoteses assumidas:
16*--------------------------------------------------------------------
17*--------------------------------------------------------------------
18*Controle de versao:
19*Versao 2.1: Ediane de Sa Alves 04/2020.
20*Alterado formatacao do documento, nenhuma alteracao no modelo.
21*Controle de versao:
22*Versao 2.2: e
23*--------------------------------------------------------------------*#
24
25using "main_stream";
26using "energy_stream";
27
28Model stoic_reactor
29
30        ATTRIBUTES
31        Pallete         = true;
32        Icon            = "icon/reactor";
33        Brief           = "Basic Model for a Stoic Reactor";
34        Info =
35"== GENERAL ==
36        Modeling of a reactor based on a stoichiometric approach.
37        The conversion of the reactions should be specified based on the
38        liminting compound. Also, the limiting compound should have a
39        stoichiometric coefficient equal to minus one.
40
41== ASSUMPTIONS ==
42* All three-phases can be involved;
43* Steady-state.
44
45== SPECIFY ==
46* Inlet stream:
47  flow rate
48  temperature
49  pressure
50  stream composition;
51* Conversion for each reaction based on the limiting compound;
52* Temperature of the reactor;
53* Reactor space-time or volume.
54
55== SET ==
56* Number of reactions;
57* Stoichiometric matrix;
58* Limiting compound for each reaction;
59* Heat of reaction;
60* The density of the mixture in the reactor (for reactor volume
61        calculations).
62";
63       
64#*-------------------------------------------------------------------
65#Parametros
66*--------------------------------------------------------------------*#
67
68        PARAMETERS
69       
70outer   NComp                                                   as Integer                      (Brief = "Number of Chemical Components for the fliud Phase");
71outer   NCompS                                                  as Integer                      (Brief = "Number of Chemical Components for the Solid Phase");
72                NReac                                                   as Integer                      (Brief = "Number Of Reactions", Default = 1);
73                stoic(NComp + NCompS, NReac)    as Real                         (Brief = "Stoichiometric Matrix, Matrix Size = NComp+NCompS, NReac");
74                limit(NReac)                                    as Integer                      (Brief = "Limiting Compound Index Number, Vector Size = NReac", Lower = 1);
75                h(NReac)                                                as heat_reaction        (Brief = "Molar Heat of Reaction Based on Limiting Component, Vector Size = NReac");
76                density                                                 as dens_mass            (Brief = "Mixture/Solution density");
77outer   PP                                                              as Plugin                       (Brief = "External Physical Properties", Type="PP");
78outer   PPS                                                     as Plugin                       (Brief = "External Physical Properties", Type="PP");
79                M(NComp)                                                as molweight            (Brief = "Component Mol Weight", Protected=true);
80                MS(NCompS)                                      as molweight            (Brief = "Component Mol Weight", Protected=true);
81               
82#*-------------------------------------------------------------------
83* Define o valor dos parametros declarados no modelo
84*--------------------------------------------------------------------*#
85
86        SET
87       
88        M   = PP.MolecularWeight();
89        MS   = PPS.MolecularWeight();
90       
91#*-------------------------------------------------------------------
92* Declaracao de variaveis
93*--------------------------------------------------------------------*#
94       
95        VARIABLES
96       
97in      Inlet                           as main_stream          (Brief = "Inlet Stream", PosX=0.0, PosY=0.2,  Symbol="_{in}");
98        F                                       as flow_mol                     (Brief = "Total Inlet Stream Flow", Protected = true);
99        z(NComp + NCompS)       as fraction             (Brief = "Total Inlet Composition, Vector Size = NComp+NCompS", Protected = true);
100out     Outlet                          as main_stream_PH       (Brief = "Outlet Stream", PosX=0.5, PosY=1, Symbol="_{out}");
101
102        Q                                               as heat_rate    (Brief = "Heat");
103        r(NComp + NCompS, NReac)        as Real                 (Brief = "Ratio between component (i) production/consumption for the limiting component, Matrix Size = NComp+NCompS, NReac");
104        conv(NReac)                                     as fraction             (Brief = "Reaction Conversion Based on Limiting Component, Vector Size = NReac", Symbol = "X");
105        V                                               as volume               (Brief = "Effective Reactor Volume", Upper = 1e6);
106        reac_time                                       as positive             (Brief = "Reaction Space-time or Total Batch Time", Unit = 'h', Lower = 0, Upper = 1e6, Symbol = "\tau");
107        T                                                       as temperature  (Brief = "Reactor Temperature");
108       
109#*-------------------------------------------------------------------
110* Equacoes do modelo
111*--------------------------------------------------------------------*#
112       
113        EQUATIONS
114               
115        "Ratio between component (i) production/consumption for the limiting component"
116        r(1:NComp+NCompS,:) = stoic(1:NComp+NCompS,:) * conv * z(limit);
117       
118        if (NReac equal 1) then
119                "Component Molar Balance (Fluid Phase)"
120                Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) =
121                Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + F * r(1:NComp,1);
122       
123                "Component Molar Balance (Solid Phase)"
124                Outlet.Solid.F * Outlet.Solid.z(1:NCompS) =
125                Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + F * r(NComp+1:NComp+NCompS,1);
126        else
127                "Component Molar Balance (Fluid Phase)"
128                Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) =
129                Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + F * sumt(r(1:NComp,:));
130       
131                "Component Molar Balance (Solid Phase)"
132                Outlet.Solid.F * Outlet.Solid.z(1:NCompS) =
133                Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + F * sumt(r(NComp+1:NComp+NCompS, :));
134        end
135       
136        "Sum of Molar Fractions (Fluid Phase)"
137        sum(Outlet.Fluid.z) = 1;
138       
139        "Sum of Molar Fractions (Solid Phase)"
140        sum(Outlet.Solid.z) = 1;
141       
142        "Energy Balance"
143        Outlet.Fluid.F * Outlet.Fluid.h + Outlet.Solid.F * Outlet.Solid.h =
144        Inlet.Fluid.F * Inlet.Fluid.h + Inlet.Solid.F * Inlet.Solid.h + Q - F * sum(h * conv * z(limit));
145       
146        "Total Inlet Composition (Fluid Phase)"
147        F * z(1:NComp) = Inlet.Fluid.F * Inlet.Fluid.z;
148       
149        "Total Inlet Composition (Solid Phase)"
150        F * z(NComp + 1: NComp + NCompS) = Inlet.Solid.F * Inlet.Solid.z;       
151
152        "Reactor Pressure"
153        Inlet.P = Outlet.P;
154       
155        "Reactor Temperature"
156        Outlet.T = T;
157       
158        "Total Inlet Stream Flow"
159        F = Inlet.Fluid.F + Inlet.Solid.F;
160       
161        "Reactor Volume"
162        V = Inlet.Fluid.Fw * reac_time / density;
163       
164end
165
166Model exo_stoic as stoic_reactor
167        ATTRIBUTES
168        Pallete         = true;
169        Icon            = "icon/reactor";
170        Brief           = "Basic Model for a Exothermic Stoic Reactor";
171        Info =
172"== GENERAL ==
173        Modeling of a exothermic reactor based on a stoichiometric approach.
174        The conversion of the reactions should be specified based on the
175        liminting compound. Also, the limiting compound should have a
176        stoichiometric coefficient equal to minus one.
177
178== ASSUMPTIONS ==
179* All three-phases can be involved;
180* Steady-state.
181
182== SPECIFY ==
183* Inlet stream:
184  flow rate
185  temperature
186  pressure
187  stream composition;
188* Conversion for each reaction based on the limiting compound;
189* Temperature of the reactor;
190* Reactor space-time or volume.
191
192== SET ==
193* Number of reactions;
194* Stoichiometric matrix;
195* Limiting compound for each reaction;
196* Heat of reaction;
197* The density of the mixture in the reactor (for reactor volume
198        calculations);
199* Basic composition (mass or molar);
200* Phase of the fluid entering the reactor;
201* Number of stream components(Ncomp/NcompS).
202";
203
204        VARIABLES
205out     Outlet_q                as heat_stream  (Brief = "Inlet Heat Stream", PosX=0.0, PosY=0.8, Symbol="_{out}");
206
207        EQUATIONS
208        "Equate Heat Stream"
209        Outlet_q.Q = Q;
210end
211       
212Model endo_stoic as stoic_reactor
213        ATTRIBUTES
214        Pallete         = true;
215        Icon            = "icon/reactor";
216        Brief           = "Basic Model for a Endothermic Stoic Reactor";
217        Info =
218"== GENERAL ==
219        Modeling of a endothermic reactor based on a stoichiometric approach.
220        The conversion of the reactions should be specified based on the
221        liminting compound. Also, the limiting compound should have a
222        stoichiometric coefficient equal to minus one.
223
224== ASSUMPTIONS ==
225* All three-phases can be involved;
226* Steady-state.
227
228== SPECIFY ==
229* Inlet stream:
230  flow rate
231  temperature
232  pressure
233  stream composition;
234* Conversion for each reaction based on the limiting compound;
235* Temperature of the reactor;
236* Reactor space-time or volume.
237
238== SET ==
239* Number of reactions;
240* Stoichiometric matrix;
241* Limiting compound for each reaction;
242* Heat of reaction;
243* The density of the mixture in the reactor (for reactor volume
244        calculations).
245* Basic composition (mass or molar);
246* Number of stream components(Ncomp/NcompS).
247";
248
249        VARIABLES
250in      Inlet_q         as heat_stream  (Brief = "Inlet Heat Stream", PosX=0.0, PosY=0.8, Symbol="_{in}");
251
252        EQUATIONS
253        "Equate Heat Stream"
254        Inlet_q.Q = -Q;
255end
256
257FlowSheet teste_endo_stoic
258       
259#*-------------------------------------------------------------------
260* Declaracao de dispositivos (ou blocos contendo o modelo)
261*--------------------------------------------------------------------*#
262       
263        DEVICES
264        SS101 as main_sourceR;
265        R101 as endo_stoic;
266        E101 as heat_sourceR;
267       
268#*-------------------------------------------------------------------
269* Especifica as conexoes entre os modelos
270*--------------------------------------------------------------------*#
271       
272        CONNECTIONS
273        SS101.Outlet to R101.Inlet;
274        E101.Outlet_q to R101.Inlet_q;
275       
276#*-------------------------------------------------------------------
277* Especifica variaveis definidas no modelo
278*--------------------------------------------------------------------*#
279       
280        SPECIFY
281        SS101.Fluid.Fw = 13 * 'kg/h';
282        SS101.Solid.Fw = 0.045 * 'kg/h';
283       
284        SS101.T = 303.15 * 'K';
285       
286        SS101.P = 1 * 'atm';
287       
288        SS101.CompositionOfSolid(1) = 0;
289        SS101.CompositionOfSolid(2) = 0;
290        SS101.CompositionOfSolid(3) = 0;
291        SS101.CompositionOfSolid(4) = 0;
292        SS101.CompositionOfSolid(5) = 1;
293        SS101.CompositionOfSolid(6) = 0;
294        SS101.CompositionOfSolid(7) = 0;
295        SS101.CompositionOfSolid(8) = 0;
296        SS101.CompositionOfSolid(9) = 0;
297        SS101.CompositionOfFluid(1) = 0.8;
298        SS101.CompositionOfFluid(2) = 0.2;
299        SS101.CompositionOfFluid(3:25) = 0;
300       
301        R101.conv = [0.7];
302        R101.T = 303.15 * 'K';
303        R101.reac_time = 48 * 'h';
304
305#*-------------------------------------------------------------------
306#Parametros
307*--------------------------------------------------------------------*#
308
309        PARAMETERS
310        PP as Plugin    (Brief = "External Physical Properties",
311                Type="PP",
312                Project = "../Flowsheets/v2_2/Fluid_v2_2.vrtherm"
313        );
314        PPS as Plugin   (Brief = "External Physical Properties",
315                Type="PP",
316                Project = "../Flowsheets/v2_2/Solid_v2_2.vrtherm"
317        );
318       
319        NComp   as Integer      (Brief = "Number of chemical components in the fluid phase");
320        NCompS  as Integer      (Brief = "Number of chemical components in the solid phase");
321       
322#*-------------------------------------------------------------------
323* Define o valor dos parametros declarados no modelo
324*--------------------------------------------------------------------*#
325       
326        SET
327        NComp = PP.NumberOfComponents();
328        NCompS = PPS.NumberOfComponents();
329       
330        SS101.CompositionBasis = "Mass";
331       
332        R101.NReac = 1;
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]; # Reaction 1: 1.Sucrose + 1.H2O  --> 2.Glucose
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       
350FlowSheet 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
435end
Note: See TracBrowser for help on using the repository browser.