Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.21 1999/04/02 06:29:25 peterg +## New implicit method - solves numerical prob with ISW +## ## 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) @@ -106,16 +109,16 @@ [MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Evaluate initial output [MTTu] = $1_input(MTTt,MTTx,MTTy); # Evaluate initial input mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them -[mttAA] = zero_matrix($Nx); # Zero the A matrix -[mttAAx] = zero_vector($Nx); # Zero the AAx vector +#[mttAA] = zero_matrix($Nx); # Zero the A matrix +#[mttAAx] = zero_vector($Nx); # Zero the AAx vector -if $Nx>0 - [MTTx] = $1_switch(MTTx); # Switches -endif; +#if $Nx>0 +# [MTTx] = $1_switch(MTTx); # Switches +#endif; if mttmethod==1 # Euler MTTddt = mttdt/mttstepfactor; # The small sample interval endif; @@ -124,12 +127,12 @@ if $Nx>0 # Dont if no states if mttmethod==1 # Euler for MTTjt = 1:mttstepfactor [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative - [MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update - [MTTx] = $1_switch(MTTx); # Switches + [MTTopen] = $1_switchopen(MTTx); # Open switches + [MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx,MTTopen); # Euler update MTTt = MTTt + MTTddt; endfor; endif; if mttmethod==2 # Implicit [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative