#*--------------------------------------------------------------------- * 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 a stoichiometric reactor *---------------------------------------------------------------------- * * Description: * Modeling of a reactor based on a stoichiometric approach. * * Assumptions: * * single- and two-phases involved * * steady-state * * Specify: * * inlet stream * * extent of reactions or * * conversion of a key component * *---------------------------------------------------------------------- * Author: Rodolfo Rodrigues * $Id$ *--------------------------------------------------------------------*# using "tank_basic"; #*--------------------------------------------------------------------- * only vapour-phase *--------------------------------------------------------------------*# Model stoic_vap as tank_vap ATTRIBUTES Brief = "Basic model for a vapour-phase stoichiometric CSTR"; Info = " == Assumptions == * only vapour-phase * steady-state "; PARAMETERS NReac as Integer (Brief="Number of reactions", Default=1); stoic(NComp,NReac) as Real (Brief="Stoichiometric matrix", Symbol="\nu"); VARIABLES out Outlet as vapour_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}"); rate(NComp) as reaction_mol (Brief="Overall component rate of reaction"); conv(NComp) as Real (Brief="Fractional conversion of component", Symbol="X", Default=0); EQUATIONS "Outlet stream" Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Tank.V; "Mechanical equilibrium" Outlet.P = Outletm.P; "Energy balance" Outlet.F*Outlet.h = Outletm.F*Outletm.h; "Steady-state" Outlet.F = Outletm.F; for i in [1:NComp] do if (Outletm.z(i) > 1e-16) then "Molar conversion" Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i)); else if (Outlet.z(i) > 0) then "Molar conversion" conv(i) = 1; # ? else "Molar conversion" conv(i) = 0; # ? end end end end #*--------------------------------------------------------------------- * only liquid-phase *--------------------------------------------------------------------*# Model stoic_liq as tank_liq ATTRIBUTES Brief = "Basic model for a liquid-phase stoichiometric CSTR"; Info = " == Assumptions == * only liquid-phase * steady-state "; PARAMETERS NReac as Integer (Brief="Number of reactions", Default=1); stoic(NComp,NReac) as Real (Brief="Stoichiometric matrix", Symbol="\nu"); VARIABLES out Outlet as liquid_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}"); rate(NComp) as reaction_mol (Brief="Overall component rate of reaction"); conv(NComp) as Real (Brief="Fractional conversion of component", Symbol="X", Default=0); EQUATIONS "Outlet stream" Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Tank.V; "Mechanical equilibrium" Outlet.P = Outletm.P; "Energy balance" Outlet.F*Outlet.h = Outletm.F*Outletm.h; "Steady-state" Outlet.F = Outletm.F; for i in [1:NComp] do if (Outletm.z(i) > 1e-16) then "Molar conversion" Outlet.F*Outlet.z(i) = Outletm.F*Outletm.z(i)*(1 - conv(i)); else if (Outlet.z(i) > 0) then "Molar conversion" conv(i) = 1; # ? else "Molar conversion" conv(i) = 0; # ? end end end end #*--------------------------------------------------------------------- * 1. extent of reactions are known *--------------------------------------------------------------------*# Model stoic_extent_vap as stoic_vap ATTRIBUTES Pallete = true; Icon = "icon/cstr"; Brief = "Model of a generic vapour-phase stoichiometric CSTR based on extent of reaction"; Info = " == Specify == * inlet stream * extent of reactions "; VARIABLES extent(NReac) as flow_mol (Brief="Extent of reaction", Symbol="\xi"); EQUATIONS "Rate of reaction" rate*Tank.V = sumt(stoic*extent); end Model stoic_extent_liq as stoic_liq ATTRIBUTES Pallete = true; Icon = "icon/cstr"; Brief = "Model of a generic liquid-phase stoichiometric CSTR based on extent of reaction"; Info = " == Specify == * inlet stream * extent of reactions "; VARIABLES extent(NReac) as flow_mol (Brief="Extent of reaction", Symbol="\xi"); EQUATIONS "Rate of reaction" rate*Tank.V = sumt(stoic*extent); end #*--------------------------------------------------------------------- * 2. conversion of a key component is known *--------------------------------------------------------------------*# Model stoic_conv_vap as stoic_vap ATTRIBUTES Pallete = true; Icon = "icon/cstr"; Brief = "Model of a generic vapour-phase stoichiometric CSTR based on conversion of a key component"; Info = " == Specify == * inlet stream * conversion of a key component "; PARAMETERS KComp as Integer(Brief="Key component", Lower=1, Default=1); VARIABLES kconv as Real (Brief="Molar conversion of key component", Symbol="X_k"); EQUATIONS "Reaction rate" rate*Tank.V = sumt(stoic)/abs(sumt(stoic(KComp,:)))*Outletm.F*Outletm.z(KComp)*kconv; end Model stoic_conv_liq as stoic_liq ATTRIBUTES Pallete = true; Icon = "icon/cstr"; Brief = "Model of a generic liquid-phase stoichiometric CSTR based on conversion of a key component"; Info = " == Specify == * inlet stream * conversion of a key component "; PARAMETERS KComp as Integer(Brief="Key component", Lower=1, Default=1); VARIABLES kconv as Real (Brief="Molar conversion of key component", Symbol="X_k"); EQUATIONS "Reaction rate" rate*Tank.V = sumt(stoic)/abs(sumt(stoic(KComp,:)))*Outletm.F*Outletm.z(KComp)*kconv; end