Changes In Branch origin/optimise-algebraic-equations Through [a922f43a0b] Excluding Merge-Ins
This is equivalent to a diff from aebab108aa to a922f43a0b
Deleted CVSROOT/checkoutlist version [db1d2d9b69].
Deleted CVSROOT/commitinfo version [85654ac9a8].
Deleted CVSROOT/config version [28e7a42550].
Deleted CVSROOT/cvswrappers version [9d41597c29].
Deleted CVSROOT/editinfo version [dfa5fb459c].
Deleted CVSROOT/loginfo version [7508d75767].
Deleted CVSROOT/modules version [84b74e5335].
Deleted CVSROOT/notify version [2a5259e3c5].
Deleted CVSROOT/rcsinfo version [c276b88ba1].
Deleted CVSROOT/syncmail version [c9554ab114].
Deleted CVSROOT/taginfo version [364dad5373].
Deleted CVSROOT/verifymsg version [cbc796537d].
Modified mttroot/mtt/bin/mtt
from [68d41245b0]
to [a4c3c642a3].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (C) 2001 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.352 2002/05/24 11:04:10 geraint ## Removed unnecessary message about *.log file not existing when -D option is used. ## ## Revision 1.351 2002/05/23 17:08:20 geraint ## `mtt sys sfun zip` now produces an input block and an interface block for MTT models. ## Models can be embedded within larger Simulink models by the 2 ports. ## The user must edit 2 code blocks in <sys>_sfun_interface.c before compiling with mex. | > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (C) 2001 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ ## Revision 1.353 2002/05/28 18:08:38 geraint ## Fixed [ 547294 ] CRs are not sought from MTT_CRS. ## ## Revision 1.352 2002/05/24 11:04:10 geraint ## Removed unnecessary message about *.log file not existing when -D option is used. ## ## Revision 1.351 2002/05/23 17:08:20 geraint ## `mtt sys sfun zip` now produces an input block and an interface block for MTT models. ## Models can be embedded within larger Simulink models by the 2 ports. ## The user must edit 2 code blocks in <sys>_sfun_interface.c before compiling with mex. |
︙ | ︙ | |||
2699 2700 2701 2702 2703 2704 2705 | ${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r 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 | | | 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 | ${sys}_rdae.r: ${sys}_ese.r ${sys}_def.r $1_modpar.r ${Subsystem}_cr.r ${Subsystem}_subs.r 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} ${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 endif ifeq ($rdae_is_dae,1) |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/dae2cse_r
from [e055f9ba28]
to [4bd66676aa].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop 1991, 1992, 1994. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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. ## ## Revision 1.17 2001/07/27 23:29:10 geraint | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Copyright (c) P.J.Gawthrop 1991, 1992, 1994. ############################################################### ## 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. ## ## Revision 1.17 2001/07/27 23:29:10 geraint |
︙ | ︙ | |||
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | *) echo "$1 is an invalid argument - ignoring" ;; 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 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 | > > | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | *) echo "$1 is an invalid argument - ignoring" ;; 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_ae.r? $1_cse.r? $1_cseo.r? # Use reduce to accomplish the transformation $SYMBOLIC >dae2cse_r.log << EOF %Read the formatting function in "$MTTPATH/trans/reduce_matrix.r"; |
︙ | ︙ | |||
317 318 319 320 321 322 323 | set(lhs(MTT_sol_i),rhs(MTT_sol_i)); END; % No algebraic variables left! MTTNYz := 0; END; % IF MTTNyz>0 and $solve | < < < < < < < < < < < > > > > > > > > > > > > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | set(lhs(MTT_sol_i),rhs(MTT_sol_i)); END; % No algebraic variables left! MTTNYz := 0; END; % IF MTTNyz>0 and $solve OUT "$1_aej.r"; IF (MTTNyz>0) THEN % as above BEGIN WRITE "MATRIX MTTyzj(",MTTNyz,",",MTTNyz,")"; WRITE "%File: $1_aej.r"; FOR i := 1:MTTNyz DO FOR j := 1:MTTNyz DO BEGIN didj := df(MTTyz(i,1),mkid('mttui,j)); IF (didj NEQ 0) THEN 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 BEGIN write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; |
︙ | ︙ | |||
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | in ("$1_cseo_write.r"); write "END;"; SHUT "$1_cseo.r2"; END; quit; EOF touch $1_cseo.r1 touch $1_cseo.r2 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 echo "Setting MTTNyz=0 in $1_def.r and updating other $1_def files" gawk '{ | > > | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | in ("$1_cseo_write.r"); write "END;"; 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 echo "Setting MTTNyz=0 in $1_def.r and updating other $1_def files" gawk '{ |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/def2write_r
from [10c4312f8d]
to [83e084d8bc].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## Optimises only when requested (-opt). ## | > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## 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 ## Optimises only when requested (-opt). ## |
︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | Nu=`mtt_getsize $sys u` # Inputs Ny=`mtt_getsize $sys y` # Outputs Nyz=`mtt_getsize $sys yz` # Zero outputs #Npar=`wc -l $sys\_sympar.txt | gawk '{print $1}'` # Set up representation-specific stuff case $rep in cse) matrices='EdX E' ns="$Nx $Nx" ms="1 $Nx" ;; csex) matrices='EdX' | > > > > > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | Nu=`mtt_getsize $sys u` # Inputs Ny=`mtt_getsize $sys y` # Outputs 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" ;; csex) matrices='EdX' |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/ese2rdae_r
from [713fa3d927]
to [2f139cc4dc].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop, 1991, 1994, 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## ## Revision 1.10 2000/11/30 15:23:16 peterg ## Taken out all subsystem stuff - now done in mtt using | > > > > > > > > > > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Copyright (c) P.J.Gawthrop, 1991, 1994, 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## 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 ## ## Revision 1.10 2000/11/30 15:23:16 peterg ## Taken out all subsystem stuff - now done in mtt using |
︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 | case $1 in -I ) info=info;; -cr ) load_cr=yes; blurb2=' using cr and subs first'; ;; -partition ) partition=yes; blurb='with partitioning'; ;; *) echo "$1 is an invalid argument - ignoring"; exit ;; | > > > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | case $1 in -I ) 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'; ;; *) echo "$1 is an invalid argument - ignoring"; exit ;; |
︙ | ︙ | |||
132 133 134 135 136 137 138 | if [ -n "${load_cr}" ]; then load_cr_comm="in \"${crname}\";" load_subs_comm="in \"${subsname}\";" fi # Inform user | | > > > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | if [ -n "${load_cr}" ]; then load_cr_comm="in \"${crname}\";" load_subs_comm="in \"${subsname}\";" fi # Inform user echo Creating $daename $blurb $blurb2 $blurb3 # Remove the old log file rm -f $logname # Use symbolic algebra to accomplish the transformation $SYMBOLIC >$logname << EOF %Read in the cr and sub when -cr is set $load_cr_comm $load_subs_comm %Read the formatting function in "$MTTPATH/trans/reduce_matrix.r"; % Definitions in "$defname"; % Elementary system equations in "$esename"; % Fix c code if required $include OFF Echo; OFF Nat; %Create the output file OUT "$daename"; |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/m/args2arg.m
from [88e206959b]
to [b6ee5ada28].
︙ | ︙ | |||
24 25 26 27 28 29 30 31 | % %% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Field separator if nargin<3 FS = ';'; end; | > > > > > > > > > > > > > > > > > > > > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | % %% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Field separator if nargin<3 FS = ';'; end; arg = ''; if strcmp(args, '')==0 L = length(args); args_count = 0; for i=1:n arg_count = 0; arg = ''; if args_count == L break; end; while args_count < L args_count = args_count+1; arg_count = arg_count+1; ch = str2ch(args,args_count); if ch==FS break; end; arg = [arg ch]; end; end; end; |
Deleted mttroot/mtt/doc/mtt.texi version [95bf219a63].
Modified mttroot/mtt/lib/rep/sfun_rep.sh
from [91c3b4a28b]
to [63c5879b48].
︙ | ︙ | |||
1375 1376 1377 1378 1379 1380 1381 | ### main program | | | | 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | ### main program #set_debug 0 #check_for_valid_input "$*" OPTS="$1" SYS="$2" REP="$3" LANG="$4" make $make_debug -f ${MTT_REP}/sfun_rep/Makefile ${2}_${3}.${4} exit 0 |