#*------------------------------------------------------------------- * 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 558 2008-07-21 20:41:41Z rafael $ *-----------------------------------------------------------------*# 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"; PIDc.tau = 1*'s'; PIDc.tauSet = 1*'s'; PIDc.alpha = 0.3; PIDc.bias = 0; PIDc.gamma = 1; PIDc.beta = 1; PIDc.Action = "Direct"; PIDc.Clip = "Clipped"; PIDc.Mode = "Automatic"; PIDc.intTime=5000*'s'; PIDc.gain = 3.5; PIDc.derivTime=1*'s'; EQUATIONS 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"; PIDx.tau = 1*'s'; PIDx.tauSet = 1*'s'; PIDx.alpha = 0.3; PIDx.bias = 0; PIDx.gamma = 1; PIDx.beta = 1; PIDx.intTime=5000*'s'; PIDx.gain =3.5; PIDx.derivTime=1*'s'; PIDx.Action = "Direct"; PIDx.Clip = "Clipped"; PIDx.Mode = "Automatic"; EQUATIONS 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