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

Last change on this file since 919 was 900, checked in by mamuller, 14 years ago

Empty Message

File size: 16.4 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 "tank";
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        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
51
52VARIABLES
53        in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
54        out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
55        in      InletQ                  as power                        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
56
57        Tbubble as temperature  (Brief ="Bubble Temperature",Protected=true, Symbol ="T_{bubble}");
58        Deg_Subcooled   as temp_delta   (Brief ="Degrees subcooled",Symbol ="\Delta T_{subcooled}");
59
60        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
61        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
62
63EQUATIONS
64
65"Molar Flow Balance"
66        InletVapour.F = OutletLiquid.F;
67
68"Molar Composition Balance"
69        InletVapour.z = OutletLiquid.z;
70
71"Energy Balance"
72        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
73
74"Pressure Drop"
75        OutletLiquid.P = InletVapour.P - Pdrop;
76
77"Bubble Temperature"
78        Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z);
79
80"Temperature"
81        OutletLiquid.T = Tbubble-Deg_Subcooled;
82
83"Temperature indicator"
84        TI * 'K' = OutletLiquid.T;
85
86"Pressure indicator"
87        PI * 'atm' = OutletLiquid.P;
88
89end
90
91Model condenserSteady_fakeH
92
93ATTRIBUTES
94        Pallete         = true;
95        Icon            = "icon/CondenserSteady";
96        Brief           = "Model of a  Steady State condenser with fake calculation of outlet conditions.";
97        Info            =
98"Model of a  Steady State condenser with fake calculation of output temperature, but with a real
99calculation of the output stream enthalpy.
100
101== ASSUMPTIONS ==
102* perfect mixing of both phases;
103* no thermodynamics equilibrium.
104
105== SET ==
106* the fake Outlet temperature ;
107* the pressure drop in the condenser;
108
109== SPECIFY ==
110* the InletVapour stream;
111* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
112
113== OPTIONAL ==
114* the condenser model has two control ports
115** TI OutletLiquid Temperature Indicator;
116** PI OutletLiquid Pressure Indicator;
117";
118
119PARAMETERS
120        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
121        outer NComp as Integer  (Brief = "Number of Components");
122
123        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
124        Fake_Temperature                as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
125
126
127VARIABLES
128        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
129        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
130        in      InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
131
132        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
133        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
134
135EQUATIONS
136
137"Molar Flow Balance"
138        InletVapour.F = OutletLiquid.F;
139
140"Molar Composition Balance"
141        InletVapour.z = OutletLiquid.z;
142
143"Energy Balance"
144        InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
145
146"Pressure Drop"
147        OutletLiquid.P = InletVapour.P - Pdrop;
148
149"Fake Temperature"
150        OutletLiquid.T = Fake_Temperature;
151
152"Vapourisation Fraction"
153        OutletLiquid.v = 0;
154       
155"Temperature indicator"
156        TI * 'K' = OutletLiquid.T;
157
158"Pressure indicator"
159        PI * 'atm' = OutletLiquid.P;
160
161end
162
163Model condenserReact
164        ATTRIBUTES
165        Pallete         = false;
166        Icon            = "icon/Condenser";
167        Brief           = "Model of a Condenser with reaction in liquid phase.";
168        Info            =
169"== Assumptions ==
170* perfect mixing of both phases;
171* thermodynamics equilibrium;
172* the reaction only takes place in liquid phase.
173       
174== Specify ==
175* the reaction related variables;
176* the inlet stream;
177* the outlet flows: OutletVapour.F and OutletLiquid.F;
178* the heat supply.
179
180== Initial Conditions ==
181* the condenser temperature (OutletLiquid.T);
182* the condenser liquid level (Level);
183* (NoComps - 1) OutletLiquid (OR OutletVapour) compositions.
184";
185       
186PARAMETERS
187        outer PP        as Plugin(Type="PP");
188        outer NComp as Integer;
189       
190        V               as volume (Brief="Condenser total volume");
191        Across  as area         (Brief="Cross Section Area of reboiler");
192
193        stoic(NComp)    as Real                 (Brief="Stoichiometric matrix");
194        Hr                              as energy_mol;
195        Initial_Level                           as length                       (Brief="Initial Level of liquid phase");
196        Initial_Temperature                     as temperature          (Brief="Initial Temperature of Condenser");
197        Initial_Composition(NComp)      as fraction             (Brief="Initial Liquid Composition");
198       
199VARIABLES
200
201in      InletVapour             as stream                       (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}");
202out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}");
203out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}");
204        InletQ          as power                        (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}");
205
206        M(NComp)        as mol                  (Brief="Molar Holdup in the tray");
207        ML                      as mol                  (Brief="Molar liquid holdup");
208        MV                      as mol                  (Brief="Molar vapour holdup");
209        E                       as energy               (Brief="Total Energy Holdup on tray");
210        vL                      as volume_mol   (Brief="Liquid Molar Volume");
211        vV                      as volume_mol   (Brief="Vapour Molar volume");
212        Level           as length               (Brief="Level of liquid phase");
213        Vol             as volume;
214        r3                      as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s');
215        C(NComp)        as conc_mol     (Brief="Molar concentration", Lower = -1);
216
217INITIAL
218
219        Level                                   = Initial_Level;
220        OutletLiquid.T                          = Initial_Temperature;
221        OutletLiquid.z(1:NComp-1)       = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
222
223EQUATIONS
224"Molar Concentration"
225        OutletLiquid.z = vL * C;
226       
227"Reaction"
228        r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s';
229       
230"Component Molar Balance"
231        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL;
232
233"Energy Balance"
234        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL;
235
236"Molar Holdup"
237        M = ML*OutletLiquid.z + MV*OutletVapour.z;
238       
239"Energy Holdup"
240        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V;
241       
242"Mol fraction normalisation"
243        sum(OutletLiquid.z)=1.0;
244
245"Liquid Volume"
246        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
247
248"Vapour Volume"
249        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
250
251"Thermal Equilibrium"
252        OutletLiquid.T = OutletVapour.T;
253
254"Mechanical Equilibrium"
255        OutletVapour.P = OutletLiquid.P;
256
257"Geometry Constraint"
258        V = ML*vL + MV*vV;
259
260        Vol = ML*vL;
261       
262"Level of liquid phase"
263        Level = ML*vL/Across;
264       
265"Chemical Equilibrium"
266        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
267        PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
268
269        sum(OutletLiquid.z)=sum(OutletVapour.z);
270
271end
272
273Model condenser
274
275ATTRIBUTES
276        Pallete         = true;
277        Icon            = "icon/Condenser";
278        Brief           = "Model of a  dynamic condenser with control.";
279        Info            =
280"== ASSUMPTIONS ==
281* perfect mixing of both phases;
282* thermodynamics equilibrium.
283       
284== SPECIFY ==
285* the InletVapour stream;
286* the outlet flows: OutletVapour.F and OutletLiquid.F;
287* the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model).
288
289== OPTIONAL ==
290* the condenser model has three control ports
291** TI OutletLiquid Temperature Indicator;
292** PI OutletLiquid Pressure Indicator;
293** LI Level Indicator of Condenser;
294
295== INITIAL CONDITIONS ==
296* Initial_Temperature :  the condenser temperature (OutletLiquid.T);
297* Levelpercent_Initial : the condenser liquid level in percent (LI);
298* Initial_Composition : (NoComps) OutletLiquid compositions.
299";     
300       
301PARAMETERS
302        outer PP                as Plugin       (Brief = "External Physical Properties", Type="PP");
303        outer NComp     as Integer (Brief="Number of Components");
304       
305        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
306        low_flow        as flow_mol     (Brief = "Low Flow",Default = 1E-6, Hidden=true);
307        zero_flow       as flow_mol     (Brief = "No Flow",Default = 0, Hidden=true);
308        KfConst         as area                 (Brief="Constant for K factor pressure drop", Default = 1, Hidden=true);
309       
310        VapourFlow      as Switcher     (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
311
312        Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3);
313       
314        Levelpercent_Initial            as positive     (Brief="Initial liquid height in Percent", Default = 0.70);
315        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Condenser");
316        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition", Lower=1E-6);
317       
318VARIABLES
319
320        Geometry                as VesselVolume (Brief="Vessel Geometry", Symbol=" ");
321
322in      InletVapour     as stream                       (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}");
323out     OutletLiquid    as liquid_stream        (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}");
324out     OutletVapour    as vapour_stream        (Brief="Vapour outlet stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}");
325in      InletQ                  as power                        (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}");
326
327        out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.33, PosY=0);
328        out     LI as control_signal    (Brief="Level  Indicator of Condenser", Protected = true, PosX=0.43, PosY=0);
329        out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.25, PosY=0);
330
331        M(NComp)        as mol                  (Brief="Molar Holdup in the tray", Protected = true);
332        ML                      as mol                  (Brief="Molar liquid holdup", Protected = true);
333        MV                      as mol                  (Brief="Molar vapour holdup", Protected = true);
334        E                       as energy               (Brief="Total Energy Holdup on tray", Protected = true);
335        vL                      as volume_mol   (Brief="Liquid Molar Volume", Protected = true);
336        vV                      as volume_mol   (Brief="Vapour Molar volume", Protected = true);
337        rho                     as dens_mass    (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho");
338        Pdrop           as press_delta  (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true);
339
340SET
341        Mw   = PP.MolecularWeight();
342        low_flow = 1E-6 * 'kmol/h';
343        zero_flow = 0 * 'kmol/h';
344        KfConst = 1*'m^2';
345       
346INITIAL
347
348"Initial level Percent"
349        LI = Levelpercent_Initial;
350
351"Initial Temperature"
352        OutletLiquid.T  = Initial_Temperature;
353
354"Initial Composition"
355        OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
356
357EQUATIONS
358
359switch VapourFlow
360
361case "on":
362        InletVapour.F*sum(Mw*InletVapour.z) = Kfactor *sqrt(Pdrop*rho)*KfConst;
363
364        when InletVapour.F < low_flow switchto "off";
365
366case "off":
367        InletVapour.F = zero_flow;
368
369        when InletVapour.P > OutletLiquid.P switchto "on";
370
371end
372
373"Component Molar Balance"
374        diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z;
375
376"Energy Balance"
377        diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ;
378
379"Molar Holdup"
380        M = ML*OutletLiquid.z + MV*OutletVapour.z;
381       
382"Energy Holdup"
383        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Geometry.Vtotal;
384       
385"Mol fraction normalisation"
386        sum(OutletLiquid.z)=1.0;
387
388"Mol fraction Constraint"
389        sum(OutletLiquid.z)=sum(OutletVapour.z);
390
391"Liquid Volume"
392        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
393       
394"Vapour Volume"
395        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
396
397"Inlet Vapour Density"
398        rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
399       
400"Chemical Equilibrium"
401        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =
402                PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
403
404"Thermal Equilibrium"
405        OutletLiquid.T = OutletVapour.T;
406
407"Mechanical Equilibrium"
408        OutletVapour.P = OutletLiquid.P;
409
410"Pressure Drop"
411        OutletLiquid.P  = InletVapour.P - Pdrop;
412
413"Geometry Constraint"
414        Geometry.Vtotal = ML*vL + MV*vV;
415
416"Liquid Level"
417        ML * vL = Geometry.Vfilled;
418
419"Temperature indicator"
420        TI * 'K' = OutletLiquid.T;
421
422"Pressure indicator"
423        PI * 'atm' = OutletLiquid.P;
424
425"Level indicator"
426        LI*Geometry.Vtotal= Geometry.Vfilled;
427       
428end
429
430
431Model condenserSubcooled
432
433ATTRIBUTES
434        Pallete         = true;
435        Icon            = "icon/CondenserSteady";
436        Brief           = "Model of a  Steady State total condenser with specified outlet temperature conditions.";
437        Info            =
438"A simple model of a Steady State total condenser with specified temperature (or subcooling degree), with a real
439calculation of the output stream enthalpy. The subcooling degree is considered to be the difference between the
440inlet vapour and the outlet liquid temperatures.
441
442== ASSUMPTIONS ==
443* perfect mixing of both phases;
444* saturated vapour at the Inlet;
445* no thermodynamics equilibrium;
446* no pressure drop in the condenser.
447
448== SPECIFY ==
449* the InletVapour stream;
450* the subcooled temperature OR the the degree of subcooling.
451
452";
453
454PARAMETERS
455        outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
456        outer NComp as Integer  (Brief = "Number of Components");
457
458#        Pdrop   as press_delta  (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P");
459        #Fake_Temperature               as temperature  (Brief="Fake temperature", Symbol = "T_{fake}");
460
461
462VARIABLES
463        in      InletVapour     as stream       (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}");
464        out     OutletLiquid    as stream       (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}");
465        #in     InletQ                  as power        (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true);
466        T_sub                           as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}");
467        SubcoolingDegree        as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta T_{sub}");
468        CondenserDuty           as power (Brief="Calculated condenser duty for desired subcooling", Protected = true, Symbol = "Q_{cond}");
469
470        #out     TI as control_signal    (Brief="Temperature  Indicator of Condenser", Protected = true, PosX=0.50, PosY=0);
471        #out     PI as control_signal    (Brief="Pressure  Indicator of Condenser", Protected = true, PosX=0.32, PosY=0);
472
473EQUATIONS
474
475"Molar Flow Balance"
476        InletVapour.F = OutletLiquid.F;
477
478"Molar Composition Balance"
479        InletVapour.z = OutletLiquid.z;
480
481#"Energy Balance"
482        #InletVapour.F*InletVapour.h  + InletQ = OutletLiquid.F*OutletLiquid.h;
483
484"Pressure Drop"
485        OutletLiquid.P = InletVapour.P;
486
487"Subcooled Temperature"
488        OutletLiquid.T = T_sub;
489       
490"Degree of subcooling" 
491        SubcoolingDegree = InletVapour.T - T_sub;
492
493"Liquid enthalpy"
494        OutletLiquid.h = PP.LiquidEnthalpy(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
495       
496"Condenser Duty"
497        CondenserDuty = OutletLiquid.F*OutletLiquid.h - InletVapour.F*InletVapour.h;
498       
499"Vapourisation Fraction"
500        OutletLiquid.v = 0;
501
502end
503
Note: See TracBrowser for help on using the repository browser.