source: trunk/eml/reactors/stoic.mso

Last change on this file was 574, checked in by Rafael de Pelegrini Soares, 14 years ago

Updated the models to work with some language constraints

File size: 5.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 stoichiometric reactor
17*----------------------------------------------------------------------
18*
19*   Description:
20*       Modeling of a reactor based on a stoichiometric approach.
21*
22*   Assumptions:
23*               * single- and two-phases involved
24*               * steady-state
25*
26*       Specify:
27*               * inlet stream
28*               * extent of reactions or
29*               * conversion of a key component
30*
31*----------------------------------------------------------------------
32* Author: Rodolfo Rodrigues
33* $Id$
34*--------------------------------------------------------------------*#
35
36using "tank_basic";
37
38
39#*---------------------------------------------------------------------
40*       only vapour-phase
41*--------------------------------------------------------------------*#
42Model stoic_vap as tank_vap
43        ATTRIBUTES
44        Brief   = "Basic model for a vapour-phase stoichiometric CSTR";
45        Info    = "
46== Assumptions ==
47* only vapour-phase
48* steady-state
49";
50       
51        PARAMETERS
52        NReac           as Integer (Brief="Number of reactions", Default=1);
53    stoic(NComp,NReac) as Real (Brief="Stoichiometric matrix", Symbol="\nu");
54
55        VARIABLES
56out Outlet              as vapour_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}");
57
58        rate(NComp) as reaction_mol (Brief="Overall component rate of reaction");
59        conv(NComp) as Real (Brief="Fractional conversion of component", Symbol="X", Default=0);
60       
61        EQUATIONS
62        "Outlet stream"
63        Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Tank.V;
64       
65        "Mechanical equilibrium"
66        Outlet.P = Outletm.P;
67       
68        "Energy balance"
69        Outlet.F*Outlet.h = Outletm.F*Outletm.h;
70       
71        "Steady-state"
72        Outlet.F = Outletm.F;
73       
74        for i in [1:NComp] do
75          if (Outletm.z(i) > 1e-16) then
76            "Molar conversion"
77            Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i));
78          else if (Outlet.z(i) > 0) then
79                        "Molar conversion"
80                                conv(i) = 1;    # ?
81                        else
82                        "Molar conversion"
83                                conv(i) = 0;    # ?
84                        end
85          end
86        end
87end
88
89
90#*---------------------------------------------------------------------
91*       only liquid-phase
92*--------------------------------------------------------------------*#
93Model stoic_liq as tank_liq
94        ATTRIBUTES
95        Brief   = "Basic model for a liquid-phase stoichiometric CSTR";
96        Info    = "
97== Assumptions ==
98* only liquid-phase
99* steady-state
100";
101
102        PARAMETERS
103        NReac           as Integer (Brief="Number of reactions", Default=1);
104    stoic(NComp,NReac) as Real (Brief="Stoichiometric matrix", Symbol="\nu");
105       
106        VARIABLES
107out Outlet              as liquid_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}");
108
109        rate(NComp) as reaction_mol (Brief="Overall component rate of reaction");
110        conv(NComp)     as Real (Brief="Fractional conversion of component", Symbol="X", Default=0);
111       
112        EQUATIONS
113        "Outlet stream"
114        Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Tank.V;
115       
116        "Mechanical equilibrium"
117        Outlet.P = Outletm.P;
118       
119        "Energy balance"
120        Outlet.F*Outlet.h = Outletm.F*Outletm.h;
121       
122        "Steady-state"
123        Outlet.F = Outletm.F;
124
125        for i in [1:NComp] do
126          if (Outletm.z(i) > 1e-16) then
127            "Molar conversion"
128            Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i));
129          else if (Outlet.z(i) > 0) then
130                        "Molar conversion"
131                                conv(i) = 1;    # ?
132                        else
133                        "Molar conversion"
134                                conv(i) = 0;    # ?
135                        end
136          end
137        end
138end
139
140
141#*---------------------------------------------------------------------
142*       1. extent of reactions are known
143*--------------------------------------------------------------------*#
144Model stoic_extent_vap as stoic_vap
145        ATTRIBUTES
146        Pallete = true;
147        Icon    = "icon/cstr";
148        Brief   = "Model of a generic vapour-phase stoichiometric CSTR based on extent of reaction";
149        Info    = "
150== Specify ==
151* inlet stream
152* extent of reactions
153";
154
155        VARIABLES
156        extent(NReac)   as flow_mol (Brief="Extent of reaction", Symbol="\xi");
157       
158        EQUATIONS
159        "Rate of reaction"
160        rate*Tank.V = sumt(stoic*extent);
161end
162
163Model stoic_extent_liq as stoic_liq
164        ATTRIBUTES
165        Pallete = true;
166        Icon    = "icon/cstr";
167        Brief   = "Model of a generic liquid-phase stoichiometric CSTR based on extent of reaction";
168        Info    = "
169== Specify ==
170* inlet stream
171* extent of reactions
172";
173
174        VARIABLES
175        extent(NReac)   as flow_mol (Brief="Extent of reaction", Symbol="\xi");
176       
177        EQUATIONS
178        "Rate of reaction"
179        rate*Tank.V = sumt(stoic*extent);
180end
181
182
183#*---------------------------------------------------------------------
184*       2. conversion of a key component is known
185*--------------------------------------------------------------------*#
186Model stoic_conv_vap as stoic_vap
187        ATTRIBUTES
188        Pallete = true;
189        Icon    = "icon/cstr";
190        Brief   = "Model of a generic vapour-phase stoichiometric CSTR based on conversion of a key component";
191        Info    = "
192== Specify ==
193* inlet stream
194* conversion of a key component
195";
196
197        PARAMETERS
198        KComp as Integer(Brief="Key component", Lower=1, Default=1);
199
200        VARIABLES
201        kconv as Real   (Brief="Molar conversion of key component", Symbol="X_k");
202
203        EQUATIONS
204        "Reaction rate"
205        rate*Tank.V = sumt(stoic)/abs(sumt(stoic(KComp,:)))*Outletm.F*Outletm.z(KComp)*kconv;
206end
207
208Model stoic_conv_liq as stoic_liq
209        ATTRIBUTES
210        Pallete = true;
211        Icon    = "icon/cstr";
212        Brief   = "Model of a generic liquid-phase stoichiometric CSTR based on conversion of a key component";
213        Info    = "
214== Specify ==
215* inlet stream
216* conversion of a key component
217";
218
219        PARAMETERS
220        KComp as Integer(Brief="Key component", Lower=1, Default=1);
221
222        VARIABLES
223        kconv as Real   (Brief="Molar conversion of key component", Symbol="X_k");
224
225        EQUATIONS
226        "Reaction rate"
227        rate*Tank.V = sumt(stoic)/abs(sumt(stoic(KComp,:)))*Outletm.F*Outletm.z(KComp)*kconv;
228end
Note: See TracBrowser for help on using the repository browser.