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

Contents of /trunk/models/z-anontype.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (19 years, 7 months ago) by aw0a
File MIME type: text/x-ascend
File size: 11437 byte(s)
Setting up web subdirectory in repository
1 REQUIRE "system.a4l"; (* for testing log/relations/reals *)
2 (* => system.a4l, basemodel.a4l *)
3 PROVIDE "z-anontype.a4c";
4 (*
5 * This file is part of the ASCEND Modeling Library and is released
6 * under the GNU Public License as described at the end of this file.
7 *)
8 (* File to test anontype classification.
9 * There may be some gaps around arrays with mixed subscripts,
10 * but since we force the indirect counter into the classification
11 * scheme, this shouldn't need testing.
12 * This file whines around some of the testing constant type
13 * definitions during parse and has deliberate compiling problems
14 * as outlined at end to test NULL classifications.
15 *
16 * To test with this file, load it and compile test_all_anon.
17 *)
18
19 CONSTANT st REFINES symbol_constant :== 'one';
20 MODEL test_sc_anon; (* ok *)
21 a,b,c,d,e,f,g IS_A symbol_constant;
22 a :== 'one';
23 b :== 'two';
24 c :== 'one';
25 d :== 'three';
26 f,g IS_REFINED_TO st;
27 A,B,C,D,E,F,G IS_A symbol_constant;
28 A :== 'one';
29 B :== 'two';
30 C :== 'one';
31 D :== 'three';
32 F,G IS_REFINED_TO st;
33 END test_sc_anon;
34
35 CONSTANT bt REFINES boolean_constant;
36 CONSTANT sbt REFINES boolean_constant :== TRUE;
37 MODEL test_bc_anon; (*ok*)
38 a,b,e IS_A boolean_constant;
39 c,d IS_A boolean_constant;
40 c :== FALSE;
41 d IS_REFINED_TO sbt;
42 a :== TRUE;
43 b :== FALSE;
44 A,B,E IS_A boolean_constant;
45 C,D IS_A boolean_constant;
46 C :== FALSE;
47 D IS_REFINED_TO sbt;
48 A :== TRUE;
49 B :== FALSE;
50 END test_bc_anon;
51
52 CONSTANT it REFINES integer_constant;
53 CONSTANT sit REFINES integer_constant :== 2;
54 MODEL test_ic_anon;
55 a,b,c,d IS_A integer_constant;
56 e,f IS_A it;
57 g,h IS_A sit;
58 a :== 1;
59 c :== 1;
60 d :== 2;
61 b :== 3;
62 (* e undefined *)
63 f :== 2;
64 A,B,C,D IS_A integer_constant;
65 E,F IS_A it;
66 G,H IS_A sit;
67 A :== 1;
68 C :== 1;
69 D :== 2;
70 B :== 3;
71 (* e undefined *)
72 F :== 2;
73 END test_ic_anon;
74
75 MODEL test_rc_anon;
76 a,b,c,d,e,f,g,h IS_A real_constant;
77 a :== 1;
78 f :== 1;
79 d :== 2{meter};
80 g :== 2{meter};
81 b :== 2;
82 c :== 3{meter};
83 h :== 0{?};
84 (* e unassigned *)
85 A,B,C,D,E,F,G,H IS_A real_constant;
86 A :== 1;
87 F :== 1;
88 D :== 2{meter};
89 G :== 2{meter};
90 B :== 2;
91 C :== 3{meter};
92 H :== 0{?};
93 (* E unassigned *)
94 END test_rc_anon;
95
96 MODEL test_ra_anon;
97 a,b,c,d IS_A real;
98 a := 1{meter};
99 c := 1{meter};
100 b,d IS_REFINED_TO solver_var;
101 END test_ra_anon;
102
103 MODEL test_set_anon;
104
105 c,C,zC IS_A set OF symbol_constant;
106
107 a,f,h,j IS_A set OF symbol_constant;
108 a :== ['foo','t'];
109 f :== ['foo','t'];
110 j :== ['a','t'];
111 h :== INTERSECTION[a,['bar']]; (* empty *)
112
113 A,F,H,J IS_A set OF symbol_constant;
114 A :== ['foo','t'];
115 F :== ['foo','t'];
116 J :== ['a','foo','t'];
117 H :== INTERSECTION[A,['bar']]; (* empty *)
118
119 zA,zF,zH,zJ IS_A set OF symbol_constant;
120 zA :== ['foo','t'];
121 zF :== ['foo','t'];
122 zJ :== ['a','foo','t'];
123 zH :== INTERSECTION[zA,['bar']]; (* empty *)
124
125 g,G,zG IS_A set OF integer_constant;
126
127 e,b,d IS_A set OF integer_constant;
128 e :== [1,2];
129 b :== [1,2];
130 d :== INTERSECTION[e,[5]]; (* empty *)
131
132 E,B,D IS_A set OF integer_constant;
133 E :== [1,2];
134 B :== [1,2];
135 D :== INTERSECTION[E,[5]]; (* empty *)
136
137 zE,zB,zD IS_A set OF integer_constant;
138 zE :== [1,2];
139 zB :== [1,2];
140 zD :== INTERSECTION[zE,[5]]; (* empty *)
141
142 END test_set_anon;
143
144 MODEL test_c_anon;
145 r IS_A test_rc_anon;
146 s IS_A test_sc_anon;
147 b IS_A test_bc_anon;
148 i IS_A test_ic_anon;
149 t IS_A test_set_anon;
150
151 s2 IS_A test_sc_anon;
152 s3,s4 IS_A test_sc_anon;
153 s2.e :== 'models';
154 s3.e :== 'models';
155 s4.e :== 'models2';
156 END test_c_anon;
157
158 ATOM tr REFINES real;
159 END tr;
160
161 MODEL test_ai_anon1;
162 a[1..3],c[1..3] IS_A real;
163 b[2..3] IS_A real;
164 d[3..1] IS_A real; (* empty *)
165 e[3..1] IS_A real;
166 f[1..3] IS_A real;
167 f[2] IS_REFINED_TO tr;
168 g[1,2,3] IS_A integer;
169 h[1..3] IS_A integer;
170 i[1..3] IS_A integer;
171 END test_ai_anon1;
172
173 MODEL test_ai_anon2;
174 a[5][1..3],c[5][1..3] IS_A real;
175 b[5][2..3] IS_A real;
176 d[5][3..1] IS_A real; (* empty *)
177 e[5][3..1] IS_A real;
178 f[5][1..3] IS_A real;
179 f[5][2] IS_REFINED_TO tr;
180 g[5][1,2,3] IS_A integer;
181 h[5][1..3] IS_A integer;
182 i[5][1..3] IS_A integer;
183 (* these should show up under the abc umbrellas somehow.
184 * but they don't because all levels of an array share the
185 * same typedesc -- there is no distinct [1..3] tyepdesc
186 * created in the definition of a. at present we're not
187 * going to mess with the array implicit typing system.
188 *)
189 j[1..3] IS_A real;
190 k[2..3] IS_A real;
191 m[2..4] IS_A real;
192 END test_ai_anon2;
193
194 MODEL test_ai_anon3;
195 a[5][1..3][7],c[5][1..3][7] IS_A real;
196 b[5][2..3][7] IS_A real;
197 d[5][3..1][7] IS_A real; (* empty *)
198 e[5][3..1][7] IS_A real;
199 f[5][1..3][7] IS_A real;
200 f[5][2][7] IS_REFINED_TO tr;
201 g[5][1,2,3][7] IS_A integer; (* type -> singleton *)
202 h[5][1..3][7] IS_A integer;
203 i[5][1..3][7] IS_A integer;
204 (* not under the abc umbrellas somehow. *)
205 j[1..3][7] IS_A real;
206 k[2..3][7] IS_A real;
207 m[2..4][7] IS_A real;
208 END test_ai_anon3;
209
210 MODEL test_ae_anon3;
211
212 s IS_A set OF symbol_constant;
213 s :== ['1','2','3'];
214 a['5']['1','2','3']['7'],c['5']['1','2','3']['7'] IS_A real;
215 b['5']['2','3']['7'] IS_A real;
216 d['5'][INTERSECTION[['a'],['b']]]['7'] IS_A real; (* empty *)
217 e['5'][INTERSECTION[['a'],['b']]]['7'] IS_A real;
218 f['5']['1','2','3']['7'] IS_A real;
219 f['5']['2']['7'] IS_REFINED_TO tr;
220 g['5'][s]['7'] IS_A integer;
221 h['5']['1','2','3']['7'] IS_A integer;
222 i['5']['1','2','3']['7'] IS_A integer;
223 (* not under the abc umbrellas somehow. *)
224 j['1','2','3']['7'] IS_A real;
225 k['2','3']['7'] IS_A real;
226 m['2','3','4']['7'] IS_A real;
227
228 END test_ae_anon3;
229
230 MODEL test_rel_anon;
231 x IS_A real;
232 y[1] IS_A real;
233 y[2] = y[3]; (* NULL relation; fooled the parse checks w/subscript. *)
234 x = x; (* silly but buildable *)
235 y[2] = y[3]; (* NULL relation; fooled the parse checks w/subscript. *)
236 x = x; (* silly but buildable *)
237 END test_rel_anon;
238
239 MODEL test_lrel_anon;
240 x IS_A boolean;
241 y[1] IS_A boolean;
242 y[2] == y[3]; (* NULL relation; fooled the parse checks w/subscript. *)
243 x == x; (* silly but buildable *)
244 y[2] == y[3]; (* NULL relation; fooled the parse checks w/subscript. *)
245 x == x; (* silly but buildable *)
246 END test_lrel_anon;
247
248 MODEL test_dummy_anon;
249 i IS_A integer_constant;
250 i:==1;
251 SELECT(i)
252 CASE 1:
253 x IS_A real;
254 CASE 2:
255 y,z,w IS_A integer;
256 END SELECT;
257 END test_dummy_anon;
258
259 UNIVERSAL ATOM ut REFINES real;
260 END ut;
261
262 MODEL test_u_anon;
263 a,b,c IS_A ut;
264 b2 IS_A real;
265 END test_u_anon;
266
267 MODEL test_u2_anon;
268 p,q IS_A test_u_anon;
269 END test_u2_anon;
270
271 MODEL test_m_anon;
272 tic IS_A test_ic_anon;
273 Tic IS_A test_ic_anon;
274 tai IS_A test_ai_anon3;
275 Tai IS_A test_ai_anon3;
276 tae IS_A test_ae_anon3;
277 Tae IS_A test_ae_anon3;
278 trel IS_A test_rel_anon;
279 Trel IS_A test_rel_anon;
280 td IS_A test_dummy_anon;
281 Td IS_A test_dummy_anon;
282 END test_m_anon;
283
284 MODEL test_all_anon;
285 tsc IS_A test_sc_anon;
286 tbc IS_A test_bc_anon;
287 tic IS_A test_ic_anon;
288 trc IS_A test_rc_anon;
289 tset IS_A test_set_anon;
290 tc IS_A test_c_anon;
291 tai1 IS_A test_ai_anon1;
292 tai2 IS_A test_ai_anon2;
293 tai3 IS_A test_ai_anon3;
294 tae3 IS_A test_ae_anon3;
295 trel IS_A test_rel_anon;
296 tlrel IS_A test_lrel_anon;
297 td IS_A test_dummy_anon;
298 tm IS_A test_m_anon;
299 tu IS_A test_u_anon;
300 tu2 IS_A test_u2_anon;
301 END test_all_anon;
302
303 (*
304 * here is the parser whine.
305 Asc-Style: (st): Assigned Constant better if Universal.
306 Asc-Style: (sbt): Assigned Constant better if Universal.
307 Asc-Style: (sit): Assigned Constant better if Universal.
308
309 * here is the expected compilation spew for test_all_anon.
310
311 Heuristic FindExprType failed. Check your indices.
312 Report this failure to ascend+bugs@cs.cmu.edu if no apparent error.
313 Assuming integer array index.
314 Possibly undefined indices in IS_A statement. z-test-a.a4c:201
315 d['5'][INTERSECTION[['a'],['b']]]['7'] IS_A real;
316
317 Heuristic FindExprType failed. Check your indices.
318 Report this failure to ascend+bugs@cs.cmu.edu if no apparent error.
319 Assuming integer array index.
320 Possibly undefined indices in IS_A statement. z-test-a.a4c:202
321 e['5'][INTERSECTION[['a'],['b']]]['7'] IS_A real;
322
323 There are 1 unexecuted Phase 1 statements in the instance.
324 ---- Pass 1 pending: -------------
325 tae3 has the following unexecuted statements.
326 Unable to execute z-test-a.a4c:201
327 d['5'][INTERSECTION[['a'],['b']]]['7'] IS_A real;
328
329 Unable to execute z-test-a.a4c:202
330 e['5'][INTERSECTION[['a'],['b']]]['7'] IS_A real;
331
332 Instance tae3 is missing part `e'
333 Instance tae3 is missing part `d'
334 Undimensioned Unassigned real constant trc.E
335 Undimensioned real constant trc.H
336 Undimensioned Unassigned real constant trc.e
337 Undimensioned real constant trc.h
338 Undimensioned Unassigned real constant tc.r.E
339 Undimensioned real constant tc.r.H
340 Undimensioned Unassigned real constant tc.r.e
341 Undimensioned real constant tc.r.h
342 Unassigned constant tc.b.E
343 Unassigned constant tc.b.e
344 Unassigned constant tbc.E
345 Unassigned constant tbc.e
346 Unassigned constant tic.E
347 Unassigned constant tic.e
348 Unassigned constant tc.i.E
349 Unassigned constant tc.i.e
350 Unassigned constant tsc.E
351 Unassigned constant tsc.e
352 Unassigned constant tc.s4.E
353 Unassigned constant tc.s3.E
354 Unassigned constant tc.s2.E
355 Unassigned constant tc.s.E
356 Unassigned constant tc.s.e
357 ---- End pass 1 pending-----------
358 Phase 1 models 199992
359 Impossible name or subscript :
360 y[2]
361 Asc-Error: Line 218: z-test-a.a4c
362 Relation contains an impossible instance
363 test_rel_anon_1 : (details suppressed);
364 Impossible name or subscript :
365 y[2]
366 Asc-Error: Line 220: z-test-a.a4c
367 Relation contains an impossible instance
368 test_rel_anon_3 : (details suppressed);
369 Phase 2 relations 16666
370 Logical Relation contains an impossible instance z-test-a.a4c:227
371 test_lrel_anon_1 : (details suppressed);
372 Logical Relation contains an impossible instance z-test-a.a4c:229
373 test_lrel_anon_3 : (details suppressed);
374 There are unexecuted Phase 3 (logical relations) in the instance.
375 Phase 3 logicals 16666
376 Phase 4 when-case 16666
377 There are unexecuted statements in the instance.
378 DEFAULT assignments not executed.
379 Phase 5 defaults 0
380 Compilation times (microseconds):
381 Phase 1 models 199992
382 Phase 2 relations 16666
383 Phase 3 logical 16666
384 Phase 4 when-case 16666
385 Phase 5 defaults 0
386 Total 249990
387 Instantiation time (u-sec): 249990
388 *
389 *)
390
391
392 (*
393 * z-anontype.a4c
394 * by Benjamin A Allan
395 * Part of the ASCEND Library
396 * $Date: 1998/06/17 19:39:32 $
397 * $Revision: 1.3 $
398 * $Author: mthomas $
399 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/z-anontype.a4c,v $
400 *
401 * This file is part of the ASCEND Modeling Library.
402 *
403 * Copyright (C) 1997 Carnegie Mellon University
404 *
405 * The ASCEND Modeling Library is free software; you can redistribute
406 * it and/or modify it under the terms of the GNU General Public
407 * License as published by the Free Software Foundation; either
408 * version 2 of the License, or (at your option) any later version.
409 *
410 * The ASCEND Modeling Library is distributed in hope that it
411 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
412 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
413 * See the GNU General Public License for more details.
414 *
415 * You should have received a copy of the GNU General Public License
416 * along with the program; if not, write to the Free Software
417 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
418 * the file named COPYING.
419 *)

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