#*------------------------------------------------------------------- * 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 the Model for the index three pendulum * in Cartesian coordinates. *-------------------------------------------------------------------- * Author: Rafael de Pelegrini Soares * $Id: sample_pend.mso 247 2007-04-24 13:44:18Z rafael $ *-------------------------------------------------------------------*# using "types.mso"; FlowSheet pend PARAMETERS g as acceleration (Brief = "Gravity acceleration"); L as length (Brief = "Pendulum cable length"); VARIABLES x as length_delta(Brief="Position x"); y as length_delta(Brief="Position y"); w as velocity(Brief = "Velocity for x"); z as velocity(Brief = "Velocity for y"); T as Real(Brief = "Tension on cable",Default=10,Unit='1/s^2'); EQUATIONS "Velocity on x" diff(x)=w; "Velocity on y" diff(y)=z; "Tension on x" diff(w)=T*x; "Tension on y" diff(z)=T*y-g; "Position Constraint" x^2+y^2=L^2; SET g = 9.8 * 'm/s^2'; L = 1 * 'm'; INITIAL "Initial Position x" x = -1 * 'm'; "Initial x Velocity" w = 0 * 'm/s'; #"Initial Position y" y = 0 * "m"; #"Initial y Velocity" z = 0 * "m/s"; OPTIONS TimeStep = 0.1; TimeEnd = 30; Integration = "index0"; # original, index0 or index1 NLASolver( RelativeAccuracy = 1e-8, AbsoluteAccuracy = 1e-9 ); DAESolver( File = "dassl", # mebdf, dasslc, dassl, or sundials RelativeAccuracy = 1e-8, AbsoluteAccuracy = 1e-9, EventAccuracy = 1e-3 ); SparseAlgebra = true; # dense or sparse end