Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -15,10 +15,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.356 2002/06/17 13:14:50 geraint +## Fixed some rules to reduce number of implicit rule searches. +## ## Revision 1.355 2002/06/10 23:18:44 geraint ## Adjusted cr.h comment delimiters to be C compliant. ## ## Revision 1.354 2002/06/10 10:43:19 gawthrop ## ode2odes now prerequisite for sim.m and ssim.m @@ -2716,11 +2719,11 @@ ifneq ($partition,) echo Doing subsystems mtt_make_subsystems ${sys} rdae r endif mtt_prepend.sh -p $1_modpar.r $1_ese.r # Add modulated parameters to start - ese2rdae_r ${cr_first} ${Subsystem}; tidy ${Subsystem}_rdae.r + ese2rdae_r ${cr_first} ${fixcc} ${Subsystem}; tidy ${Subsystem}_rdae.r ${sys}_dae.r: ${Subsystem}_rdae.r ${Subsystem}_def.r ${Subsystem}_subs.r ${Subsystem}_cr.r ifneq ($partition,) echo Doing subsystems mtt_make_subsystems ${sys} dae r Index: mttroot/mtt/bin/trans/dae2cse_r ================================================================== --- mttroot/mtt/bin/trans/dae2cse_r +++ mttroot/mtt/bin/trans/dae2cse_r @@ -13,10 +13,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.20 2002/04/28 18:41:26 geraint +## Fixed [ 549658 ] awk should be gawk. +## Replaced calls to awk with call to gawk. +## ## Revision 1.19 2001/10/26 01:01:49 geraint ## fixcc when rdae_is_dae (-cr). ## ## Revision 1.18 2001/10/05 23:37:32 geraint ## Fixed assignment statement in ae.r when RHS=0. @@ -114,11 +118,12 @@ case $1 in -A ) solve=1 solve_msg=' with explicit solution of algebraic equations' ;; -fixcc ) - fixcc=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'` + fixcc='-fixcc' + include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'` fix_msg='fixing c and cc code'; ;; -optimise) optimise='-optimise' optimise_msg=' with optimisation' ;; @@ -127,13 +132,13 @@ esac shift done # Create the reduce output code -def2write_r $optimise $1 cse -def2write_r $optimise $1 csex # Version without E matrix -def2write_r $optimise $1 cseo +def2write_r $optimise $fixcc $1 cse +def2write_r $optimise $fixcc $1 csex # Version without E matrix +def2write_r $optimise $fixcc $1 cseo echo "Creating $1_cse.r $solve_msg $optimise_msg $fix_msg" echo "Creating $1_csex.r $optimise_msg" echo "Creating $1_cseo.r $optimise_msg" @@ -152,11 +157,11 @@ OFF Echo; OFF Nat; ON NERO; %Fix c code if required -$fixcc +$include in "$1_def.r"; MTTdxs := MTTdX; %Save the symbolic form of dX in "$1_subs.r"; Index: mttroot/mtt/bin/trans/def2write_r ================================================================== --- mttroot/mtt/bin/trans/def2write_r +++ mttroot/mtt/bin/trans/def2write_r @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.11 2002/05/17 09:14:58 geraint +## Optimises each line in a separate session. Allows larger models to be built. +## ## Revision 1.10 2002/04/28 18:41:27 geraint ## Fixed [ 549658 ] awk should be gawk. ## Replaced calls to awk with call to gawk. ## ## Revision 1.9 2001/07/27 23:29:10 geraint @@ -57,10 +60,12 @@ while [ -n "`echo $1 | grep '^-'`" ]; do case $1 in -optimise) opt='-optimise' optimise_msg=' with optimisation' ;; + -fixcc ) + include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'` ;; *) echo "$1 is an invalid argument - ignoring" ;; esac shift done @@ -161,10 +166,11 @@ on double$ on noconvert$ on rounded$ off int$ off nat$ +$include out "$tmp2"$ EOF } > $tmp Index: mttroot/mtt/bin/trans/ese2rdae_r ================================================================== --- mttroot/mtt/bin/trans/ese2rdae_r +++ mttroot/mtt/bin/trans/ese2rdae_r @@ -12,10 +12,26 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.12.2.2 2002/06/05 17:28:00 geraint +## Cosmetic change. +## +## Revision 1.12.2.1 2002/06/05 11:14:51 geraint +## ae.r now generated using def2write_r like cse?.r +## fix_c.r called at ese2rdae stage so that pow gets fixed in ae.r. +## +## These changes produce the desired result (optimised algebraic equations) but +## have highlighted a problem; when optimisation fails, Reduce does not write +## a result. For complicated systems, this can lead to missing assignments in +## the resultant code. +## +## Revision 1.12 2001/07/23 23:31:17 gawthrop +## Added -cr option to load CRs first - avoids alg. loops with R +## implementation of mutiports. +## ## Revision 1.11 2001/07/06 00:46:50 gawthrop ## Added -cr option -- forces cr to be loaded before the ese.r file ## This avoids causality problems when using multi-port Rs to represent ## arbitary equations ## @@ -98,10 +114,14 @@ info=info;; -cr ) load_cr=yes; blurb2=' using cr and subs first'; ;; + -fixcc ) + include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'` + blurb3='fixing c and cc code'; + ;; -partition ) partition=yes; blurb='with partitioning'; ;; *) @@ -134,11 +154,11 @@ load_cr_comm="in \"${crname}\";" load_subs_comm="in \"${subsname}\";" fi # Inform user -echo Creating $daename $blurb $blurb2 +echo Creating $daename $blurb $blurb2 $blurb3 # Remove the old log file rm -f $logname # Use symbolic algebra to accomplish the transformation @@ -154,10 +174,13 @@ % Definitions in "$defname"; % Elementary system equations in "$esename"; + +% Fix c code if required +$include OFF Echo; OFF Nat; %Create the output file