[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 325 2007-07-29 00:41:04Z arge $ |
---|
| 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; |
---|
[325] | 42 | v as fraction(Brief = "Vapourization 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 |
---|
[298] | 84 | ATTRIBUTES |
---|
| 85 | Brief = "Stream with built-in flash calculation"; |
---|
| 86 | Info = " |
---|
| 87 | This model should be used when the vaporization fraction |
---|
| 88 | is unknown. |
---|
| 89 | |
---|
| 90 | The built-in flash calculation will determine the stream |
---|
| 91 | state as a function of the overall composition '''z''', the |
---|
| 92 | pressure '''P''' and the enthalpy '''h'''. |
---|
| 93 | |
---|
| 94 | Additionally, the liquid composition '''x''' and the vapor |
---|
| 95 | composition '''y''' are calculated. |
---|
| 96 | "; |
---|
| 97 | Pallete = false; |
---|
| 98 | |
---|
[125] | 99 | PARAMETERS |
---|
| 100 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
| 101 | |
---|
| 102 | VARIABLES |
---|
| 103 | x(NComp) as fraction(Brief = "Liquid Molar Fraction"); |
---|
| 104 | y(NComp) as fraction(Brief = "Vapour Molar Fraction"); |
---|
| 105 | |
---|
| 106 | EQUATIONS |
---|
| 107 | "Flash Calculation" |
---|
| 108 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
| 109 | "Enthalpy" |
---|
| 110 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + |
---|
| 111 | v*PP.VapourEnthalpy(T, P, y); |
---|
| 112 | end |
---|
| 113 | |
---|
[117] | 114 | Model source |
---|
| 115 | ATTRIBUTES |
---|
[321] | 116 | Pallete = true; |
---|
[310] | 117 | Icon = "icon/Source"; |
---|
[290] | 118 | Brief = "Material stream source"; |
---|
| 119 | Info = " |
---|
[117] | 120 | This model should be used for boundary streams. |
---|
| 121 | Usually these streams are known and come from another process |
---|
[290] | 122 | units. |
---|
[117] | 123 | |
---|
[290] | 124 | The user should specify: |
---|
| 125 | * Total molar (mass or volumetric) flow |
---|
| 126 | * Temperature |
---|
| 127 | * Pressure |
---|
| 128 | * Molar (mass or volumetric) composition |
---|
| 129 | |
---|
| 130 | No matter the specification set, the model will calculate some |
---|
| 131 | additional properties: |
---|
| 132 | * Mass density |
---|
| 133 | * Mass flow |
---|
| 134 | * Mass compostions |
---|
| 135 | * Specific volume |
---|
| 136 | * Vapour fraction |
---|
| 137 | * Volumetric flow |
---|
| 138 | * Liquid and Vapour compositions |
---|
| 139 | "; |
---|
| 140 | |
---|
[117] | 141 | PARAMETERS |
---|
[147] | 142 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 143 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
[297] | 144 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 145 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
[117] | 146 | |
---|
[147] | 147 | SET |
---|
| 148 | |
---|
| 149 | M = PP.MolecularWeight(); |
---|
| 150 | |
---|
[117] | 151 | VARIABLES |
---|
[325] | 152 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256); |
---|
[297] | 153 | x(NComp) as fraction (Brief = "Liquid Molar Fraction"); |
---|
| 154 | y(NComp) as fraction (Brief = "Vapour Molar Fraction"); |
---|
| 155 | hl as enth_mol; |
---|
| 156 | hv as enth_mol; |
---|
| 157 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 158 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
| 159 | vm as volume_mol (Brief = "Molar Volume"); |
---|
| 160 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
| 161 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
| 162 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 163 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
[117] | 164 | |
---|
| 165 | EQUATIONS |
---|
| 166 | "Flash Calculation" |
---|
| 167 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
[147] | 168 | |
---|
[117] | 169 | "Overall Enthalpy" |
---|
| 170 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + |
---|
| 171 | Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[123] | 172 | |
---|
| 173 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 174 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[147] | 175 | |
---|
| 176 | "Average Molecular Weight" |
---|
| 177 | Mw = sum(M*Outlet.z); |
---|
| 178 | |
---|
[297] | 179 | switch rhoModel |
---|
| 180 | case "volume": |
---|
| 181 | "Molar Density" |
---|
| 182 | rhom * vm = 1; |
---|
| 183 | |
---|
| 184 | case "correlation": |
---|
[147] | 185 | "Mass Density" |
---|
[297] | 186 | rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1; |
---|
| 187 | end |
---|
| 188 | |
---|
| 189 | "Mass or Molar Density" |
---|
| 190 | rhom * Mw = rho; |
---|
[147] | 191 | |
---|
| 192 | "Flow Mass" |
---|
| 193 | Fw = Mw*Outlet.F; |
---|
| 194 | |
---|
| 195 | "Molar Volume" |
---|
| 196 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
| 197 | |
---|
| 198 | "Volumetric Flow" |
---|
| 199 | Fvol = Outlet.F*vm ; |
---|
| 200 | |
---|
[297] | 201 | "Mass Fraction" |
---|
[147] | 202 | zmass = M*Outlet.z / Mw; |
---|
| 203 | |
---|
[117] | 204 | end |
---|
| 205 | |
---|
[311] | 206 | Model simple_source |
---|
| 207 | ATTRIBUTES |
---|
[321] | 208 | Pallete = true; |
---|
[311] | 209 | Icon = "icon/Source"; |
---|
| 210 | Brief = "Simple material stream source"; |
---|
| 211 | Info = " |
---|
| 212 | This model should be used for boundary streams. |
---|
| 213 | Usually these streams are known and come from another process |
---|
| 214 | units. |
---|
| 215 | |
---|
| 216 | The user should specify: |
---|
| 217 | * Total molar flow |
---|
| 218 | * Temperature |
---|
| 219 | * Pressure |
---|
| 220 | * Molar composition |
---|
| 221 | "; |
---|
| 222 | |
---|
| 223 | PARAMETERS |
---|
| 224 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 225 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 226 | |
---|
| 227 | VARIABLES |
---|
[325] | 228 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256); |
---|
[323] | 229 | x(NComp) as fraction (Brief = "Liquid Molar Fraction"); |
---|
| 230 | y(NComp) as fraction (Brief = "Vapour Molar Fraction"); |
---|
[311] | 231 | hl as enth_mol; |
---|
| 232 | hv as enth_mol; |
---|
[323] | 233 | |
---|
[311] | 234 | EQUATIONS |
---|
| 235 | "Flash Calculation" |
---|
| 236 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
| 237 | |
---|
| 238 | "Overall Enthalpy" |
---|
| 239 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + |
---|
| 240 | Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 241 | |
---|
| 242 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 243 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 244 | end |
---|
| 245 | |
---|
[117] | 246 | Model sink |
---|
| 247 | ATTRIBUTES |
---|
[321] | 248 | Pallete = true; |
---|
[310] | 249 | Icon = "icon/Sink"; |
---|
[290] | 250 | Brief = "Material stream sink"; |
---|
| 251 | Info = " |
---|
| 252 | This model should be used for boundary streams when additional |
---|
| 253 | information about the stream is desired. |
---|
[117] | 254 | |
---|
[290] | 255 | Some of the additional informations calculated by this models are: |
---|
| 256 | * Mass density |
---|
| 257 | * Mass flow |
---|
| 258 | * Mass compostions |
---|
| 259 | * Specific volume |
---|
| 260 | * Vapour fraction |
---|
| 261 | * Volumetric flow |
---|
| 262 | * Liquid and Vapour compositions |
---|
| 263 | "; |
---|
| 264 | |
---|
[117] | 265 | PARAMETERS |
---|
[147] | 266 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 267 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
[297] | 268 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 269 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
[117] | 270 | |
---|
[147] | 271 | SET |
---|
| 272 | |
---|
| 273 | M = PP.MolecularWeight(); |
---|
| 274 | |
---|
[117] | 275 | VARIABLES |
---|
[325] | 276 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308); |
---|
| 277 | v as fraction (Brief = "Vapourization fraction"); |
---|
[297] | 278 | x(NComp) as fraction (Brief = "Liquid Molar Fraction"); |
---|
| 279 | y(NComp) as fraction (Brief = "Vapour Molar Fraction"); |
---|
| 280 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 281 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
| 282 | vm as volume_mol (Brief = "Molar Volume"); |
---|
| 283 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
| 284 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
| 285 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 286 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
[117] | 287 | |
---|
| 288 | EQUATIONS |
---|
| 289 | "Flash Calculation" |
---|
[123] | 290 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
[147] | 291 | |
---|
| 292 | "Average Molecular Weight" |
---|
| 293 | Mw = sum(M*Inlet.z); |
---|
| 294 | |
---|
[297] | 295 | switch rhoModel |
---|
| 296 | case "volume": |
---|
| 297 | "Molar Density" |
---|
| 298 | rhom * vm = 1; |
---|
| 299 | |
---|
| 300 | case "correlation": |
---|
[147] | 301 | "Mass Density" |
---|
[297] | 302 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
| 303 | end |
---|
| 304 | |
---|
| 305 | "Mass or Molar Density" |
---|
| 306 | rhom * Mw = rho; |
---|
[147] | 307 | |
---|
| 308 | "Flow Mass" |
---|
| 309 | Fw = Mw*Inlet.F; |
---|
| 310 | |
---|
| 311 | "Molar Volume" |
---|
| 312 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
| 313 | |
---|
| 314 | "Volumetric Flow" |
---|
| 315 | Fvol = Inlet.F*vm ; |
---|
| 316 | |
---|
| 317 | "Mass Fraction" |
---|
| 318 | zmass = M*Inlet.z / Mw; |
---|
| 319 | |
---|
[117] | 320 | end |
---|
[299] | 321 | |
---|
[311] | 322 | Model simple_sink |
---|
| 323 | ATTRIBUTES |
---|
[321] | 324 | Pallete = true; |
---|
[311] | 325 | Icon = "icon/Sink"; |
---|
| 326 | Brief = "Simple material stream sink"; |
---|
| 327 | Info = " |
---|
| 328 | This model should be used for boundary streams when no additional |
---|
| 329 | information about the stream is desired. |
---|
| 330 | "; |
---|
| 331 | |
---|
| 332 | VARIABLES |
---|
[325] | 333 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308); |
---|
[311] | 334 | end |
---|
| 335 | |
---|
[310] | 336 | Model energy_stream |
---|
| 337 | ATTRIBUTES |
---|
| 338 | Pallete = false; |
---|
| 339 | Brief = "General Energy Stream"; |
---|
| 340 | Info = |
---|
| 341 | "This is the basic building block for the EML models. |
---|
| 342 | Every model should have input and output energy streams |
---|
| 343 | derived from this model."; |
---|
[299] | 344 | |
---|
[310] | 345 | VARIABLES |
---|
| 346 | Q as heat_rate(Brief="Energy rate"); |
---|
| 347 | end |
---|
| 348 | |
---|
[299] | 349 | Model energy_source |
---|
| 350 | ATTRIBUTES |
---|
[321] | 351 | Pallete = true; |
---|
[310] | 352 | Icon = "icon/energy_source"; |
---|
[299] | 353 | Brief = "Enegry stream source"; |
---|
| 354 | |
---|
| 355 | VARIABLES |
---|
[325] | 356 | out OutletQ as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.5349); |
---|
[299] | 357 | end |
---|