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

Contents of /trunk/models/plotbvp.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: 2567 byte(s)
Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)
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, see <http://www.gnu.org/licenses/>.
17 *)
18 REQUIRE "bvp.a4l";
19 REQUIRE "plot.a4l";
20 (*
21 This model demonstrates how to make a plot using a boundary value problem
22 (BVP).
23
24 by Benjamin Allan, May 17 1998.
25
26 @NOTE we avoid tangling plot modeling with the mathematics @ENDNOTE
27 *)
28
29 MODEL plotbvp;
30
31 bt IS_A bvp_test;
32
33 y[pointSet] ALIASES (bt.nodes[0 .. bt.nstep*bt.npoint].y[1])
34 WHERE pointSet IS_A set OF integer_constant
35 WITH_VALUE (0 .. bt.nstep*bt.npoint);
36
37 x[timeSet] ALIASES (bt.nodes[0 .. bt.nstep*bt.npoint].x)
38 WHERE timeSet IS_A set OF integer_constant
39 WITH_VALUE (0 .. bt.nstep*bt.npoint);
40
41
42 Y_curve IS_A plt_curve(pointSet,y,x);
43
44 (* Make Y_curve into the expected array for plt_plot *)
45 curves[curve_set] ALIASES (Y_curve) WHERE
46 curve_set IS_A set OF integer_constant;
47
48 Plot_Y IS_A plt_plot_integer(curve_set,curves);
49
50 METHODS
51
52 METHOD default_self;
53 (*
54 no defaults required here:
55 RUN Plot_Y.default_self;
56 RUN Y_curve.default_self;
57 *)
58 RUN bt.default_self;
59 Plot_Y.title := 'd/dx = 2x exp(-2t) cos(t)';
60 Plot_Y.XLabel := 'time t';
61 Plot_Y.YLabel := 'x';
62 Y_curve.legend := 'd/dx';
63 END default_self;
64
65 METHOD check_self;
66 RUN Plot_Y.check_self;
67 RUN Y_curve.check_self;
68 RUN bt.check_self;
69 END check_self;
70
71 METHOD scale_self;
72 RUN bt.scale_self;
73 END scale_self;
74
75 METHOD bound_self;
76 RUN Plot_Y.bound_self;
77 RUN Y_curve.bound_self;
78 RUN bt.bound_self;
79 END bound_self;
80
81 METHOD default_all;
82 RUN default_self;
83 END default_all;
84
85 METHOD check_all;
86 RUN check_self;
87 END check_all;
88
89 METHOD bound_all;
90 RUN bound_self;
91 END bound_all;
92
93 METHOD scale_all;
94 RUN scale_self;
95 END scale_all;
96
97 METHOD specify;
98 RUN bt.specify;
99 END specify;
100
101 METHOD values;
102 RUN bt.values;
103 END values;
104
105 METHOD on_load;
106 RUN reset;
107 RUN default_self;
108 RUN bound_self;
109 RUN scale_self;
110 RUN values;
111 END on_load;
112
113 END plotbvp;
114 (* :ex: set ts=4: *)

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