#*------------------------------------------------------------------- * 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. * *-------------------------------------------------------------------- * FlowSheet with simple linear system *-------------------------------------------------------------------- * Author: Rafael de Pelegrini Soares * $Id: sample_linear.mso 539 2008-06-16 16:59:56Z rafael $ *--------------------------------------------------------------------*# using "types"; FlowSheet linear PARAMETERS nx as Integer(Default=2); ny as Integer(Default=2); nu as Integer(Default=2); A(nx,nx) as Real; B(nx,nu) as Real; C(ny,nx) as Real; D(ny,nu) as Real; VARIABLES x(nx) as Real (Brief="State Variables"); y(ny) as Real (Brief="Output Variables"); u(nu) as Real (Brief="Control Variables"); EQUATIONS diff(x)*'s' = sumt(A*x) + sumt(B*u); y = sumt(C*x) + sumt(D*u); SPECIFY u(1:nu) = sin((time/'s' + [1:nu])*'rad'); SET nx = 7; ny = 3; nu = 5; A = 0; B = 0; C = 0; D = 0; A(1,1) = 0.5; A(2,2) = 0.5; A(3,3) = 0.5; B(1,1) = 0.75; B(2,2) = 0.75; B(3,3) = 0.75; C(2,1) = 0.85; D = 0.95; INITIAL x = 0; OPTIONS TimeStep = 0.1; TimeEnd = 2; TimeUnit = 's'; SparseAlgebra = true; Linearize = true; end