#*------------------------------------------------------------------- * 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 542 2008-06-21 16:01:41Z arge $ *-------------------------------------------------------------------*# 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 = 0.9 * 'm'; INITIAL "Initial Position x" x = 0.9 * 'm'; "Initial x Velocity" w = 0 * 'm/s'; OPTIONS TimeStep = 0.1; TimeEnd = 36; Integration = "original"; # original, index0, or index1 NLASolver( RelativeAccuracy = 1e-8, AbsoluteAccuracy = 1e-9 ); DAESolver( #File = "dasslc", #File = "dassl", # fail when "original" (high-index) File = "mebdf", #File = "pside", #File = "sundials", # fail when "original" (high-index) RelativeAccuracy = 1e-6, AbsoluteAccuracy = 1e-8 ); SparseAlgebra = true; end FlowSheet pend_polar PARAMETERS g as acceleration (Brief = "Gravity acceleration"); L as length (Brief = "Pendulum cable length"); VARIABLES phi as angle (Brief="Angle"); omega as frequency (Brief="Angular velocity", Lower=-100); 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 "x Position" x = L*sin(phi); "y Position" y = -L*cos(phi); "Velocity on x" w = L*omega*cos(phi); "Velocity on y" z = L*omega*sin(phi); "Tension" T = -g*cos(phi)/L-omega^2; "Angular velocity" diff(phi) = omega*'rad'; "Angular acceleration" diff(omega) = -g*sin(phi)/L; SET g = 9.8 * 'm/s^2'; L = 0.9 * 'm'; INITIAL "Initial Position x" x = 0.9 * 'm'; "Initial x Velocity" w = 0 * 'm/s'; OPTIONS TimeStep = 0.1; TimeEnd = 36; Integration = "original"; # original, index0, or index1 NLASolver( RelativeAccuracy = 1e-8, AbsoluteAccuracy = 1e-9 ); DAESolver( #File = "dasslc", File = "dassl", # fail when "original" (high-index) #File = "mebdf", #File = "pside", #File = "sundials", # fail when "original" (high-index) RelativeAccuracy = 1e-6, AbsoluteAccuracy = 1e-8 ); SparseAlgebra = true; end