1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.19 1999/03/30 21:39:25 peterg
## In implicit approach, set derivatives to zero (when switch is off)
## before update. This seems to stop numerical leakage though non-return
## switches.
##
## Revision 1.18 1999/03/15 01:17:07 peterg
## Removed some spurious debugging code
|
>
>
>
|
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.20 1999/04/02 02:13:58 peterg
## Back to RCS
##
## Revision 1.19 1999/03/30 21:39:25 peterg
## In implicit approach, set derivatives to zero (when switch is off)
## before update. This seems to stop numerical leakage though non-return
## switches.
##
## Revision 1.18 1999/03/15 01:17:07 peterg
## Removed some spurious debugging code
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
[MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update
[MTTx] = $1_switch(MTTx); # Switches
MTTt = MTTt + MTTddt;
endfor;
endif;
if mttmethod==2 # Implicit
[MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
#[MTTdx] = $1_switch(MTTx); # Set derivs to zero if states to zero
[mttAA,mttAAx] = $1_smx(MTTx,MTTu,mttdt); # (I-Adt) and (I-Adt)x
[mttAA] = $1_switcha(mttAA,MTTx); # Switches
[MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update
MTTt = MTTt + mttdt;
endif;
else
MTTt = MTTt + mttdt;
endif; # $Nx>0
[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Output
|
<
|
|
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
[MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update
[MTTx] = $1_switch(MTTx); # Switches
MTTt = MTTt + MTTddt;
endfor;
endif;
if mttmethod==2 # Implicit
[MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative
[mttAA,mttAAx] = $1_smx(MTTx,MTTu,mttdt); # (I-Adt) and (I-Adt)x
[MTTopen] = $1_switchopen(MTTx); # Open switches
[MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx,MTTopen); # Implicit update
MTTt = MTTt + mttdt;
endif;
else
MTTt = MTTt + mttdt;
endif; # $Nx>0
[MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Output
|