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

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

Adding BioModel? to the MSO library.

File size: 12.2 KB
RevLine 
[1008]1#*-------------------------------------------------------------------
2* Biorrefinaria Petrobras
3*--------------------------------------------------------------------
4* Nome do arquivo: liming_tank.mso
5* Projeto: Modelo integrado de producao de etanol 1G/2G
6* Conteudo: tanque de calagem
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 tanque de calagem que sera empregado
17*na biorrefinaria
18*--------------------------------------------------------------------
19
20*--------------------------------------------------------------------
21* Notas: Foram feitos flowsheets para averiguar os modelos
22*--------------------------------------------------------------------*#
23
24using "main_stream";
25using "energy_stream";
26using "assumptions";
27
28Model liming_tank
29
30        ATTRIBUTES
31        Pallete         = true;
32        Icon            = "icon/reactor";
33        Brief           = "Basic Model for a Stoichiometric 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* The inlet streams:
47  flow rate
48  temperature
49  pressure
50  stream composition;
51* Lime stream;
52* Conversion for each reaction based on the limiting compound;
53* Temperature of the reactor;
54* Reactor space-time or volume.
55
56== SET ==
57* Number of reactions;
58* Stoichiometric matrix;
59* Limiting compound for each reaction;
60* Heat of reaction;
61* The density of the mixture in the reactor (for reactor volume
62        calculations);
63* The compounds that participate in the Brix calculation
64        (1 if participates, 0 if not);
65* Basic composition (mass or molar);
66* Number of stream components(Ncomp/NcompS).
67";
68       
69#*-------------------------------------------------------------------
70#Parametros
71*--------------------------------------------------------------------*#
72
73        PARAMETERS
74       
75outer   NComp                                                   as Integer                      (Brief = "Number of Chemical Components");
76outer   NCompS                                                  as Integer                      (Brief = "Number of Chemical Components for the Solid Phase");
77                NReac                                                   as Integer                      (Brief = "Number Of Reactions", Default = 1);
78                stoic(NComp + NCompS, NReac)    as Real                         (Brief = "Stoichiometric Matrix, Matrix Size = NComp+NCompS, NReac");
79                limit(NReac)                                    as Integer                      (Brief = "Limiting Compound Index Number, Vector Size = NReac", Lower = 1);
80                h(NReac)                                                as heat_reaction        (Brief = "Molar Heat of Reaction Based on Limiting Component, Vector Size = NReac");
81                density                                                 as dens_mass            (Brief = "Mixture/Solution density");
82outer   PP                                                              as Plugin                       (Brief = "External Physical Properties", Type="PP");
83outer   PPS                                                     as Plugin                       (Brief = "External Physical Properties", Type="PP");
84                M(NComp)                                                as molweight            (Brief = "Component Mol Weight", Protected=true);
85                MS(NCompS)                                      as molweight            (Brief = "Component Mol Weight", Protected=true);
86                Brix(NComp)                                             as Integer                      (Brief = "Flag for the Compound that Enters the Brix Calculation");
87                SugarcaneFlow                                   as flow_mass            (Brief = "Sugarcane Mass Flow", Default = 500000);
88        outer flu as ConstituentFluid(Symbol = " ", Protected = true);
89        outer sol as ConstituentSolid(Symbol = " ", Protected = true); 
90#*-------------------------------------------------------------------
91* Define o valor dos parametros declarados no modelo
92*--------------------------------------------------------------------*#
93
94        SET
95       
96        M   = PP.MolecularWeight();
97        MS   = PPS.MolecularWeight();
98       
99#*-------------------------------------------------------------------
100* Declaracao de variaveis
101*--------------------------------------------------------------------*#
102       
103        VARIABLES
104       
105in  Inlet                       as main_stream          (Brief = "Inlet Stream", PosX=0, PosY=0.3, Symbol="_{in}", Protected = false);
106in  Lime                                as main_stream          (Brief = "Lime stream", PosX=0.0, PosY=0.5, Symbol="_{lime}", Protected = false);
107in  Acid                                as main_stream          (Brief = "Acid stream", PosX=0.0, PosY=0.7, Symbol="_{acid}", Protected = false);
108        F                                       as flow_mol                     (Brief = "Total Inlet Stream Flow", Protected = true);
109        z(NComp + NCompS)       as fraction             (Brief = "Total Inlet Composition, Vector Size = NComp+NCompS", Protected = true);
110out     Outlet                          as main_stream_eq       (Brief = "Outlet Stream", PosX=0.5, PosY=1, Symbol="_{out}");
111
112        Q                                               as heat_rate    (Brief = "Heat");
113        r(NComp + NCompS, NReac)        as Real                 (Brief = "Ratio Between Component (i) Production/Consumption for the Limiting Component Conversion, Matrix Size = NComp+NCompS, NReac");
114        conv(NReac)                                     as fraction             (Brief = "Reaction Conversion Based on Limiting Component, Vector Size = NReac", Symbol = "X");
115        V                                               as volume               (Brief = "Effective Reactor Volume", Upper = 1e6);
116        reac_time                                       as positive             (Brief = "Reaction Space-time or Total Batch Time", Unit = 'h', Lower = 0, Upper = 1e6, Symbol = "\tau");
117        T                                                       as temperature  (Brief = "Reactor Temperature");
118        LFPTJ                                           as positive     (Brief = "kg of Lime Per Ton of Cane Processed", Symbol="LFPTJ", Unit = 'kg/t');
119        KCPTC                                           as positive     (Brief = "kg of CaOH2 Per Ton of Cane Processed", Symbol="KCPTC", Unit = 'kg/t');
120        Ex_Acid                                         as fraction     (Brief = "Excess Acid fraction", Symbol = "Ex_{Acid}");
121        Outlet_Brix                             as fraction             (Brief = "Total Soluble Solids", Symbol="Outlet_{Brix}");
122       
123#*-------------------------------------------------------------------
124* Equacoes do modelo
125*--------------------------------------------------------------------*#
126       
127        EQUATIONS
128       
129        "Calculation of the Proportion Between Lime and the Cane Processed"
130        LFPTJ * SugarcaneFlow = Lime.Fluid.Fw;
131       
132        "Calculation of the Proportion Between Calcium Hydroxide and the Cane Processed"
133        KCPTC * SugarcaneFlow = Lime.Solid.Fw * Lime.Solid.zw(sol.CaOH2);
134       
135        "Relation between H3PO4 and Ca(OH)2"
136        Acid.Fluid.F * Acid.Fluid.z(flu.PhosphoricAcid) * 2 * (1+Ex_Acid) = Lime.Solid.F * Lime.Solid.z(sol.CaOH2) * 3;
137               
138        "Ratio Between Component (i) Production/Consumption for the Limiting Component Conversion"
139        r(1:NComp+NCompS,:) = stoic(1:NComp+NCompS,:) * conv * z(limit);
140       
141        if (NReac equal 1) then
142                "Component Molar Balance (Fluid Phase)"
143                Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) = Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + Lime.Fluid.F * Lime.Fluid.z(1:NComp) + Acid.Fluid.F * Acid.Fluid.z(1:NComp) + F * r(1:NComp,1);
144       
145                "Component Molar Balance (Solid Phase)"
146                Outlet.Solid.F * Outlet.Solid.z(1:NCompS) = Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + Lime.Solid.F * Lime.Solid.z(1:NCompS) + Acid.Solid.F * Acid.Solid.z(1:NCompS) + F * r(NComp+1:NComp+NCompS,1);
147        else
148                "Component Molar Balance (Fluid Phase)"
149                Outlet.Fluid.F * Outlet.Fluid.z(1:NComp) = Inlet.Fluid.F * Inlet.Fluid.z(1:NComp) + Lime.Fluid.F * Lime.Fluid.z(1:NComp) + Acid.Fluid.F * Acid.Fluid.z(1:NComp) + F * sumt(r(1:NComp,:));
150       
151                "Component Molar Balance (Solid Phase)"
152                Outlet.Solid.F * Outlet.Solid.z(1:NCompS) = Inlet.Solid.F * Inlet.Solid.z(1:NCompS) + Lime.Solid.F * Lime.Solid.z(1:NCompS) + Acid.Solid.F * Acid.Solid.z(1:NCompS) + F * sumt(r(NComp+1:NComp+NCompS, :));     
153        end
154       
155        "Sum of Molar Fractions (Fluid Phase)"
156        sum(Outlet.Fluid.z) = 1;
157       
158        "Sum of Molar Fractions (Solid Phase)"
159        sum(Outlet.Solid.z) = 1;
160       
161        "Energy Balance"
162        Outlet.Fluid.F * Outlet.Fluid.h + Outlet.Solid.F * Outlet.Solid.h =
163        Inlet.Fluid.F * Inlet.Fluid.h + Inlet.Solid.F * Inlet.Solid.h + Lime.Fluid.F * Lime.Fluid.h + Lime.Solid.F * Lime.Solid.h
164        + Acid.Fluid.F * Acid.Fluid.h + Acid.Solid.F * Acid.Solid.h + Q - F * sum(h * conv * z(limit));
165       
166        "Total Inlet Composition (Fluid Phase)"
167        F * z(1:NComp) = Inlet.Fluid.F * Inlet.Fluid.z + Lime.Fluid.F * Lime.Fluid.z + Acid.Fluid.F * Acid.Fluid.z;
168       
169        "Total Inlet Composition (Solid Phase)"
170        F * z(NComp + 1: NComp + NCompS) = Inlet.Solid.F * Inlet.Solid.z + Lime.Solid.F * Lime.Solid.z + Acid.Solid.F * Acid.Solid.z;   
171
172        "Reactor Pressure"
173        Inlet.P = Outlet.P;
174       
175        "Reactor Temperature"
176        Outlet.T = T;
177       
178        "Total Inlet Stream Flow"
179        F = Inlet.Fluid.F + Inlet.Solid.F + Lime.Fluid.F + Lime.Solid.F + Acid.Fluid.F + Acid.Solid.F;
180       
181        "Reactor Volume"
182        V = (Inlet.Total.Fw + Lime.Total.Fw + Acid.Total.Fw) * reac_time / density;
183       
184        "Total Soluble Solids"
185        Outlet_Brix * Outlet.Total.Fw = sum(Outlet.Fluid.zw * Brix) * Outlet.Fluid.Fw;
186       
187end
188
189
190
191FlowSheet teste_liming_tank
192       
193#*-------------------------------------------------------------------
194* Declaracao de dispositivos (ou blocos contendo o modelo)
195*--------------------------------------------------------------------*#
196       
197        DEVICES
198        S101 as main_sourceR; #juice
199        S102 as main_sourceR; #lime
200        S103 as main_sourceR; #acid
201        Tank as liming_tank;
202       
203#*-------------------------------------------------------------------
204* Especifica as conexoes entre os modelos
205*--------------------------------------------------------------------*#
206       
207        CONNECTIONS
208        S101.Outlet to Tank.Inlet;
209        S102.Outlet to Tank.Lime;
210        S103.Outlet to Tank.Acid;
211       
212#*-------------------------------------------------------------------
213* Especifica variaveis definidas no modelo
214*--------------------------------------------------------------------*#
215       
216        SPECIFY
217       
218        #Juice
219        S101.CompositionOfFluid = [0.8, 0.1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0, 0, 0];
220        S101.CompositionOfSolid = [1, 0, 0, 0, 0, 0, 0, 0, 0];
221        S101.Fluid.Fw = 251085.8 * 'kg/h';
222        S101.Solid.Fw = 7516.2 * 'kg/h';
223        S101.T = 343.13 * 'K';
224        S101.P = 1.67777 * 'bar';
225       
226        #Lime
227        S102.CompositionOfFluid = [1.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0, 0, 0];
228        S102.CompositionOfSolid = [0, 0, 0, 0, 0, 0, 0.95, 0, 0.05];
229        S102.T = 343.13 * 'K';
230        S102.P = 1.67777 * 'bar';
231       
232        #Acid
233        S103.CompositionOfFluid = [0.85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.15, 0, 0, 0];
234        S103.CompositionOfSolid = [0, 0, 0, 0, 0, 0, 1.0, 0, 0];
235        S103.Solid.Fw = 0 * 'kg/h';
236        S103.T = 343.13 * 'K';
237        S103.P = 1.67777 * 'bar';
238       
239        Tank.KCPTC = 1.057 * 'kg/t';
240        Tank.LFPTJ = 17.6 * 'kg/t';
241        Tank.Ex_Acid = 0;
242        Tank.conv = [1.0, 1.0];
243        Tank.T = 343.13 * 'K';
244        Tank.reac_time = 48 * 'h';
245
246#*-------------------------------------------------------------------
247#Parametros
248*--------------------------------------------------------------------*#
249       
250        PARAMETERS
251        PP as Plugin    (Brief = "External Physical Properties",
252                Type="PP",
253                Project = "../Flowsheets/v2_2/Fluid_v2_2.vrtherm"
254        );
255        PPS as Plugin   (Brief = "External Physical Properties",
256                Type="PP",
257                Project = "../Flowsheets/v2_2/Solid_v2_2.vrtherm"
258        );
259       
260        NComp   as Integer      (Brief = "Number of chemical components in the fluid phase");
261        NCompS  as Integer      (Brief = "Number of chemical components in the solid phase");
262               
263        flu as ConstituentFluid(Symbol = " ", Protected = true);
264        sol as ConstituentSolid(Symbol = " ", Protected = true);       
265
266
267#*-------------------------------------------------------------------
268* Define o valor dos parametros declarados no modelo
269*--------------------------------------------------------------------*#
270       
271        SET
272        NComp = PP.NumberOfComponents();
273        NCompS = PPS.NumberOfComponents();
274       
275        S101.CompositionBasis = "Mass";
276        S102.CompositionBasis = "Mass";
277        S103.CompositionBasis = "Mass";
278       
279        Tank.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];
280       
281        Tank.NReac = 2;
282        Tank.stoic (:,1) = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2/3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1/3, 0]; # Reaction 1: 1.Ca(OH)2 + 2/3.H3PO4  --> 1/3Ca3(PO4)2 + 2H2O
283        Tank.stoic (:,2) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]; # Reaction 1: Impurities(fluida) --> Impurities(solido)
284       
285        Tank.h = [0, 0] * 'kJ/kmol';
286        Tank.density = 1000 * 'kg/m^3';
287       
288        Tank.limit = [NComp+sol.CaOH2, flu.Impurities];
289
290#*-------------------------------------------------------------------
291* Condicoes iniciais e opcoes de Solver
292*--------------------------------------------------------------------*#
293       
294        OPTIONS
295       
296        Dynamic = false;
297       
298end
299
300
301
Note: See TracBrowser for help on using the repository browser.