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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 565 - (show annotations) (download) (as text)
Fri May 5 02:58:36 2006 UTC (18 years, 8 months ago) by johnpye
File MIME type: text/x-ascend
File size: 765 byte(s)
This is a sample file to illustrate ASCEND syntax.
1 REQUIRE "atoms.a4l";
2
3 (*
4 simple model to calculate the time taken for
5 an object to fall 10 m under gravity.
6 *)
7 MODEL sample;
8
9 S IS_A distance;
10 u IS_A speed;
11 a IS_A acceleration;
12 t IS_A time;
13
14 (* formula for displacement of a mass with initial
15 displacement and constant acceleration *)
16 S = u * t + 1/2 * a *t^2;
17
18 METHODS
19
20 METHOD specify; (* which variables are fixed *)
21 FIX u, a, S;
22 END specify;
23
24 METHOD values; (* set the fixed variables *)
25 S := 10 {m}; a := 9.8 {m/s^2}; u := 0 {m/s};
26 END values;
27
28 METHOD bound_self;
29 t.lower_bound := 0 {s}; (* t > 0 *)
30 END values;
31
32 (* this method will be run on startup *)
33 METHOD default_self;
34 RUN reset;
35 RUN values;
36 RUN bound_self;
37 END default_self;
38
39 END sample;

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