1 |
REQUIRE "atoms.a4l"; |
2 |
(* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
3 |
REQUIRE "plot.a4l"; |
4 |
(* => plot.a4l, atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
5 |
PROVIDE "vesselPlot.a4c"; |
6 |
(* |
7 |
* This file is part of the ASCEND Modeling Library and is released |
8 |
* under the GNU Public License as described at the end of this file. |
9 |
* |
10 |
* Use of this module is demonstrated by the associated script file |
11 |
* vesselPlot.a4s. |
12 |
*) |
13 |
|
14 |
MODEL vessel( |
15 |
vessel_vol WILL_BE volume; |
16 |
wall_thickness WILL_BE distance; |
17 |
metal_density WILL_BE mass_density; |
18 |
H_to_D_ratio WILL_BE factor; |
19 |
metal_mass WILL_BE mass; |
20 |
); |
21 |
|
22 |
NOTES 'purpose' SELF { |
23 |
This model relates the mass of metal in the walls to the diameter |
24 |
and height of a thin-walled storage vessel. The vessel is cylindrical |
25 |
with two flat ends. Extensive documentation exist for this model to |
26 |
teach a new user of ascend how to write, debug, and run ASCEND |
27 |
models. |
28 |
} |
29 |
END NOTES; |
30 |
|
31 |
(* variables *) |
32 |
side_area, end_area IS_A area; |
33 |
wall_vol IS_A volume; |
34 |
H, D IS_A distance; |
35 |
|
36 |
(* equations *) |
37 |
FlatEnds: end_area = 1{PI} * D^2 / 4; |
38 |
Sides: side_area = 1{PI} * D * H; |
39 |
Cylinder: vessel_vol = end_area * H; |
40 |
Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol; |
41 |
HD_definition: D * H_to_D_ratio = H; |
42 |
VesselMass: metal_mass = metal_density * wall_vol; |
43 |
|
44 |
METHODS |
45 |
|
46 |
METHOD default_self; |
47 |
D := 1 {m}; |
48 |
H := 1 {m}; |
49 |
END default_self; |
50 |
|
51 |
METHOD specify; |
52 |
vessel_vol.fixed := TRUE; |
53 |
H_to_D_ratio.fixed := TRUE; |
54 |
wall_thickness.fixed := TRUE; |
55 |
metal_density.fixed := TRUE; |
56 |
END specify; |
57 |
|
58 |
METHOD values; |
59 |
H_to_D_ratio := 2; |
60 |
vessel_vol := 250 {ft^3}; |
61 |
wall_thickness := 5 {mm}; |
62 |
metal_density := 5000 {kg/m^3}; |
63 |
END values; |
64 |
|
65 |
END vessel; |
66 |
|
67 |
MODEL tabulated_vessel_values; |
68 |
vessel_volume IS_A volume; |
69 |
wall_thickness IS_A distance; |
70 |
metal_density IS_A mass_density; |
71 |
|
72 |
n_entries IS_A integer_constant; |
73 |
n_entries :== 20; |
74 |
|
75 |
H_to_D_ratio[1..n_entries] IS_A factor; |
76 |
metal_mass[1..n_entries] IS_A mass; |
77 |
|
78 |
FOR i IN [1..n_entries] CREATE |
79 |
v[i] IS_A vessel(vessel_volume, wall_thickness, |
80 |
metal_density, H_to_D_ratio[i], metal_mass[i]); |
81 |
END FOR; |
82 |
|
83 |
CurveSet IS_A set OF symbol_constant; |
84 |
CurveSet :== ['5 mm']; |
85 |
|
86 |
Curves['5 mm'] IS_A plt_curve([1..n_entries], metal_mass, |
87 |
H_to_D_ratio); |
88 |
|
89 |
massVSratio IS_A plt_plot_symbol(CurveSet, Curves); |
90 |
|
91 |
METHODS |
92 |
|
93 |
METHOD default_self; |
94 |
(* set the title for the plot and the labels for the ordinate and abscissa |
95 |
*) |
96 |
massVSratio.title := |
97 |
'Metal mass of the walls vs H to D ratio for a thin-walled cylindrical vessel'; |
98 |
massVSratio.XLabel := 'H to D ratio'; |
99 |
massVSratio.YLabel := 'metal mass IN kg/m^3'; |
100 |
END default_self; |
101 |
|
102 |
METHOD specify; |
103 |
RUN v[1..n_entries].specify; |
104 |
END specify; |
105 |
|
106 |
METHOD values; |
107 |
vessel_volume := 250 {ft^3}; |
108 |
wall_thickness := 5 {mm}; |
109 |
metal_density := 5000 {kg/m^3}; |
110 |
FOR i IN [1..n_entries] DO |
111 |
H_to_D_ratio[i] := i/10.0; |
112 |
END FOR; |
113 |
END values; |
114 |
|
115 |
METHOD scale_self; |
116 |
END scale_self; |
117 |
|
118 |
END tabulated_vessel_values; |
119 |
|
120 |
|
121 |
(* |
122 |
* vesselPlot.a4c |
123 |
* by Arthur W. Westerberg |
124 |
* Part of the ASCEND Library |
125 |
* $Date: 1998/06/17 19:35:06 $ |
126 |
* $Revision: 1.2 $ |
127 |
* $Author: mthomas $ |
128 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/vesselPlot.a4c,v $ |
129 |
* |
130 |
* This file is part of the ASCEND Modeling Library. |
131 |
* |
132 |
* Copyright (C) 1998 Carnegie Mellon University |
133 |
* |
134 |
* The ASCEND Modeling Library is free software; you can redistribute |
135 |
* it and/or modify it under the terms of the GNU General Public |
136 |
* License as published by the Free Software Foundation; either |
137 |
* version 2 of the License, or (at your option) any later version. |
138 |
* |
139 |
* The ASCEND Modeling Library is distributed in hope that it |
140 |
* will be useful, but WITHOUT ANY WARRANTY; without even the implied |
141 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
142 |
* See the GNU General Public License for more details. |
143 |
* |
144 |
* You should have received a copy of the GNU General Public License |
145 |
* along with the program; if not, write to the Free Software |
146 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
147 |
* the file named COPYING. |
148 |
* |
149 |
*) |