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

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

improved condenser model (added BubbleT equation)

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