[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 757 2009-06-03 20:07:22Z 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 | |
---|
[125] | 106 | EQUATIONS |
---|
| 107 | "Flash Calculation" |
---|
| 108 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
[346] | 109 | |
---|
[125] | 110 | "Enthalpy" |
---|
[584] | 111 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + v*PP.VapourEnthalpy(T, P, y); |
---|
[346] | 112 | |
---|
[125] | 113 | end |
---|
| 114 | |
---|
[562] | 115 | Model streamPHS as streamPH |
---|
| 116 | ATTRIBUTES |
---|
| 117 | Brief = "Stream with built-in flash calculation"; |
---|
| 118 | Info = " |
---|
| 119 | This model should be used when the vaporization fraction |
---|
| 120 | is unknown. |
---|
| 121 | |
---|
| 122 | The built-in flash calculation will determine the stream |
---|
| 123 | state as a function of the overall composition '''z''', the |
---|
| 124 | pressure '''P''' and the enthalpy '''h'''. |
---|
| 125 | |
---|
[578] | 126 | Additionally, the liquid composition '''x''', the vapor |
---|
| 127 | composition '''y''' and the stream entropy are calculated. |
---|
[562] | 128 | "; |
---|
| 129 | Pallete = false; |
---|
| 130 | |
---|
| 131 | PARAMETERS |
---|
| 132 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
| 133 | |
---|
| 134 | VARIABLES |
---|
| 135 | s as entr_mol (Brief = "Stream Entropy"); |
---|
| 136 | |
---|
| 137 | EQUATIONS |
---|
| 138 | |
---|
| 139 | "Entropy" |
---|
| 140 | s = (1-v)*PP.LiquidEntropy(T, P, x) + v*PP.VapourEntropy(T, P, y); |
---|
| 141 | |
---|
| 142 | end |
---|
| 143 | |
---|
[117] | 144 | Model sink |
---|
| 145 | ATTRIBUTES |
---|
[321] | 146 | Pallete = true; |
---|
[310] | 147 | Icon = "icon/Sink"; |
---|
[290] | 148 | Brief = "Material stream sink"; |
---|
| 149 | Info = " |
---|
| 150 | This model should be used for boundary streams when additional |
---|
| 151 | information about the stream is desired. |
---|
[117] | 152 | |
---|
[290] | 153 | Some of the additional informations calculated by this models are: |
---|
| 154 | * Mass density |
---|
| 155 | * Mass flow |
---|
| 156 | * Mass compostions |
---|
| 157 | * Specific volume |
---|
| 158 | * Vapour fraction |
---|
| 159 | * Volumetric flow |
---|
| 160 | * Liquid and Vapour compositions |
---|
| 161 | "; |
---|
| 162 | |
---|
[117] | 163 | PARAMETERS |
---|
[147] | 164 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 165 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
[297] | 166 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
[117] | 167 | |
---|
[147] | 168 | SET |
---|
| 169 | |
---|
| 170 | M = PP.MolecularWeight(); |
---|
| 171 | |
---|
[117] | 172 | VARIABLES |
---|
[584] | 173 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Protected=true,Symbol="_{in}"); |
---|
| 174 | v as fraction (Brief = "Vapourization fraction",Hidden=true); |
---|
[551] | 175 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 176 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
[297] | 177 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 178 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
| 179 | vm as volume_mol (Brief = "Molar Volume"); |
---|
| 180 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
| 181 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
| 182 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 183 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
[501] | 184 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
[346] | 185 | |
---|
[117] | 186 | EQUATIONS |
---|
| 187 | "Flash Calculation" |
---|
[123] | 188 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
[147] | 189 | |
---|
| 190 | "Average Molecular Weight" |
---|
| 191 | Mw = sum(M*Inlet.z); |
---|
| 192 | |
---|
[297] | 193 | "Molar Density" |
---|
| 194 | rhom * vm = 1; |
---|
| 195 | |
---|
| 196 | "Mass or Molar Density" |
---|
| 197 | rhom * Mw = rho; |
---|
[147] | 198 | |
---|
| 199 | "Flow Mass" |
---|
| 200 | Fw = Mw*Inlet.F; |
---|
| 201 | |
---|
| 202 | "Molar Volume" |
---|
| 203 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
| 204 | |
---|
| 205 | "Volumetric Flow" |
---|
| 206 | Fvol = Inlet.F*vm ; |
---|
| 207 | |
---|
| 208 | "Mass Fraction" |
---|
| 209 | zmass = M*Inlet.z / Mw; |
---|
| 210 | |
---|
[501] | 211 | "Temperature in °C" |
---|
| 212 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
| 213 | |
---|
[117] | 214 | end |
---|
[299] | 215 | |
---|
[757] | 216 | Model sink2 |
---|
| 217 | ATTRIBUTES |
---|
| 218 | Pallete = true; |
---|
| 219 | Icon = "icon/Sink2"; |
---|
| 220 | Brief = "Material stream sink"; |
---|
| 221 | Info = " |
---|
| 222 | This model should be used for boundary streams when additional |
---|
| 223 | information about the stream is desired. |
---|
| 224 | |
---|
| 225 | Some of the additional informations calculated by this models are: |
---|
| 226 | * Mass density |
---|
| 227 | * Mass flow |
---|
| 228 | * Mass compostions |
---|
| 229 | * Specific volume |
---|
| 230 | * Vapour fraction |
---|
| 231 | * Volumetric flow |
---|
| 232 | * Liquid and Vapour compositions |
---|
| 233 | "; |
---|
| 234 | |
---|
| 235 | PARAMETERS |
---|
| 236 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 237 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 238 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 239 | |
---|
| 240 | SET |
---|
| 241 | |
---|
| 242 | M = PP.MolecularWeight(); |
---|
| 243 | |
---|
| 244 | VARIABLES |
---|
| 245 | in Inlet as stream (Brief = "Inlet Stream", PosX=1, PosY=0.5308, Protected=true,Symbol="_{in}"); |
---|
| 246 | v as fraction (Brief = "Vapourization fraction",Hidden=true); |
---|
| 247 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 248 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 249 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
| 250 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
| 251 | vm as volume_mol (Brief = "Molar Volume"); |
---|
| 252 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
| 253 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
| 254 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 255 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
| 256 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
| 257 | |
---|
| 258 | EQUATIONS |
---|
| 259 | "Flash Calculation" |
---|
| 260 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
| 261 | |
---|
| 262 | "Average Molecular Weight" |
---|
| 263 | Mw = sum(M*Inlet.z); |
---|
| 264 | |
---|
| 265 | "Molar Density" |
---|
| 266 | rhom * vm = 1; |
---|
| 267 | |
---|
| 268 | "Mass or Molar Density" |
---|
| 269 | rhom * Mw = rho; |
---|
| 270 | |
---|
| 271 | "Flow Mass" |
---|
| 272 | Fw = Mw*Inlet.F; |
---|
| 273 | |
---|
| 274 | "Molar Volume" |
---|
| 275 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
| 276 | |
---|
| 277 | "Volumetric Flow" |
---|
| 278 | Fvol = Inlet.F*vm ; |
---|
| 279 | |
---|
| 280 | "Mass Fraction" |
---|
| 281 | zmass = M*Inlet.z / Mw; |
---|
| 282 | |
---|
| 283 | "Temperature in °C" |
---|
| 284 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
| 285 | |
---|
| 286 | end |
---|
| 287 | |
---|
[311] | 288 | Model simple_sink |
---|
| 289 | ATTRIBUTES |
---|
[321] | 290 | Pallete = true; |
---|
[311] | 291 | Icon = "icon/Sink"; |
---|
| 292 | Brief = "Simple material stream sink"; |
---|
| 293 | Info = " |
---|
| 294 | This model should be used for boundary streams when no additional |
---|
| 295 | information about the stream is desired. |
---|
| 296 | "; |
---|
| 297 | |
---|
| 298 | VARIABLES |
---|
[584] | 299 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Protected=true,Symbol="_{in}"); |
---|
[311] | 300 | end |
---|
| 301 | |
---|
[757] | 302 | Model simple_sink2 |
---|
| 303 | ATTRIBUTES |
---|
| 304 | Pallete = true; |
---|
| 305 | Icon = "icon/Sink2"; |
---|
| 306 | Brief = "Simple material stream sink"; |
---|
| 307 | Info = " |
---|
| 308 | This model should be used for boundary streams when no additional |
---|
| 309 | information about the stream is desired. |
---|
| 310 | "; |
---|
| 311 | |
---|
| 312 | VARIABLES |
---|
| 313 | in Inlet as stream (Brief = "Inlet Stream", PosX=1, PosY=0.5308, Protected=true,Symbol="_{in}"); |
---|
| 314 | |
---|
| 315 | end |
---|
| 316 | |
---|
[299] | 317 | Model energy_source |
---|
| 318 | ATTRIBUTES |
---|
[321] | 319 | Pallete = true; |
---|
[310] | 320 | Icon = "icon/energy_source"; |
---|
[562] | 321 | Brief = "Energy stream source"; |
---|
[299] | 322 | |
---|
| 323 | VARIABLES |
---|
[739] | 324 | out OutletQ as power(Brief = "Outlet energy stream", PosX=1, PosY=0.40, Symbol="_{out}"); |
---|
[594] | 325 | |
---|
[299] | 326 | end |
---|
[569] | 327 | |
---|
[757] | 328 | Model energy_source2 |
---|
| 329 | ATTRIBUTES |
---|
| 330 | Pallete = true; |
---|
| 331 | Icon = "icon/energy_source2"; |
---|
| 332 | Brief = "Energy stream source"; |
---|
| 333 | |
---|
| 334 | VARIABLES |
---|
| 335 | out OutletQ as power(Brief = "Outlet energy stream", PosX=0, PosY=0.40, Symbol="_{out}"); |
---|
| 336 | |
---|
| 337 | end |
---|
| 338 | |
---|
[594] | 339 | Model work_source |
---|
| 340 | ATTRIBUTES |
---|
| 341 | Pallete = true; |
---|
| 342 | Icon = "icon/work_source"; |
---|
| 343 | Brief = "Work stream source"; |
---|
| 344 | |
---|
| 345 | VARIABLES |
---|
| 346 | out Work as power(Brief = "Outlet work stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
| 347 | |
---|
| 348 | end |
---|
| 349 | |
---|
[569] | 350 | Model info_stream |
---|
| 351 | ATTRIBUTES |
---|
| 352 | Pallete = true; |
---|
| 353 | Icon = "icon/Info_Stream"; |
---|
| 354 | Brief = "Material stream information"; |
---|
| 355 | Info = " |
---|
| 356 | This model should be used for middle streams when additional |
---|
| 357 | information about the stream is desired. |
---|
| 358 | |
---|
| 359 | Some of the additional informations calculated by this models are: |
---|
| 360 | * Mass density |
---|
| 361 | * Mass flow |
---|
| 362 | * Mass compostions |
---|
| 363 | * Specific volume |
---|
| 364 | * Vapour fraction |
---|
| 365 | * Volumetric flow |
---|
| 366 | * Liquid and Vapour compositions |
---|
| 367 | * Viscosity |
---|
| 368 | * Heat Capacity |
---|
| 369 | * Thermal Conductivity |
---|
| 370 | * Temperature in Celsius Degrees |
---|
| 371 | "; |
---|
| 372 | |
---|
| 373 | PARAMETERS |
---|
| 374 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 375 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 376 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 377 | |
---|
| 378 | SET |
---|
| 379 | |
---|
| 380 | M = PP.MolecularWeight(); |
---|
| 381 | |
---|
| 382 | VARIABLES |
---|
| 383 | |
---|
[739] | 384 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.50, Protected=true , Symbol="_{in}"); |
---|
| 385 | out Outlet as stream (Brief = "Outlet Stream", PosX=1, PosY=0.50, Protected=true , Symbol="_{out}"); |
---|
[569] | 386 | |
---|
| 387 | v as fraction (Brief = "Vapourization fraction",Hidden=true); |
---|
| 388 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 389 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 390 | |
---|
[739] | 391 | F(NComp) as flow_mol (Brief = "Component Molar Flow",Protected=true); |
---|
| 392 | FwTotal as flow_mass (Brief = "Total Mass Flow",Protected=true); |
---|
| 393 | Fw(NComp) as flow_mass (Brief = "Component Mass Flow",Protected=true); |
---|
| 394 | FvolTotal as flow_vol (Brief = "Total Volumetric Flow",Protected=true); |
---|
[569] | 395 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200,Protected=true); |
---|
| 396 | |
---|
| 397 | Mu as viscosity (Brief="Stream Viscosity",Lower=0.0001, Symbol = "\mu",Protected=true); |
---|
| 398 | Cp as cp_mol (Brief="Stream Molar Heat Capacity", Upper=1e10,Protected=true); |
---|
| 399 | K as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500,Protected=true); |
---|
| 400 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
| 401 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
| 402 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
| 403 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
| 404 | s as entr_mol (Brief = "Stream Entropy",Protected=true); |
---|
| 405 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
| 406 | |
---|
| 407 | EQUATIONS |
---|
| 408 | |
---|
| 409 | "Flash Calculation" |
---|
| 410 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
| 411 | |
---|
| 412 | "Average Molecular Weight" |
---|
| 413 | Mw = sum(M*Inlet.z); |
---|
| 414 | |
---|
| 415 | "Mass Density" |
---|
| 416 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
| 417 | |
---|
| 418 | "Mass or Molar Density" |
---|
| 419 | rhom * Mw = rho; |
---|
| 420 | |
---|
[739] | 421 | "Total Flow Mass" |
---|
| 422 | FwTotal = Mw*Inlet.F; |
---|
[569] | 423 | |
---|
[739] | 424 | "Component Flow Mass" |
---|
| 425 | Fw = FwTotal*zmass; |
---|
| 426 | |
---|
[569] | 427 | "Molar Volume" |
---|
| 428 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
| 429 | |
---|
[739] | 430 | "Total Volumetric Flow" |
---|
| 431 | FvolTotal = Inlet.F*vm ; |
---|
[569] | 432 | |
---|
| 433 | "Mass Fraction" |
---|
| 434 | zmass = M*Inlet.z / Mw; |
---|
| 435 | |
---|
| 436 | "Stream Heat Capacity" |
---|
| 437 | Cp = (1-v)*PP.LiquidCp(Inlet.T, Inlet.P, x) + v*PP.VapourCp(Inlet.T,Inlet.P,y); |
---|
| 438 | |
---|
| 439 | "Stream Viscosity" |
---|
| 440 | Mu = (1-v)*PP.LiquidViscosity(Inlet.T, Inlet.P, x) + v*PP.VapourViscosity(Inlet.T,Inlet.P,y); |
---|
| 441 | |
---|
| 442 | "Stream ThermalConductivity" |
---|
| 443 | K = (1-v)*PP.LiquidThermalConductivity(Inlet.T, Inlet.P, x) + v*PP.VapourThermalConductivity(Inlet.T,Inlet.P,y); |
---|
| 444 | |
---|
| 445 | "Stream Overall Entropy" |
---|
| 446 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
| 447 | |
---|
| 448 | "Temperature in °C" |
---|
| 449 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
| 450 | |
---|
| 451 | "Outlet Flow" |
---|
| 452 | Outlet.F = Inlet.F; |
---|
| 453 | |
---|
[739] | 454 | "Component Molar Flow" |
---|
| 455 | F = Inlet.F*Inlet.z; |
---|
| 456 | |
---|
[569] | 457 | "Outlet Temperature" |
---|
| 458 | Outlet.T = Inlet.T; |
---|
| 459 | |
---|
| 460 | "Outlet Pressure" |
---|
| 461 | Outlet.P = Inlet.P; |
---|
| 462 | |
---|
| 463 | "Outlet Vapour Fraction" |
---|
| 464 | Outlet.v = Inlet.v; |
---|
| 465 | |
---|
| 466 | "Outlet Enthalpy" |
---|
| 467 | Outlet.h = Inlet.h; |
---|
| 468 | |
---|
| 469 | "Outlet Composition" |
---|
| 470 | Outlet.z= Inlet.z; |
---|
| 471 | |
---|
| 472 | end |
---|
[571] | 473 | |
---|
[578] | 474 | Model source |
---|
[571] | 475 | |
---|
[576] | 476 | ATTRIBUTES |
---|
[571] | 477 | Pallete = true; |
---|
| 478 | Icon = "icon/Source"; |
---|
| 479 | Brief = "Material stream source"; |
---|
| 480 | Info = " |
---|
| 481 | This model should be used for boundary streams. |
---|
| 482 | Usually these streams are known and come from another process |
---|
| 483 | units. |
---|
| 484 | |
---|
| 485 | The user should specify: |
---|
| 486 | * Total molar (mass or volumetric) flow |
---|
| 487 | * Temperature |
---|
| 488 | * Pressure |
---|
[576] | 489 | * Molar or mass composition |
---|
[571] | 490 | |
---|
| 491 | No matter the specification set, the model will calculate some |
---|
| 492 | additional properties: |
---|
| 493 | * Mass density |
---|
| 494 | * Mass flow |
---|
| 495 | * Mass compostions |
---|
| 496 | * Specific volume |
---|
| 497 | * Vapour fraction |
---|
| 498 | * Volumetric flow |
---|
| 499 | * Liquid and Vapour compositions |
---|
| 500 | "; |
---|
| 501 | |
---|
[576] | 502 | PARAMETERS |
---|
| 503 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 504 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 505 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
[585] | 506 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
[577] | 507 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
[571] | 508 | |
---|
| 509 | |
---|
[576] | 510 | SET |
---|
| 511 | |
---|
[571] | 512 | M = PP.MolecularWeight(); |
---|
| 513 | |
---|
[576] | 514 | VARIABLES |
---|
| 515 | |
---|
[584] | 516 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
[576] | 517 | |
---|
| 518 | Composition(NComp) as fraction (Brief = "Stream Composition"); |
---|
[694] | 519 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
[576] | 520 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
| 521 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 522 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
| 523 | T as temperature (Brief = "Stream Temperature"); |
---|
| 524 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
| 525 | P as pressure (Brief = "Stream Pressure"); |
---|
| 526 | |
---|
[571] | 527 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 528 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 529 | |
---|
[576] | 530 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
| 531 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
| 532 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
| 533 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
| 534 | |
---|
| 535 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
| 536 | |
---|
[571] | 537 | EQUATIONS |
---|
| 538 | |
---|
[585] | 539 | switch CompositionBasis |
---|
[571] | 540 | |
---|
| 541 | case "Molar": |
---|
| 542 | "Stream Molar Composition" |
---|
| 543 | Outlet.z = Composition/sum(Composition); |
---|
| 544 | |
---|
| 545 | "Stream Mass Composition" |
---|
| 546 | zmass = M*Outlet.z / Mw; |
---|
| 547 | |
---|
| 548 | case "Mass": |
---|
| 549 | "Stream Mass Composition" |
---|
| 550 | zmass = Composition/sum(Composition); |
---|
| 551 | |
---|
| 552 | "Stream Molar Composition" |
---|
[575] | 553 | Outlet.z*sum(zmass/M) = zmass/M; |
---|
[571] | 554 | |
---|
| 555 | end |
---|
| 556 | |
---|
[577] | 557 | switch ValidPhases |
---|
[575] | 558 | |
---|
[577] | 559 | case "Liquid-Only": |
---|
| 560 | |
---|
| 561 | "Vapour Fraction" |
---|
| 562 | Outlet.v = 0; |
---|
| 563 | |
---|
| 564 | "Liquid Composition" |
---|
| 565 | x = Outlet.z; |
---|
| 566 | |
---|
| 567 | "Vapour Composition" |
---|
| 568 | y = Outlet.z; |
---|
| 569 | |
---|
| 570 | "Overall Enthalpy" |
---|
| 571 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 572 | |
---|
| 573 | "Molar Volume" |
---|
| 574 | vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); |
---|
| 575 | |
---|
| 576 | case "Vapour-Only": |
---|
| 577 | |
---|
| 578 | "Vapor Fraction" |
---|
| 579 | Outlet.v = 1; |
---|
| 580 | |
---|
| 581 | "Liquid Composition" |
---|
| 582 | x = Outlet.z; |
---|
| 583 | |
---|
| 584 | "Vapour Composition" |
---|
| 585 | y = Outlet.z; |
---|
| 586 | |
---|
| 587 | "Overall Enthalpy" |
---|
| 588 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 589 | |
---|
| 590 | "Molar Volume" |
---|
| 591 | vm = PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
| 592 | |
---|
| 593 | |
---|
| 594 | case "Vapour-Liquid": |
---|
| 595 | |
---|
[576] | 596 | "Flash Calculation" |
---|
[571] | 597 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
| 598 | |
---|
[576] | 599 | "Overall Enthalpy" |
---|
| 600 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
[571] | 601 | |
---|
[577] | 602 | "Molar Volume" |
---|
| 603 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
[571] | 604 | |
---|
[577] | 605 | end |
---|
| 606 | |
---|
[694] | 607 | "Sum of Composition" |
---|
| 608 | SumOfComposition = sum(Composition); |
---|
| 609 | |
---|
[576] | 610 | "Molar Density" |
---|
[577] | 611 | rhom * vm = 1; |
---|
| 612 | |
---|
| 613 | "Average Molecular Weight" |
---|
| 614 | Mw = sum(M*Outlet.z); |
---|
| 615 | |
---|
[576] | 616 | "Mass or Molar Density" |
---|
[571] | 617 | rhom * Mw = rho; |
---|
| 618 | |
---|
[576] | 619 | "Flow Mass" |
---|
[571] | 620 | Fw = Mw*Outlet.F; |
---|
| 621 | |
---|
[576] | 622 | "Volumetric Flow" |
---|
[571] | 623 | Fvol = Outlet.F*vm ; |
---|
| 624 | |
---|
[576] | 625 | "Temperature in °C" |
---|
[571] | 626 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
| 627 | |
---|
[576] | 628 | "Equate Flow" |
---|
| 629 | Outlet.F = F; |
---|
| 630 | |
---|
| 631 | "Equate Pressures" |
---|
| 632 | Outlet.P = P; |
---|
| 633 | |
---|
| 634 | "Equate Temperatures" |
---|
| 635 | Outlet.T = T; |
---|
| 636 | |
---|
[571] | 637 | end |
---|
[579] | 638 | |
---|
[757] | 639 | Model source2 |
---|
| 640 | |
---|
| 641 | ATTRIBUTES |
---|
| 642 | Pallete = true; |
---|
| 643 | Icon = "icon/Source2"; |
---|
| 644 | Brief = "Material stream source"; |
---|
| 645 | Info = " |
---|
| 646 | This model should be used for boundary streams. |
---|
| 647 | Usually these streams are known and come from another process |
---|
| 648 | units. |
---|
| 649 | |
---|
| 650 | The user should specify: |
---|
| 651 | * Total molar (mass or volumetric) flow |
---|
| 652 | * Temperature |
---|
| 653 | * Pressure |
---|
| 654 | * Molar or mass composition |
---|
| 655 | |
---|
| 656 | No matter the specification set, the model will calculate some |
---|
| 657 | additional properties: |
---|
| 658 | * Mass density |
---|
| 659 | * Mass flow |
---|
| 660 | * Mass compostions |
---|
| 661 | * Specific volume |
---|
| 662 | * Vapour fraction |
---|
| 663 | * Volumetric flow |
---|
| 664 | * Liquid and Vapour compositions |
---|
| 665 | "; |
---|
| 666 | |
---|
| 667 | PARAMETERS |
---|
| 668 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 669 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 670 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 671 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
| 672 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
| 673 | |
---|
| 674 | |
---|
| 675 | SET |
---|
| 676 | |
---|
| 677 | M = PP.MolecularWeight(); |
---|
| 678 | |
---|
| 679 | VARIABLES |
---|
| 680 | |
---|
| 681 | out Outlet as stream (Brief = "Outlet stream", PosX=0, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
| 682 | |
---|
| 683 | Composition(NComp) as fraction (Brief = "Stream Composition"); |
---|
| 684 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
| 685 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
| 686 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
| 687 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
| 688 | T as temperature (Brief = "Stream Temperature"); |
---|
| 689 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
| 690 | P as pressure (Brief = "Stream Pressure"); |
---|
| 691 | |
---|
| 692 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 693 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 694 | |
---|
| 695 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
| 696 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
| 697 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
| 698 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
| 699 | |
---|
| 700 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
| 701 | |
---|
| 702 | EQUATIONS |
---|
| 703 | |
---|
| 704 | switch CompositionBasis |
---|
| 705 | |
---|
| 706 | case "Molar": |
---|
| 707 | "Stream Molar Composition" |
---|
| 708 | Outlet.z = Composition/sum(Composition); |
---|
| 709 | |
---|
| 710 | "Stream Mass Composition" |
---|
| 711 | zmass = M*Outlet.z / Mw; |
---|
| 712 | |
---|
| 713 | case "Mass": |
---|
| 714 | "Stream Mass Composition" |
---|
| 715 | zmass = Composition/sum(Composition); |
---|
| 716 | |
---|
| 717 | "Stream Molar Composition" |
---|
| 718 | Outlet.z*sum(zmass/M) = zmass/M; |
---|
| 719 | |
---|
| 720 | end |
---|
| 721 | |
---|
| 722 | switch ValidPhases |
---|
| 723 | |
---|
| 724 | case "Liquid-Only": |
---|
| 725 | |
---|
| 726 | "Vapour Fraction" |
---|
| 727 | Outlet.v = 0; |
---|
| 728 | |
---|
| 729 | "Liquid Composition" |
---|
| 730 | x = Outlet.z; |
---|
| 731 | |
---|
| 732 | "Vapour Composition" |
---|
| 733 | y = Outlet.z; |
---|
| 734 | |
---|
| 735 | "Overall Enthalpy" |
---|
| 736 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 737 | |
---|
| 738 | "Molar Volume" |
---|
| 739 | vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); |
---|
| 740 | |
---|
| 741 | case "Vapour-Only": |
---|
| 742 | |
---|
| 743 | "Vapor Fraction" |
---|
| 744 | Outlet.v = 1; |
---|
| 745 | |
---|
| 746 | "Liquid Composition" |
---|
| 747 | x = Outlet.z; |
---|
| 748 | |
---|
| 749 | "Vapour Composition" |
---|
| 750 | y = Outlet.z; |
---|
| 751 | |
---|
| 752 | "Overall Enthalpy" |
---|
| 753 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 754 | |
---|
| 755 | "Molar Volume" |
---|
| 756 | vm = PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
| 757 | |
---|
| 758 | |
---|
| 759 | case "Vapour-Liquid": |
---|
| 760 | |
---|
| 761 | "Flash Calculation" |
---|
| 762 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
| 763 | |
---|
| 764 | "Overall Enthalpy" |
---|
| 765 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 766 | |
---|
| 767 | "Molar Volume" |
---|
| 768 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
| 769 | |
---|
| 770 | end |
---|
| 771 | |
---|
| 772 | "Sum of Composition" |
---|
| 773 | SumOfComposition = sum(Composition); |
---|
| 774 | |
---|
| 775 | "Molar Density" |
---|
| 776 | rhom * vm = 1; |
---|
| 777 | |
---|
| 778 | "Average Molecular Weight" |
---|
| 779 | Mw = sum(M*Outlet.z); |
---|
| 780 | |
---|
| 781 | "Mass or Molar Density" |
---|
| 782 | rhom * Mw = rho; |
---|
| 783 | |
---|
| 784 | "Flow Mass" |
---|
| 785 | Fw = Mw*Outlet.F; |
---|
| 786 | |
---|
| 787 | "Volumetric Flow" |
---|
| 788 | Fvol = Outlet.F*vm ; |
---|
| 789 | |
---|
| 790 | "Temperature in °C" |
---|
| 791 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
| 792 | |
---|
| 793 | "Equate Flow" |
---|
| 794 | Outlet.F = F; |
---|
| 795 | |
---|
| 796 | "Equate Pressures" |
---|
| 797 | Outlet.P = P; |
---|
| 798 | |
---|
| 799 | "Equate Temperatures" |
---|
| 800 | Outlet.T = T; |
---|
| 801 | |
---|
| 802 | end |
---|
| 803 | |
---|
[579] | 804 | Model simple_source |
---|
| 805 | |
---|
| 806 | ATTRIBUTES |
---|
| 807 | Pallete = true; |
---|
| 808 | Icon = "icon/Source"; |
---|
| 809 | Brief = "Simple Material stream source"; |
---|
| 810 | Info = " |
---|
| 811 | This model should be used for boundary streams. |
---|
| 812 | Usually these streams are known and come from another process |
---|
| 813 | units. |
---|
| 814 | |
---|
| 815 | The user should specify: |
---|
| 816 | * Total molar flow |
---|
| 817 | * Temperature |
---|
| 818 | * Pressure |
---|
| 819 | * Molar composition |
---|
| 820 | "; |
---|
| 821 | |
---|
| 822 | PARAMETERS |
---|
| 823 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 824 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 825 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 826 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
| 827 | |
---|
| 828 | |
---|
| 829 | SET |
---|
| 830 | |
---|
| 831 | M = PP.MolecularWeight(); |
---|
| 832 | |
---|
| 833 | VARIABLES |
---|
| 834 | |
---|
[584] | 835 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
[579] | 836 | |
---|
| 837 | MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); |
---|
[694] | 838 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
[579] | 839 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
| 840 | T as temperature (Brief = "Stream Temperature"); |
---|
| 841 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
| 842 | P as pressure (Brief = "Stream Pressure"); |
---|
| 843 | |
---|
| 844 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 845 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 846 | |
---|
| 847 | |
---|
| 848 | EQUATIONS |
---|
| 849 | |
---|
[694] | 850 | "Sum of Composition" |
---|
| 851 | SumOfComposition = sum(MolarComposition); |
---|
| 852 | |
---|
[579] | 853 | "Stream Molar Composition" |
---|
| 854 | Outlet.z = MolarComposition/sum(MolarComposition); |
---|
| 855 | |
---|
| 856 | |
---|
| 857 | switch ValidPhases |
---|
| 858 | |
---|
[757] | 859 | case "Liquid-Only": |
---|
| 860 | |
---|
| 861 | "Vapour Fraction" |
---|
| 862 | Outlet.v = 0; |
---|
| 863 | |
---|
| 864 | "Liquid Composition" |
---|
| 865 | x = Outlet.z; |
---|
| 866 | |
---|
| 867 | "Vapour Composition" |
---|
| 868 | y = Outlet.z; |
---|
| 869 | |
---|
| 870 | "Overall Enthalpy" |
---|
| 871 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 872 | |
---|
| 873 | |
---|
| 874 | case "Vapour-Only": |
---|
| 875 | |
---|
| 876 | "Vapor Fraction" |
---|
| 877 | Outlet.v = 1; |
---|
| 878 | |
---|
| 879 | "Liquid Composition" |
---|
| 880 | x = Outlet.z; |
---|
| 881 | |
---|
| 882 | "Vapour Composition" |
---|
| 883 | y = Outlet.z; |
---|
| 884 | |
---|
| 885 | "Overall Enthalpy" |
---|
| 886 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 887 | |
---|
| 888 | |
---|
| 889 | case "Vapour-Liquid": |
---|
| 890 | |
---|
| 891 | "Flash Calculation" |
---|
| 892 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
| 893 | |
---|
| 894 | "Overall Enthalpy" |
---|
| 895 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 896 | |
---|
| 897 | |
---|
| 898 | end |
---|
| 899 | |
---|
| 900 | "Temperature in °C" |
---|
| 901 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
| 902 | |
---|
| 903 | "Equate Flow" |
---|
| 904 | Outlet.F = F; |
---|
| 905 | |
---|
| 906 | "Equate Pressures" |
---|
| 907 | Outlet.P = P; |
---|
| 908 | |
---|
| 909 | "Equate Temperatures" |
---|
| 910 | Outlet.T = T; |
---|
| 911 | |
---|
| 912 | end |
---|
| 913 | |
---|
| 914 | Model simple_source2 |
---|
| 915 | |
---|
| 916 | ATTRIBUTES |
---|
| 917 | Pallete = true; |
---|
| 918 | Icon = "icon/Source2"; |
---|
| 919 | Brief = "Simple Material stream source"; |
---|
| 920 | Info = " |
---|
| 921 | This model should be used for boundary streams. |
---|
| 922 | Usually these streams are known and come from another process |
---|
| 923 | units. |
---|
| 924 | |
---|
| 925 | The user should specify: |
---|
| 926 | * Total molar flow |
---|
| 927 | * Temperature |
---|
| 928 | * Pressure |
---|
| 929 | * Molar composition |
---|
| 930 | "; |
---|
| 931 | |
---|
| 932 | PARAMETERS |
---|
| 933 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 934 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 935 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
| 936 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
| 937 | |
---|
| 938 | |
---|
| 939 | SET |
---|
| 940 | |
---|
| 941 | M = PP.MolecularWeight(); |
---|
| 942 | |
---|
| 943 | VARIABLES |
---|
| 944 | |
---|
| 945 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
| 946 | |
---|
| 947 | MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); |
---|
| 948 | SumOfComposition as positive (Brief = "Sum of Stream Composition",Protected=true); |
---|
| 949 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
| 950 | T as temperature (Brief = "Stream Temperature"); |
---|
| 951 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
| 952 | P as pressure (Brief = "Stream Pressure"); |
---|
| 953 | |
---|
| 954 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
| 955 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
| 956 | |
---|
| 957 | |
---|
| 958 | EQUATIONS |
---|
| 959 | |
---|
| 960 | "Sum of Composition" |
---|
| 961 | SumOfComposition = sum(MolarComposition); |
---|
| 962 | |
---|
| 963 | "Stream Molar Composition" |
---|
| 964 | Outlet.z = MolarComposition/sum(MolarComposition); |
---|
| 965 | |
---|
| 966 | |
---|
| 967 | switch ValidPhases |
---|
| 968 | |
---|
[579] | 969 | case "Liquid-Only": |
---|
| 970 | |
---|
| 971 | "Vapour Fraction" |
---|
| 972 | Outlet.v = 0; |
---|
| 973 | |
---|
| 974 | "Liquid Composition" |
---|
| 975 | x = Outlet.z; |
---|
| 976 | |
---|
| 977 | "Vapour Composition" |
---|
| 978 | y = Outlet.z; |
---|
| 979 | |
---|
| 980 | "Overall Enthalpy" |
---|
| 981 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
| 982 | |
---|
| 983 | |
---|
| 984 | case "Vapour-Only": |
---|
| 985 | |
---|
| 986 | "Vapor Fraction" |
---|
| 987 | Outlet.v = 1; |
---|
| 988 | |
---|
| 989 | "Liquid Composition" |
---|
| 990 | x = Outlet.z; |
---|
| 991 | |
---|
| 992 | "Vapour Composition" |
---|
| 993 | y = Outlet.z; |
---|
| 994 | |
---|
| 995 | "Overall Enthalpy" |
---|
| 996 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 997 | |
---|
| 998 | |
---|
| 999 | case "Vapour-Liquid": |
---|
| 1000 | |
---|
| 1001 | "Flash Calculation" |
---|
| 1002 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
| 1003 | |
---|
| 1004 | "Overall Enthalpy" |
---|
| 1005 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
| 1006 | |
---|
| 1007 | |
---|
| 1008 | end |
---|
| 1009 | |
---|
| 1010 | "Temperature in °C" |
---|
| 1011 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
| 1012 | |
---|
| 1013 | "Equate Flow" |
---|
| 1014 | Outlet.F = F; |
---|
| 1015 | |
---|
| 1016 | "Equate Pressures" |
---|
| 1017 | Outlet.P = P; |
---|
| 1018 | |
---|
| 1019 | "Equate Temperatures" |
---|
| 1020 | Outlet.T = T; |
---|
| 1021 | |
---|
| 1022 | end |
---|
[641] | 1023 | |
---|
| 1024 | Model sourceNoFlow |
---|
| 1025 | |
---|
| 1026 | ATTRIBUTES |
---|
| 1027 | Pallete = true; |
---|
| 1028 | Icon = "icon/SourceNoFlow"; |
---|
| 1029 | Brief = "Simple Material stream source with no flow."; |
---|
| 1030 | Info = " |
---|
| 1031 | This model should be used for boundary streams. |
---|
| 1032 | Usually these streams are known and come from another process |
---|
| 1033 | units."; |
---|
| 1034 | |
---|
| 1035 | PARAMETERS |
---|
| 1036 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
| 1037 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
| 1038 | |
---|
| 1039 | VARIABLES |
---|
| 1040 | |
---|
| 1041 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
| 1042 | |
---|
| 1043 | EQUATIONS |
---|
| 1044 | |
---|
| 1045 | "Stream Molar Composition" |
---|
| 1046 | Outlet.z = 1/NComp; |
---|
| 1047 | |
---|
| 1048 | "Stream Molar Enthalpy" |
---|
| 1049 | Outlet.h = 0 * 'J/mol'; |
---|
| 1050 | |
---|
| 1051 | "Stream Temperature" |
---|
| 1052 | Outlet.T = 300 * 'K'; |
---|
| 1053 | |
---|
| 1054 | "Stream Molar Flow" |
---|
| 1055 | Outlet.F = 0 * 'kmol/h'; |
---|
| 1056 | |
---|
| 1057 | "Stream Pressure" |
---|
| 1058 | Outlet.P = 1 * 'atm'; |
---|
| 1059 | |
---|
| 1060 | "Stream Vapour Fraction" |
---|
| 1061 | Outlet.v = 0; |
---|
| 1062 | |
---|
| 1063 | end |
---|
[672] | 1064 | |
---|
| 1065 | Model sinkNoFlow |
---|
| 1066 | ATTRIBUTES |
---|
| 1067 | Pallete = true; |
---|
[683] | 1068 | Icon = "icon/SinkNoFlow"; |
---|
[672] | 1069 | Brief = "Simple material stream sink"; |
---|
| 1070 | Info = " |
---|
| 1071 | This model should be used for seal an outlet material stream port. |
---|
| 1072 | "; |
---|
| 1073 | |
---|
| 1074 | VARIABLES |
---|
| 1075 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Protected=true,Symbol="_{in}"); |
---|
| 1076 | |
---|
| 1077 | EQUATIONS |
---|
| 1078 | "Stream Molar Flow" |
---|
| 1079 | Inlet.F = 0 * 'kmol/h'; |
---|
| 1080 | |
---|
| 1081 | end |
---|