[79] | 1 | #*------------------------------------------------------------------- |
---|
| 2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
[1] | 3 | * |
---|
[79] | 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 | * Model of basic streams |
---|
[1] | 17 | *---------------------------------------------------------------------- |
---|
[79] | 18 | * Author: Paula B. Staudt and Rafael de P. Soares |
---|
[1] | 19 | * $Id: streams.mso 147 2007-01-31 19:02:46Z bicca $ |
---|
| 20 | *---------------------------------------------------------------------*# |
---|
| 21 | |
---|
| 22 | using "types"; |
---|
| 23 | |
---|
| 24 | Model stream |
---|
[117] | 25 | ATTRIBUTES |
---|
| 26 | Pallete = false; |
---|
| 27 | Brief = "General Material Stream"; |
---|
[123] | 28 | Info = |
---|
[117] | 29 | "This is the basic building block for the EML models. |
---|
| 30 | Every model should have input and output streams derived |
---|
| 31 | from this model."; |
---|
| 32 | |
---|
[1] | 33 | PARAMETERS |
---|
[117] | 34 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
[1] | 35 | |
---|
| 36 | VARIABLES |
---|
| 37 | F as flow_mol; |
---|
| 38 | T as temperature; |
---|
| 39 | P as pressure; |
---|
[117] | 40 | z(NComp) as fraction(Brief = "Overall Molar Fraction"); |
---|
[1] | 41 | h as enth_mol; |
---|
[117] | 42 | v as fraction(Brief = "Vapourisation fraction"); |
---|
[1] | 43 | end |
---|
| 44 | |
---|
[117] | 45 | Model liquid_stream as stream |
---|
| 46 | ATTRIBUTES |
---|
| 47 | Pallete = false; |
---|
| 48 | Brief = "Liquid Material Stream"; |
---|
[123] | 49 | Info = |
---|
[117] | 50 | "Model for liquid material streams. |
---|
| 51 | This model should be used only when the phase of the stream |
---|
| 52 | is known ''a priori''."; |
---|
| 53 | |
---|
[1] | 54 | PARAMETERS |
---|
[117] | 55 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
[1] | 56 | |
---|
| 57 | EQUATIONS |
---|
[117] | 58 | "Liquid Enthalpy" |
---|
| 59 | h = PP.LiquidEnthalpy(T, P, z); |
---|
| 60 | "Liquid stream" |
---|
| 61 | v = 0; |
---|
[1] | 62 | end |
---|
| 63 | |
---|
[117] | 64 | Model vapour_stream as stream |
---|
| 65 | ATTRIBUTES |
---|
| 66 | Pallete = false; |
---|
| 67 | Brief = "Vapour Material Stream"; |
---|
[123] | 68 | Info = |
---|
[117] | 69 | "Model for vapour material streams. |
---|
| 70 | This model should be used only when the phase of the stream |
---|
| 71 | is known ''a priori''."; |
---|
| 72 | |
---|
[1] | 73 | PARAMETERS |
---|
[117] | 74 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
[1] | 75 | |
---|
| 76 | EQUATIONS |
---|
[117] | 77 | "Vapour Enthalpy" |
---|
| 78 | h = PP.VapourEnthalpy(T, P, z); |
---|
| 79 | "Vapour stream" |
---|
| 80 | v = 1; |
---|
[1] | 81 | end |
---|
| 82 | |
---|
[125] | 83 | Model streamPH as stream |
---|
| 84 | PARAMETERS |
---|
| 85 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
| 86 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 87 | |
---|
| 88 | VARIABLES |
---|
| 89 | x(NComp) as fraction(Brief = "Liquid Molar Fraction"); |
---|
| 90 | y(NComp) as fraction(Brief = "Vapour Molar Fraction"); |
---|
| 91 | |
---|
| 92 | EQUATIONS |
---|
| 93 | "Flash Calculation" |
---|
| 94 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
| 95 | "Enthalpy" |
---|
| 96 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + |
---|
| 97 | v*PP.VapourEnthalpy(T, P, y); |
---|
| 98 | end |
---|
| 99 | |
---|
[117] | 100 | Model source |
---|
| 101 | ATTRIBUTES |
---|
[123] | 102 | Info = |
---|
[117] | 103 | "Material stream source. |
---|
| 104 | This model should be used for boundary streams. |
---|
| 105 | Usually these streams are known and come from another process |
---|
| 106 | units."; |
---|
| 107 | |
---|
| 108 | PARAMETERS |
---|
[147] | 109 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 110 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 111 | M(NComp) as molweight (Brief="Component Mol Weight"); |
---|
[117] | 112 | |
---|
[147] | 113 | SET |
---|
| 114 | |
---|
| 115 | M = PP.MolecularWeight(); |
---|
| 116 | |
---|
[117] | 117 | VARIABLES |
---|
| 118 | out Outlet as stream; |
---|
| 119 | x(NComp) as fraction(Brief = "Liquid Molar Fraction"); |
---|
| 120 | y(NComp) as fraction(Brief = "Vapour Molar Fraction"); |
---|
[123] | 121 | hl as enth_mol; |
---|
| 122 | hv as enth_mol; |
---|
[147] | 123 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 124 | Mw as molweight (Brief="Average Mol Weight"); |
---|
| 125 | vm as volume_mol (Brief="Molar Volume"); |
---|
| 126 | rho as dens_mass (Brief="Stream Density"); |
---|
| 127 | Fw as flow_mass (Brief="Stream Mass Flow"); |
---|
| 128 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
[117] | 129 | |
---|
| 130 | EQUATIONS |
---|
| 131 | "Flash Calculation" |
---|
| 132 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
[147] | 133 | |
---|
[117] | 134 | "Overall Enthalpy" |
---|
| 135 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + |
---|
| 136 | Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[123] | 137 | |
---|
| 138 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 139 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[147] | 140 | |
---|
| 141 | "Average Molecular Weight" |
---|
| 142 | Mw = sum(M*Outlet.z); |
---|
| 143 | |
---|
| 144 | "Mass Density" |
---|
| 145 | rho = (1-Outlet.v)*PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v*PP.VapourDensity(Outlet.T,Outlet.P,y); |
---|
| 146 | |
---|
| 147 | "Flow Mass" |
---|
| 148 | Fw = Mw*Outlet.F; |
---|
| 149 | |
---|
| 150 | "Molar Volume" |
---|
| 151 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
| 152 | |
---|
| 153 | "Volumetric Flow" |
---|
| 154 | Fvol = Outlet.F*vm ; |
---|
| 155 | |
---|
| 156 | "Mass Fraction" |
---|
| 157 | zmass = M*Outlet.z / Mw; |
---|
| 158 | |
---|
[117] | 159 | end |
---|
| 160 | |
---|
| 161 | Model sink |
---|
| 162 | ATTRIBUTES |
---|
[123] | 163 | Info = |
---|
[117] | 164 | "Material stream sink. |
---|
| 165 | This model should be used for boundary streams."; |
---|
| 166 | |
---|
| 167 | PARAMETERS |
---|
[147] | 168 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 169 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 170 | M(NComp) as molweight (Brief="Component Mol Weight"); |
---|
[117] | 171 | |
---|
[147] | 172 | SET |
---|
| 173 | |
---|
| 174 | M = PP.MolecularWeight(); |
---|
| 175 | |
---|
[117] | 176 | VARIABLES |
---|
| 177 | in Inlet as stream; |
---|
| 178 | v as fraction; |
---|
[147] | 179 | x(NComp) as fraction (Brief = "Liquid Molar Fraction"); |
---|
| 180 | y(NComp) as fraction (Brief = "Vapour Molar Fraction"); |
---|
| 181 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 182 | Mw as molweight (Brief="Average Mol Weight"); |
---|
| 183 | vm as volume_mol (Brief="Molar Volume"); |
---|
| 184 | rho as dens_mass (Brief="Stream Density"); |
---|
| 185 | Fw as flow_mass (Brief="Stream Mass Flow"); |
---|
| 186 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
[117] | 187 | |
---|
| 188 | EQUATIONS |
---|
| 189 | "Flash Calculation" |
---|
[123] | 190 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
[147] | 191 | |
---|
| 192 | "Average Molecular Weight" |
---|
| 193 | Mw = sum(M*Inlet.z); |
---|
| 194 | |
---|
| 195 | "Mass Density" |
---|
| 196 | rho = (1-v)*PP.LiquidDensity(Inlet.T,Inlet.P,x) + v*PP.VapourDensity(Inlet.T,Inlet.P,y); |
---|
| 197 | |
---|
| 198 | "Flow Mass" |
---|
| 199 | Fw = Mw*Inlet.F; |
---|
| 200 | |
---|
| 201 | "Molar Volume" |
---|
| 202 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
| 203 | |
---|
| 204 | "Volumetric Flow" |
---|
| 205 | Fvol = Inlet.F*vm ; |
---|
| 206 | |
---|
| 207 | "Mass Fraction" |
---|
| 208 | zmass = M*Inlet.z / Mw; |
---|
| 209 | |
---|
[117] | 210 | end |
---|