source: trunk/sample/miscellaneous/sample_gibbs_reactor_simple.mso @ 623

Last change on this file since 623 was 410, checked in by Rafael de Pelegrini Soares, 16 years ago

Added symbols for the simple gibbs reactor

File size: 6.5 KB
RevLine 
[401]1#*---------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*----------------------------------------------------------------------
16* Model of a simplified Gibbs reactor.
17* This model requires VRTherm (www.vrtech.com.br) to run.
18*----------------------------------------------------------------------
19*
20*
21*
22*----------------------------------------------------------------------
23* Author: Rafael de Pelegrini Soares
24* $Id$
25*--------------------------------------------------------------------*#
26
27using "types";
28
29Model gibbs_reactor_simple
30        ATTRIBUTES
31        Info =
32"Model for reactor in thermodynamic equilibrium based on Gibbs free
33energy.
34
35The user should specify T, P and ni.
36
37There is a correction for G0 as a function of the temperature.
38This correction considers that H0 does not depend on the temperature.
39This is a good approximation for most cases (less than 2% of error)";
40       
41        PARAMETERS
42outer PP                as Plugin (Brief="External physical properties", Type="PP");
43outer NComp     as Integer (Brief="Number of components", Default=1);
44
[410]45        nu(NComp) as Real(Symbol="\nu_i");
[401]46
47        R  as Real(Brief="Universal gas constant", Unit='J/mol/K', Default=8.314);
[410]48        T0 as temperature(Default = 298.15, Symbol="T_{298}");
49        P0 as Real(Default=1, Unit='bar', Symbol="P^0");
50        g0(NComp) as energy_mol         (Brief="Gibbs energy in standard state", Symbol="g^0_{298,i}");
51        h0(NComp) as energy_mol         (Brief="Enthalpy in standard state", Symbol="h^0_{298,i}");
[401]52       
53        SET
[410]54        g0 = PP.IdealGasGibbsOfFormationAt25C();
55        h0 = PP.IdealGasEnthalpyOfFormationAt25C();
[401]56
57        VARIABLES
58        T as temperature;
59        P as pressure;
[410]60        n0(NComp) as positive(Brief="Initial number of mols", Unit='mol', Symbol="n_{i,0}");
61        n(NComp)  as positive(Brief="Number of mols at equilibrium", Unit='mol', Symbol="n_i");
62        advance   as Real(Unit='mol', Symbol="\epsilon");
[401]63
[407]64        K  as positive(Brief="Reaction equilibrium constant at T");
[410]65        K0 as positive(Brief="Reaction equilibrium constant at T0", Symbol="K_{298}");
[401]66       
[410]67        phi(NComp)      as fugacity(Brief="Fugacity coefficient", Default=1, Symbol="\phi_i");
[401]68       
69        EQUATIONS
70        "Equilibrium constant at 298 K"
[410]71        K0 = exp(-sum(nu*g0)/(R*T0));
[401]72        "Equilibrium constant at T"
[410]73        K = K0 * exp(-sum(nu*h0)/R*(1/T - 1/T0));
[407]74
[401]75        "Equilibrium rule"
[407]76        K = prod( (n/sum(n)*phi*P/P0) ^ nu);
[401]77
78        "Reaction advance"
[407]79        n = n0 + nu * advance;
[401]80       
81        "Fugacity coefficient"
82        phi = PP.VapourFugacityCoefficient(T, P, n/sum(n));
83end
84
85# Ethane decomposition to produce ethylene and hydrogen at 1000 degC
86FlowSheet gibbs_reactor_simple_sample as gibbs_reactor_simple
87        PARAMETERS
88        PP as Plugin(Brief="Physical Properties",
89                Type="PP",
90                Components = ["ethane", "ethylene", "hydrogen"],
91                LiquidModel = "PR",
92                VapourModel = "PR"
93        );
94        NComp as Integer;
95
96        SET
97        NComp = PP.NumberOfComponents;
[407]98        nu = [-1, 1, 1];
[401]99
100        SPECIFY
101        T = (1000 + 273.15) * 'K';
102        P = 1 * 'atm';
[407]103        n0 = [1, 0, 0] * 'mol';
[401]104       
105        # Expected results:
106        # advance = 0.9;
107        # n = [0.1, 0.9, 0.9]
108       
109        OPTIONS
110        Dynamic = false;
111end
[402]112
113
114# Ethanol production by ethylene hydratation at 250 degC and 35 bar
115FlowSheet gibbs_reactor_simple_sample2 as gibbs_reactor_simple
116        PARAMETERS
117        PP as Plugin(Brief="Physical Properties",
118                Type="PP",
119                Components = ["ethylene", "water", "ethanol"],
120                LiquidModel = "IdealLiquid",
121                VapourModel = "PR"
122        );
123        NComp as Integer;
124
125        SET
126        NComp = PP.NumberOfComponents;
[407]127        nu = [-1, -1, 1];
[402]128
129        SPECIFY
130        T = (250 + 273.15) * 'K';
131        P = 35 * 'atm';
[407]132        n0 = [1, 5, 0] * 'mol';
[402]133       
134        # Expected results:
135        # advance = 0.21;
136       
137        OPTIONS
138        Dynamic = false;
139end
140
141# Water-gas-shift T = 1100 K, P = 1 bar
142FlowSheet gibbs_reactor_simple_sample3 as gibbs_reactor_simple
143        PARAMETERS
144        PP as Plugin(Brief="Physical Properties",
145                Type="PP",
146                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
147                LiquidModel = "IdealLiquid",
148                VapourModel = "PR"
149        );
150        NComp as Integer;
151
152        SET
153        NComp = PP.NumberOfComponents;
[407]154        nu = [-1, -1, 1, 1];
[402]155
156        SPECIFY
157        T = 1100 * 'K';
158        P = 1 * 'bar';
[407]159        n0 = [1, 1, 0, 0] * 'mol';
[402]160       
161        # Expected results:
162        # advance = 0.41;
163       
164        OPTIONS
165        Dynamic = false;
166end
167
168
169# Water-gas-shift T = 1100 K, P = 10 bar
170FlowSheet gibbs_reactor_simple_sample4 as gibbs_reactor_simple
171        PARAMETERS
172        PP as Plugin(Brief="Physical Properties",
173                Type="PP",
174                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
175                LiquidModel = "IdealLiquid",
176                VapourModel = "PR"
177        );
178        NComp as Integer;
179
180        SET
181        NComp = PP.NumberOfComponents;
[407]182        nu = [-1, -1, 1, 1];
[402]183
184        SPECIFY
185        T = 1100 * 'K';
186        P = 1 * 'bar';
[407]187        n0 = [1, 1, 0, 0] * 'mol';
[402]188       
189        # Expected results:
190        # advance = 0.41;
191       
192        OPTIONS
193        Dynamic = false;
194end
195
196
197# Water-gas-shift T = 1100 K, P = 1 bar excess of water
198FlowSheet gibbs_reactor_simple_sample5 as gibbs_reactor_simple
199        PARAMETERS
200        PP as Plugin(Brief="Physical Properties",
201                Type="PP",
202                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
203                LiquidModel = "IdealLiquid",
204                VapourModel = "PR"
205        );
206        NComp as Integer;
207
208        SET
209        NComp = PP.NumberOfComponents;
[407]210        nu = [-1, -1, 1, 1];
[402]211
212        SPECIFY
213        T = 1100 * 'K';
214        P = 1 * 'bar';
[407]215        n0 = [1, 2, 0, 0] * 'mol';
[402]216       
217        # Expected results:
218        # advance = 0.56;
219       
220        OPTIONS
221        Dynamic = false;
222end
223
224# Ammonia synthesis from nitrogen and hydrogen T = 500 degC, P = 1 bar
225FlowSheet gibbs_reactor_simple_sample6 as gibbs_reactor_simple
226        PARAMETERS
227        PP as Plugin(Brief="Physical Properties",
228                Type="PP",
229                Components = ["nitrogen", "hydrogen", "ammonia"],
230                LiquidModel = "IdealLiquid",
231                VapourModel = "PR"
232        );
233        NComp as Integer;
234
235        SET
236        NComp = PP.NumberOfComponents;
[407]237        nu = [-1, -1, 2];
[402]238
239        SPECIFY
240        T = (500 + 273.15) * 'K';
241        P = 1 * 'bar';
[407]242        n0 = [1, 3, 0] * 'mol';
[402]243       
244        # Expected results:
245        # K = 6e-5;
246       
247        OPTIONS
248        Dynamic = false;
249end
250
251# Ammonia synthesis from nitrogen and hydrogen T = 500 degC, P = 300 bar
252FlowSheet gibbs_reactor_simple_sample7 as gibbs_reactor_simple
253        PARAMETERS
254        PP as Plugin(Brief="Physical Properties",
255                Type="PP",
256                Components = ["nitrogen", "hydrogen", "ammonia"],
257                LiquidModel = "IdealLiquid",
258                VapourModel = "PR"
259        );
260        NComp as Integer;
261
262        SET
263        NComp = PP.NumberOfComponents;
[407]264        nu = [-1, -3, 2];
[402]265
266        SPECIFY
267        T = (500 + 273.15) * 'K';
268        P = 300 * 'bar';
[407]269        n0 = [1, 3, 0] * 'mol';
[402]270       
271        # Expected results:
272        # advance = 0.54;
273       
274        OPTIONS
275        Dynamic = false;
276end
Note: See TracBrowser for help on using the repository browser.