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

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

More samples on gibbs reactor simple

File size: 6.5 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        stoic(NComp) as Real;
46
47        R  as Real(Brief="Universal gas constant", Unit='J/mol/K', Default=8.314);
48        T0 as temperature(Default = 298.15);
49        P0 as Real(Default=1, Unit='bar');
50        G0(NComp) as energy_mol         (Brief="Gibbs energy in standard state");
51        H0(NComp) as energy_mol         (Brief="Enthalpy in standard state");
52       
53        SET
54        G0 = PP.IdealGasGibbsOfFormationAt25C();
55        H0 = PP.IdealGasEnthalpyOfFormationAt25C();
56
57        VARIABLES
58        T as temperature;
59        P as pressure;
60        ni(NComp) as positive(Brief="Initial number of mols", Unit='mol');
61        n(NComp)  as positive(Brief="Number of mols at equilibrium", Unit='mol', Upper=10);
62        advance   as Real(Unit='mol', Lower=-10, Upper=10);
63
64        K  as Real(Brief="Reaction equilibrium constant at T");
65        K0 as Real(Brief="Reaction equilibrium constant at T0");
66        K1 as Real(Brief="Reaction equilibrium constant correction from T0 to T");
67       
68        phi(NComp)      as fugacity(Brief="Fugacity coefficient", Default=1);
69       
70        EQUATIONS
71        "Equilibrium constant at 298 K"
72        K0 = exp(-sum(stoic*G0)/(R*T0));
73        "Equilibrium constant temperature correction"
74        K1 = exp(sum(stoic*H0)/(R*T0) * (1- T0/T));
75        "Equilibrium constant at T"
76        K = K1*K0;
77       
78        "Equilibrium rule"
79        K = prod( (n/sum(n)*phi*P/P0) ^ stoic);
80
81        "Reaction advance"
82        n = ni + stoic * advance;
83       
84        "Fugacity coefficient"
85        phi = PP.VapourFugacityCoefficient(T, P, n/sum(n));
86end
87
88# Ethane decomposition to produce ethylene and hydrogen at 1000 degC
89FlowSheet gibbs_reactor_simple_sample as gibbs_reactor_simple
90        PARAMETERS
91        PP as Plugin(Brief="Physical Properties",
92                Type="PP",
93                Components = ["ethane", "ethylene", "hydrogen"],
94                LiquidModel = "PR",
95                VapourModel = "PR"
96        );
97        NComp as Integer;
98
99        SET
100        NComp = PP.NumberOfComponents;
101        stoic = [-1, 1, 1];
102
103        SPECIFY
104        T = (1000 + 273.15) * 'K';
105        P = 1 * 'atm';
106        ni = [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 as gibbs_reactor_simple
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        SET
129        NComp = PP.NumberOfComponents;
130        stoic = [-1, -1, 1];
131
132        SPECIFY
133        T = (250 + 273.15) * 'K';
134        P = 35 * 'atm';
135        ni = [1, 5, 0] * 'mol';
136       
137        # Expected results:
138        # advance = 0.21;
139       
140        OPTIONS
141        Dynamic = false;
142end
143
144# Water-gas-shift T = 1100 K, P = 1 bar
145FlowSheet gibbs_reactor_simple_sample3 as gibbs_reactor_simple
146        PARAMETERS
147        PP as Plugin(Brief="Physical Properties",
148                Type="PP",
149                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
150                LiquidModel = "IdealLiquid",
151                VapourModel = "PR"
152        );
153        NComp as Integer;
154
155        SET
156        NComp = PP.NumberOfComponents;
157        stoic = [-1, -1, 1, 1];
158
159        SPECIFY
160        T = 1100 * 'K';
161        P = 1 * 'bar';
162        ni = [1, 1, 0, 0] * 'mol';
163       
164        # Expected results:
165        # advance = 0.41;
166       
167        OPTIONS
168        Dynamic = false;
169end
170
171
172# Water-gas-shift T = 1100 K, P = 10 bar
173FlowSheet gibbs_reactor_simple_sample4 as gibbs_reactor_simple
174        PARAMETERS
175        PP as Plugin(Brief="Physical Properties",
176                Type="PP",
177                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
178                LiquidModel = "IdealLiquid",
179                VapourModel = "PR"
180        );
181        NComp as Integer;
182
183        SET
184        NComp = PP.NumberOfComponents;
185        stoic = [-1, -1, 1, 1];
186
187        SPECIFY
188        T = 1100 * 'K';
189        P = 1 * 'bar';
190        ni = [1, 1, 0, 0] * 'mol';
191       
192        # Expected results:
193        # advance = 0.41;
194       
195        OPTIONS
196        Dynamic = false;
197end
198
199
200# Water-gas-shift T = 1100 K, P = 1 bar excess of water
201FlowSheet gibbs_reactor_simple_sample5 as gibbs_reactor_simple
202        PARAMETERS
203        PP as Plugin(Brief="Physical Properties",
204                Type="PP",
205                Components = ["carbon monoxide", "water", "carbon dioxide", "hydrogen"],
206                LiquidModel = "IdealLiquid",
207                VapourModel = "PR"
208        );
209        NComp as Integer;
210
211        SET
212        NComp = PP.NumberOfComponents;
213        stoic = [-1, -1, 1, 1];
214
215        SPECIFY
216        T = 1100 * 'K';
217        P = 1 * 'bar';
218        ni = [1, 2, 0, 0] * 'mol';
219       
220        # Expected results:
221        # advance = 0.56;
222       
223        OPTIONS
224        Dynamic = false;
225end
226
227# Ammonia synthesis from nitrogen and hydrogen T = 500 degC, P = 1 bar
228FlowSheet gibbs_reactor_simple_sample6 as gibbs_reactor_simple
229        PARAMETERS
230        PP as Plugin(Brief="Physical Properties",
231                Type="PP",
232                Components = ["nitrogen", "hydrogen", "ammonia"],
233                LiquidModel = "IdealLiquid",
234                VapourModel = "PR"
235        );
236        NComp as Integer;
237
238        SET
239        NComp = PP.NumberOfComponents;
240        stoic = [-1, -1, 2];
241
242        SPECIFY
243        T = (500 + 273.15) * 'K';
244        P = 1 * 'bar';
245        ni = [1, 3, 0] * 'mol';
246       
247        # Expected results:
248        # K = 6e-5;
249       
250        OPTIONS
251        Dynamic = false;
252end
253
254# Ammonia synthesis from nitrogen and hydrogen T = 500 degC, P = 300 bar
255FlowSheet gibbs_reactor_simple_sample7 as gibbs_reactor_simple
256        PARAMETERS
257        PP as Plugin(Brief="Physical Properties",
258                Type="PP",
259                Components = ["nitrogen", "hydrogen", "ammonia"],
260                LiquidModel = "IdealLiquid",
261                VapourModel = "PR"
262        );
263        NComp as Integer;
264
265        SET
266        NComp = PP.NumberOfComponents;
267        stoic = [-1, -3, 2];
268
269        SPECIFY
270        T = (500 + 273.15) * 'K';
271        P = 300 * 'bar';
272        ni = [1, 3, 0] * 'mol';
273       
274        # Expected results:
275        # advance = 0.54;
276       
277        OPTIONS
278        Dynamic = false;
279end
Note: See TracBrowser for help on using the repository browser.