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

Annotation of /trunk/models/vessel.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2649 - (hide 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 johnpye 1294 (* 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 jpye 2649 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 johnpye 1294 *)
17     REQUIRE "atoms.a4l"; (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *)
18 aw0a 1 (*
19 johnpye 1294 by Arthur W Westerberg, Benjamin A Allan and John Pye
20 aw0a 1
21 johnpye 1294 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 aw0a 1 MODEL vessel;
34    
35     (* variables *)
36 johnpye 1294 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 aw0a 1
43     (* equations *)
44 johnpye 1294 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 aw0a 1
51     METHODS
52 johnpye 1294 METHOD default;
53     H_to_D_ratio := 2;
54     END default;
55 aw0a 1
56     METHOD specify;
57 johnpye 1294 FIX vessel_vol;
58     FIX H_to_D_ratio;
59     FIX wall_thickness;
60     FIX metal_density;
61 aw0a 1 END specify;
62    
63     METHOD values;
64 johnpye 1294 vessel_vol := 250 {ft^3};
65     wall_thickness := 5 {mm};
66     metal_density := 13000 {kg/m^3};
67 aw0a 1 END values;
68    
69 johnpye 1294 METHOD on_load;
70     RUN default_self;
71     RUN reset;
72     RUN values;
73     END on_load;
74 aw0a 1 END vessel;
75    
76 jpye 1621
77 aw0a 1 MODEL vessel_optimize REFINES vessel;
78    
79 johnpye 1294 cost IS_A monetary_unit;
80     a IS_A cost_per_volume;
81 aw0a 1
82     obj1def: cost = a * wall_thickness * (side_area + 2*(4/1{PI})*end_area);
83    
84 johnpye 1294 obj1: MINIMIZE cost;
85 aw0a 1
86 johnpye 1294 METHODS
87 aw0a 1 METHOD specify;
88 johnpye 1294 FIX vessel_vol;
89     FIX wall_thickness;
90     FIX metal_density;
91     FIX a;
92 aw0a 1 END specify;
93    
94     METHOD values;
95 johnpye 1294 vessel_vol := 250 {ft^3};
96     wall_thickness := 5 {mm};
97     metal_density := 13000 {kg/m^3};
98 aw0a 1
99 johnpye 1294 (* a is the cost per cubic foot of metal. rather arbitrary. *)
100     a := 10 {USD/m^3};
101 aw0a 1 END values;
102    
103 johnpye 1294 METHOD on_load;
104     RUN default_self;
105     RUN reset;
106     RUN values;
107     END on_load;
108 jpye 1621 END vessel_optimize;
109 johnpye 1294

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