Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.35 1996/11/02 10:19:19 peterg +## Constitutive Relationship generation from lbl file +## ## Revision 1.34 1996/11/01 13:34:35 peterg ## -q (quiet) switch added ## ## Revision 1.33 1996/11/01 12:34:45 peterg ## Added browser - mtt_help @@ -120,19 +123,29 @@ ## ## Revision 1.1 1996/08/04 17:29:42 peter ## Initial revision ## ############################################################### + +# MTT recursion level is zero unless explicitly set +level=0 #Look for a command line argument -if [ -n "`echo $1 | grep '-'`" ]; then - arg=$1 +while [ -n "`echo $1 | grep '-'`" ]; do + case $1 in + -q ) + quiet=quiet ;; + -l ) + level=$2; shift ;; + esac shift -fi +done + +echo $level #Print header if not in quiet (-q) mode. -if [ "$arg" != "-q" ]; then +if [ "$quiet" != "quiet" ]; then echo echo 'MTT (Model Transformation Tools) version 2.0++' echo 'This is free software with ABSOLUTELY NO WARRANTY.' echo 'Type `mtt warranty'\' 'for details.' echo @@ -348,13 +361,30 @@ echo "% a comment (ie starting with %)"; \ echo "% Component-name CR_name arg1,arg2,..argn"; \ echo "% blank"; \ )> $1_lbl.txt -#REPRESENTATION cr constitutive relationship description (r) -$1_cr.r: +#REPRESENTATION cr constitutive relationship for each subsystem (r) +$1_cr.r: $1_sub.sh lbl2cr_txt2r $1 + + if [ "$level" = "0" ]; then \ + mv $1_cr.r MTT_cr.r; \ + else \ + echo >> MTT_cr.r; \ + echo "%% CRs for subsystem $1" >> MTT_cr.r; \ + cat $1_cr.r >> MTT_cr.r; \ + fi + + echo Creating subsystem cr files for system $1 ...; \ + sh $1_sub.sh "mtt -q -l $level+1 " ' cr r'; \ + echo Finished creating subsystem cr files for system $1; \ + + if [ "$level" = "0" ]; then \ + mv MTT_cr.r $1_cr.r; \ + echo 'END;' >> $1_cr.r; \ + fi #REPRESENTATION simp simplification information (r) $1_simp.r: echo Creating $1_simp.r ( \ @@ -433,13 +463,12 @@ lbl2sympar_txt2r $1 #REPRESENTATION abg acausal bond graph (m) #Raw bond graph to acausal bond graph: mfile $1_abg.m: $1_rbg.m $1_sub.sh - echo Creating subsystem abg files for system $1 ... - sh < $1_sub.sh + sh $1_sub.sh 'mtt -q ' ' abg m' echo Finished creating subsystem abg files for system $1 rbg2abg_m $1 #REPRESENTATION cbg causal bond graph (m)