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