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

Last change on this file since 627 was 613, checked in by gerson bicca, 14 years ago

updated column model

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 24.6 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 613 2008-09-01 22:45:47Z bicca $
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       
39        PARAMETERS
40outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
41outer NComp as Integer;
42        V as volume(Brief="Total Volume of the tray");
43        Q as heat_rate (Brief="Rate of heat supply");
44        Ap as area (Brief="Plate area = Atray - Adowncomer");
45       
46        VARIABLES
47in      Inlet as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
48in      InletL as stream (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
49in      InletV as stream (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
50out     OutletL as liquid_stream (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
51out     OutletV as vapour_stream (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
52
53        M(NComp) as mol (Brief="Molar Holdup in the tray");
54        ML as mol (Brief="Molar liquid holdup");
55        MV as mol (Brief="Molar vapour holdup");
56        E as energy (Brief="Total Energy Holdup on tray");
57        vL as volume_mol (Brief="Liquid Molar Volume");
58        vV as volume_mol (Brief="Vapour Molar volume");
59        Level as length (Brief="Height of clear liquid on plate");
60        yideal(NComp) as fraction;
61        Emv as Real (Brief = "Murphree efficiency");
62       
63        EQUATIONS
64        "Component Molar Balance"
65        diff(M)=Inlet.F*Inlet.z + InletL.F*InletL.z + InletV.F*InletV.z
66                - OutletL.F*OutletL.z - OutletV.F*OutletV.z;
67       
68        "Energy Balance"
69        diff(E) = ( Inlet.F*Inlet.h + InletL.F*InletL.h + InletV.F*InletV.h
70                - OutletL.F*OutletL.h - OutletV.F*OutletV.h + Q );
71       
72        "Molar Holdup"
73        M = ML*OutletL.z + MV*OutletV.z;
74       
75        "Energy Holdup"
76        E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V;
77       
78        "Mol fraction normalisation"
79        sum(OutletL.z)= 1.0;
80        sum(OutletL.z)= sum(OutletV.z);
81       
82        "Liquid Volume"
83        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
84        "Vapour Volume"
85        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
86       
87        "Chemical Equilibrium"
88        PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
89                PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, yideal)*yideal;
90
91        "Murphree Efficiency"
92        OutletV.z = Emv * (yideal - InletV.z) + InletV.z;
93       
94        "Thermal Equilibrium"
95        OutletV.T = OutletL.T;
96       
97        "Mechanical Equilibrium"
98        OutletV.P = OutletL.P;
99       
100        "Geometry Constraint"
101        V = ML* vL + MV*vV;
102       
103        "Level of clear liquid over the weir"
104        Level = ML*vL/Ap;
105end
106
107Model tray as trayBasic
108        ATTRIBUTES
109        Pallete         = false;
110        Icon            = "icon/Tray";
111        Brief           = "Complete model of a column tray.";
112        Info            =
113"== Specify ==
114* the Feed stream
115* the Liquid inlet stream
116* the Vapour inlet stream
117* the Vapour outlet flow (OutletV.F)
118       
119== Initial ==
120* the plate temperature (OutletL.T)
121* the liquid height (Level) OR the liquid flow OutletL.F
122* (NoComps - 1) OutletL compositions
123
124== Options ==
125You can choose the equation for the liquid outlet flow and the vapour
126inlet flow calculation through the VapourFlowModel and LiquidFlowModel
127switchers.
128
129== References ==
130* 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.
131* FEEHERY, W. F. Dynamic Optimization with Path Constraints. Tese (Doutorado) - Massachusetts Institute of Technology, June 1998.
132* KLINGBERG, A. Modeling and Optimization of Batch Distillation. Dissertação (Mestrado) - Department of Automatic Control, Lund Institute of Technology, Lund, Sweden, fev. 2000.
133* 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.
134* 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.
135* 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.
136* 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.
137";     
138
139        PARAMETERS
140        Ah as area (Brief="Total holes area");
141        lw as length (Brief="Weir length");
142        g as acceleration (Default=9.81);
143        hw as length (Brief="Weir height");
144        beta as fraction (Brief="Aeration fraction");
145        alfa as fraction (Brief="Dry pressure drop coefficient");
146        w as Real (Brief="Feehery's correlation coefficient", Unit='1/m^4', Default=1);
147        btray as Real (Brief="Elgue's correlation coefficient", Unit='kg/m/mol^2', Default=1);
148        fw as Real      (Brief = "Olsen's correlation coefficient", Default=1);
149        Np as Real      (Brief = "Number of liquid passes in the tray", Default=1);
150        Mw(NComp)       as molweight    (Brief = "Component Mol Weight");
151       
152        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
153        LiquidFlow as Switcher(Valid = ["on", "off"], Default = "on");
154        VapourFlowModel as Switcher(Valid = ["Reepmeyer", "Feehery_Fv", "Roffel_Fv", "Klingberg", "Wang_Fv", "Elgue"], Default = "Reepmeyer");
155        LiquidFlowModel as Switcher(Valid = ["default", "Wang_Fl", "Olsen", "Feehery_Fl", "Roffel_Fl"], Default = "default");
156
157        SET
158        Mw = PP.MolecularWeight();
159       
160        VARIABLES
161        rhoL as dens_mass;
162        rhoV as dens_mass;
163
164        btemp as Real (Brief="Temporary variable of Roffel's liquid flow equation");
165       
166        EQUATIONS
167        "Liquid Density"
168        rhoL = PP.LiquidDensity(OutletL.T, OutletL.P, OutletL.z);
169        "Vapour Density"
170        rhoV = PP.VapourDensity(InletV.T, InletV.P, InletV.z);
171
172        switch LiquidFlow
173                case "on":
174                        switch LiquidFlowModel
175                                case "default":
176                                "Francis Equation"
177                                OutletL.F*vL = 1.84*'1/s'*lw*((Level-(beta*hw))/(beta))^2;
178                       
179                                case "Wang_Fl":
180                                OutletL.F*vL = 1.84*'m^0.5/s'*lw*((Level-(beta*hw))/(beta))^1.5;
181                       
182                                case "Olsen":
183                                OutletL.F / 'mol/s'= lw*Np*rhoL/sum(Mw*OutletV.z)/(0.665*fw)^1.5 * ((ML*sum(Mw*OutletL.z)/rhoL/Ap)-hw)^1.5 * 'm^0.5/mol';
184                       
185                                case "Feehery_Fl":
186                                OutletL.F = lw*rhoL/sum(Mw*OutletL.z) * ((Level-hw)/750/'mm')^1.5 * 'm^2/s';
187                       
188                                case "Roffel_Fl":
189                                OutletL.F = 2/3*sqrt(2*g)*rhoL/sum(Mw*OutletL.z)*lw*(2*btemp-1)*(ML*sum(Mw*OutletL.z)/(Ap*1.3)/rhoL/(2*btemp-1))^1.5;
190                        end
191                when Level < (beta * hw) switchto "off";
192               
193                case "off":
194                "Low level"
195                OutletL.F = 0 * 'mol/h';
196                when Level > (beta * hw) + 1e-6*'m' switchto "on";
197        end
198       
199        btemp = 1 - 0.3593/'Pa^0.0888545'*abs(OutletV.F*sum(Mw*OutletV.z)/(Ap*1.3)/sqrt(rhoV))^0.177709; #/'(kg/m)^0.0888545/s^0.177709';
200
201        switch VapourFlow
202                case "on":
203                        switch VapourFlowModel
204                                case "Reepmeyer":
205                                InletV.F*vV = sqrt((InletV.P - OutletV.P)/(rhoV*alfa))*Ah;
206                       
207                                case "Feehery_Fv":
208                                InletV.F = rhoV/Ap/w/sum(Mw*OutletV.z) * sqrt(((InletV.P - OutletV.P)-(rhoV*g*ML*vL/Ap))/rhoV);
209                       
210                                case "Roffel_Fv":
211                                InletV.F^1.08 * 0.0013 * 'kg/m/mol^1.08/s^0.92*1e5' = (InletV.P - OutletV.P)*1e5 - (beta*sum(M*Mw)/(Ap*1.3)*g*1e5) * (rhoV*Ah/sum(Mw*OutletV.z))^1.08 * 'm^1.08/mol^1.08';
212                       
213                                case "Klingberg":
214                                InletV.F * vV = Ap * sqrt(((InletV.P - OutletV.P)-rhoL*g*Level)/rhoV);
215                       
216                                case "Wang_Fv":
217                                InletV.F * vV = Ap * sqrt(((InletV.P - OutletV.P)-rhoL*g*Level)/rhoV*alfa);
218                               
219                                case "Elgue":
220                                InletV.F  = sqrt((InletV.P - OutletV.P)/btray);
221                        end
222                when InletV.F < 1e-6 * 'kmol/h' switchto "off";
223               
224                case "off":
225                InletV.F = 0 * 'mol/s';
226                when InletV.P > OutletV.P + Level*g*rhoL + 1e-1 * 'atm' switchto "on";
227        end
228
229end
230
231#*-------------------------------------------------------------------
232* Model of a tray with reaction
233*-------------------------------------------------------------------*#
234Model trayReact
235        ATTRIBUTES
236        Pallete         = false;
237        Icon            = "icon/Tray";
238        Brief           = "Model of a tray with reaction.";
239        Info            =
240"== Assumptions ==
241* both phases (liquid and vapour) exists all the time;
242* thermodymanic equilibrium with Murphree plate efficiency;
243* no entrainment of liquid or vapour phase;
244* no weeping;
245* the dymanics in the downcomer are neglected.
246       
247== Specify ==
248* the Feed stream;
249* the Liquid inlet stream;
250* the Vapour inlet stream;
251* the Vapour outlet flow (OutletV.F);
252* the reaction related variables.
253       
254== Initial ==
255* the plate temperature (OutletL.T)
256* the liquid height (Level) OR the liquid flow OutletL.F
257* (NoComps - 1) OutletL compositions
258";
259
260        PARAMETERS
261        outer PP as Plugin(Type="PP");
262        outer NComp as Integer;
263        V as volume(Brief="Total Volume of the tray");
264        Q as power (Brief="Rate of heat supply");
265        Ap as area (Brief="Plate area = Atray - Adowncomer");
266       
267        Ah as area (Brief="Total holes area");
268        lw as length (Brief="Weir length");
269        g as acceleration (Default=9.81);
270        hw as length (Brief="Weir height");
271        beta as fraction (Brief="Aeration fraction");
272        alfa as fraction (Brief="Dry pressure drop coefficient");
273
274        stoic(NComp) as Real(Brief="Stoichiometric matrix");
275        Hr as energy_mol;
276        Pstartup as pressure;
277       
278        VapourFlow as Switcher(Valid = ["on", "off"], Default = "off");
279        LiquidFlow as Switcher(Valid = ["on", "off"], Default = "off");
280       
281        VARIABLES
282in      Inlet as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
283in      InletL as stream (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
284in      InletV as stream (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
285out     OutletL as liquid_stream (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
286out     OutletV as vapour_stream (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
287
288        yideal(NComp) as fraction;
289        Emv as Real (Brief = "Murphree efficiency");
290
291        M(NComp) as mol (Brief="Molar Holdup in the tray");
292        ML as mol (Brief="Molar liquid holdup");
293        MV as mol (Brief="Molar vapour holdup");
294        E as energy (Brief="Total Energy Holdup on tray");
295        vL as volume_mol (Brief="Liquid Molar Volume");
296        vV as volume_mol (Brief="Vapour Molar volume");
297        Level as length (Brief="Height of clear liquid on plate");
298        Vol as volume;
299       
300        rhoL as dens_mass;
301        rhoV as dens_mass;
302        r3 as reaction_mol (Brief = "Reaction resulting ethyl acetate", DisplayUnit = 'mol/l/s');
303        C(NComp) as conc_mol (Brief = "Molar concentration", Lower = -1); #, Unit = "mol/l");
304       
305        EQUATIONS
306        "Molar Concentration"
307        OutletL.z = vL * C;
308       
309        "Reaction"
310        r3 = exp(-7150*'K'/OutletL.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4))*'l/mol/s';
311       
312        "Component Molar Balance"
313        diff(M)=Inlet.F*Inlet.z + InletL.F*InletL.z + InletV.F*InletV.z
314                - OutletL.F*OutletL.z - OutletV.F*OutletV.z + stoic*r3*ML*vL;
315       
316        "Energy Balance"
317        diff(E) = ( Inlet.F*Inlet.h + InletL.F*InletL.h + InletV.F*InletV.h
318                - OutletL.F*OutletL.h - OutletV.F*OutletV.h + Q ) + Hr * r3 * vL*ML;
319       
320        "Molar Holdup"
321        M = ML*OutletL.z + MV*OutletV.z;
322       
323        "Energy Holdup"
324        E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V;
325       
326        "Mol fraction normalisation"
327        sum(OutletL.z)= 1.0;
328       
329        "Liquid Volume"
330        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
331        "Vapour Volume"
332        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
333
334        "Thermal Equilibrium"
335        OutletV.T = OutletL.T;
336       
337        "Mechanical Equilibrium"
338        OutletV.P = OutletL.P;
339       
340        "Level of clear liquid over the weir"
341        Level = ML*vL/Ap;
342
343        Vol = ML*vL;
344       
345        "Liquid Density"
346        rhoL = PP.LiquidDensity(OutletL.T, OutletL.P, OutletL.z);
347        "Vapour Density"
348        rhoV = PP.VapourDensity(InletV.T, InletV.P, InletV.z);
349
350        switch LiquidFlow
351                case "on":
352                "Francis Equation"
353                OutletL.F*vL = 1.84*'1/s'*lw*((Level-(beta*hw)+1e-6*'m')/(beta))^2;
354                when Level < (beta * hw) switchto "off";
355               
356                case "off":
357                "Low level"
358                OutletL.F = 0 * 'mol/h';
359                when Level > (beta * hw) + 1e-6*'m' switchto "on";
360        end
361
362        switch VapourFlow
363                case "on":
364                #InletV.P = OutletV.P + Level*g*rhoL + rhoV*alfa*(InletV.F*vV/Ah)^2;
365                InletV.F*vV = sqrt((InletV.P - OutletV.P - Level*g*rhoL + 1e-8 * 'atm')/(rhoV*alfa))*Ah;
366                when InletV.P < OutletV.P + Level*g*rhoL switchto "off";
367               
368                case "off":
369                InletV.F = 0 * 'mol/s';
370                when InletV.P > OutletV.P + Level*g*rhoL + 3e-2 * 'atm' switchto "on";
371                #when InletV.P > OutletV.P + Level*beta*g*rhoL + 1e-2 * 'atm' switchto "on";
372        end
373
374        "Chemical Equilibrium"
375        PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
376                PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, yideal)*yideal;
377       
378        OutletV.z = Emv * (yideal - InletV.z) + InletV.z;
379       
380        sum(OutletL.z)= sum(OutletV.z);
381       
382        "Geometry Constraint"
383        V = ML* vL + MV*vV;
384end
385
386#*-------------------------------------
387* Model of a packed column stage
388-------------------------------------*#
389Model packedStage
390        ATTRIBUTES
391        Pallete         = false;
392        Icon            = "icon/PackedStage";
393        Brief           = "Complete model of a packed column stage.";
394        Info            =
395"== Specify ==
396* the Feed stream
397* the Liquid inlet stream
398* the Vapour inlet stream
399* the stage pressure drop (deltaP)
400       
401== Initial ==
402* the plate temperature (OutletL.T)
403* the liquid molar holdup ML
404* (NoComps - 1) OutletL compositions
405";     
406       
407        PARAMETERS
408outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
409outer NComp as Integer;
410        PPwater as Plugin(Brief="Physical Properties",
411                Type="PP",
412                Components = [ "water" ],
413                LiquidModel = "PR",
414                VapourModel = "PR"
415        );
416
417        V as volume(Brief="Total Volume of the tray");
418        Q as heat_rate (Brief="Rate of heat supply");
419        d as length (Brief="Column diameter"); 
420
421        a as Real (Brief="surface area per packing volume", Unit='m^2/m^3');
422        g as acceleration;
423        e as Real (Brief="Void fraction of packing, m^3/m^3");
424        Cpo as Real (Brief="Constant for resitance equation"); # Billet and Schultes, 1999.
425        Mw(NComp)       as molweight    (Brief = "Component Mol Weight");
426        hs as length (Brief="Height of the packing stage");
427        Qsil as positive (Brief="Resistance coefficient on the liquid load", Default=1);
428
429        VARIABLES
430in      Inlet as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
431in      InletL as stream (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
432in      InletV as stream (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
433out     OutletL as liquid_stream (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
434out     OutletV as vapour_stream (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
435
436        M(NComp) as mol (Brief="Molar Holdup in the tray", Default=0.01, Lower=0, Upper=100);
437        ML as mol (Brief="Molar liquid holdup", Default=0.01, Lower=0, Upper=100);
438        MV as mol (Brief="Molar vapour holdup", Default=0.01, Lower=0, Upper=100);
439        E as energy (Brief="Total Energy Holdup on tray", Default=-500);
440        vL as volume_mol (Brief="Liquid Molar Volume");
441        vV as volume_mol (Brief="Vapour Molar volume");
442       
443        miL as viscosity (Brief="Liquid dynamic viscosity", DisplayUnit='kg/m/s');
444        miV as viscosity (Brief="Vapor dynamic viscosity", DisplayUnit='kg/m/s');
445        rhoL as dens_mass;
446        rhoV as dens_mass;
447       
448        deltaP as pressure;
449       
450        uL as velocity (Brief="volume flow rate of liquid, m^3/m^2/s", Lower=-10, Upper=100);
451        uV as velocity (Brief="volume flow rate of vapor, m^3/m^2/s", Lower=-10, Upper=100);
452        dp as length (Brief="Particle diameter", Default=1e-3, Lower=0, Upper=10);
453        invK as positive (Brief="Wall factor", Default=1, Upper=10);
454        Rev as Real (Brief="Reynolds number of the vapor stream", Default=4000);
455        Al as area (Brief="Area occupied by the liquid", Default=0.001, Upper=1);
456        hl as positive (Brief="Column holdup", Unit='m^3/m^3', Default=0.01,Upper=10);
457
458        SET
459        Mw = PP.MolecularWeight();
460
461        EQUATIONS
462        "Component Molar Balance"
463        diff(M)=Inlet.F*Inlet.z + InletL.F*InletL.z + InletV.F*InletV.z
464                - OutletL.F*OutletL.z - OutletV.F*OutletV.z;
465
466        "Energy Balance"
467        diff(E) = ( Inlet.F*Inlet.h + InletL.F*InletL.h + InletV.F*InletV.h
468                - OutletL.F*OutletL.h - OutletV.F*OutletV.h + Q );
469       
470        "Molar Holdup"
471        M = ML*OutletL.z + MV*OutletV.z;
472       
473        "Energy Holdup"
474        E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V;
475       
476        "Mol fraction normalisation"
477        sum(OutletL.z)= 1.0;
478       
479        "Liquid Volume"
480        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
481        "Vapour Volume"
482        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
483       
484        "Chemical Equilibrium"
485        PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
486                PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, OutletV.z)*OutletV.z;
487       
488        "Thermal Equilibrium"
489        OutletV.T = OutletL.T;
490       
491        "Mechanical Equilibrium"
492        OutletL.P = OutletV.P;
493       
494        "Geometry Constraint"
495        V*e = ML*vL + MV*vV;
496       
497        "Liquid Density"
498        rhoL = PP.LiquidDensity(OutletL.T, OutletL.P, OutletL.z);
499        "Vapour Density"
500        rhoV = PP.VapourDensity(InletV.T, InletV.P, InletV.z);
501        "Liquid viscosity"
502        miL = PP.LiquidViscosity(OutletL.T, OutletL.P, OutletL.z);
503        "Vapour viscosity"
504        miV = PP.VapourViscosity(InletV.T, InletV.P, InletV.z);
505
506        "Area occupied by the liquid"
507        Al = ML*vL/hs;
508
509        "Volume flow rate of liquid, m^3/m^2/s"
510        uL * Al = OutletL.F * vL;
511        "Volume flow rate of vapor, m^3/m^2/s"
512        uV * ((d^2*3.14159/4)*e - Al) = OutletV.F * vV;
513       
514        "Liquid holdup"
515        hl = ML*vL/V/e;
516       
517        "Particle diameter"
518        dp = 6 * (1-e)/a;
519       
520        "Wall Factor"
521        invK = (1 + (2*dp/(3*d*(1-e))));
522       
523        "Reynolds number of the vapor stream"
524        Rev*invK = dp*uV*rhoV / (miV*(1-e));
525       
526        deltaP = InletV.P - OutletV.P;
527       
528        "Pressure drop and Vapor flow"
529        deltaP/hs  = Qsil*a*uV^2*rhoV*invK / (2*(e-hl)^3);
530
531        "Liquid holdup"
532        hl = (12*miL*a^2*uL/rhoL/g)^1/3;
533end
534
535#*-------------------------------------
536* Nonequilibrium Model
537-------------------------------------*#
538Model interface
539       
540        ATTRIBUTES
541        Pallete         = false;
542        Icon            = "icon/Tray";
543        Brief           = "Descrition of variables of the equilibrium interface.";
544        Info            =
545"This model contains only the variables of the equilibrium interface.";
546
547        PARAMETERS
548outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
549outer NComp as Integer;
550outer NC1 as Integer;
551       
552        VARIABLES
553        NL(NComp) as flow_mol_delta     (Brief = "Stream Molar Rate on Liquid Phase");
554        NV(NComp) as flow_mol_delta     (Brief = "Stream Molar Rate on Vapour Phase");
555        T as temperature                (Brief = "Stream Temperature");
556        P as pressure                   (Brief = "Stream Pressure");
557        x(NComp) as fraction    (Brief = "Stream Molar Fraction on Liquid Phase");
558        y(NComp) as fraction    (Brief = "Stream Molar Fraction on Vapour Phase");
559        a as area                           (Brief = "Interface Area");
560        htL as heat_trans_coeff (Brief = "Heat Transference Coefficient on Liquid Phase");
561        htV as heat_trans_coeff (Brief = "Heat Transference Coefficient on Vapour Phase");     
562        E_liq as heat_rate      (Brief = "Liquid Energy Rate at interface");
563    E_vap as heat_rate      (Brief = "Vapour Energy Rate at interface");       
564        hL as enth_mol          (Brief = "Liquid Molar Enthalpy");
565        hV as enth_mol          (Brief = "Vapour Molar Enthalpy");
566        kL(NC1,NC1) as velocity (Brief = "Mass Transfer Coefficients");
567        kV(NC1,NC1) as velocity (Brief = "Mass Transfer Coefficients");
568       
569        EQUATIONS
570        "Liquid Enthalpy"
571        hL = PP.LiquidEnthalpy(T, P, x);
572       
573        "Vapour Enthalpy"
574        hV = PP.VapourEnthalpy(T, P, y);
575
576end
577
578Model trayRateBasic
579        ATTRIBUTES
580        Pallete         = false;
581        Icon            = "icon/Tray";
582        Brief           = "Basic equations of a tray rate column model.";
583        Info            =
584"This model contains only the main equations of a column tray nonequilibrium model without
585the hidraulic equations.
586       
587== Assumptions ==
588* both phases (liquid and vapour) exists all the time;
589* no entrainment of liquid or vapour phase;
590* no weeping;
591* the dymanics in the downcomer are neglected.
592";
593       
594        PARAMETERS
595outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
596outer NComp as Integer;
597    NC1 as Integer;
598        V as volume(Brief="Total Volume of the tray");
599        Q as heat_rate (Brief="Rate of heat supply");
600        Ap as area (Brief="Plate area = Atray - Adowncomer");
601       
602        VARIABLES
603in      Inlet as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
604in      InletFV as stream (Brief="Feed stream", PosX=0, PosY=0.4932, Symbol="_{in}");
605in      InletL as stream (Brief="Inlet liquid stream", PosX=0.5195, PosY=0, Symbol="_{inL}");
606in      InletV as stream (Brief="Inlet vapour stream", PosX=0.4994, PosY=1, Symbol="_{inV}");
607out     OutletL as liquid_stream (Brief="Outlet liquid stream", PosX=0.8277, PosY=1, Symbol="_{outL}");
608out     OutletV as vapour_stream (Brief="Outlet vapour stream", PosX=0.8043, PosY=0, Symbol="_{outV}");
609
610        M_liq(NComp) as mol (Brief="Liquid Molar Holdup in the tray");
611        M_vap(NComp) as mol (Brief="Vapour Molar Holdup in the tray");
612        ML as mol (Brief="Molar liquid holdup");
613        MV as mol (Brief="Molar vapour holdup");
614        E_liq as energy (Brief="Total Liquid Energy Holdup on tray");
615        E_vap as energy (Brief="Total Vapour Energy Holdup on tray");
616        vL as volume_mol (Brief="Liquid Molar Volume");
617        vV as volume_mol (Brief="Vapour Molar volume");
618        Level as length (Brief="Height of clear liquid on plate");
619        interf as interface;   
620
621        SET   
622        NC1=NComp-1;
623
624        EQUATIONS
625        "Component Molar Balance"
626        diff(M_liq)=Inlet.F*Inlet.z + InletL.F*InletL.z
627        - OutletL.F*OutletL.z + interf.NL;
628       
629        diff(M_vap)=InletFV.F*InletFV.z + InletV.F*InletV.z
630        - OutletV.F*OutletV.z - interf.NV;
631       
632        "Energy Balance"
633        diff(E_liq) = Inlet.F*Inlet.h + InletL.F*InletL.h
634                - OutletL.F*OutletL.h  + Q + interf.E_liq;
635       
636        diff(E_vap) = InletFV.F*InletFV.h + InletV.F*InletV.h
637                - OutletV.F*OutletV.h  - interf.E_vap;
638       
639        "Molar Holdup"
640        M_liq = ML*OutletL.z;
641       
642        M_vap = MV*OutletV.z;
643       
644        "Energy Holdup"
645        E_liq = ML*(OutletL.h - OutletL.P*vL);
646       
647        E_vap = MV*(OutletV.h - OutletV.P*vV);
648       
649        "Energy Rate through the interface"
650        interf.E_liq = interf.htL*interf.a*(interf.T-OutletL.T)+sum(interf.NL)*interf.hL;       
651       
652        interf.E_vap = interf.htV*interf.a*(OutletV.T-interf.T)+sum(interf.NV)*interf.hV;
653       
654        "Mass Conservation"
655        interf.NL = interf.NV;
656       
657        "Energy Conservation"
658        interf.E_liq = interf.E_vap;
659       
660        "Mol fraction normalisation"
661        sum(OutletL.z)= 1.0;
662        sum(OutletL.z)= sum(OutletV.z);
663        sum(interf.x)=1.0;
664        sum(interf.x)=sum(interf.y);
665       
666        "Liquid Volume"
667        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
668        "Vapour Volume"
669        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
670       
671        "Chemical Equilibrium"
672        PP.LiquidFugacityCoefficient(interf.T, interf.P, interf.x)*interf.x =
673                PP.VapourFugacityCoefficient(interf.T, interf.P, interf.y)*interf.y;
674
675        "Geometry Constraint"
676        V = ML*vL + MV*vV;
677       
678        "Level of clear liquid over the weir"
679        Level = ML*vL/Ap;
680
681        "Total Mass Transfer Rates"
682        interf.NL(1:NC1)=interf.a*sumt(interf.kL*(interf.x(1:NC1)-OutletL.z(1:NC1)))/vL+
683                OutletL.z(1:NC1)*sum(interf.NL);
684
685#       interf.NL(1:NC1)=0.01*'kmol/s';
686       
687        interf.NV(1:NC1)=interf.a*sumt(interf.kV*(OutletV.z(1:NC1)-interf.y(1:NC1)))/vV+
688                OutletV.z(1:NC1)*sum(interf.NV);
689
690        "Mechanical Equilibrium"
691        OutletV.P = OutletL.P;
692        interf.P=OutletL.P;
693end
694
695Model trayRate as trayRateBasic
696        ATTRIBUTES
697        Pallete         = false;
698        Icon            = "icon/Tray";
699        Brief           = "Complete rate model of a column tray.";
700        Info            =
701"== Specify ==
702* the Feed stream
703* the Liquid inlet stream
704* the Vapour inlet stream
705* the Vapour outlet flow (OutletV.F)
706       
707== Initial ==
708* the plate temperature of both phases (OutletL.T and OutletV.T)
709* the liquid height (Level) OR the liquid flow holdup (ML)
710* the vapor holdup (MV)
711* (NoComps - 1) OutletL compositions
712";
713
714        PARAMETERS
715        Ah as area (Brief="Total holes area");
716        lw as length (Brief="Weir length");
717        g as acceleration (Default=9.81);
718        hw as length (Brief="Weir height");
719        beta as fraction (Brief="Aeration fraction");
720        alfa as fraction (Brief="Dry pressure drop coefficient");
721       
722        VapourFlow as Switcher(Valid = ["on", "off"], Default = "on");
723        LiquidFlow as Switcher(Valid = ["on", "off"], Default = "on");
724       
725        VARIABLES
726        rhoL as dens_mass;
727        rhoV as dens_mass;
728
729        EQUATIONS
730        "Liquid Density"
731        rhoL = PP.LiquidDensity(OutletL.T, OutletL.P, OutletL.z);
732        "Vapour Density"
733        rhoV = PP.VapourDensity(InletV.T, InletV.P, InletV.z);
734
735        switch LiquidFlow
736                case "on":
737                "Francis Equation"
738#               OutletL.F*vL = 1.84*'m^0.5/s'*lw*((Level-(beta*hw))/(beta))^1.5;
739                OutletL.F*vL = 1.84*'1/s'*lw*((Level-(beta*hw))/(beta))^2;
740                when Level < (beta * hw) switchto "off";
741               
742                case "off":
743                "Low level"
744                OutletL.F = 0 * 'mol/h';
745                when Level > (beta * hw) + 1e-6*'m' switchto "on";
746        end
747
748        switch VapourFlow
749                case "on":
750                InletV.F*vV = sqrt((InletV.P - OutletV.P)/(rhoV*alfa))*Ah;
751                when InletV.F < 1e-6 * 'kmol/h' switchto "off";
752               
753                case "off":
754                InletV.F = 0 * 'mol/s';
755                when InletV.P > OutletV.P + Level*g*rhoL + 1e-1 * 'atm' switchto "on";
756        end     
757end
Note: See TracBrowser for help on using the repository browser.