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

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

condenser: parameter changed to variable

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