source: trunk/eml/stage_separators/flash.mso @ 353

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

Fixing some wiki notation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.4 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* Author: Paula B. Staudt
16* $Id: flash.mso 353 2007-08-30 16:12:27Z arge $
17*--------------------------------------------------------------------*#
18
19using "streams";
20
21Model flash
22        ATTRIBUTES
23        Pallete         = true;
24        Icon            = "icon/Flash";
25        Brief           = "Model of a dynamic flash.";
26        Info            =
27"== Assumptions ==
28* both phases are perfectly mixed.
29       
30== Specify ==
31* the feed stream;
32* the outlet flows: OutletV.F and OutletL.F.
33
34== Initial Conditions ==
35* the flash initial temperature (OutletL.T);
36* the flash initial level (Level);
37* (NoComps - 1) OutletL (OR OutletV) compositions.
38";
39       
40        PARAMETERS
41outer PP as Plugin (Brief = "External Physical Properties", Type="PP");
42outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
43        V as volume (Brief="Total Volume of the flash");
44        Mw(NComp) as molweight;
45        orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical");
46        diameter as length (Brief="Vessel diameter");
47
48        SET
49        Mw=PP.MolecularWeight();
50
51        VARIABLES
52in      Inlet as stream(Brief="Feed Stream", PosX=0, PosY=0.5421, Symbol="_{in}");
53out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.4790, PosY=1, Symbol="_{outL}");
54out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.4877, PosY=0, Symbol="_{outV}");
55in      InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.7559, Symbol="_{in}");
56
57        M(NComp) as mol (Brief="Molar Holdup in the tray");
58        ML as mol (Brief="Molar liquid holdup");
59        MV as mol (Brief="Molar vapour holdup");
60        E as energy (Brief="Total Energy Holdup on tray");
61        vL as volume_mol (Brief="Liquid Molar Volume");
62        vV as volume_mol (Brief="Vapour Molar volume");
63        Level as length (Brief="liquid height");
64        Across as area (Brief="Flash Cross section area");
65        vfrac as positive (Brief="Vapourization fraction", Symbol="\phi");
66
67        EQUATIONS
68        "Component Molar Balance"
69        diff(M)=Inlet.F*Inlet.z - OutletL.F*OutletL.z - OutletV.F*OutletV.z;
70       
71        "Energy Balance"
72        diff(E) = Inlet.F*Inlet.h - OutletL.F*OutletL.h - OutletV.F*OutletV.h + InletQ.Q;
73       
74        "Molar Holdup"
75        M = ML*OutletL.z + MV*OutletV.z;
76       
77        "Energy Holdup"
78        E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V;
79       
80        "Mol fraction normalisation"
81        sum(OutletL.z)=1.0;
82
83        "Mol fraction normalisation"
84        sum(OutletL.z)=sum(OutletV.z);
85
86        "Vaporization Fraction"
87        OutletV.F = Inlet.F * vfrac;
88
89        "Liquid Volume"
90        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
91
92        "Vapour Volume"
93        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
94       
95        "Chemical Equilibrium"
96        PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
97                PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, OutletV.z)*OutletV.z;
98       
99        "Thermal Equilibrium"
100        OutletV.T = OutletL.T;
101       
102        "Mechanical Equilibrium"
103        OutletV.P = OutletL.P;
104       
105        "Geometry Constraint"
106        V = ML * vL + MV * vV;
107
108        switch orientation
109        case "vertical":
110        "Cross Section Area"
111                Across = 0.5 * asin(1) * diameter^2;
112       
113        "Liquid Level"
114                ML * vL = Across * Level;
115
116        case "horizontal":
117        "Cylindrical Side Area"
118                Across = 0.25*diameter^2 * (asin(1) - asin((diameter - 2*Level)/diameter)) +
119                                (Level - 0.5*diameter)*sqrt(Level*(diameter - Level));
120
121        "Liquid Level"
122                0.5 * asin(1) * diameter^2 * ML* vL = Across * V;
123        end
124end
125
126#*----------------------------------------------------------------------
127* Model of a  Steady State flash
128*---------------------------------------------------------------------*#
129Model flash_steady
130        ATTRIBUTES
131        Pallete         = true;
132        Icon            = "icon/Flash";
133        Brief           = "Model of a Steady State flash.";
134        Info            =
135"== Assumptions ==
136* both phases are perfectly mixed.
137       
138== Specify ==
139* the feed stream;
140* the outlet pressure (OutletV.P);
141* the outlet temperature OR the heat supplied.
142";
143       
144        PARAMETERS
145outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
146       
147        VARIABLES
148in      Inlet as stream(Brief="Feed Stream", PosX=0, PosY=0.5421, Symbol="_{in}");
149out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.4790, PosY=1, Symbol="_{outL}");
150out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.4877, PosY=0, Symbol="_{outV}");
151in      InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.7559, Symbol="_{in}");
152        vfrac as fraction (Brief="Vapourization fraction", Symbol="\phi");
153
154        EQUATIONS
155        "The flash calculation"
156        [vfrac, OutletL.z, OutletV.z] = PP.Flash(OutletV.T, OutletV.P, Inlet.z);
157       
158        "Global Molar Balance"
159        Inlet.F = OutletV.F + OutletL.F;
160       
161        "Vaporization Fraction"
162        OutletV.F = Inlet.F * vfrac;
163       
164        "Energy Balance"
165        Inlet.F*Inlet.h  + InletQ.Q = OutletL.F*OutletL.h + OutletV.F*OutletV.h;
166       
167        "Thermal Equilibrium"
168        OutletV.T = OutletL.T;
169       
170        "Mechanical Equilibrium"
171        OutletV.P = OutletL.P;
172end
173
174#*----------------------------------------------------------------------
175* Model of a steady-state PH flash.
176*---------------------------------------------------------------------*#
177Model FlashPHSteady
178        ATTRIBUTES
179        Pallete         = true;
180        Icon            = "icon/Flash";
181        Brief           = "Model of a static PH flash.";
182        Info            =
183"This model is for using the flashPH routine available on VRTherm.
184
185== Assumptions ==
186* perfect mixing of both phases;
187
188== Specify ==
189* the feed stream;
190* the heat duty;
191* the outlet pressure.
192";     
193
194        PARAMETERS
195outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
196outer NComp as Integer;
197
198        VARIABLES
199in      Inlet as stream(Brief="Feed Stream", PosX=0, PosY=0.5421, Symbol="_{in}");
200out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.4790, PosY=1, Symbol="_{outL}");
201out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.4877, PosY=0, Symbol="_{outV}");
202in      InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.7559, Symbol="_{in}");
203        vfrac as fraction(Brief="Vaporization fraction", Symbol="\phi");
204        h as enth_mol(Brief="Mixture enthalpy");
205
206        EQUATIONS
207
208        "Chemical equilibrium"
209        [vfrac,OutletL.z,OutletV.z]=PP.FlashPH(OutletL.P,h,Inlet.z);
210
211        "Global Molar Balance"
212        Inlet.F = OutletV.F + OutletL.F;
213        OutletV.F = Inlet.F * vfrac;
214
215        "Energy Balance"
216        Inlet.F*(h - Inlet.h) = InletQ.Q;
217        Inlet.F*h = Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h;
218
219        "Thermal Equilibrium"
220        OutletV.T = OutletL.T;
221       
222        "Mechanical Equilibrium"
223        OutletV.P = OutletL.P;
224end
225
226#*----------------------------------------------------------------------
227* Another model of a steady-state PH flash.
228* It is recommended to use [v,x,y]=PP.FlashPH(P,h,z) instead of.
229*---------------------------------------------------------------------*#
230Model FlashPHSteadyA
231        ATTRIBUTES
232        Pallete         = true;
233        Icon            = "icon/Flash";
234        Brief           = "Another model of a static PH flash.";
235        Info            =
236"This model shows how to model a pressure enthalpy flash
237directly with the EMSO modeling language.
238
239This model is for demonstration purposes only, the flashPH
240routine available on VRTherm is much more robust.
241
242== Assumptions ==
243* perfect mixing of both phases;
244
245== Specify ==
246* the feed stream;
247* the heat duty;
248* the outlet pressure.
249";     
250       
251        PARAMETERS
252outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
253outer NComp as Integer;
254        B as Real(Default=1000, Brief="Regularization Factor");
255
256        VARIABLES
257in      Inlet as stream(Brief="Feed Stream", PosX=0, PosY=0.5421, Symbol="_{in}");
258out     OutletL as liquid_stream(Brief="Liquid outlet stream", PosX=0.4790, PosY=1, Symbol="_{outL}");
259out     OutletV as vapour_stream(Brief="Vapour outlet stream", PosX=0.4877, PosY=0, Symbol="_{outV}");
260in      InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.7559, Symbol="_{in}");
261        vfrac as fraction(Brief="Vaporization fraction", Symbol="\phi");
262        vsat as Real(Lower=-0.1, Upper=1.1, Brief="Vaporization fraction if saturated", Symbol="\phi_{sat}");
263        Tsat as temperature(Lower=173, Upper=1473, Brief="Temperature if saturated");
264        xsat(NComp) as Real(Lower=0, Upper=1, Brief="Liquid composition if saturated");
265        ysat(NComp) as Real(Lower=0, Upper=1, Brief="Vapour composition if saturated");
266       
267        zero_one as fraction(Brief="Regularization Variable");
268        one_zero as fraction(Brief="Regularization Variable");
269
270        EQUATIONS
271        "Chemical equilibrium"
272        PP.LiquidFugacityCoefficient(Tsat, OutletL.P, xsat)*xsat =
273                PP.VapourFugacityCoefficient(Tsat, OutletV.P, ysat)*ysat;
274
275        "Global Molar Balance"
276        Inlet.F = OutletV.F + OutletL.F;
277        OutletV.F = Inlet.F * vfrac;
278
279        "Component Molar Balance"
280        Inlet.F*Inlet.z = OutletL.F*xsat + OutletV.F*ysat;
281        sum(xsat) = sum(ysat);
282
283        "Energy Balance if saturated"
284        Inlet.F*Inlet.h  + InletQ.Q =
285                Inlet.F*(1-vsat)*PP.LiquidEnthalpy(Tsat, OutletL.P, xsat) +
286                Inlet.F*vsat*PP.VapourEnthalpy(Tsat, OutletV.P, ysat);
287
288        "Real Energy Balance"
289        Inlet.F*Inlet.h  + InletQ.Q =
290                Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h;
291
292        "Thermal Equilibrium"
293        OutletV.T = OutletL.T;
294       
295        "Mechanical Equilibrium"
296        OutletV.P = OutletL.P;
297       
298        # regularization functions
299        zero_one = (1 + tanh(B * vsat))/2;
300        one_zero = (1 - tanh(B * (vsat - 1)))/2;
301       
302        vfrac = zero_one * one_zero * vsat + 1 - one_zero;
303        OutletL.z = zero_one*one_zero*xsat + (1-zero_one*one_zero)*Inlet.z;
304        OutletV.z = zero_one*one_zero*ysat + (1-zero_one*one_zero)*Inlet.z;
305end
Note: See TracBrowser for help on using the repository browser.