1 |
REQUIRE "bvp.a4l"; |
2 |
(* => bvp.a4l, atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
3 |
REQUIRE "plot.a4l"; |
4 |
(* => plot.a4l, atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
5 |
PROVIDE "plotbvp.a4c"; |
6 |
(* |
7 |
* This file is part of the ASCEND Modeling Library and is released |
8 |
* under the GNU Public License as described at the end of this file. |
9 |
*) |
10 |
|
11 |
MODEL plot_bvp_demo1; |
12 |
NOTES |
13 |
'purpose' SELF { |
14 |
This MODEL demonstrates how to make a plot out of a bvp MODEL. |
15 |
} |
16 |
'author' SELF {Benjamin Allan} |
17 |
'created' SELF {May 17, 1998} |
18 |
'revision' SELF {$Revision: 1.2 $} |
19 |
'comment' SELF { |
20 |
Once again, we avoid tangling plot modeling with the mathematics.} |
21 |
END NOTES; |
22 |
|
23 |
bt IS_A bvp_test; |
24 |
|
25 |
y[pointSet] ALIASES (bt.nodes[0 .. bt.nstep*bt.npoint].y[1]) |
26 |
WHERE pointSet IS_A set OF integer_constant |
27 |
WITH_VALUE (0 .. bt.nstep*bt.npoint); |
28 |
|
29 |
x[timeSet] ALIASES (bt.nodes[0 .. bt.nstep*bt.npoint].x) |
30 |
WHERE timeSet IS_A set OF integer_constant |
31 |
WITH_VALUE (0 .. bt.nstep*bt.npoint); |
32 |
|
33 |
|
34 |
Y_curve IS_A plt_curve(pointSet,y,x); |
35 |
|
36 |
(* Make Y_curve into the expected array for plt_plot *) |
37 |
curves[curve_set] ALIASES (Y_curve) WHERE |
38 |
curve_set IS_A set OF integer_constant; |
39 |
|
40 |
Plot_Y IS_A plt_plot_integer(curve_set,curves); |
41 |
|
42 |
METHODS |
43 |
|
44 |
METHOD default_self; |
45 |
RUN Plot_Y.default_self; |
46 |
RUN Y_curve.default_self; |
47 |
RUN bt.default_self; |
48 |
Plot_Y.title := 'd/dx = 2x exp(-2t) cos(t)'; |
49 |
Plot_Y.XLabel := 'time t'; |
50 |
Plot_Y.YLabel := 'x'; |
51 |
Y_curve.legend := 'd/dx'; |
52 |
END default_self; |
53 |
|
54 |
METHOD check_self; |
55 |
RUN Plot_Y.check_self; |
56 |
RUN Y_curve.check_self; |
57 |
RUN bt.check_self; |
58 |
END check_self; |
59 |
|
60 |
METHOD scale_self; |
61 |
RUN bt.scale_self; |
62 |
END scale_self; |
63 |
|
64 |
METHOD bound_self; |
65 |
RUN Plot_Y.bound_self; |
66 |
RUN Y_curve.bound_self; |
67 |
RUN bt.bound_self; |
68 |
END bound_self; |
69 |
|
70 |
METHOD default_all; |
71 |
RUN default_self; |
72 |
END default_all; |
73 |
|
74 |
METHOD check_all; |
75 |
RUN check_self; |
76 |
END check_all; |
77 |
|
78 |
METHOD bound_all; |
79 |
RUN bound_self; |
80 |
END bound_all; |
81 |
|
82 |
METHOD scale_all; |
83 |
RUN scale_self; |
84 |
END scale_all; |
85 |
|
86 |
METHOD specify; |
87 |
RUN bt.reset; |
88 |
END specify; |
89 |
|
90 |
END plot_bvp_demo1; |
91 |
|
92 |
|
93 |
(* |
94 |
* plotbvp.a4c |
95 |
* by Ben Allan |
96 |
* May 1998 |
97 |
* Part of the ASCEND Library |
98 |
* $Date: 1998/06/17 19:21:54 $ |
99 |
* $Revision: 1.2 $ |
100 |
* $Author: mthomas $ |
101 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/plotbvp.a4c,v $ |
102 |
* |
103 |
* This file is part of the ASCEND Modeling Library. |
104 |
* |
105 |
* Copyright (C) 1997 Benjamin Andrew Allan |
106 |
* |
107 |
* The ASCEND Modeling Library is free software; you can redistribute |
108 |
* it and/or modify it under the terms of the GNU General Public |
109 |
* License as published by the Free Software Foundation; either |
110 |
* version 2 of the License, or (at your option) any later version. |
111 |
* |
112 |
* The ASCEND Modeling Library is distributed in hope that it |
113 |
* will be useful, but WITHOUT ANY WARRANTY; without even the implied |
114 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
115 |
* See the GNU General Public License for more details. |
116 |
* |
117 |
* You should have received a copy of the GNU General Public License |
118 |
* along with the program; if not, write to the Free Software |
119 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
120 |
* the file named COPYING. |
121 |
*) |