1 |
REQUIRE "atoms.a4l"; |
2 |
(* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
3 |
PROVIDE "vesselTabulated.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 |
* Use of this module is demonstrated by the associated script file |
9 |
* vesselTabulated.a4s. |
10 |
*) |
11 |
|
12 |
MODEL vessel( |
13 |
vessel_vol "the volume contained within the cylindrical vessel" |
14 |
WILL_BE volume; |
15 |
wall_thickness "the thickness of all of the vessel walls" |
16 |
WILL_BE distance; |
17 |
metal_density "density of the metal from which the vessel |
18 |
is constructed" |
19 |
WILL_BE mass_density; |
20 |
H_to_D_ratio "the ratio of vessel height to diameter" |
21 |
WILL_BE factor; |
22 |
metal_mass "the mass of the metal in the walls of the vessel" |
23 |
WILL_BE mass; |
24 |
); |
25 |
|
26 |
NOTES |
27 |
'author' SELF {Arthur W. Westerberg} |
28 |
'creation date' SELF {May, 1998} |
29 |
END NOTES; |
30 |
|
31 |
(* variables *) |
32 |
side_area "the area of the cylindrical side wall of the vessel", |
33 |
end_area "the area of the flat ends of the vessel" |
34 |
IS_A area; |
35 |
|
36 |
wall_vol "the volume of the walls for the vessel" |
37 |
IS_A volume; |
38 |
H "the vessel height (of the cylindrical side walls)", |
39 |
D "the vessel diameter" |
40 |
IS_A distance; |
41 |
|
42 |
(* equations *) |
43 |
FlatEnds: end_area = 1{PI} * D^2 / 4; |
44 |
Sides: side_area = 1{PI} * D * H; |
45 |
Cylinder: vessel_vol = end_area * H; |
46 |
Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol; |
47 |
HD_definition: D * H_to_D_ratio = H; |
48 |
VesselMass: metal_mass = metal_density * wall_vol; |
49 |
|
50 |
METHODS |
51 |
|
52 |
METHOD specify; |
53 |
NOTES |
54 |
'purpose' SELF {to fix four variables and make the problem well-posed} |
55 |
END NOTES; |
56 |
vessel_vol.fixed := TRUE; |
57 |
H_to_D_ratio.fixed := TRUE; |
58 |
wall_thickness.fixed := TRUE; |
59 |
metal_density.fixed := TRUE; |
60 |
END specify; |
61 |
|
62 |
METHOD values; |
63 |
NOTES |
64 |
'purpose' SELF {to set the values for the fixed variables} |
65 |
END NOTES; |
66 |
H_to_D_ratio := 2; |
67 |
vessel_vol := 250 {ft^3}; |
68 |
wall_thickness := 5 {mm}; |
69 |
metal_density := 5000 {kg/m^3}; |
70 |
END values; |
71 |
|
72 |
METHOD bound_self; |
73 |
END bound_self; |
74 |
|
75 |
METHOD bound_all; |
76 |
RUN bound_self; |
77 |
END bound_all; |
78 |
|
79 |
METHOD scale_self; |
80 |
END scale_self; |
81 |
|
82 |
METHOD scale_all; |
83 |
RUN scale_self; |
84 |
END scale_all; |
85 |
|
86 |
METHOD default_self; |
87 |
D := 1 {m}; |
88 |
H := 1 {m}; |
89 |
END default_self; |
90 |
|
91 |
METHOD default_all; |
92 |
RUN default_self; |
93 |
vessel_vol := 1 {m^3}; |
94 |
wall_thickness := 5 {mm}; |
95 |
metal_density := 5000 {kg/m^3}; |
96 |
H_to_D_ratio := 1; |
97 |
END default_all; |
98 |
|
99 |
END vessel; |
100 |
|
101 |
ADD NOTES IN vessel; |
102 |
'description' SELF {This model relates the dimensions of a |
103 |
cylindrical vessel -- e.g., diameter, height and wall thickness |
104 |
to the volume of metal in the walls. It uses a thin wall |
105 |
assumption -- i.e., that the volume of metal is the area of |
106 |
the vessel times the wall thickness.} |
107 |
'purpose' SELF {to illustrate the insertion of notes into a model} |
108 |
END NOTES; |
109 |
|
110 |
MODEL tabulated_vessel_values; |
111 |
vessel_volume "volume of all the tabulated vessels" |
112 |
IS_A volume; |
113 |
wall_thickness "thickness of all the walls for all the vessels" |
114 |
IS_A distance; |
115 |
metal_density "density of metal used for all vessels" |
116 |
IS_A mass_density; |
117 |
n_entries "number of vessels to simulate" |
118 |
IS_A integer_constant; |
119 |
n_entries :== 20; |
120 |
H_to_D_ratio[1..n_entries] "set of H to D ratios for which we are |
121 |
computing metal mass" |
122 |
IS_A factor; |
123 |
metal_mass[1..n_entries] "mass of metal in walls of vessels" |
124 |
IS_A mass; |
125 |
FOR i IN [1..n_entries] CREATE |
126 |
v[i] "the i-th vessel model" |
127 |
IS_A vessel(vessel_volume, wall_thickness, |
128 |
metal_density, H_to_D_ratio[i], metal_mass[i]); |
129 |
END FOR; |
130 |
|
131 |
METHODS |
132 |
|
133 |
METHOD default_self; |
134 |
END default_self; |
135 |
|
136 |
METHOD specify; |
137 |
RUN v[1..n_entries].specify; |
138 |
END specify; |
139 |
|
140 |
METHOD values; |
141 |
NOTES 'purpose' SELF {to set up 20 vessel models having H to D ratios |
142 |
ranging from 0.1 to 2.} |
143 |
END NOTES; |
144 |
vessel_volume := 250 {ft^3}; |
145 |
wall_thickness := 5 {mm}; |
146 |
metal_density := 5000 {kg/m^3}; |
147 |
FOR i IN [1..n_entries] DO |
148 |
H_to_D_ratio[i] := i/10.0; |
149 |
END FOR; |
150 |
END values; |
151 |
|
152 |
METHOD scale_self; |
153 |
END scale_self; |
154 |
|
155 |
END tabulated_vessel_values; |
156 |
|
157 |
ADD NOTES IN tabulated_vessel_values; |
158 |
'description' SELF {This model sets up an array of vessels to |
159 |
compute a range of metal_mass values for different values |
160 |
of H_to_D_ratio.} |
161 |
'purpose' SELF {to illustrate the use of arrays in ASCEND} |
162 |
END NOTES; |
163 |
|
164 |
|
165 |
(* |
166 |
* vesselTabulated.a4c |
167 |
* by Arthur W. Westerberg |
168 |
* Part of the ASCEND Library |
169 |
* $Date: 1998/06/17 19:35:07 $ |
170 |
* $Revision: 1.2 $ |
171 |
* $Author: mthomas $ |
172 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/vesselTabulated.a4c,v $ |
173 |
* |
174 |
* This file is part of the ASCEND Modeling Library. |
175 |
* |
176 |
* Copyright (C) 1998 Carnegie Mellon University |
177 |
* |
178 |
* The ASCEND Modeling Library is free software; you can redistribute |
179 |
* it and/or modify it under the terms of the GNU General Public |
180 |
* License as published by the Free Software Foundation; either |
181 |
* version 2 of the License, or (at your option) any later version. |
182 |
* |
183 |
* The ASCEND Modeling Library is distributed in hope that it |
184 |
* will be useful, but WITHOUT ANY WARRANTY; without even the implied |
185 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
186 |
* See the GNU General Public License for more details. |
187 |
* |
188 |
* You should have received a copy of the GNU General Public License |
189 |
* along with the program; if not, write to the Free Software |
190 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
191 |
* the file named COPYING. |
192 |
*) |