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

Contents of /trunk/models/plotbvp.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1158 - (show annotations) (download) (as text)
Tue Jan 16 12:44:13 2007 UTC (17 years, 6 months ago) by johnpye
File MIME type: text/x-ascend
File size: 2476 byte(s)
More reformatting of model files. Note that plotbvp seems to be broken at present.
1 (* ASCEND modelling environment
2 Copyright (C) 1997 Benjamin Andrew Allan
3 Copyright (C) 2006 Carnegie Mellon University
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 *)
20 REQUIRE "bvp.a4l";
21 REQUIRE "plot.a4l";
22 (*
23 This model demonstrates how to make a plot using a boundary value problem
24 (BVP).
25
26 by Benjamin Allan, May 17 1998.
27
28 @NOTE we avoid tangling plot modeling with the mathematics @ENDNOTE
29 *)
30
31 MODEL plotbvp;
32
33 bt IS_A bvp_test;
34
35 y[pointSet] ALIASES (bt.nodes[0 .. bt.nstep*bt.npoint].y[1])
36 WHERE pointSet IS_A set OF integer_constant
37 WITH_VALUE (0 .. bt.nstep*bt.npoint);
38
39 x[timeSet] ALIASES (bt.nodes[0 .. bt.nstep*bt.npoint].x)
40 WHERE timeSet IS_A set OF integer_constant
41 WITH_VALUE (0 .. bt.nstep*bt.npoint);
42
43
44 Y_curve IS_A plt_curve(pointSet,y,x);
45
46 (* Make Y_curve into the expected array for plt_plot *)
47 curves[curve_set] ALIASES (Y_curve) WHERE
48 curve_set IS_A set OF integer_constant;
49
50 Plot_Y IS_A plt_plot_integer(curve_set,curves);
51
52 METHODS
53
54 METHOD default_self;
55 RUN Plot_Y.default_self;
56 RUN Y_curve.default_self;
57 RUN bt.default_self;
58 Plot_Y.title := 'd/dx = 2x exp(-2t) cos(t)';
59 Plot_Y.XLabel := 'time t';
60 Plot_Y.YLabel := 'x';
61 Y_curve.legend := 'd/dx';
62 END default_self;
63
64 METHOD check_self;
65 RUN Plot_Y.check_self;
66 RUN Y_curve.check_self;
67 RUN bt.check_self;
68 END check_self;
69
70 METHOD scale_self;
71 RUN bt.scale_self;
72 END scale_self;
73
74 METHOD bound_self;
75 RUN Plot_Y.bound_self;
76 RUN Y_curve.bound_self;
77 RUN bt.bound_self;
78 END bound_self;
79
80 METHOD default_all;
81 RUN default_self;
82 END default_all;
83
84 METHOD check_all;
85 RUN check_self;
86 END check_all;
87
88 METHOD bound_all;
89 RUN bound_self;
90 END bound_all;
91
92 METHOD scale_all;
93 RUN scale_self;
94 END scale_all;
95
96 METHOD specify;
97 RUN bt.reset;
98 END specify;
99
100 METHOD on_load;
101 RUN reset;
102 END on_load;
103
104 END plotbvp;
105 (* :ex: set ts=4: *)

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