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

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

updates

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