source: branches/gui/eml/stage_separators/tray.mso @ 875

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

packed column/tray revised

File size: 23.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: tray.mso 522 2008-05-21 23:21:12Z arge $
18*--------------------------------------------------------------------*#
19
20using "streams";
21
22Model trayBasic
23        ATTRIBUTES
24        Pallete         = false;
25        Icon            = "icon/Tray";
26        Brief           = "Basic equations of a tray column model.";
27        Info            =
28"This model contains only the main equations of a column tray equilibrium model without
29the hidraulic equations.
30       
31== Assumptions ==
32* both phases (liquid and vapour) exists all the time;
33* thermodymanic equilibrium with Murphree plate efficiency;
34* no entrainment of liquid or vapour phase;
35* no weeping;
36* the dymanics in the downcomer are neglected.
37";
38       
39PARAMETERS
40outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
41outer NComp     as Integer;
42
43VARIABLES
44
45        Inlet                                                   as stream                               (Brief="Feed stream", Hidden=true, PosX=0, PosY=0.4932, Symbol="_{in}");
46        LiquidSideStream                as liquid_stream        (Brief="liquid Sidestream", Hidden=true, Symbol="_{outL}");
47        VapourSideStream        as vapour_stream        (Brief="vapour Sidestream", Hidden=true, Symbol="_{outV}");
48
49in      InletLiquid                     as stream                               (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
50in      InletVapour                     as stream                               (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
51out     OutletLiquid    as liquid_stream        (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
52out     OutletVapour    as vapour_stream        (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
53
54
55        M(NComp)                        as mol                          (Brief="Molar Holdup in the tray");
56        ML                                              as mol                          (Brief="Molar liquid holdup");
57        MV                                              as mol                          (Brief="Molar vapour holdup");
58        E                                                       as energy                       (Brief="Total Energy Holdup on tray");
59        vL                                              as volume_mol   (Brief="Liquid Molar Volume");
60        vV                                              as volume_mol   (Brief="Vapour Molar volume");
61        Level                                   as length                       (Brief="Height of clear liquid on plate");
62        yideal(NComp)           as fraction;
63
64
65EQUATIONS
66"Component Molar Balance"
67        diff(M)=Inlet.F*Inlet.z + InletLiquid.F*InletLiquid.z + InletVapour.F*InletVapour.z- OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z-
68        LiquidSideStream.F*LiquidSideStream.z-VapourSideStream.F*VapourSideStream.z;
69
70"Molar Holdup"
71        M = ML*OutletLiquid.z + MV*OutletVapour.z;
72
73"Mol fraction normalisation"
74        sum(OutletLiquid.z)= 1.0;
75        sum(OutletLiquid.z)= sum(OutletVapour.z);
76
77"Liquid Volume"
78        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
79
80"Vapour Volume"
81        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
82
83"Chemical Equilibrium"
84        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, yideal)*yideal;
85
86"Thermal Equilibrium"
87        OutletVapour.T = OutletLiquid.T;
88
89"Mechanical Equilibrium"
90        OutletVapour.P = OutletLiquid.P;
91       
92"Thermal Equilibrium Vapour Side Stream"
93        OutletVapour.T = VapourSideStream.T;
94
95"Thermal Equilibrium Liquid Side Stream"
96        OutletLiquid.T = LiquidSideStream.T;
97
98"Mechanical Equilibrium Vapour Side Stream"
99        OutletVapour.P= VapourSideStream.P;
100
101"Mechanical Equilibrium Liquid Side Stream"
102        OutletLiquid.P = LiquidSideStream.P;
103
104"Composition Liquid Side Stream"
105        OutletLiquid.z= LiquidSideStream.z;
106       
107"Composition Vapour Side Stream"
108        OutletVapour.z= VapourSideStream.z;
109
110end
111
112Model tray as trayBasic
113        ATTRIBUTES
114        Pallete         = false;
115        Icon            = "icon/Tray";
116        Brief           = "Complete model of a column tray.";
117        Info            =
118"== Specify ==
119* the Feed stream
120* the Liquid inlet stream
121* the Vapour inlet stream
122* the Vapour outlet flow (OutletVapour.F)
123       
124== Initial ==
125* the plate temperature (OutletLiquid.T)
126* the liquid height (Level) OR the liquid flow OutletLiquid.F
127* (NoComps - 1) OutletLiquid compositions
128
129== Options ==
130You can choose the equation for the liquid outlet flow and the vapour
131inlet flow calculation through the VapourFlowModel and LiquidFlowModel
132switchers.
133
134== References ==
135* ELGUE, S.; PRAT, L.; CABASSUD, M.; LANN, J. L.; CéZERAC, J. Dynamic models for start-up operations of batch distillation columns with experimental validation. Computers and Chemical Engineering, v. 28, p. 2735-2747, 2004.
136* FEEHERY, W. F. Dynamic Optimization with Path Constraints. Tese (Doutorado) - Massachusetts Institute of Technology, June 1998.
137* KLINGBERG, A. Modeling and Optimization of Batch Distillation. Dissertação (Mestrado) - Department of Automatic Control, Lund Institute of Technology, Lund, Sweden, fev. 2000.
138* OLSEN, I.; ENDRESTOL, G. O.; SIRA, T. A rigorous and efficient distillation column model for engineering and training simulators. Computers and Chemical Engineering,v. 21, n. Suppl, p. S193-S198, 1997.
139* REEPMEYER, F.; REPKE, J.-U.; WOZNY, G. Analysis of the start-up process for reactive distillation. Chemical Engineering Technology, v. 26, p. 81-86, 2003.
140* ROFFEL, B.; BETLEM, B.; RUIJTER, J. de. First principles dynamic modeling and multivariable control of a cryogenic distillation column process. Computers and Chemical Engineering, v. 24, p. 111-123, 2000.
141* WANG, L.; LI, P.; WOZNY, G.; WANG, S. A start-up model for simulation of batch distillation starting from a cold state. Computers and Chemical Engineering, v. 27, p.1485-1497, 2003.
142";     
143
144VARIABLES
145        rhoL as dens_mass;
146        rhoV as dens_mass;
147
148EQUATIONS
149
150"Liquid Density"
151        rhoL = PP.LiquidDensity(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
152       
153"Vapour Density"
154        rhoV = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
155
156end
157
158#*-------------------------------------------------------------------
159* Model of a tray with reaction
160*-------------------------------------------------------------------*#
161Model trayReac
162        ATTRIBUTES
163        Pallete         = false;
164        Icon            = "icon/Tray";
165        Brief           = "Model of a tray with reaction.";
166        Info            =
167"== Assumptions ==
168* both phases (liquid and vapour) exists all the time;
169* thermodymanic equilibrium with Murphree plate efficiency;
170* no entrainment of liquid or vapour phase;
171* no weeping;
172* the dymanics in the downcomer are neglected.
173       
174== Specify ==
175* the Feed stream;
176* the Liquid inlet stream;
177* the Vapour inlet stream;
178* the Vapour outlet flow (OutletVapour.F);
179* the reaction related variables.
180       
181== Initial ==
182* the plate temperature (OutletLiquid.T)
183* the liquid height (Level) OR the liquid flow OutletLiquid.F
184* (NoComps - 1) OutletLiquid compositions
185";
186
187PARAMETERS
188
189        outer PP                        as Plugin(Type="PP");
190        outer NComp     as Integer;
191       
192VARIABLES
193
194        Inlet                                           as stream                               (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
195        LiquidSideStream        as liquid_stream        (Brief="liquid Sidestream", Hidden=true, Symbol="_{outL}");
196        VapourSideStream as vapour_stream       (Brief="vapour Sidestream", Hidden=true, Symbol="_{outV}");
197       
198
199in              InletLiquid             as      stream                          (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
200in              InletVapour             as      stream                          (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
201out     OutletLiquid    as      liquid_stream           (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
202out     OutletVapour    as      vapour_stream   (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
203
204        yideal(NComp)   as fraction;
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="Height of clear liquid on plate");
213        Vol                                             as volume;
214       
215        rhoL                    as dens_mass;
216        rhoV                    as dens_mass;
217        r3                              as reaction_mol         (Brief = "Reaction resulting ethyl acetate", DisplayUnit = 'mol/l/s');
218        C(NComp)        as conc_mol             (Brief = "Molar concentration", Lower = -1);
219       
220EQUATIONS
221
222"Molar Concentration"
223        OutletLiquid.z = vL * C;
224       
225"Reaction"
226        r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4))*'l/mol/s';
227       
228"Molar Holdup"
229        M = ML*OutletLiquid.z + MV*OutletVapour.z;
230
231"Thermal Equilibrium Vapour Side Stream"
232        OutletVapour.T = VapourSideStream.T;
233
234"Thermal Equilibrium Liquid Side Stream"
235        OutletLiquid.T = LiquidSideStream.T;
236
237"Mechanical Equilibrium Vapour Side Stream"
238        OutletVapour.P= VapourSideStream.P;
239
240"Mechanical Equilibrium Liquid Side Stream"
241        OutletLiquid.P = LiquidSideStream.P;
242
243"Composition Liquid Side Stream"
244        OutletLiquid.z= LiquidSideStream.z;
245       
246"Composition Vapour Side Stream"
247        OutletVapour.z= VapourSideStream.z;
248
249"Mol fraction normalisation"
250        sum(OutletLiquid.z)= 1.0;
251
252"Liquid Volume"
253        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
254
255"Vapour Volume"
256        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
257
258"Thermal Equilibrium"
259        OutletVapour.T = OutletLiquid.T;
260
261"Mechanical Equilibrium"
262        OutletVapour.P = OutletLiquid.P;
263
264        Vol = ML*vL;
265       
266"Liquid Density"
267        rhoL = PP.LiquidDensity(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
268
269"Vapour Density"
270        rhoV = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
271
272"Chemical Equilibrium"
273        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =   PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, yideal)*yideal;
274
275        sum(OutletLiquid.z)= sum(OutletVapour.z);
276
277end
278
279#*-------------------------------------
280* Model of a packed column stage
281-------------------------------------*#
282Model packedStage
283
284ATTRIBUTES
285        Pallete         = false;
286        Brief           = "Complete model of a packed column stage.";
287        Info            =
288"== Specify ==
289* the Feed stream
290* the Liquid inlet stream
291* the Vapour inlet stream
292* the stage pressure drop (deltaP)
293       
294== Initial ==
295* the plate temperature (OutletLiquid.T)
296* the liquid molar holdup ML
297* (NoComps - 1) OutletLiquid compositions
298";
299
300PARAMETERS
301
302outer PP        as Plugin       (Brief = "External Physical Properties", Type="PP");
303outer NComp as Integer  (Brief = "Number Of Components");
304
305        LiquidResistanceCoeff   as positive     (Brief="Resistance coefficient on the liquid load", Default=1,Hidden=true);
306        AreaPerPackingVolume    as Real                 (Brief="surface area per packing volume", Unit='m^2/m^3',Hidden=true);
307        ColumnInternalDiameter  as length               (Brief="Column diameter",Hidden=true);
308        PackingVoidFraction             as Real                 (Brief="Void fraction of packing, (m^3 void space/m^3 packed bed)",Hidden=true);
309        HeightOfPacking                 as length               (Brief="Height of packing",Hidden=true);
310        Number_Stages                   as Integer              (Brief="Number of Stages", Default=3,Hidden=true);
311        HeatOnStage                     as heat_rate    (Brief="Rate of heat supply",Hidden=true);
312
313        HETP                    as length               (Brief="The Height Equivalent to a Theoretical Plate",Hidden=true);
314        ColumnArea              as area                 (Brief="Column Sectional Cross Area",Hidden=true);
315        V                               as volume               (Brief="Total Volume of the tray",Hidden=true);
316        Pi                              as constant     (Brief="Pi Number",Default=3.14159265, Symbol = "\pi",Hidden=true);
317        Gconst                  as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true);
318       
319        low_flow                as flow_mol     (Brief ="Low Flow",Default = 1E-6, Hidden=true);
320        low_pressure    as pressure     (Brief ="Low Pressure",Default = 1E-6, Hidden=true);
321        zero_flow               as flow_mol     (Brief ="No Flow",Default = 0, Hidden=true);
322
323        Mw(NComp)       as molweight    (Brief = "Component Mol Weight",Hidden=true);
324        VapourFlow  as Switcher         (Brief = "Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true);
325
326SET
327        Mw = PP.MolecularWeight();
328       
329        ColumnArea      = 0.25*Pi*ColumnInternalDiameter^2;
330        HETP            = HeightOfPacking/Number_Stages;       
331        V                       = HETP * ColumnArea;
332       
333        low_pressure = 1E-4 * 'atm';
334        low_flow = 1E-6 * 'kmol/h';
335        zero_flow = 0 * 'kmol/h';
336
337VARIABLES
338
339        Inlet                   as stream                       (Brief="Feed stream", Symbol="_{in}",Protected=true);
340in      InletLiquid     as stream                       (Brief="Inlet liquid stream",  Symbol="_{inL}",Protected=true);
341in      InletVapour     as stream                       (Brief="Inlet vapour stream",  Symbol="_{inV}",Protected=true);
342out     OutletLiquid    as liquid_stream        (Brief="Outlet liquid stream", Symbol="_{outL}",Protected=true);
343out     OutletVapour    as vapour_stream        (Brief="Outlet vapour stream", Symbol="_{outV}",Protected=true);
344
345        M(NComp)        as mol                  (Brief="Molar Holdup in the tray", Default=0.01, Lower=0, Upper=100,Protected=true);
346        ML                      as mol                  (Brief="Molar liquid holdup", Default=0.01, Lower=0, Upper=100,Protected=true);
347        MV                      as mol                  (Brief="Molar vapour holdup", Default=0.01, Lower=0, Upper=100,Protected=true);
348        E                       as energy               (Brief="Total Energy Holdup on tray", Default=-500,Protected=true);
349        vL                      as volume_mol   (Brief="Liquid Molar Volume",Protected=true);
350        vV                      as volume_mol   (Brief="Vapour Molar volume",Protected=true);
351        miL             as viscosity    (Brief="Liquid dynamic viscosity", DisplayUnit='kg/m/s',Protected=true);
352        rhoL            as dens_mass    (Brief="Liquid mass density",Protected=true);
353        rhoV            as dens_mass    (Brief="Vapour mass density",Protected=true);
354        uL                      as velocity     (Brief="volume flow rate of liquid, m^3/m^2/s", Lower=-10, Upper=1000,Protected=true);
355        uV                      as velocity     (Brief="volume flow rate of vapor, m^3/m^2/s", Lower=-10, Upper=1000,Protected=true);
356        Al                      as area                 (Brief="Area occupied by the liquid", Default=0.001, Upper=10,Protected=true);
357        hl                      as positive     (Brief="Column holdup", Unit='m^3/m^3', Default=0.01,Upper=10,Protected=true);
358        deltaP          as pressure     (Brief="Stage Pressure drop",Protected=true);
359
360EQUATIONS
361
362switch VapourFlow
363       
364        case "on":
365"Pressure drop and Vapor flow, Billet (4-58)"
366        deltaP/HETP  = LiquidResistanceCoeff *( 0.5*AreaPerPackingVolume + 2/ColumnInternalDiameter) * 1/((PackingVoidFraction-hl)^3) * (uV^2) *rhoV;
367       
368        when InletVapour.F < low_flow switchto "off";
369       
370        case "off":
371"Vapour Flow"
372        InletVapour.F = zero_flow;
373       
374        when deltaP > low_pressure switchto "on";
375
376end
377
378"Energy Balance"
379        diff(E) = (Inlet.F*Inlet.h + InletLiquid.F*InletLiquid.h + InletVapour.F*InletVapour.h- OutletLiquid.F*OutletLiquid.h
380        - OutletVapour.F*OutletVapour.h + HeatOnStage );
381
382"Energy Holdup"
383        E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletLiquid.P*V;
384
385"Geometry Constraint"
386        V*PackingVoidFraction= ML*vL + MV*vV;
387
388"Volume flow rate of vapor, m^3/m^2/s"
389        uV * (V*PackingVoidFraction/HETP - Al) = InletVapour.F * vV;
390
391"Liquid holdup"
392        hl*V*PackingVoidFraction = ML*vL;
393
394"Liquid velocity as a function of liquid holdup, Billet (4-27)"
395        hl^3 = (12/Gconst) * AreaPerPackingVolume^2 * (miL/rhoL) * uL;
396
397"Area occupied by the liquid"
398        Al = ML*vL/HETP;
399
400"Component Molar Balance"
401        diff(M)=Inlet.F*Inlet.z + InletLiquid.F*InletLiquid.z + InletVapour.F*InletVapour.z- OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z;
402
403"Molar Holdup"
404        M = ML*OutletLiquid.z + MV*OutletVapour.z;
405
406"Mol Fraction Normalisation"
407        sum(OutletLiquid.z)= 1.0;
408
409"Mol Fraction Constraint"
410        sum(OutletLiquid.z)= sum(OutletVapour.z);
411       
412"Liquid Volume"
413        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
414
415"Vapour Volume"
416        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
417       
418"Chemical Equilibrium"
419        PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z =   PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z;
420       
421"Thermal Equilibrium"
422        OutletVapour.T = OutletLiquid.T;
423       
424"Mechanical Equilibrium"
425        OutletLiquid.P = OutletVapour.P;
426       
427"Liquid Density"
428        rhoL = PP.LiquidDensity(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
429
430"Vapour Density"
431        rhoV = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
432
433"Liquid viscosity"
434        miL = PP.LiquidViscosity(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
435
436"Volume flow rate of liquid, m^3/m^2/s"
437        uL * Al = OutletLiquid.F * vL;
438       
439"Pressure Drop"
440        deltaP = InletVapour.P - OutletVapour.P;       
441
442end
443
444#*-------------------------------------
445* Nonequilibrium Model
446-------------------------------------*
447Model interfaceTeste
448       
449        ATTRIBUTES
450        Pallete         = false;
451        Icon            = "icon/Tray";
452        Brief           = "Descrition of variables of the equilibrium interface.";
453        Info            =
454"This model contains only the variables of the equilibrium interface.";
455
456        PARAMETERS
457outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
458outer NComp as Integer;
459outer NC1 as Integer;
460       
461        VARIABLES
462        NL(NComp) as flow_mol_delta     (Brief = "Stream Molar Rate on Liquid Phase");
463        NV(NComp) as flow_mol_delta     (Brief = "Stream Molar Rate on Vapour Phase");
464        T as temperature                (Brief = "Stream Temperature");
465        P as pressure                   (Brief = "Stream Pressure");
466        x(NComp) as fraction    (Brief = "Stream Molar Fraction on Liquid Phase");
467        y(NComp) as fraction    (Brief = "Stream Molar Fraction on Vapour Phase");
468        a as area                           (Brief = "Interface Area");
469        htL as heat_trans_coeff (Brief = "Heat Transference Coefficient on Liquid Phase");
470        htV as heat_trans_coeff (Brief = "Heat Transference Coefficient on Vapour Phase");     
471        E_liq as heat_rate      (Brief = "Liquid Energy Rate at interface");
472    E_vap as heat_rate      (Brief = "Vapour Energy Rate at interface");       
473        hL as enth_mol          (Brief = "Liquid Molar Enthalpy");
474        hV as enth_mol          (Brief = "Vapour Molar Enthalpy");
475        kL(NC1,NC1) as velocity (Brief = "Mass Transfer Coefficients");
476        kV(NC1,NC1) as velocity (Brief = "Mass Transfer Coefficients");
477       
478        EQUATIONS
479        "Liquid Enthalpy"
480        hL = PP.LiquidEnthalpy(T, P, x);
481       
482        "Vapour Enthalpy"
483        hV = PP.VapourEnthalpy(T, P, y);
484
485end
486
487Model trayRateBasicTeste
488        ATTRIBUTES
489        Pallete         = false;
490        Icon            = "icon/Tray";
491        Brief           = "Basic equations of a tray rate column model.";
492        Info            =
493"This model contains only the main equations of a column tray nonequilibrium model without
494the hidraulic equations.
495       
496== Assumptions ==
497* both phases (liquid and vapour) exists all the time;
498* no entrainment of liquid or vapour phase;
499* no weeping;
500* the dymanics in the downcomer are neglected.
501";
502       
503        PARAMETERS
504outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
505outer NComp as Integer;
506    NC1 as Integer;
507        V as volume(Brief="Total Volume of the tray");
508        Q as heat_rate (Brief="Rate of heat supply");
509        Ap as area (Brief="Plate area = Atray - Adowncomer");
510       
511        VARIABLES
512in      Inlet as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
513in      InletFV as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
514in      InletLiquid as stream (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
515in      InletVapour as stream (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
516out     OutletLiquid as liquid_stream (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
517out     OutletVapour as vapour_stream (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
518
519        M_liq(NComp) as mol (Brief="Liquid Molar Holdup in the tray");
520        M_vap(NComp) as mol (Brief="Vapour Molar Holdup in the tray");
521        ML as mol (Brief="Molar liquid holdup");
522        MV as mol (Brief="Molar vapour holdup");
523        E_liq as energy (Brief="Total Liquid Energy Holdup on tray");
524        E_vap as energy (Brief="Total Vapour Energy Holdup on tray");
525        vL as volume_mol (Brief="Liquid Molar Volume");
526        vV as volume_mol (Brief="Vapour Molar volume");
527        Level as length (Brief="Height of clear liquid on plate");
528        interf as interfaceTeste;       
529
530        SET   
531        NC1=NComp-1;
532
533        EQUATIONS
534        "Component Molar Balance"
535        diff(M_liq)=Inlet.F*Inlet.z + InletLiquid.F*InletLiquid.z
536        - OutletLiquid.F*OutletLiquid.z + interf.NL;
537       
538        diff(M_vap)=InletFV.F*InletFV.z + InletVapour.F*InletVapour.z
539        - OutletVapour.F*OutletVapour.z - interf.NV;
540       
541        "Energy Balance"
542        diff(E_liq) = Inlet.F*Inlet.h + InletLiquid.F*InletLiquid.h
543                - OutletLiquid.F*OutletLiquid.h  + Q + interf.E_liq;
544       
545        diff(E_vap) = InletFV.F*InletFV.h + InletVapour.F*InletVapour.h
546                - OutletVapour.F*OutletVapour.h  - interf.E_vap;
547       
548        "Molar Holdup"
549        M_liq = ML*OutletLiquid.z;
550       
551        M_vap = MV*OutletVapour.z;
552       
553        "Energy Holdup"
554        E_liq = ML*(OutletLiquid.h - OutletLiquid.P*vL);
555       
556        E_vap = MV*(OutletVapour.h - OutletVapour.P*vV);
557       
558        "Energy Rate through the interface"
559        interf.E_liq = interf.htL*interf.a*(interf.T-OutletLiquid.T)+sum(interf.NL)*interf.hL; 
560       
561        interf.E_vap = interf.htV*interf.a*(OutletVapour.T-interf.T)+sum(interf.NV)*interf.hV;
562       
563        "Mass Conservation"
564        interf.NL = interf.NV;
565       
566        "Energy Conservation"
567        interf.E_liq = interf.E_vap;
568       
569        "Mol fraction normalisation"
570        sum(OutletLiquid.z)= 1.0;
571        sum(OutletLiquid.z)= sum(OutletVapour.z);
572        sum(interf.x)=1.0;
573        sum(interf.x)=sum(interf.y);
574       
575        "Liquid Volume"
576        vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
577        "Vapour Volume"
578        vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z);
579       
580        "Chemical Equilibrium"
581        PP.LiquidFugacityCoefficient(interf.T, interf.P, interf.x)*interf.x =
582                PP.VapourFugacityCoefficient(interf.T, interf.P, interf.y)*interf.y;
583
584        "Geometry Constraint"
585        V = ML*vL + MV*vV;
586       
587        "Level of clear liquid over the weir"
588        Level = ML*vL/Ap;
589
590        "Total Mass Transfer Rates"
591        interf.NL(1:NC1)=interf.a*sumt(interf.kL*(interf.x(1:NC1)-OutletLiquid.z(1:NC1)))/vL+
592                OutletLiquid.z(1:NC1)*sum(interf.NL);
593
594#       interf.NL(1:NC1)=0.01*'kmol/s';
595       
596        interf.NV(1:NC1)=interf.a*sumt(interf.kV*(OutletVapour.z(1:NC1)-interf.y(1:NC1)))/vV+
597                OutletVapour.z(1:NC1)*sum(interf.NV);
598
599        "Mechanical Equilibrium"
600        OutletVapour.P = OutletLiquid.P;
601        interf.P=OutletLiquid.P;
602end
603
604Model trayRateTeste as trayRateBasicTeste
605        ATTRIBUTES
606        Pallete         = false;
607        Icon            = "icon/Tray";
608        Brief           = "Complete rate model of a column tray.";
609        Info            =
610"== Specify ==
611* the Feed stream
612* the Liquid inlet stream
613* the Vapour inlet stream
614* the Vapour outlet flow (OutletVapour.F)
615       
616== Initial ==
617* the plate temperature of both phases (OutletLiquid.T and OutletVapour.T)
618* the liquid height (Level) OR the liquid flow holdup (ML)
619* the vapor holdup (MV)
620* (NoComps - 1) OutletLiquid compositions
621";
622
623        PARAMETERS
624        Ah as area (Brief="Total holes area");
625        lw as length (Brief="Weir length");
626        g as acceleration (Default=9.81);
627        hw as length (Brief="Weir height");
628        beta as fraction (Brief="Aeration fraction");
629        alfa as fraction (Brief="Dry pressure drop coefficient");
630       
631        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
632        LiquidFlow as Switcher(Valid = ["on", "off"], Default = "on");
633       
634        VARIABLES
635        rhoL as dens_mass;
636        rhoV as dens_mass;
637
638        EQUATIONS
639        "Liquid Density"
640        rhoL = PP.LiquidDensity(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z);
641        "Vapour Density"
642        rhoV = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z);
643
644        switch LiquidFlow
645                case "on":
646                "Francis Equation"
647#               OutletLiquid.F*vL = 1.84*'m^0.5/s'*lw*((Level-(beta*hw))/(beta))^1.5;
648                OutletLiquid.F*vL = 1.84*'1/s'*lw*((Level-(beta*hw))/(beta))^2;
649                when Level < (beta * hw) switchto "off";
650               
651                case "off":
652                "Low level"
653                OutletLiquid.F = 0 * 'mol/h';
654                when Level > (beta * hw) + 1e-6*'m' switchto "on";
655        end
656
657        switch VapourFlow
658                case "on":
659                InletVapour.F*vV = sqrt((InletVapour.P - OutletVapour.P)/(rhoV*alfa))*Ah;
660                when InletVapour.F < 1e-6 * 'kmol/h' switchto "off";
661               
662                case "off":
663                InletVapour.F = 0 * 'mol/s';
664                when InletVapour.P > OutletVapour.P + Level*g*rhoL + 1e-1 * 'atm' switchto "on";
665        end     
666end
667
668*#
Note: See TracBrowser for help on using the repository browser.