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.18 1999/03/15 01:17:07 peterg
## Removed some spurious debugging code
##
## Revision 1.17 1999/03/15 01:09:15 peterg
## Fixed bugs when Nx=0 (no state)
##
## Revision 1.16 1999/03/06 02:28:38 peterg
|
|
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#! /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
##
## Revision 1.17 1999/03/15 01:09:15 peterg
## Fixed bugs when Nx=0 (no state)
##
## Revision 1.16 1999/03/06 02:28:38 peterg
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
[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;
|
|
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
[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;
|