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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 974 - (hide annotations) (download) (as text)
Tue Dec 19 11:00:57 2006 UTC (13 years, 10 months 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 johnpye 807 REQUIRE "atoms.a4l";
2    
3     (*
4     Model an even simpler CMSlv model
5    
6     ^
7 johnpye 808 1 + .
8     | .'
9     | .'
10 johnpye 974 |.' 1
11 johnpye 807 <-+------*------+->
12 johnpye 974 -1 _.-'`|
13     ,-'` + - 0.5
14 johnpye 808 |
15 johnpye 807 *)
16     MODEL testcmslv2;
17     x IS_A factor;
18     y IS_A factor;
19    
20     rhs: y = x;
21 johnpye 974 lhs: y = 0.5*x;
22 johnpye 807
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 johnpye 974 isposp := TRUE;
40     y := 3.0;
41     x := 3.0;
42 johnpye 807 END default_self;
43    
44     METHOD values;
45 johnpye 974 x := -1;
46 johnpye 807 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 johnpye 974 METHOD self_test;
57     ASSERT y == -0.5;
58     END self_test;
59    
60 johnpye 807 END testcmslv2;

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