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.15 1999/03/06 02:19:43 peterg +## Changed args to _input +## ## Revision 1.14 1998/10/01 16:02:01 peterg ## Integration with switches handled separately fro Euler and Implicit. ## ## Revision 1.13 1998/09/30 17:41:24 peterg ## Implicit method now allows for switches via _switchA @@ -75,13 +78,14 @@ $1_numpar; # Read in parameters MTTilast = round(mttlast/mttdt); # Total number of steps #Initialise MTTt = 0.0; +[MTTu] = zero_vector($Nu); # Zero the input [MTTx] = $1_state; # Read in initial state -[MTTu] = $1_input(MTTt,MTTx,mtty); # Evaluate initial input [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 @@ -91,11 +95,10 @@ MTTddt = mttdt/mttstepfactor; # The small sample interval endif; #Integration loop for MTTit = 1:MTTilast - [MTTu] = $1_input(MTTt,MTTx,MTTy); # Input 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 @@ -110,15 +113,15 @@ [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update [MTTx] = $1_switch(MTTx); # Switches MTTt = MTTt + mttdt; endif; - - [MTTy] = $1_odeo(MTTx,MTTu,MTTt); - mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); + [MTTy] = $1_odeo(MTTx,MTTu,MTTt); # Output + [MTTu] = $1_input(MTTt,MTTx,MTTy); # Input + mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # Write it out endfor; # Integration loop EOF