Differences From Artifact [6ea960f185]:

To Artifact [75ab6aff86]:


1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21











+
+
+







#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.39  2000/10/14 08:04:40  peterg
## Changed arguments to _inout for consistency
##
## Revision 1.38  2000/10/11 09:08:08  peterg
## cse --> csex
##
## Revision 1.37  2000/08/01 12:25:06  peterg
## Now includes euler
##
## Revision 1.36  2000/05/19 17:48:16  peterg
204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
207
208
209
210
211
212
213

214
215
216
217
218
219
220
221







-
+







    [AA] = $1_smxa(x,u,ddt,par);	# (I-Adt) and (I-Adt)x
    [AAx] = $1_smxax(x,u,ddt,par); # (I-Adt) and (I-Adt)x

EOF
fi

cat <<EOF >> $1_ode2odes.m
    [open_switches] = $1_switchopen(x);	# Open switches
    [open_switches] = $1_logic(x,u,t,par); # Switch logic
    [x] = $algorithm; # Integration update
    t = t + ddt;   # Time update
    mttj = mttj+1;    # Increment counter
    if mttj==simpar.stepfactor
       mttj = 0;      # Reset counter
    endif

246
247
248
249
250
251
252
253
254


255
256
257
258
259
260
261
262
263
264
265
266
267

268
269
270
271
272
273
274
249
250
251
252
253
254
255


256
257
258
259
260
261
262
263
264
265
266
267
268
269

270
271
272
273
274
275
276
277







-
-
+
+












-
+







EOF

if [ "$method" = "euler" ]; then
cat << EOF >> $1_ode2odes.m
#    if mttmethod==1		# Euler
      for MTTjt = 1:mttstepfactor
	[MTTdx] = $1_$ode(MTTx,MTTu,MTTt,MTTpar); # State derivative
        [MTTopen] = $1_switchopen(MTTx);        # Open switches
	    [MTTx] = mtt_euler(MTTx,MTTdx,ddt,$Nx,MTTopen); # Euler update
        [MTTopen] = $1_logic(MTTx,MTTu,MTTt,MTTpar); # Switch logic
	[MTTx] = mtt_euler(MTTx,MTTdx,ddt,$Nx,MTTopen); # Euler update
	MTTt = MTTt + ddt;
      endfor;
#    endif;
EOF
fi

if [ "$method" = "implicit" ]; then
cat << EOF >> $1_ode2odes.m
#    if mttmethod==2		# Implicit 
      [MTTdx] = $1_$ode(MTTx,MTTu,MTTt,MTTpar); # State derivative
      [mttAA] = $1_smxa(MTTx,MTTu,mttdt,MTTpar);	# (I-Adt) and (I-Adt)x
      [mttAAx] = $1_smxax(MTTx,MTTu,mttdt,MTTpar);	# (I-Adt) and (I-Adt)x
      [MTTopen] = $1_switchopen(MTTx);        # Open switches
      [MTTopen] = $1_logic(MTTx,MTTu,MTTt,MTTpar); # Switch logic
      [MTTx] = $algorithm(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx,MTTopen); # Implicit update
      MTTt = MTTt + mttdt;
#    endif;
EOF
fi

cat << EOF >> $1_ode2odes.m

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