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

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

updated condenser model

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