#*------------------------------------------------------------------- * 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 372 2007-09-21 22:17:36Z arge $ *--------------------------------------------------------------------*# using "streams"; Model heater_basic ATTRIBUTES Pallete = false; Brief = "Basic model for Heater or Cooler Operation"; 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",Symbol="Q_{Duty}"); Vfrac as fraction (Brief = "Vapor fraction Outlet Stream",Symbol="V_{frac}"); Lfrac as fraction (Brief = "Liquid fraction Outlet Stream",Symbol="L_{frac}"); Kvalue(NComp) as Real (Brief = "Phase Equilibrium K-values",Symbol="K_{value}"); Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}"); Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P"); in Inlet(Ninlet ) as stream (Brief = "Inlet Streams", PosX=0, PosY=0.4833, Symbol="^{in}"); out Outlet as streamPH (Brief = "Outlet Stream", PosX=1, PosY=0.4782, Symbol="^{out}"); 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); "Pressure Drop" Outlet.P = Inlet.P - Pdrop; "Pressure Ratio" Outlet.P = Inlet.P * Pratio; 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. == Specify == * The Inlet streams: Any Number * Specify: **The outlet temperature and the outlet pressure or ** The outlet temperature and the inlet energy stream or ** The outlet pressure and the inlet energy stream "; VARIABLES in InletQ as energy_stream (Brief ="Inlet Heat Stream", PosX=0.1662, PosY=1, Symbol="_{out}"); EQUATIONS "Net Duty" 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. == Specify == * The Inlet streams: Any Number * Specify: **The outlet temperature and the outlet pressure or ** The outlet temperature and the inlet energy stream or ** The outlet pressure and the inlet energy stream "; VARIABLES in InletQ as energy_stream (Brief ="Inlet Heat Stream", PosX=0.8245, PosY=1, Symbol="_{out}"); EQUATIONS "Net Duty" InletQ.Q = -QDuty; end