Differences From Artifact [f12be2131c]:

To Artifact [c787bfea9c]:


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.6  1997/05/06 13:53:32  peterg
## Now uses the preprocessor to declare sizes -- MTTNX etc
##
# Revision 1.5  1997/05/01  13:50:11  peterg
# Replaced float by double.
#
# Revision 1.4  1997/05/01  13:43:44  peterg







>
>
>
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) P.J.Gawthrop 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1997/05/10 07:01:15  peterg
## _input called in outer loop only.
## time updated in outer loop only.
## Integer time (itime) introduced and updated in outer loop - maybe
## useful for discrete events.
## Integer time (itime) passed to _input.
##
## Revision 1.6  1997/05/06 13:53:32  peterg
## Now uses the preprocessor to declare sizes -- MTTNX etc
##
# Revision 1.5  1997/05/01  13:50:11  peterg
# Replaced float by double.
#
# Revision 1.4  1997/05/01  13:43:44  peterg
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
write "/* Write to state file */"$
write "    fprintf(fps, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNX; i++)"$
write "      fprintf(fps, ""%5.4f "", x[i]);"$
write "    fprintf(fps, ""\n"");"$

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

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 "      $1_ode();"$







|







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
write "/* Write to state file */"$
write "    fprintf(fps, ""%5.4f "",time);"$
write "    for (i=1; i<=MTTNX; i++)"$
write "      fprintf(fps, ""%5.4f "", x[i]);"$
write "    fprintf(fps, ""\n"");"$

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

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 "      $1_ode();"$

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