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

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

updates

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