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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 974 - (show annotations) (download) (as text)
Tue Dec 19 11:00:57 2006 UTC (13 years, 1 month ago) by johnpye
File MIME type: text/x-ascend
File size: 809 byte(s)
Fixed 'testcmslv2' test case.
Fixed 'sunpos5' test case.
One can now type 'python test.py TestSolver' and all current tests pass.
1 REQUIRE "atoms.a4l";
2
3 (*
4 Model an even simpler CMSlv model
5
6 ^
7 1 + .
8 | .'
9 | .'
10 |.' 1
11 <-+------*------+->
12 -1 _.-'`|
13 ,-'` + - 0.5
14 |
15 *)
16 MODEL testcmslv2;
17 x IS_A factor;
18 y IS_A factor;
19
20 rhs: y = x;
21 lhs: y = 0.5*x;
22
23 CONDITIONAL
24 ispos: x > 0;
25 END CONDITIONAL;
26
27 isposp IS_A boolean_var;
28 isposp == SATISFIED(ispos);
29
30 WHEN (isposp)
31 CASE TRUE:
32 USE rhs;
33 CASE FALSE:
34 USE lhs;
35 END WHEN;
36
37 METHODS
38 METHOD default_self;
39 isposp := TRUE;
40 y := 3.0;
41 x := 3.0;
42 END default_self;
43
44 METHOD values;
45 x := -1;
46 END values;
47
48 METHOD specify;
49 FIX x;
50 END specify;
51
52 METHOD on_load;
53 RUN default_self; RUN values; RUN specify;
54 END on_load;
55
56 METHOD self_test;
57 ASSERT y == -0.5;
58 END self_test;
59
60 END testcmslv2;

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