#*------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. * * This LIBRARY is free software; you can distribute it and/or modify * it under the therms of the ALSOC FREE LICENSE as available at * http://www.enq.ufrgs.br/alsoc. * * EMSO Copyright (C) 2004 - 2007 ALSOC, original code * from http://www.rps.eng.br Copyright (C) 2002-2004. * All rights reserved. * * EMSO is distributed under the therms of the ALSOC LICENSE as * available at http://www.enq.ufrgs.br/alsoc. * *-------------------------------------------------------------------- * Model of basic streams *---------------------------------------------------------------------- * Author: Paula B. Staudt and Rafael de P. Soares * $Id: streams.mso 352 2007-08-30 05:39:11Z arge $ *---------------------------------------------------------------------*# using "types"; Model stream ATTRIBUTES Pallete = false; Brief = "General Material Stream"; Info = "This is the basic building block for the EML models. Every model should have input and output streams derived from this model."; PARAMETERS outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); VARIABLES F as flow_mol (Brief = "Stream Molar Flow Rate"); T as temperature (Brief = "Stream Temperature"); P as pressure (Brief = "Stream Pressure"); z(NComp) as fraction (Brief = "Stream Molar Fraction"); h as enth_mol (Brief = "Stream Enthalpy"); v as fraction (Brief = "Vapourization fraction"); end Model liquid_stream as stream ATTRIBUTES Pallete = false; Brief = "Liquid Material Stream"; Info = "Model for liquid material streams. This model should be used only when the phase of the stream is known ''a priori''."; PARAMETERS outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); EQUATIONS "Liquid Enthalpy" h = PP.LiquidEnthalpy(T, P, z); "Liquid stream" v = 0; end Model vapour_stream as stream ATTRIBUTES Pallete = false; Brief = "Vapour Material Stream"; Info = "Model for vapour material streams. This model should be used only when the phase of the stream is known ''a priori''."; PARAMETERS outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); EQUATIONS "Vapour Enthalpy" h = PP.VapourEnthalpy(T, P, z); "Vapour stream" v = 1; end Model streamPH as stream ATTRIBUTES Brief = "Stream with built-in flash calculation"; Info = " This model should be used when the vaporization fraction is unknown. The built-in flash calculation will determine the stream state as a function of the overall composition '''z''', the pressure '''P''' and the enthalpy '''h'''. Additionally, the liquid composition '''x''' and the vapor composition '''y''' are calculated. "; Pallete = false; PARAMETERS outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); VARIABLES x(NComp) as fraction (Brief = "Liquid Molar Fraction"); y(NComp) as fraction (Brief = "Vapour Molar Fraction"); s as entr_mol (Brief = "Stream Entropy"); EQUATIONS "Flash Calculation" [v, x, y] = PP.FlashPH(P, h, z); "Enthalpy" h = (1-v)*PP.LiquidEnthalpy(T, P, x) + v*PP.VapourEnthalpy(T, P, y); "Entropy" s = (1-v)*PP.LiquidEntropy(T, P, x) + v*PP.VapourEntropy(T, P, y); end Model source ATTRIBUTES Pallete = true; Icon = "icon/Source"; Brief = "Material stream source"; Info = " This model should be used for boundary streams. Usually these streams are known and come from another process units. The user should specify: * Total molar (mass or volumetric) flow * Temperature * Pressure * Molar (mass or volumetric) composition No matter the specification set, the model will calculate some additional properties: * Mass density * Mass flow * Mass compostions * Specific volume * Vapour fraction * Volumetric flow * Liquid and Vapour compositions "; PARAMETERS outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); M(NComp) as molweight (Brief = "Component Mol Weight"); rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); SET M = PP.MolecularWeight(); VARIABLES out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}"); x(NComp) as fraction (Brief = "Liquid Molar Fraction"); y(NComp) as fraction (Brief = "Vapour Molar Fraction"); hl as enth_mol (Brief = "Liquid Enthalpy"); hv as enth_mol (Brief = "Vapour Enthalpy"); s as entr_mol (Brief = "Stream Entropy"); sl as entr_mol (Brief = "Liquid Entropy"); sv as entr_mol (Brief = "Vapour Entropy"); zmass(NComp) as fraction (Brief = "Mass Fraction"); Mw as molweight (Brief = "Average Mol Weight"); vm as volume_mol (Brief = "Molar Volume"); rho as dens_mass (Brief = "Stream Mass Density"); rhom as dens_mol (Brief = "Stream Molar Density"); Fw as flow_mass (Brief = "Stream Mass Flow"); Fvol as flow_vol (Brief = "Volumetric Flow"); EQUATIONS "Flash Calculation" [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); "Overall Enthalpy" Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv; "Liquid Enthalpy" hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); "Vapour Enthalpy" hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); "Overall Entropy" s = (1-Outlet.v)*sl + Outlet.v*sv; "Liquid Entropy" sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); "Vapour Entropy" sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); "Average Molecular Weight" Mw = sum(M*Outlet.z); switch rhoModel case "volume": "Molar Density" rhom * vm = 1; case "correlation": "Mass Density" rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1; end "Mass or Molar Density" rhom * Mw = rho; "Flow Mass" Fw = Mw*Outlet.F; "Molar Volume" vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); "Volumetric Flow" Fvol = Outlet.F*vm ; "Mass Fraction" zmass = M*Outlet.z / Mw; end Model simple_source ATTRIBUTES Pallete = true; Icon = "icon/Source"; Brief = "Simple material stream source"; Info = " This model should be used for boundary streams. Usually these streams are known and come from another process units. The user should specify: * Total molar flow * Temperature * Pressure * Molar composition "; PARAMETERS outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); VARIABLES out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}"); x(NComp) as fraction (Brief = "Liquid Molar Fraction"); y(NComp) as fraction (Brief = "Vapour Molar Fraction"); hl as enth_mol (Brief = "Liquid Enthalpy"); hv as enth_mol (Brief = "Vapour Enthalpy"); s as entr_mol (Brief = "Stream Entropy"); sl as entr_mol (Brief = "Liquid Entropy"); sv as entr_mol (Brief = "Vapour Entropy"); EQUATIONS "Flash Calculation" [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); "Overall Enthalpy" Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv; "Liquid Enthalpy" hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); "Vapour Enthalpy" hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); "Overall Entropy" s = (1-Outlet.v)*sl + Outlet.v*sv; "Liquid Entropy" sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x); "Vapour Entropy" sv = PP.VapourEntropy(Outlet.T, Outlet.P, y); end Model sink ATTRIBUTES Pallete = true; Icon = "icon/Sink"; Brief = "Material stream sink"; Info = " This model should be used for boundary streams when additional information about the stream is desired. Some of the additional informations calculated by this models are: * Mass density * Mass flow * Mass compostions * Specific volume * Vapour fraction * Volumetric flow * Liquid and Vapour compositions "; PARAMETERS outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); M(NComp) as molweight (Brief = "Component Mol Weight"); rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); SET M = PP.MolecularWeight(); VARIABLES in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); v as fraction (Brief = "Vapourization fraction"); x(NComp) as fraction (Brief = "Liquid Molar Fraction"); y(NComp) as fraction (Brief = "Vapour Molar Fraction"); zmass(NComp) as fraction (Brief = "Mass Fraction"); Mw as molweight (Brief = "Average Mol Weight"); vm as volume_mol (Brief = "Molar Volume"); rho as dens_mass (Brief = "Stream Mass Density"); rhom as dens_mol (Brief = "Stream Molar Density"); Fw as flow_mass (Brief = "Stream Mass Flow"); Fvol as flow_vol (Brief = "Volumetric Flow"); s as entr_mol (Brief = "Stream Entropy"); EQUATIONS "Flash Calculation" [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); "Average Molecular Weight" Mw = sum(M*Inlet.z); switch rhoModel case "volume": "Molar Density" rhom * vm = 1; case "correlation": "Mass Density" rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; end "Mass or Molar Density" rhom * Mw = rho; "Flow Mass" Fw = Mw*Inlet.F; "Molar Volume" vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); "Volumetric Flow" Fvol = Inlet.F*vm ; "Mass Fraction" zmass = M*Inlet.z / Mw; "Overall Entropy" s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + v*PP.VapourEntropy(Inlet.T, Inlet.P, y); end Model simple_sink ATTRIBUTES Pallete = true; Icon = "icon/Sink"; Brief = "Simple material stream sink"; Info = " This model should be used for boundary streams when no additional information about the stream is desired. "; VARIABLES in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); end Model energy_stream ATTRIBUTES Pallete = false; Brief = "General Energy Stream"; Info = "This is the basic building block for the EML models. Every model should have input and output energy streams derived from this model."; VARIABLES Q as heat_rate(Brief="Energy rate"); end Model energy_source ATTRIBUTES Pallete = true; Icon = "icon/energy_source"; Brief = "Enegry stream source"; VARIABLES out OutletQ as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.5349, Symbol="_{out}"); end