/[ascend]/trunk/models/z-align.a4c
ViewVC logotype

Annotation of /trunk/models/z-align.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (19 years, 8 months ago) by aw0a
File MIME type: text/x-ascend
File size: 6029 byte(s)
Setting up web subdirectory in repository
1 aw0a 1 PROVIDE "z-align.a4c";
2     (*
3     * This file is part of the ASCEND Modeling Library and is released
4     * under the GNU Public License as described at the end of this file.
5     *)
6    
7     (*============================================================================*
8    
9     Z - A L I G N . A 4 C
10     ---------------------
11    
12     AUTHOR: Benjamin A. Allan
13    
14     DATES: 02/97 - Original Code based on system.a4l
15    
16     CONTENTS: Basic definitions for relation, solver_var,
17     and generic_real and extended definitions
18     for exercising the alignment of children of atoms.
19     These tests are not exhaustive, but should catch the
20     probable errors.
21    
22     REQUIRES: empty library, except for intrinsics.
23    
24     *============================================================================*)
25    
26     DEFINITION relation
27    
28     included IS_A boolean;
29     included := TRUE;
30     tolerance IS_A real;
31     tolerance := 1e-8{?};
32    
33     END relation;
34    
35    
36     DEFINITION logic_relation
37    
38     b_index IS_A integer;
39     included IS_A boolean;
40     included := TRUE;
41     b_index :=2;
42     tolerance IS_A real;
43     tolerance := 1e-8{?};
44    
45     END logic_relation;
46    
47     ATOM solver_var REFINES real
48     DEFAULT 0.5 {?};
49    
50     lower_bound IS_A real;
51     upper_bound IS_A real;
52     nominal IS_A real;
53     fixed IS_A boolean;
54    
55     fixed := FALSE;
56     lower_bound := -1e20 {?};
57     upper_bound := 1e20 {?};
58     nominal := 0.5 {?};
59    
60     END solver_var;
61    
62     ATOM boolean_var REFINES boolean
63     DEFAULT TRUE;
64    
65     nominal IS_A boolean;
66     fixed IS_A boolean;
67     fixed := FALSE;
68     nominal := TRUE;
69    
70     END boolean_var;
71    
72     ATOM generic_real REFINES solver_var
73     DIMENSIONLESS
74     DEFAULT 0.5;
75     lower_bound := -1e20;
76     upper_bound := 1e20;
77     nominal := 0.5;
78     END generic_real;
79    
80     ATOM solver_int REFINES solver_var
81     DIMENSIONLESS
82     DEFAULT 0.0;
83    
84     relaxed IS_A boolean;
85    
86     relaxed := FALSE;
87     lower_bound := 0.0;
88     upper_bound := 1000000.0;
89     nominal := 0.5;
90     END solver_int;
91    
92     ATOM solver_binary REFINES solver_int
93     DIMENSIONLESS
94     DEFAULT 0.0;
95    
96     lower_bound := 0.0;
97     upper_bound := 1.0;
98     nominal := 0.5;
99    
100     END solver_binary;
101    
102     ATOM solver_semi REFINES solver_var
103     DEFAULT 1.0 {?};
104    
105     is_zero IS_A boolean;
106     relaxed IS_A boolean;
107    
108     is_zero := FALSE;
109     relaxed := FALSE;
110     lower_bound := 1 {?};
111     upper_bound := 1e20 {?};
112     nominal := 1.0 {?};
113    
114     END solver_semi;
115    
116    
117    
118    
119     MODEL testalignment1;
120    
121     (* MODEL to test all the standard stuff *)
122     reltest: x=1;
123     logtest: p==TRUE;
124    
125     p IS_A boolean;
126     v IS_A solver_var;
127     w IS_A boolean_var;
128     x IS_A solver_semi;
129     y IS_A solver_binary;
130     z IS_A solver_int;
131    
132     END testalignment1;
133    
134     (* children of real atoms. packing test works on alpha order assumption
135     * of the child packing scheme. testing pairwise, since real is generally
136     * the most difficult to align.
137     *)
138     ATOM rt1 REFINES real DEFAULT 0.5 {meter};
139     a IS_A boolean;
140     b IS_A real;
141     c IS_A real;
142     a := TRUE;
143     b := 7 {meter};
144     c := 7 {meter};
145     END rt1;
146    
147     ATOM rt2 REFINES real DEFAULT 0.5 {meter};
148     a IS_A integer;
149     b IS_A real;
150     c IS_A real;
151     a := 1;
152     b := 7 {meter};
153     c := 7 {meter};
154     END rt2;
155    
156     ATOM rt3 REFINES real DEFAULT 0.5 {meter};
157     a IS_A symbol;
158     b IS_A real;
159     c IS_A real;
160     a := 'fred';
161     b := 7 {meter};
162     c := 7 {meter};
163     END rt3;
164    
165     ATOM rt4 REFINES real DEFAULT 0.5 {meter};
166     a IS_A set OF symbol;
167     b IS_A real;
168     c IS_A real;
169     a := ['fred','dead'];
170     b := 7 {meter};
171     c := 7 {meter};
172     END rt4;
173    
174     ATOM rt5 REFINES real DEFAULT 0.5 {meter};
175     a IS_A real;
176     b IS_A real;
177     c IS_A real;
178     a := 7{meter};
179     b := 7 {meter};
180     c := 7 {meter};
181     END rt5;
182    
183     MODEL testalignment2;
184    
185     x1 IS_A rt1;
186     x2 IS_A rt2;
187     x3 IS_A rt3;
188     x4 IS_A rt4;
189     x5 IS_A rt5;
190    
191     END testalignment2;
192    
193     ATOM bt1 REFINES boolean DEFAULT TRUE;
194     a IS_A boolean;
195     b IS_A real;
196     a := FALSE;
197     b := 7 {meter};
198     END bt1;
199    
200     ATOM bt2 REFINES boolean DEFAULT TRUE;
201     a IS_A integer;
202     b IS_A real;
203     a := 1;
204     b := 7 {meter};
205     END bt2;
206    
207     ATOM bt3 REFINES boolean DEFAULT TRUE;
208     a IS_A real;
209     b IS_A real;
210     a := 1;
211     b := 7 {meter};
212     END bt3;
213    
214     MODEL testalignment3;
215     x1 IS_A bt1;
216     x2 IS_A bt2;
217     x3 IS_A bt3;
218     END testalignment3;
219    
220     ATOM st1 REFINES symbol DEFAULT 'biteme';
221     a IS_A boolean;
222     b IS_A real;
223     a := FALSE;
224     b := 7 {meter};
225     END st1;
226    
227     ATOM st2 REFINES symbol DEFAULT 'biteme';
228     a IS_A integer;
229     b IS_A real;
230     a := 1;
231     b := 7 {meter};
232     END st2;
233    
234     ATOM st3 REFINES symbol DEFAULT 'biteme';
235     a IS_A real;
236     b IS_A real;
237     a := 1;
238     b := 7 {meter};
239     END st3;
240    
241     MODEL testalignment4;
242     x1 IS_A st1;
243     x2 IS_A st2;
244     x3 IS_A st3;
245     END testalignment4;
246    
247    
248     ATOM it1 REFINES integer DEFAULT 3;
249     a IS_A boolean;
250     b IS_A real;
251     a := FALSE;
252     b := 7 {meter};
253     END it1;
254    
255     ATOM it2 REFINES integer DEFAULT 3;
256     a IS_A integer;
257     b IS_A real;
258     a := 1;
259     b := 7 {meter};
260     END it2;
261    
262     ATOM it3 REFINES integer DEFAULT 3;
263     a IS_A real;
264     b IS_A real;
265     a := 1;
266     b := 7 {meter};
267     END it3;
268    
269     MODEL testalignment5;
270     x1 IS_A it1;
271     x2 IS_A it2;
272     x3 IS_A it3;
273     END testalignment5;
274    
275     MODEL testall;
276     t1 IS_A testalignment1;
277     t2 IS_A testalignment2;
278     t3 IS_A testalignment3;
279     t4 IS_A testalignment4;
280     t5 IS_A testalignment5;
281     END testall;
282    
283    
284     (*
285     * z-align.a4l
286     * by Benjamin A. Allan
287     * Part of the ASCEND Library
288     * $Date: 1998/06/17 19:39:31 $
289     * $Revision: 1.4 $
290     * $Author: mthomas $
291     * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/z-align.a4c,v $
292     *
293     * This file is part of the ASCEND Modeling Library.
294     *
295     * Copyright (C) 1997 Carnegie Mellon University
296     *
297     * The ASCEND Modeling Library is free software; you can redistribute
298     * it and/or modify it under the terms of the GNU General Public
299     * License as published by the Free Software Foundation; either
300     * version 2 of the License, or (at your option) any later version.
301     *
302     * The ASCEND Modeling Library is distributed in hope that it
303     * will be useful, but WITHOUT ANY WARRANTY; without even the implied
304     * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
305     * See the GNU General Public License for more details.
306     *
307     * You should have received a copy of the GNU General Public License
308     * along with the program; if not, write to the Free Software
309     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
310     * the file named COPYING.
311     *)

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