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. @@ -127,23 +131,25 @@ esac shift done # Create the reduce output code +def2write_r $optimise $1 ae def2write_r $optimise $1 cse def2write_r $optimise $1 csex # Version without E matrix def2write_r $optimise $1 cseo +echo "Creating $1_ae.r $optimise_msg" 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" # Remove the old log file rm -f dae2cse_r.log # Remove some files -rm -f $1_cse.r? $1_cseo.r? +rm -f $1_ae.r? $1_cse.r? $1_cseo.r? # Use reduce to accomplish the transformation $SYMBOLIC >dae2cse_r.log << EOF %Read the formatting function @@ -319,21 +325,10 @@ % No algebraic variables left! MTTNYz := 0; END; % IF MTTNyz>0 and $solve -OUT "$1_ae.r"; -IF (MTTNyz>0) THEN % not $solve (or perhaps solution failed?) -BEGIN - WRITE "MATRIX MTTyz(",MTTNyz,",1)"; - WRITE "%File: $1_ae.r"; - FOR i := 1:MTTNyz DO - WRITE "MTTyz(",i,",1) := ",MTTyz(i,1)," +0"; -END; % if MTTNyz>0 (and !$solve) -WRITE ";END;"; -SHUT "$1_ae.r"; - OUT "$1_aej.r"; IF (MTTNyz>0) THEN % as above BEGIN WRITE "MATRIX MTTyzj(",MTTNyz,",",MTTNyz,")"; WRITE "%File: $1_aej.r"; @@ -345,10 +340,22 @@ WRITE "MTTyzj(",i,",",j,") := ",didj," +0"; END; END; WRITE ";END;"; SHUT "$1_aej.r"; + +IF MTTNyz>0 THEN % not $solve or solution failed +BEGIN +OUT "$1_ae.r1"; +write "MATRIX MTTYZ(", MTTNyz, ",", 1, ")$"; +SHUT "$1_ae.r1"; +OUT "$1_ae.r2"; +write "%File: $1_ae.r"; +in ("$1_ae_write.r"); +write "END;"; +SHUT "$1_ae.r2"; +END; % Create the matrix declarations OUT "$1_cse.r1"; write "%"; IF (MTTNx > 0) THEN @@ -445,12 +452,14 @@ SHUT "$1_cseo.r2"; END; quit; EOF +touch $1_ae.r1 $1_ae.r2 touch $1_cseo.r1 touch $1_cseo.r2 +cat $1_ae.r1 $1_ae.r2 > $1_ae.r cat $1_cse.r1 $1_cse.r2 > $1_cse.r cat $1_csex.r1 $1_csex.r2 > $1_csex.r cat $1_cseo.r1 $1_cseo.r2 > $1_cseo.r if [ "$solve" = "1" ]; then 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 @@ -79,10 +82,15 @@ Nyz=`mtt_getsize $sys yz` # Zero outputs #Npar=`wc -l $sys\_sympar.txt | gawk '{print $1}'` # Set up representation-specific stuff case $rep in +ae) +matrices='Yz' +ns="$Nyz" +ms="1" +;; cse) matrices='EdX E' ns="$Nx $Nx" ms="1 $Nx" ;; Index: mttroot/mtt/bin/trans/ese2rdae_r ================================================================== --- mttroot/mtt/bin/trans/ese2rdae_r +++ mttroot/mtt/bin/trans/ese2rdae_r @@ -12,10 +12,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## 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 +102,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 +142,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 +162,13 @@ % Definitions in "$defname"; % Elementary system equations in "$esename"; + +% Fix c code if required +$include OFF Echo; OFF Nat; %Create the output file