[83] | 1 | #*------------------------------------------------------------------- |
---|
| 2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
[1] | 3 | * |
---|
[83] | 4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
| 5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
| 6 | * http://www.enq.ufrgs.br/alsoc. |
---|
[1] | 7 | * |
---|
[83] | 8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
| 9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
| 10 | * All rights reserved. |
---|
[1] | 11 | * |
---|
[83] | 12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
| 13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
| 14 | * |
---|
| 15 | *-------------------------------------------------------------------- |
---|
[1] | 16 | * FlowSheet with the Model for the index three pendulum |
---|
| 17 | * in Cartesian coordinates. |
---|
[83] | 18 | *-------------------------------------------------------------------- |
---|
| 19 | * Author: Rafael de Pelegrini Soares |
---|
| 20 | * $Id: sample_pend.mso 396 2007-10-22 14:13:56Z arge $ |
---|
| 21 | *-------------------------------------------------------------------*# |
---|
[1] | 22 | |
---|
| 23 | using "types.mso"; |
---|
| 24 | |
---|
| 25 | FlowSheet pend |
---|
| 26 | PARAMETERS |
---|
| 27 | g as acceleration (Brief = "Gravity acceleration"); |
---|
| 28 | L as length (Brief = "Pendulum cable length"); |
---|
| 29 | |
---|
| 30 | VARIABLES |
---|
| 31 | x as length_delta(Brief="Position x"); |
---|
| 32 | y as length_delta(Brief="Position y"); |
---|
| 33 | w as velocity(Brief = "Velocity for x"); |
---|
| 34 | z as velocity(Brief = "Velocity for y"); |
---|
[182] | 35 | T as Real(Brief = "Tension on cable",Default=10,Unit='1/s^2'); |
---|
[1] | 36 | |
---|
| 37 | EQUATIONS |
---|
| 38 | "Velocity on x" |
---|
| 39 | diff(x)=w; |
---|
| 40 | |
---|
| 41 | "Velocity on y" |
---|
| 42 | diff(y)=z; |
---|
| 43 | |
---|
| 44 | "Tension on x" |
---|
| 45 | diff(w)=T*x; |
---|
| 46 | |
---|
| 47 | "Tension on y" |
---|
| 48 | diff(z)=T*y-g; |
---|
| 49 | |
---|
| 50 | "Position Constraint" |
---|
| 51 | x^2+y^2=L^2; |
---|
| 52 | |
---|
| 53 | SET |
---|
[182] | 54 | g = 9.8 * 'm/s^2'; |
---|
| 55 | L = 1 * 'm'; |
---|
[1] | 56 | |
---|
| 57 | INITIAL |
---|
| 58 | "Initial Position x" |
---|
[182] | 59 | x = -1 * 'm'; |
---|
[1] | 60 | |
---|
| 61 | "Initial x Velocity" |
---|
[182] | 62 | w = 0 * 'm/s'; |
---|
[1] | 63 | |
---|
| 64 | #"Initial Position y" y = 0 * "m"; |
---|
| 65 | #"Initial y Velocity" z = 0 * "m/s"; |
---|
| 66 | |
---|
| 67 | OPTIONS |
---|
[182] | 68 | TimeStep = 0.1; |
---|
| 69 | TimeEnd = 30; |
---|
[314] | 70 | Integration = "original"; # original, index0 or index1 |
---|
[247] | 71 | |
---|
| 72 | NLASolver( |
---|
| 73 | RelativeAccuracy = 1e-8, |
---|
| 74 | AbsoluteAccuracy = 1e-9 |
---|
| 75 | ); |
---|
| 76 | DAESolver( |
---|
[395] | 77 | File = "dasslc", |
---|
[396] | 78 | #File = "dassl", # fail when "original" (high-index) |
---|
[395] | 79 | #File = "mebdf", |
---|
| 80 | #File = "pside", |
---|
[396] | 81 | #File = "sundials", # fail when "original" (high-index) |
---|
| 82 | RelativeAccuracy = 1e-6, |
---|
| 83 | AbsoluteAccuracy = 1e-8, |
---|
[247] | 84 | EventAccuracy = 1e-3 |
---|
| 85 | ); |
---|
[182] | 86 | SparseAlgebra = true; # dense or sparse |
---|
[1] | 87 | end |
---|