Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -15,10 +15,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.373 2003/04/17 20:07:32 geraint +## Added rule to create _sese.m +## ## Revision 1.372 2003/03/24 12:03:36 gawthrop ## Added -I switch to sese transformation ## ## Revision 1.371 2003/03/13 15:47:35 gawthrop ## Added sese rep. @@ -1460,10 +1463,14 @@ esac;; -s ) sensitivity_switch='-s'; mtt_switches="$mtt_switches $1"; sensitivity=sensitivity ;; + -sort ) + mtt_switches="$mtt_switches $1"; + use_sorted_equations="yes"; + integration_method="sorted_euler";; -ss ) mtt_switches="$mtt_switches $1"; steadystate_computation=yes ;; -d ) directory=$2; cd $directory; shift ;; @@ -1633,10 +1640,11 @@ echo ' -p print environment variables' echo ' -partition partition hierachical system' echo ' -pdf generate pdf in place of ps' echo ' -r reset time stamp on representation' echo ' -s generate sensitivity BG (use mtt -s sSys rep lang)' + echo ' -sort use sorted equations (sese) and Euler integration (EXPERIMENTAL)' echo ' -ss use steady-state info to initialise simulations' echo ' -stdin read input data from standard input for simulations' echo ' -sub operate on this subsystem' echo ' -t tidy mode (default)' echo ' -trace Just indicate what mtt will do - but do not do it' @@ -2985,21 +2993,26 @@ else make_ode2odes $1 m $integration_method $algebraic_solver endif endif ifneq ($integration_method,implicit) +ifeq ($integration_method,sorted_euler) +$1_ode2odes.m : $1_def.r $1_sympars.txt\ + $1_simpar.m $1_numpar.m $1_state.m $1_input.m \ + $1_sese.m $1_logic.m +else $1_ode2odes.m : $1_def.r $1_sympars.txt\ $1_simpar.m $1_numpar.m $1_state.m $1_input.m \ $1_ode.m $1_odeo.m $1_logic.m +endif ifeq ($using_oct,yes) echo "*** Warning: Shouldn't be here! Creating dummy $1_ode2odes.m" touch $1_ode2odes.m # Create a dummy which wont' be used mtt $mtt_switches -q -u $1 ode2odes oct else make_ode2odes $1 m $integration_method $algebraic_solver endif - endif #SUMMARY ode2odes Simulation function (m) #SUMMARY ode2odes Simulation function (cc) #SUMMARY ode2odes Simulation function (oct) 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.83 2002/08/07 14:27:14 geraint +## Changes to make "-i dassl" work again. +## ## Revision 1.82 2002/07/24 14:00:12 geraint ## Corrected arguments passed to mtt_write when dumping data (sigint). ## ## Revision 1.81 2002/07/11 13:00:23 geraint ## Declared more function arguments to be "const" - improves compiler optimisation. @@ -353,10 +356,13 @@ "dassl") ode=ode odeo=odeo algorithm="mtt_dassl(x,u,t,par,dx,ddt,MTTNX,MTTNYZ,open_switches)" ;; + "sorted_euler") + algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)" + ;; "euler" | "rk4" | *) ode=ode odeo=odeo algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)" ;; @@ -395,11 +401,22 @@ endfor; mttj = 0; for it = 1:ilast #Integration loop [u] = ${sys}_input(x,y,t,par); # Input +EOF +if [ "$method" = "sorted_euler" ]; then +cat <> $filename + [dx,y] = ${sys}_sese(x,u,t,par); # Output +EOF +else +cat <> $filename [y] = ${sys}_$odeo(x,u,t,par); # Output + +EOF +fi +cat <> $filename if mttj==0 mtt_write(t,x,y,$Nx,$Ny,simpar.first); # Write it out endif EOF @@ -409,10 +426,14 @@ [k2] = ddt * ${sys}_${ode}(x+k1/2,u,t+ddt/2,par); [k3] = ddt * ${sys}_${ode}(x+k2/2,u,t+ddt/2,par); [k4] = ddt * ${sys}_${ode}(x+k3,u,t+ddt,par); [dx] = [k1 + 2.0 * [k2 + k3] + k4] / (6.0 * ddt); EOF +elif [ "$method" = "sorted_euler" ]; then +cat <> $filename + [dx,y] = ${sys}_sese(x,u,t,par); # State derivative and Output +EOF else cat << EOF >> $filename [dx] = ${sys}_$ode(x,u,t,par); # State derivative EOF fi