#*------------------------------------------------------------------- * 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. *---------------------------------------------------------------------- * Author: Gerson Balbueno Bicca * $Id: heater.mso 325 2007-07-29 00:41:04Z arge $ *--------------------------------------------------------------------*# using "streams"; Model heater_basic ATTRIBUTES Pallete = false; Brief = "Basic model for Heater or Cooler"; Info = "Determines thermal and phase conditions of an outlet stream"; PARAMETERS outer PP as Plugin (Brief="Physical Properties", Type="PP"); outer NComp as Integer (Brief="Number of Components"); Ninlet as Integer (Brief="Number of Inlet Streams"); Kvalues as Switcher (Brief="Option for Display Phase Equilibrium K-values",Valid=["yes","no"], Default="yes"); VARIABLES QDuty as power (Brief = "Actual Duty"); Vfrac as fraction (Brief = "Vapor fraction Outlet Stream"); Lfrac as fraction (Brief = "Liquid fraction Outlet Stream"); Kvalue(NComp) as Real (Brief = "Phase Equilibrium K-values"); in Inlet(Ninlet ) as stream (Brief="Inlet Streams", PosX=0, PosY=0.4833); out Outlet as streamPH (Brief="Outlet Stream", PosX=1, PosY=0.4782); EQUATIONS "Flow" Outlet.F = sum(Inlet.F); for j in [1 : NComp] "Composition" Outlet.F*Outlet.z(j) = sum(Inlet.F*Inlet.z(j)); end "Vapor fraction Outlet Stream" Vfrac = Outlet.v; "Liquid fraction Outlet Stream" Lfrac = 1-Vfrac; "Heat Duty" QDuty = Outlet.F*Outlet.h - sum(Inlet.F*Inlet.h); switch Kvalues # Fix for better convergence !!! case "yes": "K-values Phase Equilibrium" Kvalue*(Outlet.x) = Outlet.y; case "no": "K-values Phase Equilibrium" Kvalue = 1; end end Model heater as heater_basic ATTRIBUTES Pallete = true; Icon = "icon/heater"; Brief = "Heater"; Info = "Determines thermal and phase conditions of an outlet stream"; VARIABLES in InletQ as energy_stream (Brief ="Inlet Heat Stream", PosX=0.1662, PosY=1); out OutletQ as energy_stream (Brief ="Outlet Heat Stream", PosX=0.8245, PosY=0); EQUATIONS "Net Duty" OutletQ.Q = InletQ.Q - QDuty; end Model cooler as heater_basic ATTRIBUTES Pallete = true; Icon = "icon/cooler"; Brief = "Cooler"; Info = "Determines thermal and phase conditions of an outlet stream"; VARIABLES in InletQ as energy_stream (Brief ="Inlet Heat Stream", PosX=0.8245, PosY=1); out OutletQ as energy_stream (Brief ="Outlet Heat Stream", PosX=0.1662, PosY=0); EQUATIONS "Net Duty" OutletQ.Q = InletQ.Q - QDuty; end