1 |
REQUIRE "atoms.a4l"; |
2 |
(* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
3 |
PROVIDE "vessel.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 |
|
9 |
MODEL vessel; |
10 |
|
11 |
(* variables *) |
12 |
side_area, end_area IS_A area; |
13 |
vessel_vol, wall_vol IS_A volume; |
14 |
wall_thickness, H, D IS_A distance; |
15 |
H_to_D_ratio IS_A factor; |
16 |
metal_density IS_A mass_density; |
17 |
metal_mass IS_A mass; |
18 |
|
19 |
(* equations *) |
20 |
FlatEnds: end_area = 1{PI} * D^2 / 4; |
21 |
Sides: side_area = 1{PI} * D * H; |
22 |
Cylinder: vessel_vol = end_area * H; |
23 |
Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol; |
24 |
HD_definition: D * H_to_D_ratio = H; |
25 |
VesselMass: metal_mass = metal_density * wall_vol; |
26 |
|
27 |
METHODS |
28 |
|
29 |
METHOD defaults; |
30 |
H_to_D_ratio := 2; |
31 |
END defaults; |
32 |
|
33 |
METHOD clear; |
34 |
side_area.fixed := FALSE; |
35 |
end_area.fixed := FALSE; |
36 |
vessel_vol.fixed := FALSE; |
37 |
wall_vol.fixed := FALSE; |
38 |
wall_thickness.fixed := FALSE; |
39 |
H.fixed := FALSE; |
40 |
D.fixed := FALSE; |
41 |
H_to_D_ratio.fixed := FALSE; |
42 |
metal_density.fixed := FALSE; |
43 |
metal_mass.fixed := FALSE; |
44 |
END clear; |
45 |
|
46 |
METHOD specify; |
47 |
vessel_vol.fixed := TRUE; |
48 |
H_to_D_ratio.fixed := TRUE; |
49 |
wall_thickness.fixed := TRUE; |
50 |
metal_density.fixed := TRUE; |
51 |
END specify; |
52 |
|
53 |
METHOD reset; |
54 |
RUN clear; |
55 |
RUN specify; |
56 |
END reset; |
57 |
|
58 |
METHOD values; |
59 |
vessel_vol := 250 {ft^3}; |
60 |
wall_thickness := 5 {mm}; |
61 |
metal_density := 13000 {kg/m^3}; |
62 |
END values; |
63 |
|
64 |
END vessel; |
65 |
|
66 |
MODEL vessel_optimize REFINES vessel; |
67 |
|
68 |
cost IS_A monetary_unit; |
69 |
a IS_A cost_per_volume; |
70 |
|
71 |
obj1def: cost = a * wall_thickness * (side_area + 2*(4/1{PI})*end_area); |
72 |
|
73 |
obj1: MINIMIZE cost; |
74 |
|
75 |
METHODS |
76 |
|
77 |
METHOD clear; |
78 |
side_area.fixed := FALSE; |
79 |
end_area.fixed := FALSE; |
80 |
vessel_vol.fixed := FALSE; |
81 |
wall_vol.fixed := FALSE; |
82 |
wall_thickness.fixed := FALSE; |
83 |
H.fixed := FALSE; |
84 |
D.fixed := FALSE; |
85 |
H_to_D_ratio.fixed := FALSE; |
86 |
metal_density.fixed := FALSE; |
87 |
metal_mass.fixed := FALSE; |
88 |
cost.fixed := FALSE; |
89 |
a.fixed := FALSE; |
90 |
END clear; |
91 |
|
92 |
METHOD specify; |
93 |
vessel_vol.fixed := TRUE; |
94 |
wall_thickness.fixed := TRUE; |
95 |
metal_density.fixed := TRUE; |
96 |
a.fixed := TRUE; |
97 |
END specify; |
98 |
|
99 |
METHOD min_cost; |
100 |
RUN clear; |
101 |
RUN specify; |
102 |
END min_cost; |
103 |
|
104 |
METHOD values; |
105 |
vessel_vol := 250 {ft^3}; |
106 |
wall_thickness := 5 {mm}; |
107 |
metal_density := 13000 {kg/m^3}; |
108 |
|
109 |
(* a is the cost per cubic foot of metal. rather arbitrary. *) |
110 |
a := 10 {USD}; |
111 |
END values; |
112 |
|
113 |
END vessel_optimize; |
114 |
|
115 |
(* |
116 |
* vessel.a4c |
117 |
* by Arthur W Westerberg, Benjamin A Allan |
118 |
* Part of the ASCEND Library |
119 |
* $Date: 1998/06/17 19:35:43 $ |
120 |
* $Revision: 1.3 $ |
121 |
* $Author: mthomas $ |
122 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/vessel.a4c,v $ |
123 |
* |
124 |
* This file is part of the ASCEND Modeling Library. |
125 |
* |
126 |
* Copyright (C) 1998 Carnegie Mellon University |
127 |
* |
128 |
* The ASCEND Modeling Library is free software; you can redistribute |
129 |
* it and/or modify it under the terms of the GNU General Public |
130 |
* License as published by the Free Software Foundation; either |
131 |
* version 2 of the License, or (at your option) any later version. |
132 |
* |
133 |
* The ASCEND Modeling Library is distributed in hope that it |
134 |
* will be useful, but WITHOUT ANY WARRANTY; without even the implied |
135 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
136 |
* See the GNU General Public License for more details. |
137 |
* |
138 |
* You should have received a copy of the GNU General Public License |
139 |
* along with the program; if not, write to the Free Software |
140 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. |
141 |
*) |