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