#*------------------------------------------------------------------- * 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 84 2006-12-08 20:37:22Z paula $ *-----------------------------------------------------------------*# using "tanksmodel"; using "controllers/PIDs"; using "controllers/PIDIncr"; FlowSheet Tanque_inc DEVICES Tanque1 as tank; PID as PIDIncr_Ideal_AWBT; 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"; EQUATIONS PID.Parameters.tau = 1*"s"; PID.Parameters.tauSet = 1*"s"; PID.Parameters.alpha = 0.3; PID.Parameters.bias = 0; PID.Parameters.gamma = 1; PID.Parameters.beta = 1; PID.Options.action = -1; PID.Options.clip=1; PID.Options.autoMan = 0; PID.Parameters.intTime=5000*"s"; PID.Parameters.gain = 3.5; PID.Parameters.derivTime=1*"s"; PID.Ports.input = h_ad; h_ad = (Tanque1.h-h_min)/(h_max-h_min); Tanque1.k = 8*"m^2.5/h"*PID.Ports.output; #Perturbação servo #Nível desejado=1*"m" PID.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 DAESolver = "dassl"; time = [0:0.1:30] * "h" ; end FlowSheet Tanque DEVICES Tanque1 as tank; PID as PID_Ideal_AWBT; 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"; EQUATIONS PID.Parameters.tau = 1*"s"; PID.Parameters.tauSet = 1*"s"; PID.Parameters.alpha = 0.3; PID.Parameters.bias = 0; PID.Parameters.gamma = 1; PID.Parameters.beta = 1; PID.Parameters.intTime=5000*"s"; PID.Parameters.gain =3.5; PID.Parameters.derivTime=1*"s"; PID.Options.action = -1; PID.Options.clip=1; PID.Options.autoMan = 0; PID.Ports.input = h_ad; h_ad = (Tanque1.h-h_min)/(h_max-h_min); Tanque1.k = 8*"m^2.5/h"*PID.Ports.output; #Perturbação servo #Nível desejado=1*"m" PID.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 NLASolver = "sundials"; time = [0:0.1:30] * "h" ; end