source: branches/gui/sample/miscellaneous/sample_gibbs_reactor_simple.mso @ 913

Last change on this file since 913 was 913, checked in by Argimiro Resende Secchi, 12 years ago

Checking new EML.

File size: 6.9 KB
Line 
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
45        nu(NComp) as Real(Symbol="\nu_i");
46
47        R  as Real(Brief="Universal gas constant", Unit='J/mol/K', Default=8.314);
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}");
52       
53        SET
54        g0 = PP.IdealGasGibbsOfFormationAt25C();
55        h0 = PP.IdealGasEnthalpyOfFormationAt25C();
56
57        VARIABLES
58        T as temperature;
59        P as pressure;
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");
63
64        K  as positive(Brief="Reaction equilibrium constant at T");
65        K0 as positive(Brief="Reaction equilibrium constant at T0", Symbol="K_{298}");
66       
67        phi(NComp)      as fugacity(Brief="Fugacity coefficient", Default=1, Symbol="\phi_i");
68       
69        EQUATIONS
70        "Equilibrium constant at 298 K"
71        K0 = exp(-sum(nu*g0)/(R*T0));
72        "Equilibrium constant at T"
73        K = K0 * exp(-sum(nu*h0)/R*(1/T - 1/T0));
74
75        "Equilibrium rule"
76        K = prod( (n/sum(n)*phi*P/P0) ^ nu);
77
78        "Reaction advance"
79        n = n0 + nu * advance;
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
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        DEVICES
97        R as gibbs_reactor_simple;
98
99        SET
100        NComp = PP.NumberOfComponents;
101        R.nu = [-1, 1, 1];
102
103        SPECIFY
104        R.T = (1000 + 273.15) * 'K';
105        R.P = 1 * 'atm';
106        R.n0 = [1, 0, 0] * 'mol';
107       
108        # Expected results:
109        # advance = 0.9;
110        # n = [0.1, 0.9, 0.9]
111       
112        OPTIONS
113        Dynamic = false;
114end
115
116
117# Ethanol production by ethylene hydratation at 250 degC and 35 bar
118FlowSheet gibbs_reactor_simple_sample2
119        PARAMETERS
120        PP as Plugin(Brief="Physical Properties",
121                Type="PP",
122                Components = ["ethylene", "water", "ethanol"],
123                LiquidModel = "IdealLiquid",
124                VapourModel = "PR"
125        );
126        NComp as Integer;
127
128        DEVICES
129        R as gibbs_reactor_simple;
130
131        SET
132        NComp = PP.NumberOfComponents;
133        R.nu = [-1, -1, 1];
134
135        SPECIFY
136        R.T = (250 + 273.15) * 'K';
137        R.P = 35 * 'atm';
138        R.n0 = [1, 5, 0] * 'mol';
139       
140        # Expected results:
141        # advance = 0.21;
142       
143        OPTIONS
144        Dynamic = false;
145end
146
147# Water-gas-shift T = 1100 K, P = 1 bar
148FlowSheet gibbs_reactor_simple_sample3
149        PARAMETERS
150        PP as Plugin(Brief="Physical Properties",
151                Type="PP",
152                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
153                LiquidModel = "IdealLiquid",
154                VapourModel = "PR"
155        );
156        NComp as Integer;
157
158        DEVICES
159        R as gibbs_reactor_simple;
160
161        SET
162        NComp = PP.NumberOfComponents;
163        R.nu = [-1, -1, 1, 1];
164
165        SPECIFY
166        R.T = 1100 * 'K';
167        R.P = 1 * 'bar';
168        R.n0 = [1, 1, 0, 0] * 'mol';
169       
170        # Expected results:
171        # advance = 0.41;
172       
173        OPTIONS
174        Dynamic = false;
175end
176
177
178# Water-gas-shift T = 1100 K, P = 10 bar
179FlowSheet gibbs_reactor_simple_sample4
180        PARAMETERS
181        PP as Plugin(Brief="Physical Properties",
182                Type="PP",
183                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
184                LiquidModel = "IdealLiquid",
185                VapourModel = "PR"
186        );
187        NComp as Integer;
188
189        DEVICES
190        R as gibbs_reactor_simple;
191
192        SET
193        NComp = PP.NumberOfComponents;
194        R.nu = [-1, -1, 1, 1];
195
196        SPECIFY
197        R.T = 1100 * 'K';
198        R.P = 1 * 'bar';
199        R.n0 = [1, 1, 0, 0] * 'mol';
200       
201        # Expected results:
202        # advance = 0.41;
203       
204        OPTIONS
205        Dynamic = false;
206end
207
208
209# Water-gas-shift T = 1100 K, P = 1 bar excess of water
210FlowSheet gibbs_reactor_simple_sample5
211        PARAMETERS
212        PP as Plugin(Brief="Physical Properties",
213                Type="PP",
214                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
215                LiquidModel = "IdealLiquid",
216                VapourModel = "PR"
217        );
218        NComp as Integer;
219       
220        DEVICES
221        R as gibbs_reactor_simple;
222       
223        SET
224        NComp = PP.NumberOfComponents;
225        R.nu = [-1, -1, 1, 1];
226
227        SPECIFY
228        R.T = 1100 * 'K';
229        R.P = 1 * 'bar';
230        R.n0 = [1, 2, 0, 0] * 'mol';
231       
232        # Expected results:
233        # advance = 0.56;
234       
235        OPTIONS
236        Dynamic = false;
237end
238
239# Ammonia synthesis from nitrogen and hydrogen T = 500 degC, P = 1 bar
240FlowSheet gibbs_reactor_simple_sample6
241        PARAMETERS
242        PP as Plugin(Brief="Physical Properties",
243                Type="PP",
244                Components = ["nitrogen", "hydrogen", "ammonia"],
245                LiquidModel = "IdealLiquid",
246                VapourModel = "PR"
247        );
248        NComp as Integer;
249
250        DEVICES
251        R as gibbs_reactor_simple;
252       
253        SET
254        NComp = PP.NumberOfComponents;
255        R.nu = [-1, -1, 2];
256
257        SPECIFY
258        R.T = (500 + 273.15) * 'K';
259        R.P = 1 * 'bar';
260        R.n0 = [1, 3, 0] * 'mol';
261       
262        # Expected results:
263        # K = 6e-5;
264       
265        OPTIONS
266        Dynamic = false;
267end
268
269# Ammonia synthesis from nitrogen and hydrogen T = 500 degC, P = 300 bar
270FlowSheet gibbs_reactor_simple_sample7
271        PARAMETERS
272        PP as Plugin(Brief="Physical Properties",
273                Type="PP",
274                Components = ["nitrogen", "hydrogen", "ammonia"],
275                LiquidModel = "IdealLiquid",
276                VapourModel = "PR"
277        );
278        NComp as Integer;
279
280        DEVICES
281        R as gibbs_reactor_simple;
282       
283        SET
284        NComp = PP.NumberOfComponents;
285        R.nu = [-1, -3, 2];
286
287        SPECIFY
288        R.T = (500 + 273.15) * 'K';
289        R.P = 300 * 'bar';
290        R.n0 = [1, 3, 0] * 'mol';
291       
292        # Expected results:
293        # advance = 0.54;
294       
295        OPTIONS
296        Dynamic = false;
297end
Note: See TracBrowser for help on using the repository browser.