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

Annotation of /trunk/models/plotbvp.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: 2567 byte(s)
Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)
1 johnpye 1158 (* 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 jpye 2649 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 johnpye 1158 *)
18 aw0a 1 REQUIRE "bvp.a4l";
19     REQUIRE "plot.a4l";
20     (*
21 johnpye 1158 This model demonstrates how to make a plot using a boundary value problem
22     (BVP).
23 aw0a 1
24 johnpye 1158 by Benjamin Allan, May 17 1998.
25 aw0a 1
26 johnpye 1158 @NOTE we avoid tangling plot modeling with the mathematics @ENDNOTE
27     *)
28    
29     MODEL plotbvp;
30    
31 aw0a 1 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 johnpye 1158 METHOD default_self;
53 jpye 2314 (*
54     no defaults required here:
55 johnpye 1158 RUN Plot_Y.default_self;
56     RUN Y_curve.default_self;
57 jpye 2314 *)
58 johnpye 1158 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 aw0a 1
65 johnpye 1158 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 aw0a 1
71 johnpye 1158 METHOD scale_self;
72     RUN bt.scale_self;
73     END scale_self;
74 aw0a 1
75 johnpye 1158 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 aw0a 1
81 johnpye 1158 METHOD default_all;
82     RUN default_self;
83     END default_all;
84 aw0a 1
85 johnpye 1158 METHOD check_all;
86     RUN check_self;
87     END check_all;
88 aw0a 1
89 johnpye 1158 METHOD bound_all;
90     RUN bound_self;
91     END bound_all;
92 aw0a 1
93 johnpye 1158 METHOD scale_all;
94     RUN scale_self;
95     END scale_all;
96 aw0a 1
97 johnpye 1158 METHOD specify;
98 jpye 2314 RUN bt.specify;
99 johnpye 1158 END specify;
100 aw0a 1
101 jpye 2314 METHOD values;
102     RUN bt.values;
103     END values;
104    
105 johnpye 1158 METHOD on_load;
106     RUN reset;
107 johnpye 1198 RUN default_self;
108 jpye 2314 RUN bound_self;
109     RUN scale_self;
110     RUN values;
111 johnpye 1158 END on_load;
112 aw0a 1
113 johnpye 1158 END plotbvp;
114     (* :ex: set ts=4: *)

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