Index: mttroot/mtt/bin/trans/mtt_r2m ================================================================== --- mttroot/mtt/bin/trans/mtt_r2m +++ mttroot/mtt/bin/trans/mtt_r2m @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.5 1998/08/13 16:25:07 peterg +## Removed some documentation form odeo.m +## ## Revision 1.4 1998/08/13 15:10:47 peterg ## Change temp var name to mtt_t1 etc ## ## Revision 1.3 1998/08/13 12:43:19 peterg ## Cahnged tmp variable to mtt_1 etc @@ -38,14 +41,13 @@ Lc='#'; Rc='#'; Lb='('; Rb=')'; -outfile=$1"_"$rep.$ext - -rm -f $outfile.* - +outfile=$1"_"$rep +echo $outfile +rm -fv $outfile.[123] #Set up gentran cat <mtt_setreduce.r % Set up the code generator % Load the general translator package LOAD GENTRAN; @@ -63,71 +65,61 @@ in "$1_def.r"; %Read the reduce $REP file in "$1_$rep.r"; -%Read the parameter file -in "$1_sympar.r"; - EOF #Inform user -echo Creating $outfile +echo Creating $outfile.m # Remove the old log file -rm -f mtt_r2lang.log +rm -f mtt_r2m.log #Remove the temporary files -rm -f $outfile.* if [ "$rep" = "ode" ]; then #echo Creating $1_odea.$ext - echo Creating $1_odeo.$ext - rm -f $1_odeo.$ext.1; + outfileo=$outfile"o" + echo Creating $outfileo.m + rm ode odeo #rm -f $1_odea.$ext.1; #Header - lang_header $1 $rep $ext 'mttx,mttu,t' mttdx > $outfile.1 + lang_header $1 $rep $ext 'mttx,mttu,t' mttdx > $1_ode.p + lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.p # Use reduce to accomplish the transformation - $SYMBOLIC >mtt_r2lang.log << EOF - +$SYMBOLIC > mtt_r2m.log < $outfile.4 - rm -f $outfile.3 ## # Create the odea.$ext function ## lang_header $1 odea $ext 'mttui' mttyz 'global mttxx mttt; mttx = mttxx; t=mttt;' > $1_odea.$ext ## ## $MATRIX -q <> $1_odea.$ext @@ -191,37 +177,38 @@ ## % The algebraic equations ##EOF ## sed 's/mtt_matrix/mttyz/' $1_odea.$ext.1 >> $1_odea.$ext - # Create the odeo.$ext function - lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.$ext - -$MATRIX -q <> $1_odeo.$ext - %System structure - [nx,ny,nu,nz,nyz] = $1_def; - if nyz>0 - printf("$Lc====== Extract the internal input variables ======$Rc\n"); - for i = 1:nyz - printf(" mttui$Lb%i$Rb = mttx$Lb%i$Rb;\n",i,i+nx); - end; - printf("\n"); - - printf("$Lc====== Set up the internal input variables ======$Rc\n"); - for i = 1:nyz - printf(" mttui%i = mttui$Lb%i$Rb;\n",i,i); - end; - printf("\n"); - end; - -EOF - -sed 's/mtt_matrix/mtty/' $1_odeo.$ext.1 >> $1_odeo.$ext - -# Convert from Pascal syntax to Octave syntax - mv $1_odeo.m mtt_junk; mtt_p2m $1_odeo.m -# mv $1_odea.m mtt_junk; mtt_p2m $1_odea.m + # Create the odeo function + +##$MATRIX -q <> $1_odeo.p +## %System structure +## [nx,ny,nu,nz,nyz] = $1_def; +## if nyz>0 +## printf("$Lc====== Extract the internal input variables ======$Rc\n"); +## for i = 1:nyz +## printf(" mttui$Lb%i$Rb = mttx$Lb%i$Rb;\n",i,i+nx); +## end; +## printf("\n"); +## +## printf("$Lc====== Set up the internal input variables ======$Rc\n"); +## for i = 1:nyz +## printf(" mttui%i = mttui$Lb%i$Rb;\n",i,i); +## end; +## printf("\n"); +## end; +##EOF + +sed 's/mtt_matrix/mttdx/' > $1_ode.p +sed 's/mtt_matrix/mtty/' > $1_odeo.p + +# Convert from Pascal syntax to Octave syntax + mtt_p2m<$1_odeo.p > $1_odeo.m + mtt_p2m<$1_ode.p > $1_ode.m +# mv $1_odea.m mtt_junk; mtt_p2m $1_odea.m + fi if [ "$rep" = "sm" ]||[ "$rep" = "dm" ]; then if [ "$rep" = "sm" ]; then @@ -297,22 +284,26 @@ mtt_matrix_m := $M; lang_matrix(); GENTRANSHUT "$outfile.1"; EOF -echo "% $Symbol matrix" >$outfile.$Symbol -cat "$outfile.2" >> $outfile.$Symbol +echo "%$Symbol matrix#" > $outfile.$Symbol +cat "$outfile.2" >> $outfile.$Symbol sed "s/mtt_matrix/mtt$Symbol/" < $outfile.1 |\ -grep -v '=0\.0;' >> $outfile.$Symbol +grep -v '=0\.0;' >> $outfile.$Symbol done -rm -f $outfile.[12] -fi + +fi # Convert from Pascal syntax to Octave syntax cat $outfile.? | mtt_p2m > $outfile -rm -f $outfile.? +#rm -f $outfile.? + + + +