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

Last change on this file since 821 was 821, checked in by gerson bicca, 14 years ago

fixed initial condition for Level indicator

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