Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -15,10 +15,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.398 2004/08/29 14:39:23 geraint +## Added rule to create dae from sorted equations (sese) if sorting is requested. +## ## Revision 1.397 2004/08/29 13:17:30 geraint ## Added rules to use sae (sorted algebraic equations) instead ## of ae if sorted equations are being used. ## ## Converted temporary variable names to lowercase in sorted @@ -1412,10 +1415,17 @@ # MTT recursion level is zero unless explicitly set level=0 #Computation mode is octave by default computation=octave + +#By default, Reduce is used if available +if [ -n "$SYMBOLIC" ]; then + use_reduce='yes' +else + use_reduce='no' +fi #By default, the dae and ode representations are different dae_is_ode=0 #By default, the ode and cse reps are different @@ -1496,10 +1506,20 @@ mtt_switches="$mtt_switches $1"; dae_is_ode=1 ;; -nocr ) mtt_switches="$mtt_switches $1"; rdae_is_dae=1 ;; + -no-reduce ) + mtt_switches="$mtt_switches $1"; + use_reduce='no'; + do_sort='-sort'; + sort_method='make'; + rdae_is_dae=1 ; + cr_first='-cr'; + Solve=''; + num_tmp_var=0 ; + integration_method="euler" ;; -i ) mtt_switches="$mtt_switches $1"; shift; case $1 in dassl) @@ -1556,12 +1576,11 @@ sensitivity=sensitivity ;; -make-sort ) mtt_switches="$mtt_switches $1"; do_sort='-sort'; sort_method="make"; - num_tmp_var=0; - integration_method="euler";; + num_tmp_var=0 ;; -sort ) mtt_switches="$mtt_switches $1"; do_sort='-sort'; sort_method="seqn"; integration_method="sorted_euler";; @@ -1729,11 +1748,12 @@ echo ' -o ode is same as dae' echo ' -oct use oct files in place of m files where appropriate' echo ' -opt optimise code generation (equivalent to -optl)' echo ' -optl optimise code generation (local : line-by-line)' echo ' -optg optimise code generation (global : full vector) (EXPERIMENTAL)' - echo " -ntmpvar declare N temporary variables (default=$num_tmp_var)" + echo ' -no-reduce try not to use symbolic algebra (EXPERIMENTAL)' + echo ' -ntmpvar declare N temporary variables (default=$num_tmp_var)' 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)' @@ -2755,11 +2775,11 @@ endif # Dummy target FORCE: -ifeq ($do_sort,) +ifeq ($use_reduce,yes) $1_ode2odes_common_%.stamp: $1_ae.% $1_input.% $1_logic.% $1_numpar.% $1_simpar.% $1_state.% touch \$@ $1_ode2odes_common.o: $1_ae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o @echo "Creating $1_ode2odes_common.o" ar -cr \$@ \$^ @@ -2769,11 +2789,11 @@ $1_ode2odes_common.o: $1_sae.o $1_input.o $1_logic.o $1_numpar.o $1_simpar.o $1_state.o @echo "Creating $1_ode2odes_common.o" ar -cr \$@ \$^ endif -ifeq ($do_sort,) +ifeq ($use_reduce,yes) $1_ode2odes_euler_%.stamp $1_ode2odes_rk4_%.stamp: $1_ode.% $1_odeo.% touch \$@ $1_ode2odes_euler.o $1_ode2odes_rk4.o: $1_ode.o $1_odeo.o mtt_euler.o @echo "Creating \$@" ar -cr \$@ \$^ @@ -2783,17 +2803,19 @@ $1_ode2odes_euler.o $1_ode2odes_rk4.o: $1_sesx.o $1_sesy.o mtt_euler.o @echo "Creating \$@" ar -cr \$@ \$^ endif +ifeq ($use_reduce,yes) $1_ode2odes_implicit_%.stamp: $1_cseo.% $1_csex.% $1_smxa.% $1_smxax.% touch \$@ $1_ode2odes_implicit.o: $1_cseo.o $1_csex.o $1_smxa.o $1_smxax.o mtt_implicit.o @echo "Creating $1_ode2odes_implicit.o" ar -cr \$@ \$^ +endif # no alternative -ifeq ($do_sort,) +ifeq ($use_reduce,yes) $1_ode2odes_dassl_oct.stamp: $1_ode.oct $1_odeo.oct mtt_dassl.oct touch \$@ $1_ode2odes_dassl_o.stamp: $1_ode.o $1_odeo.o mtt_dassl.o touch \$@ $1_ode2odes_dassl_%.stamp: $1_ode.% $1_odeo.% @@ -2969,19 +2991,20 @@ #SUMMARY struc* structure - list of inputs, outputs and states (view) #Elementary system equations + definitions ${sys}_ese.r: ${sys}_cbg.m cbg2ese_m2r $partition $info_switch $Subsystem; #ese_tidy $1 -# sorted equations generated from seqn +ifeq ($sort_method,seqn) ${sys}_sese.m: ${sys}_def.r ${sys}_sese.r ${sys}_sympar.txt echo Creating \$@ mtt_r2m ${sys} sese m ${sys}_sese.r: ${sys}_cbg.m ${sys}_struc.m echo Creating \$@ cbg2sese_m2r $info_switch $Subsystem +endif -# sorted equations generated by make +ifeq ($sort_method,make) ${sys}_sesx.m: ${sys}_def.r ${sys}_sesx.r ${sys}_sympar.txt echo Creating \$@ mtt_r2m ${sys} sesx m ${sys}_sesy.m: ${sys}_def.r ${sys}_sesy.r ${sys}_sympar.txt echo Creating \$@ @@ -2988,10 +3011,14 @@ mtt_r2m ${sys} sesy m ${sys}_sae.m: ${sys}_def.r ${sys}_sae.r ${sys}_sympar.txt echo Creating \$@ mtt_r2m ${sys} sae m +${sys}_sese.r: ${sys}_sese.make + echo Creating \$@ + make -f \$< all > \$@ + echo ";end;" >> \$@ ${sys}_sesx.r: ${sys}_sese.make echo Creating \$@ make -f \$< MTTdX > \$@ ${sys}_sesy.r: ${sys}_sese.make echo Creating \$@ @@ -3001,11 +3028,11 @@ make -f \$< MTTyz > \$@ ${sys}_sese.make: ${sys}_ese.r echo Creating \$@ ese_r2make.pl --sys=${sys} --outfile=\$@ --$debug - +endif $1_def.r: $1_ese.r touch $1_def.r $1_struc.txt: $1_ese.r touch $1_struc.txt @@ -3195,11 +3222,11 @@ ifeq ($sort_method,seqn) $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 -ifeq ($sort_method,make) +ifeq ($use_reduce,no) $1_ode2odes.m : $1_def.r $1_sympars.txt\ $1_simpar.m $1_numpar.m $1_state.m $1_input.m \ $1_sesx.m $1_sesy.m $1_logic.m else $1_ode2odes.m : $1_def.r $1_sympars.txt\