Index: mttroot/mtt/bin/trans/cbg2ese_m2r ================================================================== --- mttroot/mtt/bin/trans/cbg2ese_m2r +++ mttroot/mtt/bin/trans/cbg2ese_m2r @@ -14,10 +14,13 @@ ## Version control history ############################################################### ## $Id$ ## ## $Log$ +## Revision 1.26 2000/12/05 09:04:54 peterg +## *** empty log message *** +## ## Revision 1.25 2000/12/01 14:51:26 peterg ## Major changes towards partioning ## ## - generates sub ese, def and struc ## - generates indices for conversion of subsystem in/out/state - but not used yet @@ -188,11 +191,12 @@ # Save up the full def file mv $1_def.r mtt_all_def.r ## Recreate def file from the ese file directly -function makedef { +makedef () +{ echo Creating $1_def.r Nx=`mtt_getsize -external $1 dX` Nz=`mtt_getsize -external $1 z` @@ -223,17 +227,19 @@ echo "END;" >> $1_def.r } -function get_indices { +get_indices () +{ sys=$1 which=$2 awk '{if ($1==which) print $2}' which=$which < ${sys}_struc.txt } -function convert_indices { +convert_indices () +{ sys=$1 Which="input output state" for which in $Which; do indices=`get_indices ${sys} $which` Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.43 2000/12/04 10:59:40 peterg +## *** empty log message *** +## ## Revision 1.42 2000/11/10 14:19:50 peterg ## Corrected the csex and cseo functions ## ## Revision 1.41 2000/11/09 17:06:39 peterg ## Now does euler for cc @@ -165,11 +168,12 @@ ode=ode odeo=odeo algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)" fi -function make_m() { +make_m() +{ #lang_header $1 ode2odes m 'x,par,simpar' '[Y,X,t]' > $filename mtt_header ${sys} ode2odes m > $filename cat <> $filename global MTT_data; @@ -234,11 +238,12 @@ endfunction EOF } # make_m -function make_cc() { +make_cc() +{ cat < $filename #include #include @@ -529,11 +534,11 @@ ColumnVector open_switches (MTTNX); register double t = 0.0; const double ddt = simpar ["dt"].double_value () / simpar ["stepfactor"].double_value (); - const int ilast = (int)round (simpar ["last"].double_value () / ddt); + const int ilast = (int)round (simpar ["last"].double_value () / ddt) + 1; // cse translation // LSODE will need ODEFUNC for (register int j = 0, i = 1; i <= ilast; i++) @@ -560,11 +565,11 @@ cat <> $filename open_switches = mtt_logic (x, u, t, par); x = $algorithm; t += ddt; j++; - j = (j == (int)simpar ["stepfactor"].double_value ()) ? j : 0; + j = (j == (int)simpar ["stepfactor"].double_value ()) ? 0 : j; } retval (0) = octave_value (y); retval (1) = octave_value (x); retval (2) = octave_value (t);