#*------------------------------------------------------------------- * 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. * *-------------------------------------------------------------------- * Sample file showing how to model a ammonia process *-------------------------------------------------------------------- * * This sample file needs VRTherm (www.vrtech.com.br) to run. * *---------------------------------------------------------------------- * Author: Rafael P. Soares * based on code from VRThech Tecnologias Industriais Ltda. * $Id: ammonia.mso 85 2006-12-08 20:43:24Z paula $ *--------------------------------------------------------------------*# using "stage_separators/flash"; using "mixers_splitters/splitter"; # A simple ideal compressor Model Compressor PARAMETERS ext PP as CalcObject; ext NComp as Integer; VARIABLES in Inlet as stream; out Outlet as stream_therm; EQUATIONS "Isentropic expansion" PP.VapourEntropy(Outlet.T, Outlet.P, Outlet.z) = PP.VapourEntropy(Inlet.T, Inlet.P, Inlet.z); "Global Molar Balance" Inlet.F = Outlet.F; "Component Molar Balance" Inlet.z = Outlet.z; "vaporization fraction " Outlet.v = 1.0; end # A simple 2 Inlet mixer. Model Mixer PARAMETERS ext PP as CalcObject; ext NComp as Integer; VARIABLES in Inlet1 as stream; in Inlet2 as stream; out Outlet as stream_therm; EQUATIONS "Energy Balance" Outlet.F * Outlet.h = Inlet1.F * Inlet1.h + Inlet2.F * Inlet2.h; Inlet1.P = Outlet.P; "Global Molar Balance" Inlet1.F + Inlet2.F = Outlet.F; "Component Molar Balance" Inlet1.z*Inlet1.F + Inlet2.z*Inlet2.F = Outlet.F * Outlet.z; "vaporization fraction" Outlet.v = Inlet1.v; end # A simple 'conversion' based reactor. Model Reactor PARAMETERS ext PP as CalcObject; ext NComp as Integer; NReac as Integer(Default=1); stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix"); comp(NReac) as Integer(Default=1, Brief = "Key Component of the reaction"); VARIABLES in Inlet as stream; out Outlet as stream_therm; Outletz(NComp) as fraction; X(NReac) as fraction(Brief="Convertion of the key component"); EQUATIONS "Energy Balance" Outlet.F * Outlet.h = Inlet.F * Inlet.h; "Global Molar Balance" Outlet.F = Inlet.F * (1 - sum(Outletz)); for i in [1:NComp] "Component Molar Balance" Outletz(i) = Inlet.z(i) + sum(stoic(i,:)*X*Inlet.z(comp)); end "Normalize the outlet composition" Outlet.z * sum(Outletz) = Outletz; Outlet.P = Inlet.P; "vaporization fraction" Outlet.v = Inlet.v; end # Ammonia Process FlowSheet Ammonia PARAMETERS PP as CalcObject(Brief="Physical Properties", File="vrpp"); NComp as Integer; SET PP.Components = ["hydrogen", "nitrogen", "argon", "methane", "ammonia"]; PP.LiquidModel = "APR"; PP.VapourModel = "APR"; NComp = PP.NumberOfComponents; DEVICES FEED as streamTP; C101 as Compressor; R101 as Reactor; F101 as flash_Steady; F102 as flash_Steady; S101 as splitter; M101 as Mixer; M102 as Mixer; C102 as Compressor; VARIABLES purity as fraction(Brief="Purity of the product"); production as flow_mol(Unit = "lbmol/h", Brief="Ammonia in the product"); loose as flow_mol(Unit = "lbmol/h", Brief="Ammonia in the purge"); Q1 as heat_rate; Q2 as heat_rate; CONNECTIONS FEED to M101.Inlet1; M101.Outlet to C101.Inlet; C101.Outlet to M102.Inlet1; M102.Outlet to R101.Inlet; R101.Outlet to F101.Inlet; F101.OutletL to F102.Inlet; F102.OutletV to M101.Inlet2; F101.OutletV to S101.Inlet; S101.Outlet1 to C102.Inlet; C102.Outlet to M102.Inlet2; Q1 to F101.Q; Q2 to F102.Q; SET R101.comp = 2; # Key component of the reaction R101.stoic = [-3, -1, 0, 0, 2]; # Stoichiometry of the reaction SPECIFY FEED.F = 2000 * "lbmol/h"; FEED.T = (27 + 273.15) * "K"; FEED.P = 10 * "atm"; FEED.z = [0.74, 0.24, 0.01, 0.01, 0.0]; C101.Outlet.P = 200 * "atm"; C102.Outlet.P = 200 * "atm"; R101.X = 0.4; # Convertion of the reactor F101.OutletV.P = 199 * "atm"; F101.OutletV.T = (-34 + 273.15) * "K"; F102.OutletV.P = 10 * "atm"; F102.Q = 0 * "kJ/h"; # We can choose between one of the following specs S101.frac = 0.78; # Recycle fraction #loose = 1 * "lbmol/h"; # Ammonia in the purge EQUATIONS production = purity * F102.OutletL.F; purity = F102.OutletL.z(5); loose = S101.Outlet2.F * S101.Outlet2.z(5); OPTIONS mode = "steady"; relativeAccuracy = 1e-5; end