Index: mttroot/mtt/bin/trans/abg2cbg_m ================================================================== --- mttroot/mtt/bin/trans/abg2cbg_m +++ mttroot/mtt/bin/trans/abg2cbg_m @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.13 1998/07/27 20:30:12 peterg +## *** empty log message *** +## ## Revision 1.12 1998/07/10 08:43:46 peterg ## Added -I switch ## ## Revision 1.11 1998/01/23 13:29:54 peterg ## $RMATRIX --> $MATRIX @@ -105,14 +108,17 @@ # P.J.Gawthrop May 1996 # Copyright (c) P.J.Gawthrop, 1996. +derivative=0;blurb=integral while [ -n "`echo $1 | grep '^-'`" ]; do case $1 in -I ) info=info;; + -derivative ) + derivative=1; blurb=derivative;; *) echo "$1 is an invalid argument - ignoring" ;; esac shift done @@ -127,11 +133,11 @@ rm -f $typefile rm -f $infofile #Inform user -echo Creating $1_cbg.m +echo "Creating $1_cbg.m (maximise $blurb causality)" echo Creating $1_type.sh # Use matrix manipulation to accomplish the transformation $MATRIX << EOF >abg2cbg_m.log #2>mtt_error.txt @@ -144,11 +150,11 @@ port_bonds = []; port_direction = []; port_status = []; [cbonds,status] = abg2cbg(system_name, '', '', port_bonds, port_direction, port_status, ... - typefilenum, infofilenum, errorfilenum); + $derivative,typefilenum, infofilenum, errorfilenum); EOF if [ "$info" = "info" ]; then cat $infofile Index: mttroot/mtt/bin/trans/can_r2tex ================================================================== --- mttroot/mtt/bin/trans/can_r2tex +++ mttroot/mtt/bin/trans/can_r2tex @@ -2,136 +2,192 @@ ###################################### ##### Model Transformation Tools ##### ###################################### -# Bourne shell script: sm_r2tex +# Bourne shell script: can_r2tex # Reduce constrained-state matrices to LaTex constrained-state matrices. -# P.J.Gawthrop 9 Sep 1991, May 1994 -# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996. +# P.J.Gawthrop January 8th 1997 +# Copyright (c) P.J.Gawthrop, 1997 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ -# Revision 1.3 1997/06/13 13:50:11 peterg -# Matrices in amstex format -# -# Revision 1.2 1997/04/18 12:54:00 peterg -# No longer does labels. -# -# Revision 1.1 1996/08/19 15:19:23 peter -# Initial revision -# ############################################################### # Inform user -echo Creating $1_sm.tex +echo Creating $1_can.tex # Remove the old log file -rm -f sm_r2tex.log +rm -f can_r2tex.log # Use reduce to accomplish the transformation -reduce >sm_r2tex.log << EOF +reduce >can_r2tex.log<< EOF %Read the definitions file in "$1_def.r"; -%Read the constrained-state matrices file -in "$1_sm.r"; +%Read the canonical-form matrices file +in "$1_can.r"; -%Read the symbolic parameters file -in "$1_sympar.r"; +%Read the substitution file +in "$1_subs.r"; %Read the simplification file in "$1_simp.r"; +%Read the formatting function +in "$MTTPATH/trans/latex_matrix.r"; OFF Echo; OFF Nat; -OFF EXP; -%ON Rounded; -%Precision 5; - - -OUT "$1_sm.tex"; - -%Write out the state matrices. -write "%state matrices $1"; -write "%File: $1.rcm"; + +OUT "$1_can.tex"; + +%Write out the canonical matrices +write "%Canonical-form matrices $1"; +write "%File: $1_can.tex"; write""; -write "%constrained-state matrices"; - -IF MTTNx>0 THEN -BEGIN -write "% - A matrix"; -write "\begin{equation}"; -write "MTTA = \begin{pmatrix}"; - FOR Row := 1:MTTNx DO - BEGIN - FOR Col := 1:MTTNx DO - BEGIN - Write "{", MTTA(Row,Col), "}"; - IF Col0 - -write "% - D matrix"; -write "\begin{equation}"; -write "MTTD = \begin{pmatrix}"; - FOR Row := 1:MTTNy DO - BEGIN - FOR Col := 1:MTTNu DO - BEGIN - Write "{", MTTD(Row,Col), "}"; - IF Col $MATRIX ## ## Revision 1.8 1996/12/07 19:23:07 peterg ## Registered agian. @@ -65,11 +68,11 @@ #Inform user echo Creating $2_cbg.fig -- component type $1 # Use matrix manipulation to accomplish the transformation -$MATRIX <mtt_error.txt #> cbg_m2fig.log +$MATRIX <mtt_error.txt > cbg_m2fig.log system_type = "$1" system_name = "$2" thick = 3; length = 150; red = 4; blue = 1; green = 12; font = 18; Index: mttroot/mtt/bin/trans/cse2scse_r ================================================================== --- mttroot/mtt/bin/trans/cse2scse_r +++ mttroot/mtt/bin/trans/cse2scse_r @@ -16,25 +16,38 @@ system_def=$1_def.r system_cse=$1_cse.r system_scse=$1_scse.r # Parameters -n=`echo $2 | sed 's/,/ /g' |wc -w` -echo $n_parameters +n=`echo $2 | sed 's/,/ /g' |wc -w` ## Number of parameters +## Parameter information for reduce. parameters=`echo $2 | sed 's/,/ /g' |\ awk '{ for (i=1; i<=NF; i++) { printf("mttpar(%i,1) := %s;\n", i, $i); printf("mttcoef(%i,1) := %ss;\n", i, $i); } }'` -matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);" +## Update sympar list. +echo Recreating $1_sympar.txt +# Zap any sensitivity coeficients +mv $1_sympar.txt mtt_junk +grep -v MTT_Sensitivity_Coefficients mtt_junk > $1_sympar.txt + +# Create the new sens coeffs at end of list. +echo $2 | sed 's/,/ /g' |\ +awk '{ + for (i=1; i<=NF; i++) { + printf("%ss\tMTT_Sensitivity_Coefficients\n",$i); + } + }' >> $1_sympar.txt + +touch $1_sympar.txt -echo $parameters -echo $matrix +matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);" # Number of states Nx=`grep "MTTNx " <$system_def | awk '{print $3}' | sed 's/;//'` #Inform user Index: mttroot/mtt/bin/trans/dae2cse_r ================================================================== --- mttroot/mtt/bin/trans/dae2cse_r +++ mttroot/mtt/bin/trans/dae2cse_r @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.13 2000/10/11 08:52:46 peterg +## Creates csex (cse with dxe only) rep. +## ## Revision 1.12 2000/10/10 21:00:58 peterg ## New code genration ## ## Revision 1.11 1998/11/26 09:18:55 peterg ## Incluse subs.r @@ -95,10 +98,13 @@ echo "Creating $1_cseo.r" # Remove the old log file rm -f dae2cse_r.log +# Remove some files +rm -f $1_cse.r? $1_cseo.r? + # Use reduce to accomplish the transformation $SYMBOLIC >dae2cse_r.log << EOF %Read the formatting function in "$MTTPATH/trans/reduce_matrix.r"; @@ -281,13 +287,16 @@ OUT "$1_csex.r1"; write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; SHUT "$1_csex.r1"; -OUT "$1_cseo.r1"; -write "MATRIX MTTY(", MTTNy, ",", MTTNx, ")$"; -SHUT "$1_cseo.r1"; +IF MTTNy>0 THEN +BEGIN + OUT "$1_cseo.r1"; + write "MATRIX MTTY(", MTTNy, ",", MTTNx, ")$"; + SHUT "$1_cseo.r1"; +END; %%Create the _cse.r file OUT "$1_cse.r2"; write "%File: $1_cse.r"; in ("$1_cse_write.r"); @@ -350,21 +359,26 @@ in ("$1_csex_write.r"); write "END;"; SHUT "$1_csex.r2"; %Write out the output equations +IF MTTNy>0 THEN +BEGIN OUT "$1_cseo.r2"; write "%File: $1_cseo.r"; in ("$1_cseo_write.r"); write "END;"; SHUT "$1_cseo.r2"; +END; quit; EOF -cat $1_cse.r1 $1_cse.r2 > $1_cse.r -cat $1_csex.r1 $1_csex.r2 > $1_csex.r -cat $1_cseo.r1 $1_cseo.r2 > $1_cseo.r +touch $1_cseo.r1 +touch $1_cseo.r2 +cat $1_cse.r1 $1_cse.r2 > $1_cse.r +cat $1_csex.r1 $1_csex.r2 > $1_csex.r +cat $1_cseo.r1 $1_cseo.r2 > $1_cseo.r if [ "$solve" = "1" ]; then echo "Setting MTTNyz=0 in $1_def.r and removing other $1_def files" awk '{ if ($1=="MTTNyz") Index: mttroot/mtt/bin/trans/dir2rep ================================================================== --- mttroot/mtt/bin/trans/dir2rep +++ mttroot/mtt/bin/trans/dir2rep @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/03/11 10:32:11 peterg +## Now uses dir2paths transformation +## ## Revision 1.1 1998/02/05 13:31:25 peterg ## Initial revision ## ############################################################### @@ -28,9 +31,9 @@ # Headings echo "% Verbal description for directory $1 ($1_rep.txt)"> $1_rep.txt echo "% Generated by MTT on" `date`. >> $1_rep.txt # Create paths for all valid examples - ie dir name is system name -dir2paths $1 $2 | \ +dir2paths $1 $2 | sed 's/Introduction/AAAAA/g' | sort | sed 's/AAAAA/Introduction/g' | \ awk '{ print "mtt -t -d " $1,$2 " rep tex"; }' >> $1_rep.txt Index: mttroot/mtt/bin/trans/dm_r2m ================================================================== --- mttroot/mtt/bin/trans/dm_r2m +++ mttroot/mtt/bin/trans/dm_r2m @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 1998/04/13 11:01:55 peterg +## Now uses generic header : matlab_header +## # Revision 1.6 1997/04/16 13:43:29 peterg # Added matrix dimenensions # # Revision 1.5 1997/02/24 14:44:28 peterg # Ignores numerical parameters in global list. @@ -106,11 +109,11 @@ EOF # Header -matlab_header $1 dm> $1_dm.m +matlab_header $1 dm 'A,B,C,D,E'> $1_dm.m #Define array sizes. grep -v 'function' $1_def.m | grep -v '%' >> $1_dm.m echo 'mtta = zeros(nx+nyz+2*nz,nx+nyz+2*nz);' >> $1_dm.m echo 'mttb = zeros(nx+nyz+2*nz,nu);' >> $1_dm.m Index: mttroot/mtt/bin/trans/examples_txt2tk ================================================================== --- mttroot/mtt/bin/trans/examples_txt2tk +++ mttroot/mtt/bin/trans/examples_txt2tk @@ -24,11 +24,11 @@ while ((path[same]==oldpath[same])&&(same<=N)){ menu=menu"."tolower(path[same]) same++ } oldmenu=menu - for (i=same;i<=N;i++){ + for (i=same;i1 THEN - BEGIN - FOR col := 1:MTT_Matrix_m DO - BEGIN - IF (row EQ 1) AND (col EQ 1) THEN DELAYOPTS; - INAME(mtt_o); % Set temp name - gentran declare mtt_matrix_element:REAL; - gentran declare mtt_matrix:REAL; - mtt_matrix_element := mtt_matrix(row,col); - GENTRAN mtt_matrix(row,col) ::=: mtt_matrix_element; - IF (row EQ MTT_matrix_n) AND (col EQ MTT_Matrix_m) THEN MAKEOPTS; - END; - END - ELSE - BEGIN - IF (row EQ 1) THEN DELAYOPTS; - INAME(mtt_o); % Set temp name - GENTRAN mtt_matrix(row) ::=: mtt_matrix(row,1); - IF (row EQ MTT_matrix_n) THEN MAKEOPTS; - END; - END +%INAME(mtt_o); % Set temp name +GENTRAN mtt_matrix :=: mtt_matrix; + +% FOR row := 1:MTT_Matrix_n DO +% BEGIN +% IF MTT_Matrix_m>1 THEN +% BEGIN +% FOR col := 1:MTT_Matrix_m DO +% BEGIN +% IF (row EQ 1) AND (col EQ 1) THEN DELAYOPTS; +% INAME(mtt_o); % Set temp name +% %SETLENGTH(2); % Adjust optimisation +% gentran declare mtt_matrix_element:REAL; +% gentran declare mtt_matrix:REAL; +% mtt_matrix_element := mtt_matrix(row,col); +% GENTRAN mtt_matrix(row,col) ::=: mtt_matrix_element; +% IF (row EQ MTT_matrix_n) AND (col EQ MTT_Matrix_m) THEN MAKEOPTS; +% END; +% END +% ELSE +% BEGIN +% IF (row EQ 1) THEN DELAYOPTS; +% INAME(mtt_o); % Set temp name +% GENTRAN mtt_matrix(row) ::=: mtt_matrix(row,1); +% IF (row EQ MTT_matrix_n) THEN MAKEOPTS; +% END; +% END END; END;; Index: mttroot/mtt/bin/trans/latex_tidy ================================================================== --- mttroot/mtt/bin/trans/latex_tidy +++ mttroot/mtt/bin/trans/latex_tidy @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.16 2000/10/10 21:03:20 peterg +## *** empty log message *** +## ## Revision 1.15 1998/04/07 08:44:11 peterg ## zapped eta - it messes up theta ## ## Revision 1.14 1998/02/25 22:12:07 peterg ## Added , to regexp for subscripts @@ -71,10 +74,12 @@ -e "s/\// \\\over /g" \ -e "s/[0-9a-z_]*mtty/mtty/g" \ -e "s/[0-9a-z_]*mttu/mttu/g" \ -e "s/mttx\([0-9]*\)/x_{\1}/g" \ -e "s/mttex\([0-9]*\)/\\\chi_{\1}/g" \ + -e "s/mttddui\([0-9]*\)/\\\ddot{v}_{\1}/g" \ + -e "s/mttdui\([0-9]*\)/\\\dot{v}_{\1}/g" \ -e "s/mttui\([0-9]*\)/v_{\1}/g" \ -e "s/mttu\([0-9]*\)/u_{\1}/g" \ -e "s/mtty\([0-9]*\)/y_{\1}/g" \ -e "s/mttz\([0-9]*\)/z_{\1}/g" \ -e "s/mttdx0/\\\dot x_0/g" \