#*------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2008 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 - 2008 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. * *-------------------------------------------------------------------- * Flash separator sample file. *-------------------------------------------------------------------- * * This sample file needs VRTherm (www.vrtech.com.br) to run. * *-------------------------------------------------------------------- * Author: Rafael de Pelegrini Soares * $Id: Sample_flash_pid.mso 537 2008-06-16 03:58:00Z arge $ *------------------------------------------------------------------*# using "stage_separators/flash"; using "controllers/PIDIncr"; FlowSheet Flash_Dynamic PARAMETERS PP as Plugin(Brief="Physical Properties",Type="PP", Components = ["n-butane", "benzene", "n-octane"], LiquidModel = "PR", VapourModel = "PR"); NComp as Integer; #Maximum and minimum vapor and liquid flow rates FVMin as flow_mol; FVMax as flow_mol; FLMax as flow_mol; FLMin as flow_mol; #Maximum and minimum pressure PMin as pressure; PMax as pressure; #Maximum and minimum level LMax as length; LMin as length; VARIABLES L_ad as Real (Brief="Dimensionless level"); P_ad as Real (Brief="Dimensionless pressure"); Q as energy_source (Brief="Heat supplied"); DEVICES pidL as PIDIncr; #Level controller pidP as PIDIncr; #Pressure controller fl as flash; s1 as source; SET NComp = PP.NumberOfComponents; pidL.PID_Select = "Parallel_AWBT"; pidP.PID_Select = "Parallel_AWBT"; #Flash model parameters fl.V = 10 * 'm^3'; fl.diameter = 0.5 * 'm'; fl.orientation = "vertical"; #Maximum and minimum values PMax=2.36 *'atm'; PMin=0 *'atm'; LMax=2 *'m'; LMin=0 *'m'; FVMax=300*'kmol/h'; FVMin=0*'kmol/h'; FLMax=692.7*'kmol/h'; FLMin=0*'kmol/h'; CONNECTIONS s1.Outlet to fl.Inlet; Q.OutletQ to fl.InletQ; SPECIFY Q.OutletQ.Q = 1026.32 * 'kJ/s'; #Level controller parameters pidL.Ports.setPoint=0.5; pidL.Parameters.bias=0.5; pidL.Parameters.gain=1.1776; pidL.Parameters.derivTime=19*'s'; pidL.Parameters.intTime=76*'s'; pidL.Parameters.tau=1*'s'; pidL.Parameters.tauSet=1*'s'; pidL.Parameters.alpha =1; pidL.Parameters.beta =1; pidL.Parameters.gamma =1; #Level controller configuration pidL.Options.autoMan=0; pidL.Options.clip=1; pidL.Options.action =-1; #Pressure controller parameters pidP.Parameters.bias=0.5; pidP.Parameters.gain=0.9275; pidP.Parameters.derivTime=18*'s'; pidP.Parameters.intTime=72*'s'; pidP.Parameters.tau=1*'s'; pidP.Parameters.tauSet=1*'s'; pidP.Parameters.alpha =1; pidP.Parameters.beta =1; pidP.Parameters.gamma =1; #Pressure controller configuration pidP.Options.autoMan=0; pidP.Options.clip=1; pidP.Options.action =-1; EQUATIONS #Feed stream s1.Outlet.z = [0.3, 0.3, 0.4]; s1.Outlet.P = 5 * 'atm'; #Disturbance if time < 0.5*'h' then s1.Outlet.T = 338 * 'K'; s1.Outlet.F = 496.3 * 'kmol/h'; else s1.Outlet.T = 360 * 'K'; s1.Outlet.F = 450 * 'kmol/h'; end #Control variables: fl.Level and fl.OutletV.P #Normalized control variables L_ad*(LMax-LMin)=fl.Level-LMin; P_ad*(PMax-PMin)=fl.OutletV.P-PMin; #Controllers input ports pidL.Ports.input=L_ad; pidP.Ports.input=P_ad; #Setpoint change if time < 2*'h' then pidP.Ports.setPoint=0.501822; else pidP.Ports.setPoint=0.8474576; end #Controllers output ports #Manipulated variables: fl.OutletV.F (pressure control) and fl.OutletL.F (level control) fl.OutletV.F = pidP.Ports.output*(FVMax-FVMin)+FVMin; fl.OutletL.F = pidL.Ports.output*(FLMax-FLMin)+FLMin; INITIAL fl.OutletL.T = 340 *'K'; fl.Level = 1* 'm'; fl.OutletL.z(1) = 0.1; fl.OutletL.z(2) = 0.1; OPTIONS TimeStep = 0.02; TimeEnd = 3; TimeUnit = 'h'; DAESolver(File="dassl"); end