source: trunk/BioModel/reactors/fermenter.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.3 KB
Line 
1#*-------------------------------------------------------------------
2* Biorrefinaria Petrobras
3*--------------------------------------------------------------------
4* Nome do arquivo: fermenter.mso
5* Projeto: Modelo integrado de producao de etanol 1G/2G
6* Conteudo: fermentadores
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 de um reator com base em uma reaÃÃo estequiométrica para a
17*fermentação de soluções de glicose e xilose.
18*--------------------------------------------------------------------
19
20*--------------------------------------------------------------------
21*Hipoteses assumidas:
22*                     
23*--------------------------------------------------------------------
24
25*--------------------------------------------------------------------
26* Notas: Foram feito flowsheets para averiguar os modelos
27*--------------------------------------------------------------------*#
28
29using "main_stream";
30using "water_stream";
31using "assumptions";
32
33Model stoic_fermenter_base
34
35        ATTRIBUTES
36        Pallete         = true;
37        Icon            = "icon/reactor";
38        Brief           = "Basic Model for a Stoichiometric Fermenter";
39        Info =
40"== GENERAL ==
41        Modeling of a reactor based on a stoichiometric approach for the
42        fermentation of both glucose and xylose solutions.
43        The conversion of the reactions should be specified based on the
44        liminting compound. Also, the limiting compound should have a
45        stoichiometric coefficient equal to minus one.
46
47== ASSUMPTIONS ==
48* All three-phases can be involved;
49* Steady-state.
50
51== SPECIFY ==
52* The inlet streams:
53  flow rate
54  temperature
55  pressure
56  stream composition;
57* Conversion for each reaction based on the limiting compound;
58* Temperature of the reactor;
59
60== SET ==
61* Number of reactions;
62* Stoichiometric matrix;
63* Limiting compound for each reaction;
64* Heat of reaction;
65* The density of the mixture in the reactor (for reactor volume
66        calculations);
67* Type of fermentation through the switcher 'fermentation':
68        Glucose or Xylose or Glucose/Xylose fermentation;
69* The position in the compound vector of the ethanol (NEthanol),
70        CO2 (NCO2), glucose (NGlucose) and xylose (NXylose);
71* The compounds that participate in the Brix calculation
72        (1 if participates, 0 if not).
73";
74
75#*-------------------------------------------------------------------
76#Parametros
77*--------------------------------------------------------------------*#
78
79        PARAMETERS
80       
81outer   NComp                                                   as Integer                      (Brief = "Number of Chemical Components for the fluid Phase");
82outer   NCompS                                                  as Integer                      (Brief = "Number of Chemical Components for the Solid Phase");
83                NReac                                                   as Integer                      (Brief = "Number Of Reactions", Default = 1);
84                stoic(NComp + NCompS, NReac)    as Real                         (Brief = "Stoichiometric Matrix, Matrix Size = NComp+NCompS, NReac", Default = 0);
85                limit(NReac)                                    as Integer                      (Brief = "Limiting Compound Index Number, Vector Size = NReac", Lower = 1);
86                h(NReac)                                                as heat_reaction        (Brief = "Molar Heat of Reaction Based on Limiting Component, Vector Size = NReac");
87                density                                                 as dens_mass            (Brief = "Mixture/Solution density");
88outer   PP                                                              as Plugin                       (Brief = "External Physical Properties", Type="PP");
89outer   PPS                                                     as Plugin                       (Brief = "External Physical Properties", Type="PP");
90                M(NComp)                                                as molweight            (Brief = "Component Mol Weight", Protected=true);
91                MS(NCompS)                                      as molweight            (Brief = "Component Mol Weight", Protected=true);
92outer   flu as ConstituentFluid(Symbol = " ", Protected = true);       
93outer   sol as ConstituentSolid(Symbol = " ", Protected = true);       
94
95       
96#*-------------------------------------------------------------------
97* Define o valor dos parametros declarados no modelo
98*--------------------------------------------------------------------*#
99
100        SET
101        M   = PP.MolecularWeight();
102        MS   = PPS.MolecularWeight();
103       
104#*-------------------------------------------------------------------
105* Declaracao de variaveis
106*--------------------------------------------------------------------*#
107       
108        VARIABLES
109       
110in      Inlet                           as main_stream           (Brief = "Inlet Stream", PosX=0.0, PosY=0.2,  Symbol="_{Juice}", Protected = false);
111        F                                       as flow_mol                      (Brief = "Total Inlet Stream Flow");
112        z(NComp + NCompS)       as fraction              (Brief = "Total Inlet Composition");
113out     Outlet                          as main_stream_eq        (Brief = "Outlet Stream", PosX=0.5, PosY=1, Symbol="_{Wine}", Protected = false);
114out     Gas                             as main_stream_eq        (Brief = "Outlet Stream", PosX=0.8, PosY=0.0, Symbol="_{Gas}", Protected = false);
115
116        Q                                               as heat_rate    (Brief = "Heat");
117        r(NComp + NCompS, NReac)        as Real                 (Brief = "Ratio between component (i) production/consumption for the limiting component, Matrix Size = NComp+NCompS, NReac");
118        conv(NReac)                                     as fraction             (Brief = "Reaction Conversion Based on Limiting Component, Vector Size = NReac", Symbol = "X");
119
120        SET
121        Outlet.Phase = "Liquid";
122        Gas.Phase = "Vapour";
123       
124#*-------------------------------------------------------------------
125* Equacoes do modelo
126*--------------------------------------------------------------------*#
127       
128        EQUATIONS
129       
130        "Ratio between component (i) production/consumption for the limiting component"
131        r(1:NComp+NCompS,:) = stoic(1:NComp+NCompS,:) * conv * z(limit);
132       
133        "Sum of Molar Fractions (Fluid Phase)"
134        sum(Outlet.Fluid.z) = 1;
135       
136        "Sum of Molar Fractions (Solid Phase)"
137        sum(Outlet.Solid.z) = 1;
138
139        "Mechanical Equilibrium 1"
140        Inlet.P = Outlet.P;
141       
142        "Mechanical Equilibrium 2"
143        Inlet.P = Gas.P;
144       
145        "Thermal Equilibrium"
146        Outlet.T = Gas.T;
147       
148        "Outlet_Gas Composition"
149        Gas.Solid.z = Outlet.Solid.z;
150       
151        "Solids in Gas Outlet"
152        Gas.Solid.F = 0 * 'kmol/h';
153       
154end
155
156Model stoic_fermenter as stoic_fermenter_base
157
158        ATTRIBUTES
159        Pallete         = true;
160        Icon            = "icon/reactor";
161        Brief           = "Basic Model for a Stoichiometric Fermenter";
162        Info =
163"== GENERAL ==
164        Modeling of a reactor based on a stoichiometric approach for the
165        fermentation of both glucose and xylose solutions.
166        The conversion of the reactions should be specified based on the
167        liminting compound. Also, the limiting compound should have a
168        stoichiometric coefficient equal to minus one.
169
170== ASSUMPTIONS ==
171* All three-phases can be involved;
172* Steady-state.
173
174== SPECIFY ==
175* The inlet streams:
176  flow rate
177  temperature
178  pressure
179  stream composition;
180* Conversion for each reaction based on the limiting compound;
181* Temperature of the reactor;
182
183== SET ==
184* Number of reactions;
185* Stoichiometric matrix;
186* Limiting compound for each reaction;
187* Heat of reaction;
188* The density of the mixture in the reactor (for reactor volume
189        calculations);
190* Type of fermentation through the switcher 'fermentation':
191        Glucose or Xylose or Glucose/Xylose fermentation;
192* The position in the compound vector of the ethanol (NEthanol),
193        CO2 (NCO2), glucose (NGlucose) and xylose (NXylose);
194* The compounds that participate in the Brix calculation
195        (1 if participates, 0 if not);
196* Basic composition (mass or molar);
197* Number of stream components(Ncomp/NcompS).
198";
199
200#*-------------------------------------------------------------------
201#Parametros
202*--------------------------------------------------------------------*#
203
204        PARAMETERS
205        fermentation            as Switcher             (Brief = "Which process is Specified", Valid = ["glucose", "xylose", "glucose-xylose"], Default = "glucose");
206        Brix(NComp)                     as Integer                      (Brief = "Flag for the Compound that Enters the Brix Calculation");
207
208        VARIABLES
209        Inlet_Brix                              as fraction             (Brief = "Total Soluble Solids", Symbol="Inlet_{Brix}");
210        Yps                                             as positive             (Brief = "Yield Coefficient", Symbol = "Y_{P/S}");
211        Cs                                                      as Real                 (Brief = "Sugar Concentration (Glucose or Xylose)", Unit='kg/m^3');
212        Cp                                                      as Real                 (Brief = "Ethanol Concentration", Unit='kg/m^3');
213       
214
215#*-------------------------------------------------------------------
216* Equacoes do modelo
217*--------------------------------------------------------------------*#
218       
219        EQUATIONS
220       
221        switch fermentation
222               
223                case "glucose":
224                "Ethanol Concentration"
225                Cp * Outlet.Total.Fw = density * Outlet.Fluid.zw(flu.Ethanol) * Outlet.Fluid.Fw;
226               
227                "Glucose Concentration"
228                Cs * Outlet.Total.Fw = density * Outlet.Fluid.zw(flu.Glucose) * Outlet.Fluid.Fw;
229               
230                "Yield Coefficient"
231                Yps * Inlet.Fluid.Fw * Inlet.Fluid.zw(flu.Glucose) = Outlet.Fluid.Fw * Outlet.Fluid.zw(flu.Ethanol);
232       
233                case "xylose":
234                "Ethanol Concentration"
235                Cp * Outlet.Total.Fw = density * Outlet.Fluid.zw(flu.Ethanol) * Outlet.Fluid.Fw;
236               
237                "Xylose Concentration"
238                Cs * Outlet.Total.Fw = density * Outlet.Fluid.zw(flu.Xylose) * Outlet.Fluid.Fw;
239               
240                "Yield Coefficient"
241                Yps * Inlet.Fluid.Fw * Inlet.Fluid.zw(flu.Xylose) = Outlet.Fluid.Fw * Outlet.Fluid.zw(flu.Ethanol);
242               
243                case "glucose-xylose":
244                "Ethanol Concentration"
245                Cp * Outlet.Total.Fw = density * Outlet.Fluid.zw(flu.Ethanol) * Outlet.Fluid.Fw;
246               
247                "Xylose Concentration"
248                Cs * Outlet.Total.Fw = density * (Outlet.Fluid.zw(flu.Xylose) + Outlet.Fluid.zw(flu.Glucose)) * Outlet.Fluid.Fw;
249               
250                "Yield Coefficient"
251                Yps * Inlet.Fluid.Fw * (Inlet.Fluid.zw(flu.Xylose) + Inlet.Fluid.zw(flu.Glucose)) = Outlet.Fluid.Fw * Outlet.Fluid.zw(flu.Ethanol);
252       
253        end
254
255        if (NReac equal 1) then
256                "Component Molar Balance (Fluid Phase)"
257                Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) +
258                Gas.Fluid.F * Gas.Fluid.z(1:NComp) =
259                Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + F * r(1:NComp,1);
260       
261                "Component Molar Balance (Solid Phase)"
262                Outlet.Solid.F * Outlet.Solid.z(1:NCompS) +
263                Gas.Solid.F * Gas.Solid.z(1:NCompS) =
264                Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + F * r(NComp+1:NComp+NCompS,1);
265        else
266                "Component Molar Balance (Fluid Phase)"
267                Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) +
268                Gas.Fluid.F * Gas.Fluid.z(1:NComp) =
269                Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + F * sumt(r(1:NComp,:));
270       
271                "Component Molar Balance (Solid Phase)"
272                Outlet.Solid.F * Outlet.Solid.z(1:NCompS) +
273                Gas.Solid.F * Gas.Solid.z(1:NCompS) =
274                Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + F * sumt(r(NComp+1:NComp+NCompS, :));
275        end
276       
277        "Energy Balance"
278        Outlet.Fluid.F * Outlet.Fluid.h + Outlet.Solid.F * Outlet.Solid.h +
279        Gas.Fluid.F * Gas.Fluid.h + Gas.Solid.F * Gas.Solid.h =
280        Inlet.Fluid.F * Inlet.Fluid.h + Inlet.Solid.F * Inlet.Solid.h
281        + Q + F * sum(h * conv * z(limit));
282       
283        "Total Inlet Composition (Fluid Phase)"
284        F * z(1:NComp) = Inlet.Fluid.F * Inlet.Fluid.z;
285       
286        "Total Inlet Composition (Solid Phase)"
287        F * z(NComp + 1: NComp + NCompS) = Inlet.Solid.F * Inlet.Solid.z;       
288
289        "Total Inlet Stream Flow"
290        F = Inlet.Fluid.F + Inlet.Solid.F;
291       
292        "Total Soluble Solids"
293        Inlet_Brix * Inlet.Total.Fw = sum(Inlet.Fluid.zw * Brix) * Inlet.Fluid.Fw;
294       
295        for i in [1:NComp] do
296                if i equal flu.CO2 then
297                "Outlet_Gas Composition"
298                        Gas.Fluid.z(i) = 0.98;
299                else if i equal flu.Ethanol then
300                "Outlet_Gas Composition"
301                        Gas.Fluid.z(i) = 0.02;
302                else
303                "Outlet_Gas Composition"
304                        Gas.Fluid.z(i) = 0;
305                end
306                end
307        end
308       
309        "Gases in Solid Outlet"
310        Outlet.Fluid.F * Outlet.Fluid.z(flu.CO2) = 0 * 'kmol/h';
311       
312end
313
314
315
316FlowSheet teste_stoic_fermenter
317       
318#*-------------------------------------------------------------------
319* Declaracao de dispositivos (ou blocos contendo o modelo)
320*--------------------------------------------------------------------*#
321       
322        DEVICES
323        SS101 as main_sourceR;
324        R101 as stoic_fermenter;
325       
326#*-------------------------------------------------------------------
327* Especifica as conexoes entre os modelos
328*--------------------------------------------------------------------*#
329       
330        CONNECTIONS
331        SS101.Outlet to R101.Inlet;
332       
333#*-------------------------------------------------------------------
334* Especifica variaveis definidas no modelo
335*--------------------------------------------------------------------*#
336       
337        SPECIFY
338        SS101.Fluid.Fw = 13 * 'kg/h';
339        SS101.Solid.Fw = 1e-6 * 'kg/h';
340       
341        SS101.T = 303.15 * 'K';
342       
343        SS101.P = 1 * 'atm';
344       
345        SS101.CompositionOfSolid(1) = 0;
346        SS101.CompositionOfSolid(2) = 0;
347        SS101.CompositionOfSolid(3) = 0;
348        SS101.CompositionOfSolid(4) = 0;
349        SS101.CompositionOfSolid(5) = 1;
350        SS101.CompositionOfSolid(6:9) = 0;
351        SS101.CompositionOfFluid(1) = 0.8;
352        SS101.CompositionOfFluid(2) = 0;
353        SS101.CompositionOfFluid(3) = 0;
354        SS101.CompositionOfFluid(4) = 0.2;
355        SS101.CompositionOfFluid(5:25) = 0;
356       
357        R101.conv = [0.9];
358        R101.Outlet.T = 303.15 * 'K';
359
360#*-------------------------------------------------------------------
361#Parametros
362*--------------------------------------------------------------------*#
363
364        PARAMETERS
365        PP as Plugin    (Brief = "External Physical Properties",
366                Type="PP",
367                Project = "../Flowsheets/v2_2/Fluid_v2_2.vrtherm"
368        );
369        PPS as Plugin   (Brief = "External Physical Properties",
370                Type="PP",
371                Project = "../Flowsheets/v2_2/Solid_v2_2.vrtherm"
372        );
373       
374        NComp   as Integer      (Brief = "Number of chemical components in the fluid phase");
375        NCompS  as Integer      (Brief = "Number of chemical components in the solid phase");
376        flu as ConstituentFluid(Symbol = " ", Protected = true);
377        sol as ConstituentSolid(Symbol = " ", Protected = true);
378#*-------------------------------------------------------------------
379* Define o valor dos parametros declarados no modelo
380*--------------------------------------------------------------------*#
381       
382        SET
383        NComp = PP.NumberOfComponents();
384        NCompS = PPS.NumberOfComponents();
385        SS101.CompositionBasis = "Molar";
386       
387        R101.NReac = 1;
388        #R101.stoic (:,1) = [0, 0, -1, 0, 2, 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];  # Reaction 1: 1.Glucose --> 2·Ethanol + 2.CO2
389        R101.stoic (:,1) = [0, 0, 0, -1, 5/3, 5/3, 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 2: 3.Xylose --> 5·Ethanol + 5.CO2
390       
391        R101.h = [0] * 'kJ/kmol';
392        R101.density = 1000 * 'kg/m^3';
393        R101.Brix = [0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
394       
395        #R101.limit = [3];
396        R101.limit = [4];
397       
398        #R101.fermentation = "glucose";
399        R101.fermentation = "xylose";
400
401#*-------------------------------------------------------------------
402* Condicoes iniciais e opcoes de Solver
403*--------------------------------------------------------------------*#
404       
405        OPTIONS
406        Dynamic = false;
407end
408       
409
Note: See TracBrowser for help on using the repository browser.