#*------------------------------------------------------------------- * 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 for tanks level control * *------------------------------------------------------------------- * Author: Tiago Osório * $Id: sample_tanks_pid.mso 381 2007-10-08 21:07:25Z arge $ *-----------------------------------------------------------------*# using "tanksmodel"; using "controllers/PIDs"; using "controllers/PIDIncr"; FlowSheet Tanque_inc DEVICES Tanque1 as tank; PIDc as PIDIncr; PARAMETERS h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m'); h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m'); VARIABLES h_ad as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1); CONNECTIONS SET Tanque1.A = 8 * 'm^2'; h_max = 2 * 'm'; h_min = 0 * 'm'; PIDc.PID_Select = "Ideal_AWBT"; EQUATIONS PIDc.Parameters.tau = 1*'s'; PIDc.Parameters.tauSet = 1*'s'; PIDc.Parameters.alpha = 0.3; PIDc.Parameters.bias = 0; PIDc.Parameters.gamma = 1; PIDc.Parameters.beta = 1; PIDc.Options.action = -1; PIDc.Options.clip=1; PIDc.Options.autoMan = 0; PIDc.Parameters.intTime=5000*'s'; PIDc.Parameters.gain = 3.5; PIDc.Parameters.derivTime=1*'s'; PIDc.Ports.input = h_ad; h_ad = (Tanque1.h-h_min)/(h_max-h_min); Tanque1.k = 8*'m^2.5/h'*PIDc.Ports.output; #Perturbação servo #Nível desejado=1*'m' PIDc.Ports.setPoint=0.5; #Perturbação regulatória if time<10*"h" then Tanque1.Fin= 3*'m^3/h'; else Tanque1.Fin= 1.5*'m^3/h'; end INITIAL "altura inicial" Tanque1.h = 0.2 * 'm'; OPTIONS TimeStep = 0.1; TimeEnd = 30; TimeUnit = 'h'; end FlowSheet Tanque DEVICES Tanque1 as tank; PIDx as PID; PARAMETERS h_max as Real (Brief="Altura máxima do nível do tanque", Unit='m'); h_min as Real (Brief="Altura mínima do nível do tanque", Unit='m'); VARIABLES h_ad as Real (Brief="Altura adimensional do nível do tanque", Lower=0,Upper=1); CONNECTIONS SET Tanque1.A = 8 * 'm^2'; h_max = 2 * 'm'; h_min = 0 * 'm'; PIDx.PID_Select = "Ideal_AWBT"; EQUATIONS PIDx.Parameters.tau = 1*'s'; PIDx.Parameters.tauSet = 1*'s'; PIDx.Parameters.alpha = 0.3; PIDx.Parameters.bias = 0; PIDx.Parameters.gamma = 1; PIDx.Parameters.beta = 1; PIDx.Parameters.intTime=5000*'s'; PIDx.Parameters.gain =3.5; PIDx.Parameters.derivTime=1*'s'; PIDx.Options.action = -1; PIDx.Options.clip=1; PIDx.Options.autoMan = 0; PIDx.Ports.input = h_ad; h_ad = (Tanque1.h-h_min)/(h_max-h_min); Tanque1.k = 8*'m^2.5/h'*PIDx.Ports.output; #Perturbação servo #Nível desejado=1*'m' PIDx.Ports.setPoint=0.5; #Perturbação regulatória if time<10*"h" then Tanque1.Fin= 3*'m^3/h'; else Tanque1.Fin= 1.5*'m^3/h'; end INITIAL "altura inicial" Tanque1.h = 0.2 * 'm'; OPTIONS TimeStep = 0.1; TimeEnd = 30; TimeUnit = 'h'; end