Differences From Artifact [0c76dc5319]:

To Artifact [e2fc3e22e9]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27







+
+
+







# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16  1998/06/25 08:47:23  peterg
## Put correct arguments for _input -- (x,t)
##
## Revision 1.15  1998/05/21 16:20:27  peterg
## Modified to include explicit algebraic loop solution
##
## Revision 1.14  1998/05/19 19:48:02  peterg
## Read the simpar file now.
##
## Revision 1.13  1998/05/14 08:05:10  peterg
79
80
81
82
83
84
85
86


87
88
89
90
91
92

93
94
95
96
97
98
99
82
83
84
85
86
87
88

89
90
91
92
93
94
95

96
97
98
99
100
101
102
103







-
+
+





-
+







#else
#  PARAMS=$2;
#fi

# PARAMS="$PARAMS ;"


$MATRIX << EOF > ode2odes_m.log 2>mtt_error.txt
$MATRIX --verbose << EOF > ode2odes_m.log 2>mtt_error.txt

  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;

  %Read in parameters
  $1_numpar; 
 

  %Read in state
  x = $1_state;

  %Set the initial output
  %if ny>0
  %  y = $1_odeo(x,0);
  %end; 
129
130
131
132
133
134
135

136
137
138
139
140
141
142
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147







+







method = tolower(METHOD)

if nx>0
  if strcmp(method,'lsode')
    X = lsode('$1_ode', x, T);
  elseif strcmp(method,'euler')
    %Euler integration
    disp("Euler")
    X=[];
    dt = (T(2)-T(1))/STEPFACTOR;
    for t=T'
      X = [X; xx'];
      ts = t;
      for i=1:STEPFACTOR
        x = xx(1:nx);
193
194
195
196
197
198
199
200
201


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


205
206
207
208
209
210
211
212
213







-
-
+
+







else
  X = zeros(size(T));
end;

if ny>0 % compute y and print it
  i = 0; Y=[];
  for t=T'
    i = i+1, X(i,:)
    y = $1_odeo(X(i,:),t);
    i = i+1; X(i,:);
    y = $1_odeo(X(i,:)',t);
    Y = [Y; y'];
  end;
  write_matrix([T,Y], '$1_odeso');
end;


EOF

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