Parent Directory | Revision Log
Removed BBOXWHINE (replaced with some one-time-only warnings for the moment) Added ExtMethodDestroyFn to allow 'user_data' associated with external methods to be destroyed. Implemented the destroy fn through to 'extpy' module. Added 'name' as an extra parameter in the user_data for extpy, to help with debug msgs. Moved 'solvernotes' to a file of its own (was part of listnotes.py) Added 'repaint' to GTK 'tools' menu (for debugging) Added 'python.h' to top of library, type files (pygtk) to stop silly warnings. Working on some diagnosing of problems as noted in Simulation::checkInstance. Removed some old comments from namio.h and others. Renamed 'blsys' to 'sys' in integrator.c. Some work on fixing up the J*v function for IDA (not yet complete). Added new 'destroyfn' parameter (as NULL) to all calls to 'CreateUserFunctionMethod'.
1 | REQUIRE "ivpsystem.a4l"; |
2 | REQUIRE "atoms.a4l"; |
3 | IMPORT "johnpye/extpy/extpy"; |
4 | IMPORT "johnpye/solve"; |
5 | |
6 | MODEL pendulum; |
7 | x IS_A delta_distance; y IS_A delta_distance; |
8 | r IS_A distance; |
9 | theta IS_A angle; |
10 | -y = r*cos(theta); |
11 | x = r*sin(theta); |
12 | |
13 | m IS_A mass; |
14 | v_x, v_x1 IS_A speed; v_y, v_y1 IS_A speed; |
15 | a_x IS_A acceleration; a_y IS_A acceleration; |
16 | g IS_A acceleration; |
17 | |
18 | t IS_A time; |
19 | |
20 | (* equations of motion *) |
21 | Fc IS_A force; |
22 | +Fc*cos(theta)-m*g = m*a_y; |
23 | |
24 | -Fc*sin(theta) = m*a_x; |
25 | |
26 | v_x1 = v_x; |
27 | v_y1 = v_y; |
28 | |
29 | METHODS |
30 | METHOD specify; |
31 | FIX r, m, g, x, t; |
32 | FIX v_x; |
33 | END specify; |
34 | |
35 | METHOD default_self; |
36 | y := -sqrt(3)/2*(1{m}); |
37 | x := 0.5 {m}; |
38 | r := 1 {m}; |
39 | v_y := 0 {m/s}; |
40 | v_x := 0 {m/s}; |
41 | v_y1 := 0 {m/s}; |
42 | v_x1 := 0 {m/s}; |
43 | END default_self; |
44 | |
45 | METHOD values; |
46 | t := 0 {s}; |
47 | r := 1 {m}; |
48 | m := 1 {kg}; |
49 | g := 9.8 {N/kg}; |
50 | END values; |
51 | |
52 | METHOD set_ode; (* this is where the current implementation sux *) |
53 | x.ode_id := 1; x.ode_type := 1; |
54 | v_x.ode_id := 1; v_x.ode_type := 2; |
55 | |
56 | v_x1.ode_id := 2; v_x1.ode_type := 1; |
57 | a_x.ode_id := 2; a_x.ode_type := 2; |
58 | |
59 | y.ode_id := 3; y.ode_type := 1; |
60 | v_y.ode_id := 3; v_y.ode_type := 2; |
61 | |
62 | v_y1.ode_id := 4; v_y1.ode_type := 1; |
63 | a_y.ode_id := 4; a_y.ode_type := 2; |
64 | |
65 | t.ode_type :=-1; |
66 | END set_ode; |
67 | |
68 | METHOD set_obs; |
69 | x.obs_id :=1; |
70 | y.obs_id :=2; |
71 | END set_obs; |
72 | |
73 | METHOD on_load; |
74 | RUN default_self; |
75 | RUN reset; |
76 | RUN specify; |
77 | EXTERNAL solve(SELF); |
78 | EXTERNAL solve(SELF); |
79 | RUN set_obs; |
80 | RUN set_ode; |
81 | END on_load; |
82 | |
83 | END pendulum; |
john.pye@anu.edu.au | ViewVC Help |
Powered by ViewVC 1.1.22 |