1 | #*------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
3 | * |
---|
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. |
---|
7 | * |
---|
8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | *-------------------------------------------------------------------- |
---|
16 | * FlowSheet with the Model for the index three pendulum |
---|
17 | * in Cartesian coordinates. |
---|
18 | *-------------------------------------------------------------------- |
---|
19 | * Author: Rafael de Pelegrini Soares |
---|
20 | * $Id: sample_pend.mso 247 2007-04-24 13:44:18Z rafael $ |
---|
21 | *-------------------------------------------------------------------*# |
---|
22 | |
---|
23 | using "types.mso"; |
---|
24 | |
---|
25 | FlowSheet pend |
---|
26 | PARAMETERS |
---|
27 | L as length (Brief = "Pendulum cable length"); |
---|
28 | |
---|
29 | VARIABLES |
---|
30 | g as acceleration (Brief = "Gravity acceleration"); |
---|
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"); |
---|
35 | T as Real(Brief = "Tension on cable",Default=10,Unit='1/s^2'); |
---|
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 | if (time < 5.3 * 's') then |
---|
54 | "Gravity acceleration" |
---|
55 | g = 9.8 * 'm/s^2'; |
---|
56 | else |
---|
57 | "Gravity acceleration" |
---|
58 | g = 2.0 * 'm/s^2'; |
---|
59 | end |
---|
60 | |
---|
61 | SET |
---|
62 | L = 1 * 'm'; |
---|
63 | |
---|
64 | INITIAL |
---|
65 | "Initial Position x" |
---|
66 | x = -1 * 'm'; |
---|
67 | |
---|
68 | "Initial x Velocity" |
---|
69 | w = 0 * 'm/s'; |
---|
70 | |
---|
71 | #"Initial Position y" y = 0 * "m"; |
---|
72 | #"Initial y Velocity" z = 0 * "m/s"; |
---|
73 | |
---|
74 | OPTIONS |
---|
75 | TimeStep = 0.001; |
---|
76 | TimeEnd = 10; |
---|
77 | Integration = "original"; # original, index0 or index1 |
---|
78 | |
---|
79 | NLASolver( |
---|
80 | RelativeAccuracy = 1e-9, |
---|
81 | AbsoluteAccuracy = 1e-12 |
---|
82 | ); |
---|
83 | DAESolver( |
---|
84 | File = "dasslc", |
---|
85 | #File = "dassl", # fail when "original" (high-index) |
---|
86 | #File = "mebdf", |
---|
87 | #File = "pside", |
---|
88 | #File = "sundials", # fail when "original" (high-index) |
---|
89 | RelativeAccuracy = 1e-7, |
---|
90 | AbsoluteAccuracy = 1e-9, |
---|
91 | EventAccuracy = 1e-6 |
---|
92 | ); |
---|
93 | SparseAlgebra = true; # dense or sparse |
---|
94 | end |
---|