Differences From Artifact [7fb136b450]:

To Artifact [e440f7df4b]:


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.9  1997/05/10 09:54:34  peterg
## Moved _input call to after the inner integration loop.
##
## Revision 1.8  1997/05/10 08:12:23  peterg
## Put second argument into _input.
##
## Revision 1.7  1997/05/10 07:01:15  peterg







>
>
>







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.10  1997/05/10  10:05:15  peterg
# Put _input in inner loop in front of call to _ode
#
## Revision 1.9  1997/05/10 09:54:34  peterg
## Moved _input call to after the inner integration loop.
##
## Revision 1.8  1997/05/10 08:12:23  peterg
## Put second argument into _input.
##
## Revision 1.7  1997/05/10 07:01:15  peterg
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
write "  "$
write "{"$



write "/* Counters etc*/ "$
write "  double time;"$
write "  int itime;"$
write "  double dt;"$
write "  int i;"$
write "  int k;"$

write "/*functions */ "$
write "  extern  $1_numpar();"$

%Open the output files
write "/* %Open the output file */"$
write "fps = fopen(""$1_odes.m"", ""w"");  "$
write "fpso = fopen(""$1_odeso.m"", ""w"");  "$

%Set up user-defined constants
write "/* Set up user-defined constants */"$
write "  $1_numpar();"$

%Initialise main (Euler) integration loop
write "/* Initialise main (Euler) integration loop */"$
write "  time = 0.0;"$
write "  itime = 0;"$
write "  dt = DT/STEPFACTOR;"$
write "  for (i=1; i<=MTTNX; i++)"$
write "      x[i] = 0.0;"$

%Set up system inputs
write "/* Set up system inputs */"$
write "  for (i=1; i<=", MTTNu, "; i++)"$
write "      u[i] = 1.0;"$

write "  $1_input(0.0,0);"$

write "    fprintf(fps, ""function data = ", "$1_odes \n"");"$
write "    fprintf(fps, ""data = [\n"");"$
write "    fprintf(fpso, ""function data = ", "$1_odeso \n"");"$
write "    fprintf(fpso, ""data = [\n"");"$

% Compute the first output







<



















<









|







130
131
132
133
134
135
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
write "  "$
write "{"$



write "/* Counters etc*/ "$
write "  double time;"$

write "  double dt;"$
write "  int i;"$
write "  int k;"$

write "/*functions */ "$
write "  extern  $1_numpar();"$

%Open the output files
write "/* %Open the output file */"$
write "fps = fopen(""$1_odes.m"", ""w"");  "$
write "fpso = fopen(""$1_odeso.m"", ""w"");  "$

%Set up user-defined constants
write "/* Set up user-defined constants */"$
write "  $1_numpar();"$

%Initialise main (Euler) integration loop
write "/* Initialise main (Euler) integration loop */"$
write "  time = 0.0;"$

write "  dt = DT/STEPFACTOR;"$
write "  for (i=1; i<=MTTNX; i++)"$
write "      x[i] = 0.0;"$

%Set up system inputs
write "/* Set up system inputs */"$
write "  for (i=1; i<=", MTTNu, "; i++)"$
write "      u[i] = 1.0;"$

write "  $1_input(0.0);"$

write "    fprintf(fps, ""function data = ", "$1_odes \n"");"$
write "    fprintf(fps, ""data = [\n"");"$
write "    fprintf(fpso, ""function data = ", "$1_odeso \n"");"$
write "    fprintf(fpso, ""data = [\n"");"$

% Compute the first output
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
write "/* Inner integration loop */"$
write "    for (k=1; k<=STEPFACTOR; k++)"$
write "    {"$
write "      for (i=1; i<=MTTNX; i++)"$
write "        x[i] = x[i] + dx[i]*dt;"$

write "      /* Set up system inputs */"$
write "      $1_input(time,itime);"$
write "      $1_ode();"$
write "    }"$


write "      time = time + DT;"$
write "      itime = itime + 1;"$
write "  }"$

%Write to files
%Write to output to file
write "/* Write to output file */"$
write "    fprintf(fpso, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNY; i++)"$







|





<







197
198
199
200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
write "/* Inner integration loop */"$
write "    for (k=1; k<=STEPFACTOR; k++)"$
write "    {"$
write "      for (i=1; i<=MTTNX; i++)"$
write "        x[i] = x[i] + dx[i]*dt;"$

write "      /* Set up system inputs */"$
write "      $1_input(time);"$
write "      $1_ode();"$
write "    }"$


write "      time = time + DT;"$

write "  }"$

%Write to files
%Write to output to file
write "/* Write to output file */"$
write "    fprintf(fpso, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNY; i++)"$

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]