Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -12,10 +12,14 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.213 1999/09/02 23:24:40 peterg +## Now explicitly generates executable _ode2odes.out file +## Which takes command line arguments +## ## Revision 1.212 1999/08/18 06:20:32 peterg ## Put -u back again ..... ## ## Revision 1.211 1999/08/17 04:10:38 peterg ## Removed the -u switch from cp - it doesnt work on non GNU cps @@ -721,20 +725,22 @@ #Check $MTTPATH has been set mtt_check_var "$MTTPATH" "MTTPATH" #Version -version='3.8++' +version='4.0' # MTT recursion level is zero unless explicitly set level=0 #Computation mode is octave by default computation=octave #By default, the dae and ode representations are different dae_is_ode=0 +#By default, the ode and cse reps are different +ode_is_cse=0 # By default, don't look for BG switches switches=0 #By default, don't print the environment variables @@ -766,10 +772,13 @@ mtt_switches="$mtt_switches $1"; computation=c ;; -o ) mtt_switches="$mtt_switches $1"; dae_is_ode=1 ;; + -cse ) + mtt_switches="$mtt_switches $1"; + ode_is_cse=1 ;; -ss ) mtt_switches="$mtt_switches $1"; steadystate_computation=yes ;; -d ) directory=$2; cd $directory; shift ;; @@ -804,11 +813,11 @@ Solve='-A';; -abg ) mtt_switches="$mtt_switches $1"; start_at_abg='yes';; --version) - echo 'MTT (Model Transformation Tools) version' $version; exit;; + echo 'MTT version' $version; exit;; --versions) mtt_versions; exit;; *) echo "$1 is an invalid argument - ignoring" ;; esac @@ -830,11 +839,12 @@ fi fi #Print what's going on if in verbose mode if [ -n "$Verbose" ]; then - echo Starting mtt $mtt_switches $1 $2 $3 $4 + echo Starting mtt $mtt_switches $1 $2 $3 $4 at level $level + echo " " current wd $PWD fi #Check the principle paths mtt_check_vars $print @@ -848,11 +858,11 @@ echo 'Usage: mtt help -- mtt on-line help' echo ' mtt find component -- find location of a compound component' echo ' mtt info -- info-based manual' echo ' mtt info topic' echo ' mtt hinfo -- hypertext manual' - echo ' mtt manual -- pdf manual' + echo ' mtt manual -- ps manual' echo ' mtt warranty' echo ' mtt clean -- cleans up intermediate files' echo ' mtt rclean -- recursively cleans up intermediate files' echo ' mtt Clean -- cleans up all generated files' echo ' mtt clean' @@ -868,10 +878,11 @@ echo ' -abg start at abg.m representation' echo ' -c c-code generation' echo ' -d use directory ' echo ' -dc Maximise derivative (not integral) causality' echo ' -o ode and dae are the same' + echo ' -cse ode is computed in cse form' echo ' -p print environment variables' echo ' -ss use steady-state info to initialise simulations' echo ' -t tidy mode (default)' echo ' -u untidy mode (leaves files in current dir)' echo ' -v verbose mode' @@ -899,13 +910,13 @@ (cd $MTTPATH/doc; $HTMLVIEW ./mtt_toc.html)& exit fi if [ "$1" = "manual" ] && [$2 = ""]; then - mtt_check_var "$PDFVIEW" PDFVIEW - echo Invoking $PDFVIEW - $PDFVIEW $MTTPATH/doc/mtt.PDF & + mtt_check_var "$PSVIEW" PSVIEW + echo Invoking $PSVIEW + $PSVIEW $MTTPATH/doc/mtt.ps & exit fi if [ $1 = "find" ]&& [$3 = ""]; then mtt_find $MTT_COMPONENTS $2 @@ -952,11 +963,11 @@ fi fi # Clean up if [ "$1" = "clean" ]; then - echo 'Removing intermediate files' + echo Removing intermediate files in `pwd` rm -fr MTT_work exit fi # Recursively clean up @@ -1272,11 +1283,11 @@ fi # Tidy mode - operate in the directory MTT-work if [ "$tidy" = "tidy" ]; then mkdir -p MTT_work - cp -p -u Makefile *.* .* MTT_work # 2>/dev/null + cp -p -u Makefile *.* .* MTT_work 2>/dev/null cd MTT_work if [ -z "$directory" ]; then Directory='' else @@ -1290,10 +1301,11 @@ if [ "$mtt_status" != "0" ]; then echo Exiting MTT with error $mtt_status exit 1 fi + # Copy back form working directory if [ "$3" != "view" ]; then if [ "$3" != "hview" ]; then if [ "$3" = "html" ]; then echo Moving $1_$2 @@ -1304,11 +1316,10 @@ fi if [ "$PLOTTYPE" = "multiple" ]; then echo Copying $1_$2$__ARGS.ps cp $1_$2$__ARGS.ps .. fi - fi fi # Remove the MTT_work directory if very tidy if [ "$verytidy" = "verytidy" ]; then @@ -1318,12 +1329,26 @@ exit fi # User defined representations if [ -f "$2_rep.make" ]; then - echo make -f $2_rep.make "SYS=$1" "LANG=$3" - make -f $2_rep.make "SYS=$1" "LANG=$3" + if [ -n "$4" ]; then + filename=$1_$2-$4.$3 + else + filename=$1_$2.$3 + fi + + if [ -f "$filename" ]; then + echo $filename exists + else + echo make -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$4" + make -f $2_rep.make "SYS=$1" "LANG=$3" "ARG=$" + if [ -n "$4" ]; then + echo Copying $1_$2_$4.ps + cp $1_$2_$4.ps .. + fi + fi exit fi ################################ @@ -1781,13 +1806,13 @@ #SUMMARY cse* constrained-state equations (m) #SUMMARY cse constrained-state equations (tex) #SUMMARY cse* constrained-state equations (view) #SUMMARY cse constrained-state equations (ps) #Constrained-state equations -$1_cse.r: $1_dae.r $1_def.r $1_sympar.r +$1_cse.r: $1_dae.r $1_def.r $1_sympar.r $1_subs.r dae2cse_r $Solve $1; tidy $1_cse.r $1_subs.r -$1_cse.m: $1_def.r $1_cse.r $1_sympar.r +$1_cse.m: $1_def.r $1_cse.r $1_sympar.r $1_subs.r cse_r2m $1; matlab_tidy $1_cse.m $1_cse.tex: $1_cse.r $1_sympar.r $1_simp.r cse_r2tex $1; latex_tidy $1_cse.tex #SUMMARY ode ordinary differential equations (r) @@ -1799,17 +1824,28 @@ #Ordinary differential equations ifeq ($dae_is_ode,0) $1_ode.r: $1_cse.r $1_def.r $1_sympar.r $1_subs.r cse2ode_r $1; tidy $1_ode.r endif + ifeq ($dae_is_ode,1) $1_ode.r: $1_dae.r echo Copying $1_dae.r to $1_ode.r cp $1_dae.r $1_ode.r endif + +ifeq ($ode_is_cse,1) +$1_ode.m: $1_def.m $1_cse.r $1_sympars.txt + mtt_r2m $1 cse; matlab_tidy $1_cse.m; + cp -v $1_cse.m $1_ode.m; + cp -v $1_cseo.m $1_odeo.m; +endif +ifeq ($ode_is_cse,0) $1_ode.m: $1_def.m $1_ode.r $1_sympars.txt mtt_r2m $1 ode m; matlab_tidy $1_ode.m +endif + $1_odea.m: $1_ode.m touch $1_odea.m $1_odeo.m: $1_ode.m touch $1_odeo.m #$1_ode.c: $1_def.r $1_ode.r $1_sympar.r $1_sympar.c @@ -1839,11 +1875,11 @@ mtt_m2p $1_odeo.m $1_smx.p : $1_def.r $1_smx.m mtt_m2p $1_smx.m $1_switchopen.p : $1_def.r $1_switchopen.m mtt_m2p $1_switchopen.m -$1_ode2odes.p : $1_ode2odes.m $1_def.r\ +$1_ode2odes.p : $1_ode2odes.m $1_def.r $1_smx.p\ $1_simpar.p $1_numpar.p $1_state.p $1_input.p \ $1_ode.p $1_odeo.p $1_switchopen.p mtt_m2p $1_ode2odes.m $1_ode2odes.c: $1_ode2odes.p @@ -1938,12 +1974,12 @@ #SUMMARY smx state matrices with variable state x (m) #SUMMARY smxx Sparse computation of Ax (m) #SUMMARY smxtx Sparse computation of ATx (m) $1_smx.r: $1_def.r $1_def.m $1_ode.r $1_subs.r ode2smx_lang $1 r; tidy $1_smx.r -$1_smx.m: $1_def.r $1_def.m $1_ode.r $1_sympars.txt - ode2smx_lang $1 m; +$1_smx.m: $1_def.r $1_def.m $1_cse.r $1_sympars.txt $1_subs.r + cse2smx_lang $1 m; $1_smxx.m: $1_smx.m touch $1_smxx.m $1_smxtx.m: $1_smx.m touch $1_smxtx.m @@ -2392,14 +2428,14 @@ mv -f *.log LOGFILES fi #Print what's going on if in verbose mode if [ -n "$Verbose" ]; then - echo Finishing mtt $mtt_switches $1 $2 $3 $4 + echo Finishing mtt $mtt_switches $1 $2 $3 $4 at level $level fi if [ "$make_status" != "0" ]; then echo Exiting MTT with error $make_status exit 1 fi