16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# Copyright (c) P.J.Gawthrop 1997.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.2 1997/01/21 22:57:17 peterg
# Various bug fixes.
#
## Revision 1.1 1997/01/21 10:52:23 peterg
## Initial revision
##
###############################################################
|
>
>
>
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# Copyright (c) P.J.Gawthrop 1997.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.3 1997/03/20 14:51:11 peterg
# Includes the sympar.c file.
#
# Revision 1.2 1997/01/21 22:57:17 peterg
# Various bug fixes.
#
## Revision 1.1 1997/01/21 10:52:23 peterg
## Initial revision
##
###############################################################
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
write "void $1_ode()"$
write " "$
write "{"$
write "/* Declare standard arrays */"$
write " extern double y[", MTTNy+1, "]; /* $1_ode output */"$
write " extern double dx[", MTTNx+1, "]; /* $1_ode state derivative */"$
write " extern double x[", MTTNx+1, "]; /* $1_ode state */"$
write " extern double u[", MTTNu+1, "]; /* $1_ode input */"$
%Declare the dummy variables t0--t9
write "/* Dummy variable list */ "$
write " double t0;"$
FOR i := 1:9 DO
BEGIN
write " double t", i, ";"$
END$
%Declarations$
write "/* State variable list */ "$
FOR i := 1:MTTNx DO
BEGIN
write " double mttx", i, ";"$
END$
write "/* Input variable list */ "$
FOR i := 1:MTTNu DO
BEGIN
write " double mttu", i, ";"$
END$
write "/* Counter */ "$
write " int i;"$
write "/* Parameter list */ "$
write "#include ", """$1_sympar.c"""$
|
|
|
|
|
|
|
|
|
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
write "void $1_ode()"$
write " "$
write "{"$
write "/* Declare standard arrays */"$
write " extern float y[", MTTNy+1, "]; /* $1_ode output */"$
write " extern float dx[", MTTNx+1, "]; /* $1_ode state derivative */"$
write " extern float x[", MTTNx+1, "]; /* $1_ode state */"$
write " extern float u[", MTTNu+1, "]; /* $1_ode input */"$
%Declare the dummy variables t0--t9
write "/* Dummy variable list */ "$
write " float t0;"$
FOR i := 1:9 DO
BEGIN
write " float t", i, ";"$
END$
%Declarations$
write "/* State variable list */ "$
FOR i := 1:MTTNx DO
BEGIN
write " float mttx", i, ";"$
END$
write "/* Input variable list */ "$
FOR i := 1:MTTNu DO
BEGIN
write " float mttu", i, ";"$
END$
write "/* Counter */ "$
write " int i;"$
write "/* Parameter list */ "$
write "#include ", """$1_sympar.c"""$
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
END$
END$
write " "$
write " /*====== Compute the state derivative and output ======*/"$
SHUT $1_ode.c1
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'C;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
|
|
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
END$
END$
write " "$
write " /*====== Compute the state derivative and output ======*/"$
SHUT "$1_ode.c1";
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'C;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
|