#*------------------------------------------------------------------- * 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 L as length (Brief = "Pendulum cable length"); VARIABLES g as acceleration (Brief = "Gravity acceleration"); 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; if (time < 5.3 * 's') then "Gravity acceleration" g = 9.8 * 'm/s^2'; else "Gravity acceleration" g = 2.0 * 'm/s^2'; end SET 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.001; TimeEnd = 10; Integration = "original"; # original, index0 or index1 NLASolver( RelativeAccuracy = 1e-9, AbsoluteAccuracy = 1e-12 ); DAESolver( File = "dasslc", #File = "dassl", # fail when "original" (high-index) #File = "mebdf", #File = "pside", #File = "sundials", # fail when "original" (high-index) RelativeAccuracy = 1e-7, AbsoluteAccuracy = 1e-9, EventAccuracy = 1e-6 ); SparseAlgebra = true; # dense or sparse end