[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 551 2008-07-08 20:51:28Z 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 |
---|
[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 | h as enth_mol (Brief = "Stream Enthalpy"); |
---|
| 41 | v as fraction (Brief = "Vapourization fraction"); |
---|
[523] | 42 | z(NComp) as fraction (Brief = "Stream Molar 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 |
---|
[551] | 103 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 104 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
[346] | 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}"); |
---|
[551] | 159 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 160 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
[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"); |
---|
[501] | 173 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
[117] | 174 | |
---|
| 175 | EQUATIONS |
---|
| 176 | "Flash Calculation" |
---|
| 177 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
[147] | 178 | |
---|
[117] | 179 | "Overall Enthalpy" |
---|
[346] | 180 | Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv; |
---|
| 181 | |
---|
| 182 | "Liquid Enthalpy" |
---|
[123] | 183 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
[346] | 184 | |
---|
| 185 | "Vapour Enthalpy" |
---|
[123] | 186 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[346] | 187 | |
---|
| 188 | "Overall Entropy" |
---|
| 189 | s = (1-Outlet.v)*sl + Outlet.v*sv; |
---|
| 190 | |
---|
| 191 | "Liquid Entropy" |
---|
| 192 | sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); |
---|
[147] | 193 | |
---|
[346] | 194 | "Vapour Entropy" |
---|
| 195 | sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); |
---|
| 196 | |
---|
[147] | 197 | "Average Molecular Weight" |
---|
| 198 | Mw = sum(M*Outlet.z); |
---|
| 199 | |
---|
[297] | 200 | switch rhoModel |
---|
| 201 | case "volume": |
---|
| 202 | "Molar Density" |
---|
| 203 | rhom * vm = 1; |
---|
| 204 | |
---|
| 205 | case "correlation": |
---|
[147] | 206 | "Mass Density" |
---|
[297] | 207 | rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1; |
---|
| 208 | end |
---|
| 209 | |
---|
| 210 | "Mass or Molar Density" |
---|
| 211 | rhom * Mw = rho; |
---|
[147] | 212 | |
---|
| 213 | "Flow Mass" |
---|
| 214 | Fw = Mw*Outlet.F; |
---|
| 215 | |
---|
| 216 | "Molar Volume" |
---|
| 217 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
| 218 | |
---|
| 219 | "Volumetric Flow" |
---|
| 220 | Fvol = Outlet.F*vm ; |
---|
| 221 | |
---|
[297] | 222 | "Mass Fraction" |
---|
[501] | 223 | zmass = M*Outlet.z / Mw; |
---|
[147] | 224 | |
---|
[501] | 225 | "Temperature in °C" |
---|
| 226 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
| 227 | |
---|
[117] | 228 | end |
---|
| 229 | |
---|
[311] | 230 | Model simple_source |
---|
| 231 | ATTRIBUTES |
---|
[321] | 232 | Pallete = true; |
---|
[311] | 233 | Icon = "icon/Source"; |
---|
| 234 | Brief = "Simple material stream source"; |
---|
| 235 | Info = " |
---|
| 236 | This model should be used for boundary streams. |
---|
| 237 | Usually these streams are known and come from another process |
---|
| 238 | units. |
---|
| 239 | |
---|
| 240 | The user should specify: |
---|
| 241 | * Total molar flow |
---|
| 242 | * Temperature |
---|
| 243 | * Pressure |
---|
| 244 | * Molar composition |
---|
| 245 | "; |
---|
| 246 | |
---|
| 247 | PARAMETERS |
---|
| 248 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 249 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 250 | |
---|
| 251 | VARIABLES |
---|
[352] | 252 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}"); |
---|
[551] | 253 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 254 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
[346] | 255 | hl as enth_mol (Brief = "Liquid Enthalpy"); |
---|
| 256 | hv as enth_mol (Brief = "Vapour Enthalpy"); |
---|
| 257 | s as entr_mol (Brief = "Stream Entropy"); |
---|
| 258 | sl as entr_mol (Brief = "Liquid Entropy"); |
---|
| 259 | sv as entr_mol (Brief = "Vapour Entropy"); |
---|
[323] | 260 | |
---|
[311] | 261 | EQUATIONS |
---|
| 262 | "Flash Calculation" |
---|
| 263 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
| 264 | |
---|
| 265 | "Overall Enthalpy" |
---|
[346] | 266 | Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv; |
---|
[311] | 267 | |
---|
[346] | 268 | "Liquid Enthalpy" |
---|
[311] | 269 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
[346] | 270 | |
---|
| 271 | "Vapour Enthalpy" |
---|
[311] | 272 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[346] | 273 | |
---|
| 274 | "Overall Entropy" |
---|
| 275 | s = (1-Outlet.v)*sl + Outlet.v*sv; |
---|
| 276 | |
---|
| 277 | "Liquid Entropy" |
---|
| 278 | sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); |
---|
| 279 | |
---|
| 280 | "Vapour Entropy" |
---|
| 281 | sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); |
---|
[311] | 282 | end |
---|
| 283 | |
---|
[117] | 284 | Model sink |
---|
| 285 | ATTRIBUTES |
---|
[321] | 286 | Pallete = true; |
---|
[310] | 287 | Icon = "icon/Sink"; |
---|
[290] | 288 | Brief = "Material stream sink"; |
---|
| 289 | Info = " |
---|
| 290 | This model should be used for boundary streams when additional |
---|
| 291 | information about the stream is desired. |
---|
[117] | 292 | |
---|
[290] | 293 | Some of the additional informations calculated by this models are: |
---|
| 294 | * Mass density |
---|
| 295 | * Mass flow |
---|
| 296 | * Mass compostions |
---|
| 297 | * Specific volume |
---|
| 298 | * Vapour fraction |
---|
| 299 | * Volumetric flow |
---|
| 300 | * Liquid and Vapour compositions |
---|
| 301 | "; |
---|
| 302 | |
---|
[117] | 303 | PARAMETERS |
---|
[147] | 304 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 305 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
[297] | 306 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 307 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
[117] | 308 | |
---|
[147] | 309 | SET |
---|
| 310 | |
---|
| 311 | M = PP.MolecularWeight(); |
---|
| 312 | |
---|
[117] | 313 | VARIABLES |
---|
[352] | 314 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); |
---|
[325] | 315 | v as fraction (Brief = "Vapourization fraction"); |
---|
[551] | 316 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 317 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
[297] | 318 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 319 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
| 320 | vm as volume_mol (Brief = "Molar Volume"); |
---|
| 321 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
| 322 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
| 323 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 324 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
[346] | 325 | s as entr_mol (Brief = "Stream Entropy"); |
---|
[501] | 326 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
[346] | 327 | |
---|
[117] | 328 | EQUATIONS |
---|
| 329 | "Flash Calculation" |
---|
[123] | 330 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
[147] | 331 | |
---|
| 332 | "Average Molecular Weight" |
---|
| 333 | Mw = sum(M*Inlet.z); |
---|
| 334 | |
---|
[297] | 335 | switch rhoModel |
---|
| 336 | case "volume": |
---|
| 337 | "Molar Density" |
---|
| 338 | rhom * vm = 1; |
---|
| 339 | |
---|
| 340 | case "correlation": |
---|
[147] | 341 | "Mass Density" |
---|
[297] | 342 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
| 343 | end |
---|
| 344 | |
---|
| 345 | "Mass or Molar Density" |
---|
| 346 | rhom * Mw = rho; |
---|
[147] | 347 | |
---|
| 348 | "Flow Mass" |
---|
| 349 | Fw = Mw*Inlet.F; |
---|
| 350 | |
---|
| 351 | "Molar Volume" |
---|
| 352 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
| 353 | |
---|
| 354 | "Volumetric Flow" |
---|
| 355 | Fvol = Inlet.F*vm ; |
---|
| 356 | |
---|
| 357 | "Mass Fraction" |
---|
| 358 | zmass = M*Inlet.z / Mw; |
---|
| 359 | |
---|
[346] | 360 | "Overall Entropy" |
---|
| 361 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + |
---|
| 362 | v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
[501] | 363 | |
---|
| 364 | "Temperature in °C" |
---|
| 365 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
| 366 | |
---|
[117] | 367 | end |
---|
[299] | 368 | |
---|
[311] | 369 | Model simple_sink |
---|
| 370 | ATTRIBUTES |
---|
[321] | 371 | Pallete = true; |
---|
[311] | 372 | Icon = "icon/Sink"; |
---|
| 373 | Brief = "Simple material stream sink"; |
---|
| 374 | Info = " |
---|
| 375 | This model should be used for boundary streams when no additional |
---|
| 376 | information about the stream is desired. |
---|
| 377 | "; |
---|
| 378 | |
---|
| 379 | VARIABLES |
---|
[352] | 380 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); |
---|
[311] | 381 | end |
---|
| 382 | |
---|
[310] | 383 | Model energy_stream |
---|
| 384 | ATTRIBUTES |
---|
| 385 | Pallete = false; |
---|
| 386 | Brief = "General Energy Stream"; |
---|
| 387 | Info = |
---|
| 388 | "This is the basic building block for the EML models. |
---|
| 389 | Every model should have input and output energy streams |
---|
| 390 | derived from this model."; |
---|
[299] | 391 | |
---|
[310] | 392 | VARIABLES |
---|
| 393 | Q as heat_rate(Brief="Energy rate"); |
---|
| 394 | end |
---|
| 395 | |
---|
[299] | 396 | Model energy_source |
---|
| 397 | ATTRIBUTES |
---|
[321] | 398 | Pallete = true; |
---|
[310] | 399 | Icon = "icon/energy_source"; |
---|
[299] | 400 | Brief = "Enegry stream source"; |
---|
| 401 | |
---|
| 402 | VARIABLES |
---|
[551] | 403 | out OutletQ as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
[299] | 404 | end |
---|