source: trunk/eml/reactors/yield.mso @ 837

Last change on this file since 837 was 530, checked in by Argimiro Resende Secchi, 15 years ago

Fix some examples.

File size: 4.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 an yield reactor
17*----------------------------------------------------------------------
18*
19*   Description:
20*       Modeling of a reactor based on an yield approach.
21*
22*   Assumptions:
23*               * single- and two-phases involved
24*       * steady-state
25*
26*       Specify:
27*               * inlet stream
28*               * component yield or
29*               * reaction yield
30*
31*----------------------------------------------------------------------
32* Author: Rodolfo Rodrigues
33* $Id$
34*--------------------------------------------------------------------*#
35
36using "tank_basic";
37
38
39#*---------------------------------------------------------------------
40*       only vapour phase
41*--------------------------------------------------------------------*#
42Model yield_vap as tank_vap
43        ATTRIBUTES
44        Pallete = true;
45        Icon    = "icon/cstr";
46        Brief   = "Model of a generic vapour-phase yield CSTR";
47        Info    = "
48== Assumptions ==
49* only vapour-phase
50* steady-state
51
52== Specify ==
53* inlet stream
54* component yield or
55* reaction yield
56";
57
58        PARAMETERS
59        NReac   as Integer      (Brief="Number of reactions", Default=1);
60        KComp   as Integer      (Brief="Key component", Lower=1, Default=1);
61       
62        VARIABLES
63out Outlet                as vapour_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}");
64        rate(NComp)   as reaction_mol (Brief="Overall component rate of reaction");
65        conv(NComp)   as Real (Brief="Fractional conversion of component", Symbol="X", Default=0);
66       
67        yield(NComp)  as Real (Brief="Molar component yield (global)", Symbol="Y_G");
68        yield_(NComp) as Real (Brief="Molar reaction yield (instantaneous)", Symbol="Y_I");
69
70        EQUATIONS
71        "Outlet stream"
72        Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Tank.V;
73       
74        "Rate of reaction"
75        rate*Tank.V = Outletm.F*(yield/(1 + yield(KComp))*Outletm.z(KComp) - Outletm.z);
76       
77        "Instantaneous yield"
78        rate = yield_*rate(KComp);
79       
80        "Mechanical equilibrium"
81        Outlet.P = Outletm.P;
82       
83        "Energy balance"
84        Outlet.F*Outlet.h = Outletm.F*Outletm.h;
85       
86        for i in [1:NComp]
87          if (Outletm.z(i) > 1e-16) then
88            "Molar conversion"
89            Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i));
90          else if (Outlet.z(i) > 0) then
91                        "Molar conversion"
92                                conv(i) = 1;    # ?
93                        else
94                        "Molar conversion"
95                                conv(i) = 0;    # ?
96                        end
97          end
98        end
99end
100
101
102#*---------------------------------------------------------------------
103*       only liquid phase
104*--------------------------------------------------------------------*#
105Model yield_liq as tank_liq
106        ATTRIBUTES
107        Pallete = true;
108        Icon    = "icon/cstr";
109        Brief   = "Model of a generic liquid-phase yield CSTR";
110        Info    = "
111== Assumptions ==
112* only liquid-phase
113* steady-state
114
115== Specify ==
116* inlet stream
117* component yield or
118* reaction yield
119";
120
121        PARAMETERS
122        NReac   as Integer      (Brief="Number of reactions", Default=1);
123        KComp   as Integer      (Brief="Key component", Lower=1, Default=1);
124       
125        VARIABLES
126out Outlet                as liquid_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}");
127        rate(NComp)   as reaction_mol (Brief="Overall component rate of reaction");
128        conv(NComp)   as Real (Brief="Fractional conversion of component", Symbol="X", Default=0);
129       
130        yield(NComp)  as Real (Brief="Molar component yield (global)", Symbol="Y_G");
131        yield_(NComp) as Real (Brief="Molar reaction yield (instantaneous)", Symbol="Y_I");
132
133        EQUATIONS
134        "Outlet stream"
135        Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Tank.V;
136       
137        "Rate of reaction"
138        rate*Tank.V = Outletm.F*(yield/(1 + yield(KComp))*Outletm.z(KComp) - Outletm.z);
139       
140        "Molar reaction yield"
141        rate = yield_*rate(KComp);
142       
143        "Mechanical equilibrium"
144        Outlet.P = Outletm.P;
145       
146        "Energy balance"
147        Outlet.F*Outlet.h = Outletm.F*Outletm.h;
148       
149        for i in [1:NComp]
150          if (Outletm.z(i) > 0) then
151            "Molar conversion"
152            Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i));
153          else if (Outlet.z(i) > 0) then
154                        "Molar conversion"
155                                conv(i) = 1;    # ?
156                        else
157                        "Molar conversion"
158                                conv(i) = 0;    # ?
159                        end
160          end
161        end
162end
Note: See TracBrowser for help on using the repository browser.