/[ascend]/trunk/models/johnpye/shm.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/shm.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 972 - (show annotations) (download) (as text)
Tue Dec 19 07:55:02 2006 UTC (18 years, 1 month ago) by johnpye
File MIME type: text/x-ascend
File size: 688 byte(s)
Fixed a bug with initial time step in IDA (and added a checking asc_assert)
Added switch to turn on and off 'IDACalcIC'.
Changed 'already loaded' ASC_PROG_ERR into ASC_PROG_WARN (so that repeated 'IMPORT' doesn't cause problems)
Removed unnecessary solver tricks from shm.a4c (for easier debugging of Integrator API)
Widened self_test limits in zill.a4c.
Some more debugging in simulation.cpp.
Breaking down test.py into smaller test classes (thinking about moving it to its own directory)
1 REQUIRE "ivpsystem.a4l";
2 REQUIRE "atoms.a4l";
3
4 (* Model of simple harmonic motion *)
5 MODEL shm;
6 x IS_A factor;
7 dx_dt IS_A factor;
8 v IS_A factor;
9 dv_dt IS_A factor;
10
11 xderiv: dx_dt = v;
12 vderiv: dv_dt = -x;
13
14 t IS_A time;
15 METHODS
16
17 METHOD values;
18 v := 0;
19 x := 10;
20 t := 0 {s};
21 END values;
22
23 METHOD specify;
24 FIX x, v;
25 END specify;
26
27 METHOD ode_init;
28 FREE x,v;
29 t.ode_type := -1; t := 0 {s};
30 dx_dt.ode_id := 1; x.ode_id := 1; dx_dt.ode_type := 2; x.ode_type := 1;
31 dv_dt.ode_id := 2; v.ode_id := 2; dv_dt.ode_type := 2; v.ode_type := 1;
32 x.obs_id := 1;
33 v.obs_id := 2;
34 dv_dt.obs_id := 3;
35 END ode_init;
36
37 METHOD on_load;
38 RUN reset; RUN values;
39 RUN ode_init;
40 END on_load;
41
42 END shm;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22