/[ascend]/trunk/models/distance_calc.a4c
ViewVC logotype

Contents of /trunk/models/distance_calc.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, 10 months ago) by aw0a
File MIME type: text/x-ascend
File size: 2239 byte(s)
Setting up web subdirectory in repository
1 REQUIRE "atoms.a4l";
2 (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *)
3 PROVIDE "distance_calc.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 * This model is the second example in "Solved simple models with ASCEND."
9 *)
10
11 MODEL travel_distance;
12 kmax IS_A integer_constant;
13 v[1..2*kmax+1] IS_A speed;
14 delta_time IS_A time;
15 d IS_A distance;
16
17 d = SUM[v[2*k-1]+4*v[2*k]+v[2*k+1] SUCH_THAT k IN
18 [1..kmax]]*delta_time/6;
19
20 END travel_distance;
21
22 MODEL test_travel_distance REFINES travel_distance;
23 kmax :== 5;
24
25 METHODS
26
27 METHOD specify;
28 v[1..2*kmax+1].fixed := TRUE;
29 delta_time.fixed := TRUE;
30 END specify;
31
32 METHOD values;
33 v[1] := 100 {ft/min};
34 v[2] := 120 {ft/min};
35 v[3] := 130 {ft/min};
36 v[4] := 135 {ft/min};
37 v[5] := 140 {ft/min};
38 v[6] := 160 {ft/min};
39 v[7] := 180 {ft/min};
40 v[8] := 210 {ft/min};
41 v[9] := 240 {ft/min};
42 v[10] := 220 {ft/min};
43 v[11] := 200 {ft/min};
44 delta_time := 10 {s};
45 END values;
46
47 END test_travel_distance;
48
49 (*
50 * Travel distance small example
51 * By Arthur Westerberg
52 * Part of the ASCEND Library
53 * $Date: 1998/06/17 18:59:42 $
54 * $Revision: 1.2 $
55 * $Author: mthomas $
56 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/distance_calc.a4c,v $
57 *
58 * This file is part of the ASCEND Modeling Library.
59 *
60 * Copyright (C) 1997 Carnegie Mellon University
61 *
62 * The ASCEND Modeling Library is free software; you can redistribute
63 * it and/or modify it under the terms of the GNU General Public
64 * License as published by the Free Software Foundation; either
65 * version 2 of the License, or (at your option) any later version.
66 *
67 * The ASCEND Modeling Library is distributed in hope that it
68 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
69 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
70 * See the GNU General Public License for more details.
71 *
72 * You should have received a copy of the GNU General Public License
73 * along with the program; if not, write to the Free Software
74 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
75 * the file named COPYING.
76 *)

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