Index: mttroot/mtt/bin/trans/rdae2dae_r ================================================================== --- mttroot/mtt/bin/trans/rdae2dae_r +++ mttroot/mtt/bin/trans/rdae2dae_r @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.1 2000/09/01 12:14:44 peterg +## Initial revision +## ## Revision 1.3 1998/03/07 12:57:19 peterg ## Fixed logname bug ## ## Revision 1.2 1998/03/07 12:51:20 peterg ## This is the new version of ese2dae - it does not do the CRs at this @@ -62,10 +65,26 @@ ## Revision 1.2 1996/08/25 08:31:28 peter ## Error handling added. ## ############################################################### + +while [ -n "`echo $1 | grep '^-'`" ]; do + case $1 in + -I ) + info=info;; + -partition ) + partition=yes; + blurb='with partitioning'; + ;; + *) + echo "$1 is an invalid argument - ignoring"; + exit ;; + esac + shift +done + #Create the top-level system name topname=$1 #Create the system names if [ -z "$2" ]; @@ -136,23 +155,61 @@ MTT_Matrix := MTTYz$ MTT_Matrix_name := "MTTYz"$ MTT_Matrix_n := MTTNyz$ MTT_Matrix_m := 1$ Reduce_Matrix()$ - -% Connecting inputs -MTT_Matrix := MTTuc$ -MTT_Matrix_name := "MTTuc"$ -MTT_Matrix_n := MTTNuc$ -MTT_Matrix_m := 1$ -Reduce_Matrix()$ - - -write ";END;"; SHUT "$daename"; quit; EOF + +if [ -n "$partition" ]; then + rm -f mtt_junk + # Now for the subsystems + # Find subsystems + subsystems=`sh rc2_type.sh 'echo ' ' ' | awk '{if (NR>1) print $2}'` + + for subsystem in $subsystems; do + echo Doing $subsystem + ucname="MTT_"$subsystem"_uc" + + Nu=`mtt_getsize -internal $subsystem"_1" u` + echo Nu $Nu + + # Use symbolic algebra to accomplish the transformation + $SYMBOLIC >$logname << EOF + + %Read the formatting function + in "$MTTPATH/trans/reduce_matrix.r"; + + % Definitions + in "$defname"; + + % Elementary system equations + in "$rdaename"; + + OFF Echo; + OFF Nat; + + %Create the output file + OUT "mtt_junk"; + % Connecting inputs + MTT_Matrix := $ucname $ + MTT_Matrix_name := "$ucname" $ + MTT_Matrix_n := $Nu $ + MTT_Matrix_m := 1$ + Reduce_Matrix()$ + + shut "mtt_junk"; +EOF + echo >> $1_dae.r + echo %Connections for subsystem $subsystem >> $1_dae.r + cat mtt_junk >> $1_dae.r + rm -rf mtt_junk + done +fi + +echo "END;" >> $1_dae.r # Now invoke the standard error handling. mtt_error_r $logname