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 | * Authors: Rafael de Pelegrini Soares |
---|
17 | * Andrey Copat, Estefane S. Horn, Marcos L. Alencastro |
---|
18 | * $Id$ |
---|
19 | *--------------------------------------------------------------------*# |
---|
20 | |
---|
21 | using "streams"; |
---|
22 | |
---|
23 | Model expander |
---|
24 | |
---|
25 | ATTRIBUTES |
---|
26 | Pallete = true; |
---|
27 | Icon = "icon/expander"; |
---|
28 | Brief = "Model of an expansor."; |
---|
29 | Info = |
---|
30 | "To be documented"; |
---|
31 | |
---|
32 | PARAMETERS |
---|
33 | |
---|
34 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
35 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
36 | Rgas as positive (Brief = "Constant of Gases", Unit= 'kJ/kmol/K', Default = 8.31451,Hidden=true); |
---|
37 | Mw(NComp) as molweight (Brief = "Molar Weight"); |
---|
38 | |
---|
39 | VARIABLES |
---|
40 | |
---|
41 | IseCoeff as positive (Brief = "Isentropic Coefficient", Lower=0.2); |
---|
42 | Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}"); |
---|
43 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P"); |
---|
44 | Pdecrease as press_delta (Brief = "Pressure Decrease", DisplayUnit = 'kPa', Symbol ="P_{decr}"); |
---|
45 | |
---|
46 | Head as energy_mass (Brief = "Head",Hidden=true); |
---|
47 | HeadIsentropic as energy_mass (Brief = "Isentropic Head"); |
---|
48 | Tisentropic as temperature (Brief = "Isentropic Temperature"); |
---|
49 | |
---|
50 | IsentropicEff as efficiency (Brief = "Isentropic efficiency"); |
---|
51 | MechanicalEff as efficiency (Brief = "Mechanical efficiency"); |
---|
52 | |
---|
53 | FluidPower as power (Brief = "Fluid Power"); |
---|
54 | BrakePower as power (Brief = "Brake Power"); |
---|
55 | PowerLoss as power (Brief = "Power Losses",Lower=0); |
---|
56 | Mwm as molweight (Brief = "Mixture Molar Weight"); |
---|
57 | rho as dens_mass (Brief = "Mass Density"); |
---|
58 | Zfac_in as fraction (Brief = "Compressibility factor at inlet"); |
---|
59 | Zfac_out as fraction (Brief = "Compressibility factor at outlet"); |
---|
60 | |
---|
61 | in Inlet as stream (Brief = "Inlet stream", PosX=0.05, PosY=0.0, Symbol="_{in}"); |
---|
62 | out Outlet as streamPH (Brief = "Outlet stream", PosX=0.65, PosY=1, Symbol="_{out}"); |
---|
63 | |
---|
64 | out WorkOut as work_stream (Brief = "Work Outlet", PosX=1, PosY=0.46); |
---|
65 | |
---|
66 | SET |
---|
67 | |
---|
68 | Mw = PP.MolecularWeight(); |
---|
69 | |
---|
70 | Rgas = 8.31451*'kJ/kmol/K'; |
---|
71 | |
---|
72 | EQUATIONS |
---|
73 | |
---|
74 | "Overall Molar Balance" |
---|
75 | Outlet.F = Inlet.F; |
---|
76 | |
---|
77 | "Component Molar Balance" |
---|
78 | Outlet.z = Inlet.z; |
---|
79 | |
---|
80 | "Average Molecular Weight" |
---|
81 | Mwm = sum(Mw*Inlet.z); |
---|
82 | |
---|
83 | "Pressure Ratio" |
---|
84 | Outlet.P = Inlet.P * Pratio; |
---|
85 | |
---|
86 | "Pressure Drop" |
---|
87 | Outlet.P = Inlet.P - Pdrop; |
---|
88 | |
---|
89 | "Pressure Decrease" |
---|
90 | Outlet.P = Inlet.P - Pdecrease; |
---|
91 | |
---|
92 | "Mass Density" |
---|
93 | rho = PP.VapourDensity(Inlet.T, Inlet.P, Inlet.z); |
---|
94 | |
---|
95 | "Compressibility factor at Inlet Conditions" |
---|
96 | Zfac_in = PP.VapourCompressibilityFactor(Inlet.T,Inlet.P,Inlet.z); |
---|
97 | |
---|
98 | "Compressibility factor at Outlet Conditions" |
---|
99 | Zfac_out = PP.VapourCompressibilityFactor(Outlet.T,Outlet.P,Outlet.z); |
---|
100 | |
---|
101 | "Isentropic Head" |
---|
102 | HeadIsentropic*Mwm = (PP.VapourEnthalpy(Tisentropic,Outlet.P,Outlet.z)-Inlet.h); |
---|
103 | |
---|
104 | "Actual Head" |
---|
105 | Head*Mwm = (Outlet.h-Inlet.h); |
---|
106 | |
---|
107 | "Isentropic Coefficient" |
---|
108 | HeadIsentropic = (0.5*Zfac_in+0.5*Zfac_out)*(1/Mwm)*(IseCoeff/(IseCoeff-1.001))*Rgas*Inlet.T*((Outlet.P/Inlet.P)^((IseCoeff-1.001)/IseCoeff) - 1); |
---|
109 | |
---|
110 | "Isentropic Outlet Temperature" |
---|
111 | PP.VapourEntropy(Tisentropic, Outlet.P, Outlet.z) = PP.VapourEntropy(Inlet.T, Inlet.P, Inlet.z); |
---|
112 | |
---|
113 | |
---|
114 | if IsentropicEff equal 1 |
---|
115 | |
---|
116 | then |
---|
117 | "Discharge Temperature" |
---|
118 | Outlet.T = Tisentropic; |
---|
119 | |
---|
120 | else |
---|
121 | |
---|
122 | "Discharge Temperature" |
---|
123 | (PP.VapourEnthalpy(Outlet.T,Outlet.P,Outlet.z)-Inlet.h)= (PP.VapourEnthalpy(Tisentropic,Outlet.P,Outlet.z)-Inlet.h)*IsentropicEff; |
---|
124 | |
---|
125 | end |
---|
126 | |
---|
127 | "Fluid Power" |
---|
128 | FluidPower = IsentropicEff*HeadIsentropic*sum(Mw*Inlet.z)*Inlet.F+PowerLoss; |
---|
129 | |
---|
130 | "Brake Power" |
---|
131 | BrakePower = WorkOut.Work; |
---|
132 | |
---|
133 | "Brake Power" |
---|
134 | BrakePower = FluidPower*MechanicalEff; |
---|
135 | |
---|
136 | "Power Loss" |
---|
137 | PowerLoss = BrakePower - FluidPower; |
---|
138 | |
---|
139 | end |
---|