Differences From Artifact [6a08492f47]:

To Artifact [0c76dc5319]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## 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
## Put back under RCS
##
## Revision 1.12  1998/02/25 18:02:39  peterg







>
>
>







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.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
## Put back under RCS
##
## Revision 1.12  1998/02/25 18:02:39  peterg
139
140
141
142
143
144
145






































146
147
148
149
150
151
152
        x = xx(1:nx);
        xx = $1_ode(xx,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = x + dx*dt;
        xx(1:nx) = x;
      end;






































    end;
  else
    error('Method %s not available here', METHOD);
    return;
  end;
  write_matrix([T,X], '$1_odes');
else







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
        x = xx(1:nx);
        xx = $1_ode(xx,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = x + dx*dt;
        xx(1:nx) = x;
      end;
    end;
  elseif strcmp(method,'implicitl')
    %Euler integration
    X=[];
    dt = (T(2)-T(1))/STEPFACTOR;
    u = $1_input(x,t);
    A = $1_sm(x,u); 
    inverse = inv(eye(nx) - dt*A);
    for t=T'
      X = [X; xx'];
      ts = t;
      for i=1:STEPFACTOR
        x = xx(1:nx);
        xx = $1_ode(xx,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = inverse*(x + dt*(dx - A*x));
        xx(1:nx) = x;
      end;
    end;
  elseif strcmp(method,'implicit')
    %Euler integration
    X=[];
    dt = (T(2)-T(1))/STEPFACTOR;
    One = eye(nx);
    for t=T'
      X = [X; xx'];
      ts = t;
      for i=1:STEPFACTOR
        x = xx(1:nx);
        u = $1_input(x,t);
    	A = $1_sm(x,u); 
        xx = $1_ode(xx,ts);
        ts = ts + dt;
        dx = xx(1:nx);
        x = (One-A*dt)\(x + dt*(dx - A*x));
        xx(1:nx) = x;
      end;
    end;
  else
    error('Method %s not available here', METHOD);
    return;
  end;
  write_matrix([T,X], '$1_odes');
else

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