/[ascend]/trunk/models/test/defaultall/test3.a4c
ViewVC logotype

Contents of /trunk/models/test/defaultall/test3.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2245 - (show annotations) (download) (as text)
Mon Aug 2 04:20:18 2010 UTC (10 years, 3 months ago) by jpye
File MIME type: text/x-ascend
File size: 1003 byte(s)
Added test 3b to defaultall tests, all looks to be working fine now.
1 (* test file for 'default_all' automatic recursive model initialisation trick *)
2
3 REQUIRE "system.a4l";
4
5 (* this time, we check that the defaultself_visit_childatoms routine is
6 doing its job. *)
7
8 ATOM var_default_to_three REFINES solver_var
9 DIMENSIONLESS
10 DEFAULT 3.0;
11 nominal := 1.0;
12 lower_bound := 0.0;
13 upper_bound := 10.0;
14 END var_default_to_three;
15
16
17 MODEL sub1;
18 c IS_A var_default_to_three;
19 a IS_A solver_var;
20 b IS_A solver_var;
21 c = 5; (* equation, value is not applied until model is solved *)
22 METHODS
23 METHOD default;
24 a := 4;
25 b := 8;
26 END default;
27 END sub1;
28
29 MODEL sub2;
30 s1a IS_A sub1;
31 s1b IS_A sub1;
32 c IS_A var_default_to_three;
33 d IS_A var_default_to_three;
34 METHODS
35 METHOD default;
36 d := 5.;
37 END default;
38 END sub2;
39
40 MODEL test3;
41 s2 IS_A sub2;
42 c IS_A var_default_to_three;
43 METHODS
44 METHOD mess_up_values;
45 c := 0;
46 s2.c := 0;
47 s2.d := 0;
48 s2.s1a.a := 0;
49 s2.s1a.b := 0;
50 s2.s1a.c := 0;
51 s2.s1b.a := 0;
52 s2.s1b.b := 0;
53 s2.s1b.c := 0;
54 END mess_up_values;
55 END test3;

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