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

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

updates

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