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

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

updates

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