Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -14,10 +14,15 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.305 2001/04/11 09:44:26 gawthrop +## Fixed cc and c problems to do with pow(x,y) and integers +## mtt/lib/reduce/fix_c.r is included in rdae2dae and cse2smx_lang for +## -c, -cc and -oct options +## ## Revision 1.304 2001/04/11 07:35:22 gawthrop ## Now uses system_cr.h in place of system.h in .c rep - ## compatible with older code ## ## Revision 1.303 2001/04/10 12:54:50 gawthrop @@ -1398,11 +1403,11 @@ rm -f *_obs.* *_rfe.* *_ss.* rm -f *_dm.* *_csm.* *_tf.* *_sr*.* *_ir*.* *_*fr.* rm -f *_numpar.m *_numpar.c *_input.m *_input.c *_switch.c *_switch.txt rm -f *_sm.* *_can.* rm -f *_struc.* *_sympar.txt *_sympar.c *_sympar.h *_sympar.m - rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps + rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps *_odes.sg rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc rm -f *_rep.tex rm -f *_unique_raw_list *_raw_list rm -f mtt_error.txt mtt_info.txt *_ode2odes.out @@ -1433,11 +1438,11 @@ rm -f $1_dae*.* $1_cse.* $1_ode.* $1_obs.* $1_rfe.* $1_ss.* rm -f $1_dm.* $1_csm.* $1_tf.* $1_sr*.* $1_ir*.* $1_*fr.* rm -f $1_numpar.m $1_numpar.c $1_input.m $1_input.c $1_switch.c $1_switch.txt rm -f $1_sm*.* $1_can.* rm -f $1_struc.* $1_sympar.txt $1_sympar.c $1_sympar.h $1_sympar.m - rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps + rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps $1_odes.sg rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc rm -f $1_rep.tex rm -f $1_unique_raw_list $1_raw_list rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out @@ -1788,11 +1793,11 @@ if [ "$3" != "view" ] && [ "$3" != "hview" ] && [ -z "$reset" ]; then if [ "$3" = "html" ]; then echo Moving $1_$2 mv $1_$2 .. else - if [ "$PLOTTYPE" = "multiple" ]; then + if [ "$PLOTTYPE" = "multiple" -a -f $1_$2__ARGS.$ps ]; then echo Copying $1_$2$__ARGS.$ps cp $1_$2$__ARGS.$ps .. else echo Copying $1$subsystem"_"$2.$lang cp -p -u $1$subsystem"_"$2.$lang .. @@ -2828,10 +2833,11 @@ #SUMMARY sro step response - output (ps) #SUMMARY sro* step response - output (view) #SUMMARY odes ode solution - state (m) #SUMMARY odes* ode solution - state (dat) +#SUMMARY odes ode solution - state & output for SciGraphica (sg) #SUMMARY odes* ode solution - state (ps) #SUMMARY odes* ode solution - state (view) #SUMMARY sms ode (in state matrix form) solution - state & output (c) @@ -2895,13 +2901,13 @@ ifeq ($computation,cc) $1_sim.exe: $1_ese.r mtt $mtt_switches -q $1 sim exe -$1_odes.dat2: $1_sim.exe +$1_odes.dat2: $1_ode2odes.exe echo Creating $1_odes.dat2 using cc version $ARGS - time ./$1_sim.exe $ARGS >$1_odes.dat2 + time ./$1_ode2odes.exe $ARGS >$1_odes.dat2 endif #$1_odeso.m: $1_odes.m # touch $1_odeso.m @@ -2917,10 +2923,15 @@ $1_odeso.sdat: $1_odeso.dat $1_struc.txt odeso_dat2sdat $1 $1_odes.sdat: $1_odes.dat $1_struc.txt odes_dat2sdat $1 + +#Conversion of data to SciGraphica +$1_odes.sg: $1_struc.m $1_odes.dat2 + echo Creating $1_odes.sg + dat22sg.sh $1 #SUMMARY odess ode numerical steady-states - states (m) #SUMMARY odess ode numerical steady-states - states (dat) #SUMMARY odess ode numerical steady-states - states (ps) #SUMMARY odess ode numerical steady-states - states (view) ADDED mttroot/mtt/bin/trans/dat22sg.sh Index: mttroot/mtt/bin/trans/dat22sg.sh ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/dat22sg.sh @@ -0,0 +1,147 @@ +#! /bin/sh + +# Convert simulation data to SciGraphica (v 0.61) Project file ($sys_odes.sg) + +sys=$1 + +write_project_header () +{ + cat < + + + + + application + scigraphica + + + author + MTT:${USER} + + + +EOF +} + +write_project_footer () +{ + echo '' + echo '' +} + +write_worksheet_header () +{ + name=$1 ; ncol=$2 ; nrow=$3 + cat < + + + application + scigraphica + + + author + MTT:${USER} + + + + ${name} + ${ncol} + ${nrow} + -1 + -1 +EOF +} + +write_worksheet_footer () +{ + echo '' + echo '' +} + +write_column_headings () +{ + awk '{ printf (" \n \n", NR-1,$0) }' +} + +write_output_headings () +{ + sys=$1 + ${MATRIX} -q <\n", row,col); + printf (" %f\n", val); + printf (" %f\n", val); + printf (" \n"); +endfunction + + [u_names,y_names,x_names] = ${sys}_struc; + ncol = size(${vec}_names)(1); + + load ("${sys}_odes.dat2"); + nrow = size(MTT_data)(1); + + # write Time + for r = 1:nrow + write_cell (r-1,0,MTT_data(r,1)); + endfor + + if ("${vec}" == "y") + offset = 1; + elseif ("${vec}" == "x") + offset = size(y_names)(1); + endif + + for r = 1:nrow + for c = 1:ncol + write_cell (r-1,c,MTT_data(r,c+offset)); + endfor + endfor +EOF +} + +file=${sys}_odes.sg + +NX=`mtt_getsize ${sys} x` +NY=`mtt_getsize ${sys} y` +NTMP=`wc -l ${sys}_odes.dat2 | awk '{print $1}'` +NROW=`expr ${NTMP} - 4` # 4 comment lines in MTT_data + +{ + write_project_header + # states + write_worksheet_header "X_${sys}" `expr 1 + ${NX}` ${NROW} + write_state_headings ${sys} + write_cell_values ${sys} x + write_worksheet_footer + # outputs + write_worksheet_header "Y_${sys}" `expr 1 + ${NY}` ${NROW} + write_output_headings ${sys} + write_cell_values ${sys} y + write_worksheet_footer + write_project_footer +} > ${file} +