/[ascend]/trunk/models/johnpye/extpy/extpytest.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/extpy/extpytest.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 875 - (show annotations) (download) (as text)
Sat Oct 7 06:26:34 2006 UTC (19 years, 1 month ago) by johnpye
File MIME type: text/x-ascend
File size: 693 byte(s)
Can now access the ASCEND model from an external python script method. The API is not at all nice, but it's basically working now.
1 REQUIRE "atoms.a4l";
2 IMPORT "johnpye/extpy/extpy";
3 IMPORT "johnpye/extpy/extpytest";
4
5 (*
6 A very simple model to illustrate the possibility to accessing a model
7 from an external python script during an interactive ASCEND session.
8 *)
9 MODEL extpytest;
10
11 a IS_A factor;
12 b IS_A factor;
13
14 x_1,y_1 IS_A delta_distance;
15 x_2,y_2 IS_A delta_distance;
16 y_1 = a * x_1 + b;
17 y_2 = a * x_2 + b;
18
19 METHODS
20 METHOD specify;
21 FIX x_1,y_1;
22 FIX x_2,y_2;
23 END specify;
24 METHOD values;
25 x_1 := 0{m};
26 y_1 := 1{m};
27 x_2 := 1{m};
28 y_2 := 0{m};
29 END values;
30 METHOD on_load;
31 RUN reset; RUN values;
32 RUN pythonthing;
33 END on_load;
34 METHOD pythonthing;
35 EXTERNAL mypythonmethod(SELF);
36 END pythonthing;
37
38 END extpytest;

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