source: branches/new_gui/eml/stage_separators/condenser.mso @ 890

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

added more folders

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