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 | * The car axis problem |
---|
17 | * |
---|
18 | * The problem is a stiff DAE of index 3, consisting of 8 |
---|
19 | * differential and 2 algebraic equations. |
---|
20 | *-------------------------------------------------------------------- |
---|
21 | * Author: Rafael de Pelegrini Soares |
---|
22 | * $Id: sample_car.mso 249 2007-04-24 21:08:06Z rafael $ |
---|
23 | *--------------------------------------------------------------------*# |
---|
24 | |
---|
25 | FlowSheet CarAxis |
---|
26 | |
---|
27 | PARAMETERS |
---|
28 | l as Real(Default=1); |
---|
29 | l0 as Real(Default=1/2); |
---|
30 | eps as Real(Default=1e-2); |
---|
31 | M as Real(Default=10); |
---|
32 | h as Real(Default=1/5); |
---|
33 | tau as Real(Default=3.1514/5); |
---|
34 | w as Real(Default=10); |
---|
35 | r as Real(Default=0.1); |
---|
36 | |
---|
37 | |
---|
38 | VARIABLES |
---|
39 | xl as Real(Default = 0, Lower=-1, Upper = 1); |
---|
40 | yl as Real(Default = 0.5, Lower=-1, Upper = 1); |
---|
41 | xr as Real(Default = 1, Lower=-2, Upper = 2); |
---|
42 | yr as Real(Default = 0.5, Lower=-1, Upper = 1); |
---|
43 | q(4) as Real(Default = -1); |
---|
44 | lambda(2) as Real(Default = 0); |
---|
45 | xb as Real(Default = 1); |
---|
46 | yb as Real(Default = 0); |
---|
47 | ll as Real(Default = 0.5, Brief="Left spring length"); |
---|
48 | lr as Real(Default = 0.5, Brief="Right spring length"); |
---|
49 | |
---|
50 | EQUATIONS |
---|
51 | diff([xl, yl, xr, yr])*'s' = q; |
---|
52 | |
---|
53 | eps^2*M/2 * diff(q(1))*'s' = (l0-ll)*xl/ll |
---|
54 | +lambda(1)*xb +2*lambda(1)*(xl-xr); |
---|
55 | |
---|
56 | eps^2*M/2 * diff(q(2))*'s' = (l0-ll)*yl/ll |
---|
57 | +lambda(1)*yb +2*lambda(2)*(yr-yl) - eps^2*M/2; |
---|
58 | |
---|
59 | |
---|
60 | eps^2*M/2 * diff(q(3))*'s' = (l0-lr)*(xr-xb)/lr |
---|
61 | -2*lambda(2)*(xl-xr); |
---|
62 | |
---|
63 | eps^2*M/2 * diff(q(4))*'s' = (l0-lr)*(yr-yb)/lr |
---|
64 | -2*lambda(2)*(yl-yr) - eps^2*M/2; |
---|
65 | |
---|
66 | xl*xb + yl*yb = 0; |
---|
67 | |
---|
68 | (xl-xr)^2 + (yl-yr)^2 = l^2; |
---|
69 | |
---|
70 | xb = sqrt(l^2-yb^2); |
---|
71 | |
---|
72 | yb = r*sin(w*time*'rad/s'); |
---|
73 | |
---|
74 | ll = sqrt(xl^2 + yl^2); |
---|
75 | |
---|
76 | lr = sqrt((xr-xb)^2 + (yr-yb)^2); |
---|
77 | |
---|
78 | INITIAL |
---|
79 | yl = 0.5; |
---|
80 | xr = 1; |
---|
81 | q(3) = -0.5; |
---|
82 | q(4) = 0; |
---|
83 | |
---|
84 | OPTIONS |
---|
85 | TimeStart = 0; |
---|
86 | TimeStep = 0.01; |
---|
87 | TimeEnd = 3; |
---|
88 | Integration = "index0";# "index0"; # "original"; |
---|
89 | NLASolver( |
---|
90 | File = "sundials", |
---|
91 | RelativeAccuracy = 1e-5, |
---|
92 | AbsoluteAccuracy = 1e-5 |
---|
93 | ); |
---|
94 | DAESolver( |
---|
95 | File = "dassl", # "mebdf", |
---|
96 | RelativeAccuracy = 1e-5, |
---|
97 | AbsoluteAccuracy = 1e-5 |
---|
98 | ); |
---|
99 | end |
---|