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

Contents of /trunk/models/vessel.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2649 - (show annotations) (download) (as text)
Wed Dec 12 12:39:25 2012 UTC (11 years, 6 months ago) by jpye
File MIME type: text/x-ascend
File size: 3071 byte(s)
Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)
1 (* ASCEND modelling environment
2 Copyright (C) 1998, 2007 Carnegie Mellon University
3
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, see <http://www.gnu.org/licenses/>.
16 *)
17 REQUIRE "atoms.a4l"; (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *)
18 (*
19 by Arthur W Westerberg, Benjamin A Allan and John Pye
20
21 This file contains two model declarations. The first is a 'full-blown'
22 vessel model build by extending the declaration from vesselPlain.a4c. This
23 new model contains a number of initialisation routines that ensure that
24 the model can easily be put into a solvable state. The model also contains
25 a 'values' method that defines the base case for which we are solving.
26
27 The second model in this file is an optimisation problem. Here, we are
28 REFINING the earlier 'vessel' model with the addition of an objective
29 function (see the 'OPTIMIZE' statement). We can then load the model and
30 optimise it.
31 *)
32
33 MODEL vessel;
34
35 (* variables *)
36 side_area, end_area IS_A area;
37 vessel_vol, wall_vol IS_A volume;
38 wall_thickness, H, D IS_A distance;
39 H_to_D_ratio IS_A factor;
40 metal_density IS_A mass_density;
41 metal_mass IS_A mass;
42
43 (* equations *)
44 FlatEnds: end_area = 1{PI} * D^2 / 4;
45 Sides: side_area = 1{PI} * D * H;
46 Cylinder: vessel_vol = end_area * H;
47 Metal_volume: (side_area + 2 * end_area) * wall_thickness = wall_vol;
48 HD_definition: D * H_to_D_ratio = H;
49 VesselMass: metal_mass = metal_density * wall_vol;
50
51 METHODS
52 METHOD default;
53 H_to_D_ratio := 2;
54 END default;
55
56 METHOD specify;
57 FIX vessel_vol;
58 FIX H_to_D_ratio;
59 FIX wall_thickness;
60 FIX metal_density;
61 END specify;
62
63 METHOD values;
64 vessel_vol := 250 {ft^3};
65 wall_thickness := 5 {mm};
66 metal_density := 13000 {kg/m^3};
67 END values;
68
69 METHOD on_load;
70 RUN default_self;
71 RUN reset;
72 RUN values;
73 END on_load;
74 END vessel;
75
76
77 MODEL vessel_optimize REFINES vessel;
78
79 cost IS_A monetary_unit;
80 a IS_A cost_per_volume;
81
82 obj1def: cost = a * wall_thickness * (side_area + 2*(4/1{PI})*end_area);
83
84 obj1: MINIMIZE cost;
85
86 METHODS
87 METHOD specify;
88 FIX vessel_vol;
89 FIX wall_thickness;
90 FIX metal_density;
91 FIX a;
92 END specify;
93
94 METHOD values;
95 vessel_vol := 250 {ft^3};
96 wall_thickness := 5 {mm};
97 metal_density := 13000 {kg/m^3};
98
99 (* a is the cost per cubic foot of metal. rather arbitrary. *)
100 a := 10 {USD/m^3};
101 END values;
102
103 METHOD on_load;
104 RUN default_self;
105 RUN reset;
106 RUN values;
107 END on_load;
108 END vessel_optimize;

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