1 |
REQUIRE "atoms.a4l"; |
(* ASCEND modelling environment |
2 |
(* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
Copyright (C) 1998, 2007 Carnegie Mellon University |
3 |
PROVIDE "vessel.a4c"; |
|
4 |
|
This program is free software; you can redistribute it and/or modify |
5 |
|
it under the terms of the GNU General Public License as published by |
6 |
|
the Free Software Foundation; either version 2, or (at your option) |
7 |
|
any later version. |
8 |
|
|
9 |
|
This program is distributed in the hope that it will be useful, |
10 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
|
GNU General Public License for more details. |
13 |
|
|
14 |
|
You should have received a copy of the GNU General Public License |
15 |
|
along with this program; if not, write to the Free Software |
16 |
|
Foundation, Inc., 59 Temple Place - Suite 330, |
17 |
|
Boston, MA 02111-1307, USA. |
18 |
|
*) |
19 |
|
REQUIRE "atoms.a4l"; (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
20 |
(* |
(* |
21 |
* This file is part of the ASCEND Modeling Library and is released |
by Arthur W Westerberg, Benjamin A Allan and John Pye |
22 |
* under the GNU Public License as described at the end of this file. |
|
23 |
*) |
This file contains two model declarations. The first is a 'full-blown' |
24 |
|
vessel model build by extending the declaration from vesselPlain.a4c. This |
25 |
|
new model contains a number of initialisation routines that ensure that |
26 |
|
the model can easily be put into a solvable state. The model also contains |
27 |
|
a 'values' method that defines the base case for which we are solving. |
28 |
|
|
29 |
|
The second model in this file is an optimisation problem. Here, we are |
30 |
|
REFINING the earlier 'vessel' model with the addition of an objective |
31 |
|
function (see the 'OPTIMIZE' statement). We can then load the model and |
32 |
|
optimise it. |
33 |
|
*) |
34 |
|
|
35 |
MODEL vessel; |
MODEL vessel; |
36 |
|
|
37 |
(* variables *) |
(* variables *) |
38 |
side_area, end_area IS_A area; |
side_area, end_area IS_A area; |
39 |
vessel_vol, wall_vol IS_A volume; |
vessel_vol, wall_vol IS_A volume; |
40 |
wall_thickness, H, D IS_A distance; |
wall_thickness, H, D IS_A distance; |
41 |
H_to_D_ratio IS_A factor; |
H_to_D_ratio IS_A factor; |
42 |
metal_density IS_A mass_density; |
metal_density IS_A mass_density; |
43 |
metal_mass IS_A mass; |
metal_mass IS_A mass; |
44 |
|
|
45 |
(* equations *) |
(* equations *) |
46 |
FlatEnds: end_area = 1{PI} * D^2 / 4; |
FlatEnds: end_area = 1{PI} * D^2 / 4; |
47 |
Sides: side_area = 1{PI} * D * H; |
Sides: side_area = 1{PI} * D * H; |
48 |
Cylinder: vessel_vol = end_area * H; |
Cylinder: vessel_vol = end_area * H; |
49 |
Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol; |
Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol; |
50 |
HD_definition: D * H_to_D_ratio = H; |
HD_definition: D * H_to_D_ratio = H; |
51 |
VesselMass: metal_mass = metal_density * wall_vol; |
VesselMass: metal_mass = metal_density * wall_vol; |
52 |
|
|
53 |
METHODS |
METHODS |
54 |
|
|
55 |
METHOD defaults; |
METHOD default; |
56 |
H_to_D_ratio := 2; |
H_to_D_ratio := 2; |
57 |
END defaults; |
END default; |
|
|
|
|
METHOD clear; |
|
|
FREE side_area; |
|
|
FREE end_area; |
|
|
FREE vessel_vol; |
|
|
FREE wall_vol; |
|
|
FREE wall_thickness; |
|
|
FREE H; |
|
|
FREE D; |
|
|
FREE H_to_D_ratio; |
|
|
FREE metal_density; |
|
|
FREE metal_mass; |
|
|
END clear; |
|
58 |
|
|
59 |
METHOD specify; |
METHOD specify; |
60 |
FIX vessel_vol; |
FIX vessel_vol; |
61 |
FIX H_to_D_ratio; |
FIX H_to_D_ratio; |
62 |
FIX wall_thickness; |
FIX wall_thickness; |
63 |
FIX metal_density; |
FIX metal_density; |
64 |
END specify; |
END specify; |
65 |
|
|
|
METHOD reset; |
|
|
RUN clear; |
|
|
RUN specify; |
|
|
END reset; |
|
|
|
|
66 |
METHOD values; |
METHOD values; |
67 |
vessel_vol := 250 {ft^3}; |
vessel_vol := 250 {ft^3}; |
68 |
wall_thickness := 5 {mm}; |
wall_thickness := 5 {mm}; |
69 |
metal_density := 13000 {kg/m^3}; |
metal_density := 13000 {kg/m^3}; |
70 |
END values; |
END values; |
71 |
|
|
72 |
|
METHOD on_load; |
73 |
|
RUN default_self; |
74 |
|
RUN reset; |
75 |
|
RUN values; |
76 |
|
END on_load; |
77 |
|
|
78 |
END vessel; |
END vessel; |
79 |
|
|
80 |
MODEL vessel_optimize REFINES vessel; |
MODEL vessel_optimize REFINES vessel; |
81 |
|
|
82 |
cost IS_A monetary_unit; |
cost IS_A monetary_unit; |
83 |
a IS_A cost_per_volume; |
a IS_A cost_per_volume; |
84 |
|
|
85 |
obj1def: cost = a * wall_thickness * (side_area + 2*(4/1{PI})*end_area); |
obj1def: cost = a * wall_thickness * (side_area + 2*(4/1{PI})*end_area); |
86 |
|
|
87 |
obj1: MINIMIZE cost; |
obj1: MINIMIZE cost; |
|
|
|
|
METHODS |
|
88 |
|
|
89 |
METHOD clear; |
METHODS |
|
FREE side_area; |
|
|
FREE end_area; |
|
|
FREE vessel_vol; |
|
|
FREE wall_vol; |
|
|
FREE wall_thickness; |
|
|
FREE H; |
|
|
FREE D; |
|
|
FREE H_to_D_ratio; |
|
|
FREE metal_density; |
|
|
FREE metal_mass; |
|
|
FREE cost; |
|
|
FREE a; |
|
|
END clear; |
|
90 |
|
|
91 |
METHOD specify; |
METHOD specify; |
92 |
FIX vessel_vol; |
FIX vessel_vol; |
93 |
FIX wall_thickness; |
FIX wall_thickness; |
94 |
FIX metal_density; |
FIX metal_density; |
95 |
FIX a; |
FIX a; |
96 |
END specify; |
END specify; |
97 |
|
|
|
METHOD min_cost; |
|
|
RUN clear; |
|
|
RUN specify; |
|
|
END min_cost; |
|
|
|
|
98 |
METHOD values; |
METHOD values; |
99 |
vessel_vol := 250 {ft^3}; |
vessel_vol := 250 {ft^3}; |
100 |
wall_thickness := 5 {mm}; |
wall_thickness := 5 {mm}; |
101 |
metal_density := 13000 {kg/m^3}; |
metal_density := 13000 {kg/m^3}; |
102 |
|
|
103 |
(* a is the cost per cubic foot of metal. rather arbitrary. *) |
(* a is the cost per cubic foot of metal. rather arbitrary. *) |
104 |
a := 10 {USD}; |
a := 10 {USD/m^3}; |
105 |
END values; |
END values; |
106 |
|
|
107 |
END vessel_optimize; |
METHOD on_load; |
108 |
|
RUN default_self; |
109 |
|
RUN reset; |
110 |
|
RUN values; |
111 |
|
END on_load; |
112 |
|
|
113 |
(* |
END vessel_optimize; |
|
* vessel.a4c |
|
|
* by Arthur W Westerberg, Benjamin A Allan |
|
|
* Part of the ASCEND Library |
|
|
* $Date: 1998/06/17 19:35:43 $ |
|
|
* $Revision: 1.3 $ |
|
|
* $Author: mthomas $ |
|
|
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/vessel.a4c,v $ |
|
|
* |
|
|
* This file is part of the ASCEND Modeling Library. |
|
|
* |
|
|
* Copyright (C) 1998 Carnegie Mellon University |
|
|
* |
|
|
* The ASCEND Modeling Library is free software; you can redistribute |
|
|
* it and/or modify it under the terms of the GNU General Public |
|
|
* License as published by the Free Software Foundation; either |
|
|
* version 2 of the License, or (at your option) any later version. |
|
|
* |
|
|
* The ASCEND Modeling Library is distributed in hope that it |
|
|
* will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
|
* See the GNU General Public License for more details. |
|
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with the program; if not, write to the Free Software |
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. |
|
|
*) |
|