source: branches/gui/eml/stage_separators/condenser.mso @ 829

Last change on this file since 829 was 829, checked in by gerson bicca, 13 years ago

updates

File size: 12.6 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* Author: Paula B. Staudt
17* $Id: condenser.mso 555 2008-07-18 19:01:13Z rafael $
18*--------------------------------------------------------------------*#
19
20using "streams";
21
22Model condenserSteady
23
24ATTRIBUTES
25        Pallete         = true;
26        Icon            = "icon/CondenserSteady";
27        Brief           = "Model of a  Steady State condenser with no thermodynamics equilibrium.";
28        Info            =
29"== ASSUMPTIONS ==
30* perfect mixing of both phases;
31* no thermodynamics equilibrium.
32
33== SET ==
34* the pressure drop in the condenser;
35* the degree of subcooling;
36
37== SPECIFY ==
38* the InletVapour stream;
39* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
40
41== OPTIONAL ==
42* the condenser model has two control ports
43** TI OutletLiquid Temperature Indicator;
44** PI OutletLiquid Pressure Indicator;
45";
46
47PARAMETERS
48        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
49        outer NComp as Integer  (Brief = "Number of Components");
50
51        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
52        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
53        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
54        KfConst         as area                 (Brief="Constant for K factor pressure drop", Default = 1, Hidden=true);
55
56        VapourFlow      as Switcher     (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
57
58        Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3);
59        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
60        Deg_Subcooled   as temperature  (Brief ="Degrees subcooled",Symbol ="\Delta T_{subcooled}");
61
62SET
63
64        Mw   = PP.MolecularWeight();
65        low_flow = 1E-6 * 'kmol/h';
66        zero_flow = 0 * 'kmol/h';
67        KfConst = 1*'m^2';
68
69VARIABLES
70        in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
71        out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
72        in      InletQ                  as power                        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
73       
74        rho     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
75        Tbubble as temperature  (Brief ="Bubble Temperature",Protected=true, Symbol ="T_{bubble}");
76       
77        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
78        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
79       
80EQUATIONS
81
82switch VapourFlow
83
84case "on":
85        InletVapour.F*sum(Mw*InletVapour.z) = Kfactor *sqrt(Pdrop*rho)*KfConst;
86
87        when InletVapour.F < low_flow switchto "off";
88
89case "off":
90        InletVapour.F = zero_flow;
91
92        when InletVapour.P > OutletLiquid.P switchto "on";
93
94end
95
96"Molar Flow Balance"
97        InletVapour.F = OutletLiquid.F;
98
99"Molar Composition Balance"
100        InletVapour.z = OutletLiquid.z;
101
102"Energy Balance"
103        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
104
105"Inlet Vapour Density"
106        rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
107
108"Pressure Drop"
109        OutletLiquid.P = InletVapour.P - Pdrop;
110
111"Bubble Temperature"
112        Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z);
113
114"Temperature"
115        OutletLiquid.T = Tbubble-Deg_Subcooled;
116
117"Temperature indicator"
118        TI * 'K' = OutletLiquid.T;
119
120"Pressure indicator"
121        PI * 'atm' = OutletLiquid.P;
122
123end
124
125Model condenserReact
126        ATTRIBUTES
127        Pallete         = false;
128        Icon            = "icon/Condenser";
129        Brief           = "Model of a Condenser with reaction in liquid phase.";
130        Info            =
131"== Assumptions ==
132* perfect mixing of both phases;
133* thermodynamics equilibrium;
134* the reaction only takes place in liquid phase.
135       
136== Specify ==
137* the reaction related variables;
138* the inlet stream;
139* the outlet flows: OutletVapour.F and OutletLiquid.F;
140* the heat supply.
141
142== Initial Conditions ==
143* the condenser temperature (OutletLiquid.T);
144* the condenser liquid level (Level);
145* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
146";
147       
148PARAMETERS
149        outer PP        as Plugin(Type="PP");
150        outer NComp as Integer;
151       
152        V               as volume (Brief="Condenser total volume");
153        Across  as area         (Brief="Cross Section Area of reboiler");
154
155        stoic(NComp)    as Real                 (Brief="Stoichiometric matrix");
156        Hr                              as energy_mol;
157        Initial_Level                           as length                       (Brief="Initial Level of liquid phase");
158        Initial_Temperature                     as temperature          (Brief="Initial Temperature of Condenser");
159        Initial_Composition(NComp)      as fraction             (Brief="Initial Liquid Composition");
160       
161VARIABLES
162
163in      InletVapour             as stream                       (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}");
164out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
165out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
166        InletQ          as power                        (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
167
168        M(NComp)        as mol                  (Brief="Molar Holdup in the tray");
169        ML                      as mol                  (Brief="Molar liquid holdup");
170        MV                      as mol                  (Brief="Molar vapour holdup");
171        E                       as energy               (Brief="Total Energy Holdup on tray");
172        vL                      as volume_mol   (Brief="Liquid Molar Volume");
173        vV                      as volume_mol   (Brief="Vapour Molar volume");
174        Level           as length               (Brief="Level of liquid phase");
175        Vol             as volume;
176        r3                      as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s');
177        C(NComp)        as conc_mol     (Brief="Molar concentration", Lower = -1);
178
179INITIAL
180
181        Level                                   = Initial_Level;
182        OutletLiquid.T                          = Initial_Temperature;
183        OutletLiquid.z(1:NComp-1)       = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
184
185EQUATIONS
186"Molar Concentration"
187        OutletLiquid.z = vL * C;
188       
189"Reaction"
190        r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s';
191       
192"Component Molar Balance"
193        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL;
194
195"Energy Balance"
196        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL;
197
198"Molar Holdup"
199        M = ML*OutletLiquid.z + MV*OutletVapour.z;
200       
201"Energy Holdup"
202        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
203       
204"Mol fraction normalisation"
205        sum(OutletLiquid.z)=1.0;
206
207"Liquid Volume"
208        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
209
210"Vapour Volume"
211        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
212
213"Thermal Equilibrium"
214        OutletLiquid.T = OutletVapour.T;
215
216"Mechanical Equilibrium"
217        OutletVapour.P = OutletLiquid.P;
218
219"Geometry Constraint"
220        V = ML*vL + MV*vV;
221
222        Vol = ML*vL;
223       
224"Level of liquid phase"
225        Level = ML*vL/Across;
226       
227"Chemical Equilibrium"
228        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
229        PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
230
231        sum(OutletLiquid.z)=sum(OutletVapour.z);
232
233end
234
235Model condenser
236
237ATTRIBUTES
238        Pallete         = true;
239        Icon            = "icon/Condenser";
240        Brief           = "Model of a  dynamic condenser with control.";
241        Info            =
242"== ASSUMPTIONS ==
243* perfect mixing of both phases;
244* thermodynamics equilibrium.
245       
246== SPECIFY ==
247* the InletVapour stream;
248* the outlet flows: OutletVapour.F and OutletLiquid.F;
249* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
250
251== OPTIONAL ==
252* the condenser model has three control ports
253** TI OutletLiquid Temperature Indicator;
254** PI OutletLiquid Pressure Indicator;
255** LI Level Indicator of Condenser;
256
257== INITIAL CONDITIONS ==
258* Initial_Temperature :  the condenser temperature (OutletLiquid.T);
259* Levelpercent_Initial : the condenser liquid level in percent (LI);
260* Initial_Composition : (NoComps) OutletLiquid compositions.
261";     
262       
263PARAMETERS
264        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
265        outer NComp     as Integer (Brief="Number of Components");
266       
267        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
268        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
269        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
270        KfConst         as area                 (Brief="Constant for K factor pressure drop", Default = 1, Hidden=true);
271       
272        VapourFlow      as Switcher     (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
273
274        V               as volume       (Brief="Condenser total volume");
275        Across  as area         (Brief="Cross Section Area of condenser");
276        Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3);
277       
278        Levelpercent_Initial            as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
279        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Condenser");
280        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition", Lower=1E-6);
281       
282VARIABLES
283
284in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}");
285out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}");
286out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}");
287in      InletQ                  as power                        (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}");
288
289        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.33, PosY=0);
290        out     LI as control_signal    (Brief="Level  Indicator of Condenser", Protected = true, PosX=0.43, PosY=0);
291        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.25, PosY=0);
292
293        M(NComp)        as mol                  (Brief="Molar Holdup in the tray", Protected = true);
294        ML                      as mol                  (Brief="Molar liquid holdup", Protected = true);
295        MV                      as mol                  (Brief="Molar vapour holdup", Protected = true);
296        E                       as energy               (Brief="Total Energy Holdup on tray", Protected = true);
297        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected = true);
298        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
299        rho                     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
300        Level           as length               (Brief="Level of liquid phase", Protected = true);
301        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
302
303SET
304
305        Mw   = PP.MolecularWeight();
306        low_flow = 1E-6 * 'kmol/h';
307        zero_flow = 0 * 'kmol/h';
308        KfConst = 1*'m^2';
309       
310INITIAL
311
312"Initial level Percent"
313        LI = Levelpercent_Initial;
314
315"Initial Temperature"
316        OutletLiquid.T  = Initial_Temperature;
317
318"Initial Composition"
319        OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
320
321EQUATIONS
322
323switch VapourFlow
324
325case "on":
326        InletVapour.F*sum(Mw*InletVapour.z) = Kfactor *sqrt(Pdrop*rho)*KfConst;
327
328        when InletVapour.F < low_flow switchto "off";
329
330case "off":
331        InletVapour.F = zero_flow;
332
333        when InletVapour.P > OutletLiquid.P switchto "on";
334
335end
336
337"Component Molar Balance"
338        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z;
339
340"Energy Balance"
341        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ;
342
343"Molar Holdup"
344        M = ML*OutletLiquid.z + MV*OutletVapour.z;
345       
346"Energy Holdup"
347        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
348       
349"Mol fraction normalisation"
350        sum(OutletLiquid.z)=1.0;
351
352"Mol fraction Constraint"
353        sum(OutletLiquid.z)=sum(OutletVapour.z);
354
355"Liquid Volume"
356        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
357       
358"Vapour Volume"
359        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
360
361"Inlet Vapour Density"
362        rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
363       
364"Chemical Equilibrium"
365        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
366                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
367
368"Thermal Equilibrium"
369        OutletLiquid.T = OutletVapour.T;
370
371"Mechanical Equilibrium"
372        OutletVapour.P = OutletLiquid.P;
373
374"Pressure Drop"
375        OutletLiquid.P  = InletVapour.P - Pdrop;
376
377"Geometry Constraint"
378        V = ML*vL + MV*vV;
379
380"Level of liquid phase"
381        Level = ML*vL/Across;
382
383"Temperature indicator"
384        TI * 'K' = OutletLiquid.T;
385
386"Pressure indicator"
387        PI * 'atm' = OutletLiquid.P;
388
389"Level indicator"
390        LI*V = Level*Across;
391       
392end
Note: See TracBrowser for help on using the repository browser.