Comment: | Put under RCS |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5ca714598426ce2a3cc22ca2a53a14b1 |
User & Date: | gawthrop@users.sourceforge.net on 2000-12-28 12:48:53 |
Other Links: | branch diff | manifest | tags |
2000-12-28
| ||
12:53:10 | *** empty log message *** check-in: 3d5410607c user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
12:48:53 | Put under RCS check-in: 5ca7145984 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
12:31:15 | *** empty log message *** check-in: 7c2e142b43 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Added mttroot/mtt/bin/trans/abg2cr_m2txt version [8b839d7a30].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: abg2cr_m2txt # Abg file to constitutive relationship conversion # P.J.Gawthrop march 2000 # Copyright (C) 2000 by Peter J. Gawthrop # Inform user if [ -f "$1_cr.txt" ]; then echo "Using $1_cr.txt" exit else echo "Creating $1_cr.txt" fi rm -f mtt_error # This is the main transformation using awk # And remove crs with same name as system grep 'cr = ' $1_abg.m | awk ' BEGIN { # Include lin cr anyway. print "lin" } { crs=substr($3,2,length($3)-3); N=split(crs,cr,";"); for (i=1;i<=N;i++){ if (length(cr[i])>0) print cr[i]; } }' 2>mtt_error.txt | sort -u | grep -v none | grep -v '\$[0-9]'> $1_cr.txt # Now invoke the standard error handling. mtt_error mtt_error.txt |
Added mttroot/mtt/bin/trans/cse2ode_r version [b0e0e060b2].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: cse2ode_r # Reduce constrained-state equations to ode. # P.J.Gawthrop 10th May 199, 8th August 1991, April 1994, Dec 1994 # Copyright (c) P.J.Gawthrop, 1991, 1994. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1997/01/06 21:17:10 peterg ## Removed: OFF Exp; OFF GCD; ## ## Revision 1.1 1996/08/25 10:05:45 peter ## Initial revision ## ############################################################### # Create the reduce output code def2write_r $1 ode def2write_r $1 odeo #Inform user echo Creating $1_ode.r echo Creating $1_odeo.r # Remove the old log file rm -f cse2ode_r.log # Use reduce to accomplish the transformation $SYMBOLIC >cse2ode_r.log << EOF %Read the formatting function in "$MTTPATH/trans/reduce_matrix.r"; %Read the definitions file in "$1_def.r"; %Read the substitution file in "$1_subs.r"; %Read the constrained-state equations file in "$1_cse.r"; IF MTTNx>0 THEN IF MTTNz>0 THEN MTTdXX := MTTE^(-1)*MTTEdX ELSE MTTdXX := MTTEdX; %Remove all dX terms from y - a rather nasty method, sorry! MTTdX1 := 0; MTTdX2 := 0; MTTdX3 := 0; MTTdX4 := 0; MTTdX5 := 0; MTTdX6 := 0; MTTdX7 := 0; MTTdX8 := 0; MTTdX9 := 0; MTTdX10 := 0; MTTdX11 := 0; MTTdX12 := 0; MTTdX13 := 0; MTTdX14 := 0; MTTdX15 := 0; MTTdX16 := 0; MTTdX17 := 0; MTTdX18 := 0; MTTdX19 := 0; MTTdX20 := 0; %Substitute dX into y; IF MTTNz>0 THEN IF MTTNx>0 THEN MTTY := MTTY + MTTEyx*MTTdX; OFF Echo; OFF Nat; MTTdX := MTTdXX; %Write out the ordinary differential equations. OUT "$1_ode.r"; write "%File: $1_ode.r"; in ("$1_ode_write.r"); write "in ""$1_odeo.r"";"; write "END;"; SHUT "$1_ode.r"; %Write out the output equations OUT "$1_odeo.r"; write "%File: $1_odeo.r"; in ("$1_odeo_write.r"); write "END;"; SHUT "$1_odeo.r"; quit; EOF # Now invoke the standard error handling. mtt_error_r cse2ode_r.log |
Added mttroot/mtt/bin/trans/cse2rfe_r version [5e4feb17e7].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: cse2rfe_r # Reduce constrained-state equations to robot matrices # Experimental version! # State vector should have momenta in odd rows,angles in even; # the last row should have the gravity velocity term. # There should be one output (only) for each joint velocity. # P.J.Gawthrop, Nov 92, Dec 93, May 1994 # Copyright (c) P.J.Gawthrop, 1992, May 1994. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1996/12/05 12:10:00 peterg ## Version history added. ## ############################################################### # Inform user echo Creating $1_rfe.r # Remove the old log file rm -f cse2rfe_r.log # Use reduce to accomplish the transformation reduce >cse2rfe_r.log << EOF IN "$1_def.r"; IN "$1_sympar.r"; IN "$1_csm.r"; IN "$1_cse.r"; MTTN2 := MTTNy; %Find E11 and E12 matrices MATRIX MTTE11(MTTN2,MTTN2), MTTE12(MTTN2,MTTN2); FOR i := 1:MTTN2 DO FOR j := 1:MTTN2 DO BEGIN MTTE11(i,j) := MTTE(2*i-1,2*j-1); MTTE12(i,j) := MTTE(2*i-1,2*j); END; %Find inertia matrix MATRIX MTTImi(MTTN2,MTTN2); FOR i := 1:MTTN2 DO BEGIN MTTImi(i,i) := MTTC(i,2*i-1); END; MTTIm := MTTImi^-1; %Find gravity matrix if there is an extra gravity state MATRIX MTTG(MTTN2,1); MTTNy2 := 2*MTTNy; IF ( (MTTNx-1)/MTTNy2 = 1) THEN FOR i := 1:MTTN2 DO BEGIN MTTG(i,1) := MTTE(2*i-1,MTTNx); END; %Find V matrix from RHS of equation MTTu1 := 0; MTTu2 := 0; MTTu3 := 0; MTTu4 := 0; MTTu5 := 0; MTTu6 := 0; MTTx2 := theta_1; MTTx4 := theta_2; MTTx6 := theta_3; MTTx8 := theta_4; MTTx10 := theta_5; MTTx12 := theta_6; MTTx1 := dot_theta_1*MTTIm(1,1); MTTx3 := dot_theta_2*MTTIm(2,2); MTTx5 := dot_theta_3*MTTIm(2,3); MATRIX MTTdt(6,1); MTTdt(1,1) := dot_theta_1; MTTdt(2,1) := dot_theta_2; MTTdt(3,1) := dot_theta_3; MTTdt(4,1) := dot_theta_4; MTTdt(5,1) := dot_theta_5; MTTdt(6,1) := dot_theta_6; MATRIX dtheta(MTTN2,1); FOR i := 1:MTTN2 DO BEGIN dtheta(i,1) := MTTdt(i,1); END; MATRIX MTTVrhs(MTTN2,1); MATRIX MTTV(MTTN2,1); FOR i := 1:MTTN2 DO BEGIN MTTVrhs(i,1) := MTTEdX(2*i-1,1); END; %Find V matrix MTTV := MTTE12*dtheta - MTTVrhs; %Find C matrix MATRIX MTTC(MTTN2,MTTN2); k := 0; FOR i := 1:MTTN2 DO FOR j := 1:MTTN2 DO BEGIN coeffs := coeff(MTTV(i,1),MTTdt(j,1)); IF length(coeffs)>2 THEN co := part(coeffs,3) ELSE co := 0; MTTC(i,j) := co; END; %Find B matrix MTTN3 := MTTN2*(MTTN2-1)/2; IF MTTN3>0 THEN BEGIN MATRIX MTTB(MTTN2,MTTN3); FOR i := 1:MTTN2 DO BEGIN counter := 0; FOR j := 1:MTTN2-1 DO BEGIN coeffs := coeff(MTTV(i,1),MTTdt(j,1)); IF length(coeffs)>1 THEN co := part(coeffs,2) ELSE co := 0; FOR k := j+1:MTTN2 DO BEGIN counter := counter+1; coeffs2 := coeff(co,MTTdt(k,1)); IF length(coeffs2)>1 THEN co2 := part(coeffs2,2) ELSE co2 := 0; MTTB(i,counter) := co2; END; END; END; END; OFF Echo; OFF Nat; ON NERO; OUT "$1_rfe.r"; %% M write "MATRIX MTTM(", MTTN2, ",", MTTN2, ")"; MTTM := MTTE11*MTTIm; %% V write "MATRIX MTTRV(", MTTN2, ",1)"; MTTRV := MTTV; %% write "MATRIX MTTRC(", MTTN2, ",", MTTN2, ")"; MTTRC := MTTC; IF MTTN3>0 THEN BEGIN write "MATRIX MTTRB(", MTTN2, ",", MTTN3, ")"; MTTRB := MTTRB; END; write "MATRIX MTTRG(", MTTN2, ", 1)"; MTTRG := MTTG; write ";END;"$ SHUT "$1_rfe.r"; quit; EOF |
Added mttroot/mtt/bin/trans/csm2sm_r version [f47703e67d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: csm2sm_r # Constrained-state equation to linear constrained-state matrices conversion # P.J.Gawthrop 6th September 1991, May 1994 # Copyright (c) P.J.Gawthrop, 1991, 1994, 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1996/08/25 10:11:32 peter ## Added END in output file. ## Error handling. ## ## Revision 1.1 1996/08/19 15:06:16 peter ## Initial revision ## ############################################################### # Create the reduce output code def2write_r $1 $2 # Inform user echo Creating $1_$2.r case $2 in sm) rep=csm; ;; ssm) rep=scsm ;; *) echo Representation must be sm or ssm esac # Remove the old log file rm -f csm2sm_r.log # Use reduce to accomplish the transformation $SYMBOLIC >csm2sm_r.log << EOF in "$1_def.r"; in "$1_$rep.r"; in "$1_cr.r"; %%in "$1_sympar.r"; OFF Echo; OFF Nat; % Find MTTA and MTTB : the A and B matrices MTTinvE := MTTE^(-1); MTTA := MTTinvE*MTTA; MTTB := MTTinvE*MTTB; % Create the matrix declarations OUT "$1_$2.r1"; write "MATRIX MTTA(", MTTNx, ",", MTTNx, ")$"; write "MATRIX MTTB(", MTTNx, ",", MTTNu, ")$"; write "MATRIX MTTC(", MTTNy, ",", MTTNx, ")$"; write "MATRIX MTTD(", MTTNy, ",", MTTNu, ")$"; SHUT "$1_$2.r1"; %Create the output file OUT "$1_$2.r2"; write "%File: $1_ode.r"; write "% New constants"; write "MTTNx := ", MTTNx, ";"; write "MTTNy := ", MTTNy, ";"; in ("$1_sm_write.r"); %Write out the matrices. % IF MTTNx>0 THEN % BEGIN % write "matrix MTTA(", MTTNx, ",", MTTNx, ");"; % FOR i := 1:MTTNx DO % FOR j := 1:MTTNx DO IF MTTA(i,j) NEQ 0 THEN % write "MTTA(", i, ",", j, ") := ", MTTA(i,j); % END; % IF MTTNx>0 THEN % IF MTTNu>0 THEN % BEGIN % write "matrix MTTB(", MTTNx, ",", MTTNu, ");"; % FOR i := 1:MTTNx DO % FOR j := 1:MTTNu DO IF MTTB(i,j) NEQ 0 THEN % write "MTTB(", i, ",", j, ") := ", MTTB(i,j); % END; % %Write it out % IF MTTNy>0 THEN % IF MTTNx>0 THEN % BEGIN % write "matrix MTTC(", MTTNy, ",", MTTNx, ");"; % FOR i := 1:MTTNy DO % FOR j := 1:MTTNx DO IF MTTC(i,j) NEQ 0 THEN % write "MTTC(", i, ",", j, ") := ", MTTC(i,j); % END; % IF MTTNy>0 THEN IF MTTNu>0 THEN % BEGIN % write "matrix MTTD(", MTTNy, ",", MTTNu, ");"; % FOR i := 1:MTTNy DO % FOR j := 1:MTTNu DO IF MTTD(i,j) NEQ 0 THEN % write "MTTD(", i, ",", j, ") := ", MTTD(i,j); % END; write "END;"; SHUT "$1_$2.r2"; quit; EOF cat $1_$2.r1 $1_$2.r2 > $1_$2.r # Now invoke the standard error handling. mtt_error_r csm2sm_r.log |
Added mttroot/mtt/bin/trans/csm_r2m version [79de729926].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: csm_r2m # Reduce constained state-space A,B,C,D and E matrices to Matlab # P.J.Gawthrop July 1990, Feb 1991, May 1991, Sep 91, Dec 93, Jan 94, May 94. # Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1996/08/19 18:40:02 peter ## read in the nuim_par function etc. ## ## Revision 1.1 1996/08/19 16:27:04 peter ## Initial revision ## ############################################################### # Inform user echo Creating $1_$2.m # Remove the old log file rm -f csm_r2m.log # Use reduce to accomplish the transformation reduce >csm_r2m.log << EOF %Read in the definitions file in "$1_def.r"; %Read the reduce state-space A,B,C and D matrices file in "$1_$2.r"; %Set up the number of argument variables to zero in case the user has forgotten MTTNVar := 0; %Read in the parameter file %%in "$1_sympar.r"; OUT "$1_$2.m"; %Headings - Matlab style %(Note. The ;; are deleted by for2mat) IF MTTNvar>0 THEN BEGIN write "function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2(..."; FOR i := 1:MTTNvar DO BEGIN IF i<MTTNvar THEN write MTTVar(i,1), ",..." ELSE write MTTVar(i,1), ");;"; END; END ELSE write "function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2;;"; IF MTTNvar>0 THEN BEGIN write "%function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2(..."; FOR i := 1:MTTNvar DO BEGIN IF i<MTTNvar THEN write "%", MTTVar(i,1), ",..." ELSE write "%", MTTVar(i,1), ");;"; END; END ELSE write "%function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_$2;;"; write "%Linearised constrained-state matrices for system $1"; write "%File $1_$2.m"; write "%Generated by MTT"; IF MTTNvar>0 THEN BEGIN write "% Read in the parameters"; write "[ ...;;"; FOR i := 1:MTTNvar DO BEGIN IF i<MTTNvar THEN write MTTVar(i,1), ",..." ELSE write MTTVar(i,1), "] = $1_numpar" END; write "% Read in the arguments"; write "$1_args"; END; %Fortran switches - one line expressions OFF echo; ON fort$ cardno!* := 1$ fortwidth!* := 100$ OFF period$ write "MTTA = zeros(", MTTNx, ",", MTTNx, ");"; write "MTTB = zeros(", MTTNx, ",", MTTNu, ");"; write "MTTC = zeros(", MTTNy, ",", MTTNx, ");"; write "MTTD = zeros(", MTTNy, ",", MTTNu, ");"; write "MTTE = zeros(", MTTNx, ",", MTTNx, ");"; ON NERO; % Suppress zero elements. MTTA := MTTA; MTTB := MTTB; MTTC := MTTC; MTTD := MTTD; MTTE := MTTE; SHUT "$1_$2.m"; |
Added mttroot/mtt/bin/trans/csm_r2tex version [c5c521eb67].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: csm_r2tex # Reduce constrained-state matrices to LaTex constrained-state matrices. # P.J.Gawthrop 9 Sep 1991, May 1994 # Copyright (c) P.J.Gawthrop, 1991, May 1994. # Inform user echo Creating $1_$2.tex # Remove the old log file rm -f csm_r2tex.log # Use reduce to accomplish the transformation reduce >csm_r2tex.log << EOF %Read the definitions file in "$1_def.r"; %Read the constrained-state matrices file in "$1_$2.r"; %Read the symbolic parameters file %%in "$1_sympar.r"; %Read the substitution file in "$1_subs.r"; %Read the simplification file in "$1_simp.r"; %Read the formatting function in "$MTTPATH/trans/latex_matrix.r"; OFF Echo; OFF Nat; OUT "$1_$2.tex"; %Write out the constrained-state matrices. write "%constrained-state matrices $1"; write "%File: $1_$2.tex"; write""; write "%constrained-state matrices"; MTT_Matrix := MTTA$ MTT_Matrix_name := "MTTA"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ LaTeX_Matrix()$ MTT_Matrix := MTTB$ MTT_Matrix_name := "MTTB"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNu$ LaTeX_Matrix()$ MTT_Matrix := MTTC$ MTT_Matrix_name := "MTTC"$ MTT_Matrix_n := MTTNy$ MTT_Matrix_m := MTTNx$ LaTeX_Matrix()$ MTT_Matrix := MTTD$ MTT_Matrix_name := "MTTD"$ MTT_Matrix_n := MTTNu$ MTT_Matrix_m := MTTNu$ LaTeX_Matrix()$ MTT_Matrix := MTTE$ MTT_Matrix_name := "MTTE"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ LaTeX_Matrix()$ SHUT "$1_$2.tex"; quit; EOF |
Added mttroot/mtt/bin/trans/dat2gdat version [a62f4178a4].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: dat2gdat # Converts a data file in data format to gplot data format # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.8 1998/09/29 20:01:27 peterg ## 4th argument for nyquist style files - ie differnt x for each y ## ## Revision 1.7 1997/12/04 22:10:32 peterg ## Handles argument list - variable names. ## ## Revision 1.6 1997/05/22 10:34:05 peterg ## Changed argument structure. ## ## Revision 1.5 1997/05/22 10:11:19 peterg ## Fixed parametetr bug ## # Revision 1.4 1997/05/16 13:03:10 peterg # Now selects variables to display. # # Revision 1.3 1996/08/26 13:02:58 peterg # Cahged awk to awk. # # Revision 1.2 1996/08/15 11:49:11 peter # Puts a blank line at the end of the file: # this allows user to cat files for use in gnuplot. # ## Revision 1.1 1996/08/14 09:13:52 peter ## Initial revision ## ############################################################### echo Creating $1_$2.gdat rm -f $1_$2.gdat DifferentX=$4; # Convert multi-columns into gnuplot format - # ie stack two columns vertically separated by blank lines #Get the desired data index which=`name2index $1 "$3"` if [ -z "$DifferentX" ]; then awk ' BEGIN{ row=0; col=0; } { if (row==0) { N=split(which,Which,","); } row++; j=1; if (Which[1]==0) { x[row] = $1; for (i=1; i<NF; i++) { ycol = i+1; y[row,j++] = $ycol; } } else { xcol = Which[1]; x[row] = $xcol for (i=1; i<N; i++) { ycol = Which[i+1]; y[row,j++] = $ycol; } } cols=j-1; } END { rows = row; for (col = 1; col <= cols; col++) { for (row = 1; row <= rows; row++) { print x[row], y[row,col] }; if (col<=cols) { printf("\n") } } }' which="$which" <$1_$2.dat > $1_$2.gdat else awk ' BEGIN{ row=0; col=0; } { row++; cols=NF/2 for (i=1; i<=cols; i++) { ycol=2*i; xcol=ycol-1; x[row,i] = $xcol y[row,i] = $ycol; } } END { rows = row; for (col = 1; col <= cols; col++) { for (row = 1; row <= rows; row++) { print x[row,col], y[row,col] }; if (col<=cols) { printf("\n") } } }' <$1_$2.dat > $1_$2.gdat fi |
Added mttroot/mtt/bin/trans/dat2sdat version [8c6cd455bb].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: dat2sdat # Structure file - dat to sdat conversion # P.J.Gawthrop April 1997 # Copyright (c) P.J.Gawthrop, 1997, 1999 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 1999/03/28 21:29:40 peterg ## Initial revision ## ############################################################### if [ "$2" = "odes" ]; then which="state" else which="output" fi awk ' BEGIN{ printf("Time"); } { if ($1==which) printf(" %s(%s)", $3, $5); } END{ printf("\n"); } ' SYSTEM=$1 which=$which < $1_struc.txt cat $1_$2.dat |
Added mttroot/mtt/bin/trans/dm_r2tex version [acd65c348e].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 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 158 159 160 161 162 163 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: dm_r2tex # Reduce descriptor matrices to LaTex descriptor matrices. # P.J.Gawthrop 9 June 1990, 8th July 1990, 14 Feb 1991, 10th May 1991, 4th June 1991 # Copyright (c) P.J.Gawthrop, 1990, 1991. #Inform user echo Creating $1_dm.tex # Remove the old log file rm -f dm_r2tex.log # Use reduce to accomplish the transformation reduce >dm_r2tex.log << EOF %Read the definitions file in "$1_def.r"; %Read the symbolic parameters file %%in "$1_sympar.r"; %Read the substitution file in "$1_subs.r"; %Read the simplification file in "$1_simp.r"; %Number of descriptor variables MTTN := MTTNx + 2*MTTNz + MTTNyz; %Read the descriptor matrices file in "$1_dm.r"; OFF Echo; OFF Nat; OUT "$1_dm.tex"; %Write out the descriptor matrices. write "%Descriptor matrices $1"; write "%File: $1_dm.tex"; write""; write "%Descriptor matrices"; %IF (MTTNz+MTTNyz) NEQ 0 THEN %BEGIN % write "% - E matrix"; % write "\begin{equation}"; % write "MTTE = MTTI_0(", MTTNx+MTTNz, ",", MTTNz+MTTNyz, ")"; % write "\end{equation}"; %END; IF MTTN NEQ 0 THEN IF (MTTNz+MTTNyz) > 0 THEN BEGIN write "% - E matrix"; write "\begin{equation}"; write "MTTE = \begin{pmatrix}"; FOR Row := 1:MTTN DO BEGIN FOR Col := 1:MTTN DO BEGIN Write "{", MTTE(Row,Col), "}"; IF Col<MTTN THEN Write "&" END; IF Row<MTTN THEN Write "\cr"; END; Write "\end{pmatrix}"; write "\end{equation}"; END; IF MTTN NEQ 0 THEN BEGIN write "% - A matrix"; write "\begin{equation}"; write "MTTA = \begin{pmatrix}"; FOR Row := 1:MTTN DO BEGIN FOR Col := 1:MTTN DO BEGIN Write "{", MTTA(Row,Col), "}"; IF Col<MTTN THEN Write "&" END; IF Row<MTTN THEN Write "\cr"; END; Write "\end{pmatrix}"; write "\end{equation}"; END; IF MTTN NEQ 0 THEN IF MTTNu NEQ 0 THEN BEGIN write "% - B matrix"; write "\begin{equation}"; write "MTTB = \begin{pmatrix}"; FOR Row := 1:MTTN DO BEGIN FOR Col := 1:MTTNu DO BEGIN Write "{", MTTB(Row,Col), "}"; IF Col<MTTNu THEN Write "&" END; IF Row<MTTN THEN Write "\cr"; END; Write "\end{pmatrix}"; write "\end{equation}"; END; IF MTTN NEQ 0 THEN IF MTTNy NEQ 0 THEN BEGIN write "% - C matrix"; write "\begin{equation}"; write "MTTC = \begin{pmatrix}"; FOR Row := 1:MTTNy DO BEGIN FOR Col := 1:MTTN DO BEGIN Write "{", MTTC(Row,Col), "}"; IF Col<MTTN THEN Write "&" END; IF Row<MTTNy THEN Write "\cr"; END; Write "\end{pmatrix}"; write "\end{equation}"; END; IF MTTNy NEQ 0 THEN IF MTTNu NEQ 0 THEN BEGIN write "% - D matrix"; write "\begin{equation}"; write "MTTD = \begin{pmatrix}"; FOR Row := 1:MTTNy DO BEGIN FOR Col := 1:MTTNu DO BEGIN Write "{", MTTD(Row,Col), "}"; IF Col<MTTNu THEN Write "&" END; IF Row<MTTNy THEN Write "\cr"; END; Write "\end{pmatrix}"; write "\end{equation}"; END; SHUT "$1_dm.tex"; quit; EOF |
Modified mttroot/mtt/bin/trans/lbl2cr_txt2r from [a6453bab2e] to [52afa16970].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1996/11/02 10:20:53 peterg ## Created from lbl2sympar ## ############################################################### # Inform user echo "Creating $1_cr.r" rm -f mtt_error #Write some file headers echo "%% constitutive relationship file ($1_cr.r)" > $1_cr.r echo "%% Generated by MTT at `date`" >> $1_cr.r | > > > | | | 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 37 38 39 40 41 42 43 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.3 1996/11/03 21:11:44 peterg # Removed END; statement # ## Revision 1.2 1996/11/02 10:20:53 peterg ## Created from lbl2sympar ## ############################################################### # Inform user echo "Creating $1_cr.r" rm -f mtt_error #Write some file headers echo "%% constitutive relationship file ($1_cr.r)" > $1_cr.r echo "%% Generated by MTT at `date`" >> $1_cr.r # This is the main transformation using awk awk -f $MTTPATH/trans/awk/lbl2cr.awk <$1_lbl.txt 2>mtt_error.txt | \ sh >> $1_cr.r # Now invoke the standard error handling. #mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/lbl2sympar_txt2r from [e36cd23682] to [7f7d56852b].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.5 1996/09/12 17:18:44 peter ## Don't add an RCS header .. ## ## Revision 1.4 1996/08/30 19:01:21 peter ## Added headers to sympar file. ## ## Revision 1.3 1996/08/30 10:18:33 peter | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.6 1996/12/07 19:39:51 peterg # Minor debugging. # ## Revision 1.5 1996/09/12 17:18:44 peter ## Don't add an RCS header .. ## ## Revision 1.4 1996/08/30 19:01:21 peter ## Added headers to sympar file. ## ## Revision 1.3 1996/08/30 10:18:33 peter |
︙ | ︙ | |||
38 39 40 41 42 43 44 | rm -f mtt_error #Write some file headers echo "%% Symbolic parameter file ($1_sympar.r)" > $1_sympar.r echo "%% Generated by MTT at `date`" >> $1_sympar.r | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | rm -f mtt_error #Write some file headers echo "%% Symbolic parameter file ($1_sympar.r)" > $1_sympar.r echo "%% Generated by MTT at `date`" >> $1_sympar.r # This is the main transformation using awk tr ';' ',' < $1_lbl.txt | \ awk -f $MTTPATH/trans/awk/lbl2sympar.awk | sort >> $1_sympar.r 2>mtt_error.txt # Now invoke the standard error handling. mtt_error mtt_error.txt |
Modified mttroot/mtt/bin/trans/lbl_txt2tex from [b15ec7c7b3] to [633efeea32].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.8 1999/02/17 21:42:19 peterg ## Replaced print by printf to avoid extra nl in paragraph command. ## ## Revision 1.7 1998/07/27 12:56:26 peterg ## Splits up | separated expressions. ## ## Revision 1.6 1998/07/27 10:56:31 peterg | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.9 2000/11/16 13:11:06 peterg ## Included PAR and UNITS declarations ## ## Revision 1.8 1999/02/17 21:42:19 peterg ## Replaced print by printf to avoid extra nl in paragraph command. ## ## Revision 1.7 1998/07/27 12:56:26 peterg ## Splits up | separated expressions. ## ## Revision 1.6 1998/07/27 10:56:31 peterg |
︙ | ︙ | |||
121 122 123 124 125 126 127 | } END{if (NR==0) print "\\item This component has no UNITs declarations" }' >> $1_lbl.tex cat <<EOF >> $1_lbl.tex \end{description} EOF | | > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | } END{if (NR==0) print "\\item This component has no UNITs declarations" }' >> $1_lbl.tex cat <<EOF >> $1_lbl.tex \end{description} EOF # Write the actual lbl file cat >> $1_lbl.tex <<EOF \subsubsection*{The label file: $1\_lbl.txt} \begin{verbatim} EOF cat $1_lbl.txt >> $1_lbl.tex cat >> $1_lbl.tex <<EOF \end{verbatim} EOF |
Added mttroot/mtt/bin/trans/lde_r2tex version [d2cd6c0a98].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: lde_r2tex # Reduce differential-algebraic to LaTex differential-algebraic equations. # P.J.Gawthrop 10th May 1991, April 1994 # Copyright (c) P.J.Gawthrop, 1991, 1994, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 1998/01/23 15:51:01 peterg ## Repleace eqnarray by equation + aligned -- this works with Latex2html ## ## Revision 1.2 1996/12/20 08:59:10 peterg ## Now writes out mtti instead of mtt_{i} -- lets latex_tidy do the ## conversion. ## ## Revision 1.1 1996/12/20 08:53:57 peterg ## Initial revision ## ############################################################### # Inform user echo Creating $1_lde.tex # Remove the old log file rm -f lde_r2tex.log # Use reduce to accomplish the transformation reduce >lde_r2tex.log << EOF %Read the definitions file in "$1_def.r"; %Read the differential-algebraic equations file in "$1_lde.r"; %Read the symbolic parameter file %%in "$1_sympar.r"; OFF Echo; OFF Nat; %Read the substitution file IN "$1_subs.r"; %Read the simplifying expressions file IN "$1_simp.r"; OUT "$1_lde.tex"; %Write out the differential-algebraic equations. write "%File: $1_lde.tex"; write "%ordinary differential equations"; write "% Generated by MTT"; IF MTTNyz>0 THEN BEGIN write"\begin{equation} \label{eq_$1_lde_x}"; write"\begin{aligned}"; FOR Row := 1:MTTNx DO BEGIN write "{"; write MTTl(Row,1); write "}"; write " &= 0"; IF Row<MTTNx THEN write "\cr"; END; write"\end{aligned}"; write"\end{equation}"; END; IF MTTNy>0 THEN BEGIN write"\begin{equation} \label{eq_$1_lde_y}"; write"\begin{aligned}"; FOR Row := 1:MTTNy DO BEGIN write "MTTy", Row, " &= "; write "{"; write MTTy(Row,1); write "}"; IF Row<MTTNy THEN write "\cr"; END; write"\end{aligned}"; write"\end{equation}"; END; SHUT "$1_lde.tex"; quit; EOF |
Modified mttroot/mtt/bin/trans/matlab_header from [e8ca59587b] to [f6f0a00194].
1 2 3 4 5 6 7 8 9 10 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: matlab_header # Generic octave function header #Write some file headers | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: matlab_header # Generic octave function header #Write some file headers echo "function [$3] = $1_$2" echo "% $2 function for system $1 ($1_$2.m)" echo "% Generated by MTT at `date`" echo #Globals sympar2global_txt2m $1 echo ';' |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/matlab_matrix.r from [c0199f19b4] to [d9d59df9cf].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % $Id$ % % $Log$ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Load the general translator package LOAD GENTRAN; GENTRANLANG!* := 'FORTRAN; ON GENTRANSEG; | > > > | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % $Id$ % % $Log$ % % Revision 1.1 1998/03/22 10:26:47 peterg % % Initial revision % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Load the general translator package LOAD GENTRAN; GENTRANLANG!* := 'FORTRAN; ON GENTRANSEG; MAXEXPPRINTLEN!* := 400; PROCEDURE matlab_Matrix; BEGIN ON NERO; write "mtt_matrix = zeros(", mtt_matrix_n, ",", mtt_matrix_m, ");"; IF MTT_Matrix_n>0 THEN IF MTT_Matrix_m>0 THEN |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/mtt_error from [92fe21cdaa] to [8a6269ba81].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop, 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.6 1998/03/05 10:17:41 peterg ## Cosmetic change ## ## Revision 1.5 1998/03/05 10:14:37 peterg ## Toned down the error warning message ## ## Revision 1.4 1998/02/26 10:21:51 peterg | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop, 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.7 1998/03/06 17:14:09 peterg ## Cospetic change to message ## ## Revision 1.6 1998/03/05 10:17:41 peterg ## Cosmetic change ## ## Revision 1.5 1998/03/05 10:14:37 peterg ## Toned down the error warning message ## ## Revision 1.4 1998/02/26 10:21:51 peterg |
︙ | ︙ | |||
38 39 40 41 42 43 44 | error_file=$1; # Test for errors and print if any err_length=`wc -c <$error_file | awk '{print $1}'` if [ "$err_length" != "0" ] then echo "INFORMATION: An MTT transformation has generated the following messages" | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 | error_file=$1; # Test for errors and print if any err_length=`wc -c <$error_file | awk '{print $1}'` if [ "$err_length" != "0" ] then echo "INFORMATION: An MTT transformation has generated the following messages" # echo " (which may not be important)" cat $error_file exit 1 else exit 0 fi |
Modified mttroot/mtt/bin/trans/mtt_getsize from [b103a18170] to [ca21605aad].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #$Id$ while [ -n "`echo $1 | grep '^-'`" ]; do case $1 in -internal ) internal=yes; ;; *) echo "$1 is an invalid argument - ignoring"; exit ;; esac shift done if [ -n "$internal" ]; then | > > > > | > > > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #$Id$ while [ -n "`echo $1 | grep '^-'`" ]; do case $1 in -internal ) internal=yes; ;; -external ) external=yes; ;; *) echo "$1 is an invalid argument - ignoring"; exit ;; esac shift done if [ -n "$internal" ]; then name=MTT$2"[0-9]"; # echo $name grep -i "$name" $1_ese.r | wc -l exit fi if [ -n "$external" ]; then name="^MTT"$2"("; #echo $name grep -i "$name" $1_ese.r | wc -l exit fi ## The original version for external sizes. if [ "$2" = "xx" ]; then n=`mtt_getsize $1 x` N=`echo "$n * $n" | bc` |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/obs_r2m from [f6c0999a75] to [425f980273].
︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 | if [ "$affine" = "1" ]; then lang_header $1 obs m x [o_o,o_h] > $1_obs.m1 else lang_header $1 obs m x,u yy > $1_obs.m1 fi # Put together the pieces matlab_tidy $1_obs.m3 cat $1_obs.m? >$1_obs.m rm -f $1_obs.m? | > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | if [ "$affine" = "1" ]; then lang_header $1 obs m x [o_o,o_h] > $1_obs.m1 else lang_header $1 obs m x,u yy > $1_obs.m1 fi # Put together the pieces matlab_tidy $1_obs.m2 matlab_tidy $1_obs.m3 cat $1_obs.m? >$1_obs.m rm -f $1_obs.m? |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/obs_r2tex from [469a1957ed] to [f36c171b61].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.3 1997/06/13 13:50:11 peterg # Matrices in amstex format # # Revision 1.2 1997/04/18 12:54:00 peterg # No longer does labels. # # Revision 1.1 1996/08/19 15:19:23 peter | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 1998/04/07 08:30:20 peterg ## Initial revision ## # Revision 1.3 1997/06/13 13:50:11 peterg # Matrices in amstex format # # Revision 1.2 1997/04/18 12:54:00 peterg # No longer does labels. # # Revision 1.1 1996/08/19 15:19:23 peter |
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | in "$1_def.r"; %Read the obs file in "$1_obs.r"; %Read the Obs function parameters in "$1_obspar.r"; %Read the simplification parameters in "$1_simp.r"; %Read the formatting function in "$MTTPATH/trans/latex_matrix.r"; OFF Echo; OFF Nat; OFF EXP; OUT "$1_obs.tex"; | > > > < < < < < < < > > > > > > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | in "$1_def.r"; %Read the obs file in "$1_obs.r"; %Read the Obs function parameters in "$1_obspar.r"; %Read the substitution file in "$1_subs.r"; %Read the simplification parameters in "$1_simp.r"; %Read the formatting function in "$MTTPATH/trans/latex_matrix.r"; OFF Echo; OFF Nat; OFF EXP; OUT "$1_obs.tex"; % Write the affine form IF affine=1 THEN BEGIN MTT_Matrix := MTTObs_o$ MTT_Matrix_name := "MTTO_o"$ MTT_Matrix_n := (MTTGPCNY+1)*MTTNy$ MTT_Matrix_m := 1$ LaTeX_Matrix()$ MTT_Matrix := MTTObs_h$ MTT_Matrix_name := "MTTO_h"$ MTT_Matrix_n := (MTTGPCNy+1)*MTTNy$ MTT_Matrix_m := (MTTGPCNu+1)*MTTNu$ LaTeX_Matrix()$ END ELSE BEGIN % Write the obs vector (YY) MTT_Matrix := MTTYY$ MTT_Matrix_name := "MTTO"$ MTT_Matrix_n := (MTTGPCNY+1)*MTTNy$ MTT_Matrix_m := 1$ LaTeX_Matrix()$ END; SHUT "$1_obs.tex"; quit; EOF |
Modified mttroot/mtt/bin/trans/ode2odes_m from [e2fc3e22e9] to [e593903528].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.16 1998/06/25 08:47:23 peterg ## Put correct arguments for _input -- (x,t) ## ## Revision 1.15 1998/05/21 16:20:27 peterg ## Modified to include explicit algebraic loop solution ## ## Revision 1.14 1998/05/19 19:48:02 peterg | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.17 1998/06/27 14:49:16 peterg ## No change ## ## Revision 1.16 1998/06/25 08:47:23 peterg ## Put correct arguments for _input -- (x,t) ## ## Revision 1.15 1998/05/21 16:20:27 peterg ## Modified to include explicit algebraic loop solution ## ## Revision 1.14 1998/05/19 19:48:02 peterg |
︙ | ︙ | |||
141 142 143 144 145 146 147 | X=[]; dt = (T(2)-T(1))/STEPFACTOR; for t=T' X = [X; xx']; ts = t; for i=1:STEPFACTOR x = xx(1:nx); | > | | | > | | | > | | 144 145 146 147 148 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | X=[]; dt = (T(2)-T(1))/STEPFACTOR; for t=T' X = [X; xx']; ts = t; for i=1:STEPFACTOR x = xx(1:nx); u = $1_input(xx,ts); xx = $1_ode(xx,u,ts); ts = ts + dt; dx = xx(1:nx); x = x + dx*dt; xx(1:nx) = x; end; end; elseif strcmp(method,'implicitl') %Euler integration X=[]; dt = (T(2)-T(1))/STEPFACTOR; u = $1_input(x,u,t); A = $1_smx(x,u); inverse = inv(eye(nx) - dt*A); for t=T' X = [X; xx']; ts = t; u = $1_input(x,t); for i=1:STEPFACTOR x = xx(1:nx); xx = $1_ode(xx,u,ts); ts = ts + dt; dx = xx(1:nx); x = inverse*(x + dt*(dx - A*x)); xx(1:nx) = x; end; end; elseif strcmp(method,'implicit') %Euler integration X=[]; dt = (T(2)-T(1))/STEPFACTOR; One = eye(nx); for t=T' X = [X; xx']; ts = t; for i=1:STEPFACTOR x = xx(1:nx); u = $1_input(x,t); A = $1_smx(x,u); xx = $1_ode(xx,u,ts); ts = ts + dt; dx = xx(1:nx); x = (One-A*dt)\(x + dt*(dx - A*x)); xx(1:nx) = x; end; end; else error('Method %s not available here', METHOD); return; end; write_matrix([T,X], '$1_odes'); else X = zeros(size(T)); end; if ny>0 % compute y and print it i = 0; Y=[]; for t=T' i = i+1; X(i,:); u = $1_input(x,t); y = $1_odeo(X(i,:)',u,t); Y = [Y; y']; end; write_matrix([T,Y], '$1_odeso'); end; EOF |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/ode2odess_m from [5c1ac9a370] to [4c1d52ada1].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 1998/05/19 19:27:04 peterg ## Zapped all the parameter stuff ## ## Revision 1.2 1996/09/13 19:40:51 peter ## Fixed problem with default paramaters. ## ## Revision 1.1 1996/09/12 19:26:57 peter | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.4 2000/10/17 11:07:59 peterg ## *** empty log message *** ## ## Revision 1.3 1998/05/19 19:27:04 peterg ## Zapped all the parameter stuff ## ## Revision 1.2 1996/09/13 19:40:51 peter ## Fixed problem with default paramaters. ## ## Revision 1.1 1996/09/12 19:26:57 peter |
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 | ## Initial revision ## ############################################################### echo Creating $1_odess.m rm -f ode2odess_m.log $MATRIX << EOF > ode2odess_m.log 2>mtt_error.txt %Read in parameters | > > > > | < < < | | | > > | > < > > > | < | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ## Initial revision ## ############################################################### echo Creating $1_odess.m rm -f ode2odess_m.log Nx=`mtt_getsize $1 x` # States Nxx=`mtt_getsize $1 xx` # States x States Nu=`mtt_getsize $1 u` # Inputs Ny=`mtt_getsize $1 y` # Inputs $MATRIX << EOF > ode2odess_m.log 2>mtt_error.txt %Read in parameters par = $1_numpar; %Read in simulation parameters simpar=$1_simpar; T = [0:simpar.dt:simpar.last]; t=0; %Just in case it appears in the parameter list. %Defaults if exist('T')==0 T=[0:0.1:1] end; if exist('x0')==0 x0 = zeros($Nx,1); end; [n,m]=size(T); if m>n T=T'; end; global t; function dx=f(x) global t par = $1_numpar; u = $1_input(x,zeros($Ny,1),t,par); dx = $1_ode(x,u,t,par);; endfunction; i=0; x = x0; for t=T' u = $1_input(x,zeros($Ny,1),t,par); y(i) = $1_odeo(x,u,t,par)'; mtt_write(t,x,y,$Nx,$Ny); # Write it out x = fsolve('f',x)'; end; i=0; for t=T' i=i+1; end; write_matrix([T,x], '$1_odess'); write_matrix([T,y], '$1_odesso'); EOF |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/ode2smx_lang from [6bb7242e73] to [564d3a89c6].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) P.J.Gawthrop, 1991, 1994, 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.10 1998/11/17 17:10:22 peterg ## Read in the constitutive relationship file as well ## ## Revision 1.9 1998/08/27 07:06:25 peterg ## Just genrate xj once. ## ## Revision 1.8 1998/08/27 07:04:44 peterg | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop, 1991, 1994, 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.11 1998/11/26 10:32:34 peterg ## Include subs.r ## ## Revision 1.10 1998/11/17 17:10:22 peterg ## Read in the constitutive relationship file as well ## ## Revision 1.9 1998/08/27 07:06:25 peterg ## Just genrate xj once. ## ## Revision 1.8 1998/08/27 07:04:44 peterg |
︙ | ︙ | |||
185 186 187 188 189 190 191 | %END %GENTRANSHUT "$1_smxtx.$lang"; EOF if [ "$lang" = "m" ]; then mv $1_smx.$lang mtt_junk | | > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | %END %GENTRANSHUT "$1_smxtx.$lang"; EOF if [ "$lang" = "m" ]; then mv $1_smx.$lang mtt_junk # lang_header $1 smx m 'mttx,mttu,mttdt' '[mtta,mttax]' > $1_smx.m mtt_header $1 $2 m cat mtt_junk | mtt_p2m >> $1_smx.m rm -f mtt_junk # mv $1_smxx.$lang mtt_junk # lang_header $1 smxx m 'mttx,mttu,mttxx,mttdt' '[mttax]' > $1_smxx.m # cat mtt_junk | mtt_p2m >> $1_smxx.m # rm -f mtt_junk |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/odeso_dat2sdat from [c75da8fe88] to [055c2bffbd].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### # Inform user echo "Creating $1_odeso.sdat" | > > > < | < < < < < < < < < < < < < < < < < < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 1999/03/28 21:29:40 peterg ## Initial revision ## ############################################################### # Inform user echo "Creating $1_odeso.sdat" dat2sdat $1 odeso | dat2siag > $1_odeso.sdat |
Modified mttroot/mtt/bin/trans/rdae2dae_r from [67adcbc44a] to [33e888aa4a].
︙ | ︙ | |||
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.3 2000/09/02 15:55:11 peterg ## Now doesn't include def files in da files ## ## Revision 1.2 2000/09/01 13:36:15 peterg ## Added -partition option ## ## Revision 1.1 2000/09/01 12:14:44 peterg | > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Copyright (c) P.J.Gawthrop, 1991, 1994, 1996 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.4 2000/09/04 08:42:53 peterg ## Put in extra echo to space output ## ## Revision 1.3 2000/09/02 15:55:11 peterg ## Now doesn't include def files in da files ## ## Revision 1.2 2000/09/01 13:36:15 peterg ## Added -partition option ## ## Revision 1.1 2000/09/01 12:14:44 peterg |
︙ | ︙ | |||
169 170 171 172 173 174 175 | MTT_Matrix_m := 1$ Reduce_Matrix()$ SHUT "$daename"; quit; EOF | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | MTT_Matrix_m := 1$ Reduce_Matrix()$ SHUT "$daename"; quit; EOF #if [ -n "$partition" ]; then # rm -f mtt_junk # # Now for the subsystems # # Find subsystems # subsystems=`mtt_get_subsystems $1` # # for subsystem in $subsystems; do # echo Doing $subsystem # ucname="MTT_"$subsystem"_uc" # # Nu=`mtt_getsize -internal $subsystem u` # echo Nu $Nu # # # Use symbolic algebra to accomplish the transformation # $SYMBOLIC >$logname << EOF # # %Read the formatting function # in "$MTTPATH/trans/reduce_matrix.r"; # # % Definitions # in "$defname"; # # % Elementary system equations # in "$rdaename"; # # OFF Echo; # OFF Nat; # # %Create the output file # OUT "mtt_junk"; # % Connecting inputs # MTT_Matrix := $ucname $ # MTT_Matrix_name := "$ucname" $ # MTT_Matrix_n := $Nu $ # MTT_Matrix_m := 1$ # Reduce_Matrix()$ # # shut "mtt_junk"; #EOF # echo >> $1_dae.r # echo %Connections for subsystem $subsystem >> $1_dae.r # echo >> $1_dae.r # # cat mtt_junk >> $1_dae.r # rm -rf mtt_junk # done #fi echo "END;" >> $1_dae.r # Now invoke the standard error handling. mtt_error_r $logname |
Modified mttroot/mtt/bin/trans/reps_txt2tk from [02869b51d3] to [3e47e7c9bc].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Copyright (c) P.J.Gawthrop, 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 1999/08/18 06:15:48 peterg ## Stripped down to just representations menu - see mtt_make_menu ## ## Revision 1.2 1999/03/09 00:03:19 peterg ## Revisions for xmtt ## ## Revision 1.1 1998/10/20 08:13:14 peterg ## Initial revision ## ############################################################### # Create reps menu | > > > > | > | > | | | < < < < < < < < | 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # Copyright (c) P.J.Gawthrop, 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.4 2000/04/05 07:37:27 peterg ## *** empty log message *** ## ## Revision 1.3 1999/08/18 06:15:48 peterg ## Stripped down to just representations menu - see mtt_make_menu ## ## Revision 1.2 1999/03/09 00:03:19 peterg ## Revisions for xmtt ## ## Revision 1.1 1998/10/20 08:13:14 peterg ## Initial revision ## ############################################################### sep='|'; # Separates the languages from the rest. # Create reps menu awk --field-separator=$sep '{ # Find the rep and the title split($1,REP," "); rep=REP[1]; # find the languages N=split($2,LANG," "); # Important representation? if (index(rep,"*")) { # Zap * rep=substr(rep,1,length(rep)-1); sub(/\*/,"",$1); printf("\n# Menus for representation %s\n", rep) printf(".rep.rep add cascade -label \"%s\" -menu .rep.rep.%s\n", $1, rep); printf("menu .rep.rep.%s\n", rep); for (i=1;i<=N;i++) { lang = LANG[i]; printf(" set mtt {mtt_pause $args $system %s %s} \n", rep, lang); title = sprintf("Output_log_for_representation_%s_(language_%s)", rep, lang); printf(".rep.rep.%s add command -label \"%s\" ", rep, lang); printf(" -command \"exec xterm -title %s -e $mtt &\" \n", title); } } else { printf("\n# Menus for representation %s\n", rep) printf(".repall.repall add cascade -label \"%s\" -menu .repall.repall.%s\n", $1, rep); printf("menu .repall.repall.%s\n", rep); for (i=1;i<=N;i++) { printf(" set mtt {mtt $args $system %s %s; mtt_pause} \n", rep, LANG[i]); printf(".repall.repall.%s add command -label \"%s\" ", rep, LANG[i]); printf(" -command \"exec echo $mtt &; exec $mtt &\" \n"); } } }' |
Modified mttroot/mtt/bin/trans/sm2can_r from [1123315a04] to [27a5fb1925].
1 2 3 4 5 6 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### | | | | | < < < < < < < > | | | | | | > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > | | > | > > | > > > > > | | > > > > > > > > | | > | > > > > > | > > > > > > | > > > > > > | > > > > > > | > > > > > > | > > > > > > | > > | | > | | > | > > > > | | > > > > > | > > > > > > > > > > > > | | > > > > > > | > > > > > | > > > > > | | > > | > > | | | 1 2 3 4 5 6 7 8 9 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 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 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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 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 364 365 366 367 368 369 370 371 372 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: sm2can_r # state matrices to various canonical forms. # P.J.Gawthrop 12 Jan 1997 # Copyright (c) P.J.Gawthrop 1997 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ############################################################### # Inform user echo Creating $1_can.r -- NOTE this is for SISO systems only. # Remove the old log file rm -f sm2can_r.log # Use reduce to accomplish the transformation reduce >sm2can_r.log << EOF in "$1_def.r"; in "$1_sm.r"; in "$1_tf.r"; %Read the formatting function in "$MTTPATH/trans/reduce_matrix.r"; OFF Echo; OFF Nat; % Find the controllability and observibility matrices. MATRIX MTTCon(MTTNx,MTTNX); MTTAB := MTTB; FOR j := 1:MTTNx DO BEGIN FOR i := 1:MTTNx DO MTTCon(i,j) := MTTAB(i,1); MTTAB := MTTA*MTTAB; END; MATRIX MTTObs(MTTNx,MTTNX); MTTCA := MTTC; FOR i := 1:MTTNx DO BEGIN FOR j := 1:MTTNx DO MTTObs(i,j) := MTTCA(1,j); MTTCA := MTTCA*MTTA; END; %Canonical forms: % This statement makes Gs a scalar transfer function Gs := MTTtf(1,1); % Numerator and denominator polynomials bs := num(gs); as := den(gs); % extract coeficients and divide by coeff of s^n % reverse operator puts list with highest oder coeffs first ai := reverse(coeff(as,s)); a0 := first(ai); MTTn := length(ai) - 1; % Normalised coeficients; ai := reverse(coeff(as/a0,s)); bi := reverse(coeff(bs/a0,s)); MTTm := length(bi)-1; % Zap the (unity) first element of ai list; ai := rest(ai); % System in controller form % MTTA_c matrix matrix MTTA_c(MTTn,MTTn); % First row is ai coefficients for i := 1:MTTn do MTTA_c(1,i) := -part(ai,i); % (MTTn-1)x(MTTn-1) unit matrix in lower left-land corner (if n>1) if MTTn>1 then for i := 1:MTTn-1 do MTTA_c(i+1,i) := 1; % B_c vector; matrix MTTB_c(MTTn,1); MTTB_c(1,1) := 1; % C_c vector; matrix MTTC_c(1,MTTn); for i := 1:MTTm+1 do MTTC_c(1,i+MTTn-MTTm-1) := part(bi,i); % D_c MTTD_c := MTTD; %Observable form. MTTA_o := tp(MTTA_c); MTTB_o := tp(MTTC_c); MTTC_o := tp(MTTB_c); MTTD_o := MTTD; %Controllability matrix of controllable form MATRIX MTTCon_c(MTTNx,MTTNX); MTTAB := MTTB_c; FOR j := 1:MTTNx DO BEGIN FOR i := 1:MTTNx DO MTTCon_c(i,j) := MTTAB(i,1); MTTAB := MTTA_c*MTTAB; END; % Transformation matrix; MTTT_c := MTTCon_c*MTTCon^(-1); %Observability matrix of observer form MATRIX MTTObs_o(MTTNx,MTTNX); MTTCA := MTTC_o; FOR i := 1:MTTNx DO BEGIN FOR j := 1:MTTNx DO MTTObs_o(i,j) := MTTCA(1,j); MTTCA := MTTCA*MTTA_o; END; % Transformation matrix; MTTT_o := MTTObs^(-1)*MTTObs_o; %%%% Controller design %%%%% % gain in controller form: matrix MTTk_c(1,mttn); matrix alpha_c(9,1); alpha_c(1,1) := alpha_c1; alpha_c(2,1) := alpha_c2; alpha_c(3,1) := alpha_c3; alpha_c(4,1) := alpha_c4; alpha_c(5,1) := alpha_c5; alpha_c(6,1) := alpha_c6; alpha_c(7,1) := alpha_c7; alpha_c(8,1) := alpha_c8; alpha_c(9,1) := alpha_c9; for i := 1:MTTNx do MTTk_c(1,i) := alpha_c(i,1) - part(ai,i); % Gain in physical form MTTk := MTTk_c*MTTT_c; %%%% Observer design %%%%% % gain in Observer form: matrix MTTl_o(MTTn,1); matrix alpha_o(9,1); alpha_o(1,1) := alpha_o1; alpha_o(2,1) := alpha_o2; alpha_o(3,1) := alpha_o3; alpha_o(4,1) := alpha_o4; alpha_o(5,1) := alpha_o5; alpha_o(6,1) := alpha_o6; alpha_o(7,1) := alpha_o7; alpha_o(8,1) := alpha_o8; alpha_o(9,1) := alpha_o9; for i := 1:MTTNx DO MTTL_o(i,1) := alpha_o(i,1) - part(ai,i); % Gain in physical form MTTL := MTTT_o*MTTL_o; % Steady-state stuff % Create the matrix [A B; C D]; matrix ABCD(MTTn+1,MTTn+1); for i := 1:MTTNx do for j := 1:MTTNx do ABCD(i,j) := MTTA(i,j); for i :=1:MTTNx do ABCD(i,MTTNx+1) := MTTB(i,1); for j := 1:MTTNx do ABCD(MTTNx+1,j) := MTTC(1,j); ABCD(MTTNx+1,MTTNx+1) := MTTD(1,1); matrix zero_one(MTTNx+1,1); zero_one(MTTNx+1,1) := 1; %Find N vector Nxu := ABCD^(-1)*zero_one; %Extract the parts MATRIX MTTX_r(MTTNx,1); FOR i := 1:MTTNx DO MTTX_r(i,1) := Nxu(i,1); MTTu_r := Nxu(MTTNx+1,1); % Compensator matrix zero(MTTNx,1); %State matrices MTTA_comp := MTTA - MTTL*MTTC - MTTB*MTTK; MTTB_comp := -MTTL; MTTC_comp := -MTTK; %Transfer function %Ds := C_d*((s*MTTI - A_d)^(-1))*B_d; %MTTTFC := Ds; %Create the output file OUT "$1_can.r"; %Write out the matrices. % Controllable form MTT_Matrix := MTTA_c$ MTT_Matrix_name := "MTTA_c"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ MTT_Matrix := MTTB_c$ MTT_Matrix_name := "MTTB_c"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNu$ Reduce_Matrix()$ MTT_Matrix := MTTC_c$ MTT_Matrix_name := "MTTC_c"$ MTT_Matrix_n := MTTNy$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ % Observable form MTT_Matrix := MTTA_o$ MTT_Matrix_name := "MTTA_o"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ MTT_Matrix := MTTB_o$ MTT_Matrix_name := "MTTB_o"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNu$ Reduce_Matrix()$ MTT_Matrix := MTTC_o$ MTT_Matrix_name := "MTTC_o"$ MTT_Matrix_n := MTTNy$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Controllability matrix"; MTT_Matrix := MTTCon$ MTT_Matrix_name := "MTTCon"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% -Observability matrix"; MTT_Matrix := MTTObs$ MTT_Matrix_name := "MTTObs"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% -Controllability matrix - controller form"; MTT_Matrix := MTTCon_c$ MTT_Matrix_name := "MTTCon_c"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Transformation matrix - controller form"; MTT_Matrix := MTTT_c$ MTT_Matrix_name := "MTTT_c"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Gain matrix - controller form"; MTT_Matrix := MTTK_c$ MTT_Matrix_name := "MTTK_c"$ MTT_Matrix_n := MTTNu$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Gain matrix - physical form"; MTT_Matrix := MTTK$ MTT_Matrix_name := "MTTK"$ MTT_Matrix_n := MTTNu$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% -Observability matrix - Observer form"; MTT_Matrix := MTTObs_o$ MTT_Matrix_name := "MTTObs_o"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Transformation matrix - Observer form"; MTT_Matrix := MTTT_o$ MTT_Matrix_name := "MTTT_o"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Observer Gain matrix - observer form"; MTT_Matrix := MTTL_o$ MTT_Matrix_name := "MTTL_o"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNy$ Reduce_Matrix()$ write "% - Gain matrix - physical form"; MTT_Matrix := MTTL$ MTT_Matrix_name := "MTTL"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNy$ Reduce_Matrix()$ % Controllable form MTT_Matrix := MTTA_comp$ MTT_Matrix_name := "MTTA_comp"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ MTT_Matrix := MTTB_comp$ MTT_Matrix_name := "MTTB_comp"$ MTT_Matrix_n := MTTNx$ MTT_Matrix_m := MTTNu$ Reduce_Matrix()$ MTT_Matrix := MTTC_comp$ MTT_Matrix_name := "MTTC_comp"$ MTT_Matrix_n := MTTNy$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ KX := MTTK*MTTX_r; MTTu_r := MTTu_r + KX(1,1); MTTu_r := MTTu_r; write "END;"; SHUT "$1_can.r"; quit; EOF # Now invoke the standard error handling. mtt_error_r sm2can_r.log |
Modified mttroot/mtt/bin/trans/sm2ir_m from [f8ebca73f6] to [eae4b74875].
︙ | ︙ | |||
15 16 17 18 19 20 21 | echo Creating $1_ir.m echo Creating $1_iro.m rm -f sm2ir_m.log rm -f $1_ir.m rm -f $1_iro.m rm -f mtt_error | | | | | | | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | echo Creating $1_ir.m echo Creating $1_iro.m rm -f sm2ir_m.log rm -f $1_ir.m rm -f $1_iro.m rm -f mtt_error # if [ "$2" = "" ]; # then # PARAMS='T=[0:0.1:10];u0=ones(nu,1);x0=zeros(nx,1);' # echo Using default parameter $PARAMS # else # PARAMS=$2; # fi # PARAMS="$PARAMS ;" $MATRIX << EOF > sm2ir_m.log 2>mtt_error.txt % Read in the numeric system parameters mttpar = $1_numpar; [nx,ny,nu,nz,nyz] = $1_def; t=0; %Just in case it appears in the parameter list. $PARAMS %Defaults |
︙ | ︙ | |||
54 55 56 57 58 59 60 | [n,m]=size(T); if m>n T=T'; end; | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | [n,m]=size(T); if m>n T=T'; end; [A,B,C,D] = $1_sm(mttpar); [y,x] = sm2ir(A,B,C,D,T,u0,x0); if nx>0 write_matrix([T x], '$1_ir'); end; if ny>0 write_matrix([T y], '$1_iro'); |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/smc2ssk_r from [df8f77d47d] to [06844ee033].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1998/01/23 09:30:36 peterg ## Fixed a sign error - the coeficients of a(s) appear with - signs in ## the A_c matrix! ## ## Revision 1.1 1998/01/22 13:16:16 peterg ## Initial revision ## ############################################################### # Inform user | > > > > > > > > > > > > > > > > > > > | | 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 1998/02/09 14:16:52 peterg ## Writes end statement to the o/p file ## ## Revision 1.2 1998/01/23 09:30:36 peterg ## Fixed a sign error - the coeficients of a(s) appear with - signs in ## the A_c matrix! ## ## Revision 1.1 1998/01/22 13:16:16 peterg ## Initial revision ## ############################################################### Nu=`mtt_getsize $1 u` Ny=`mtt_getsize $1 y` if [ "$Nu" = "1" ]; then if [ "$Ny" = "1" ]; then blurb=' for this siso system' else blurb=" using first output of $Ny" fi else if [ "$Ny" = "1" ]; then blurb=" using first input of $Nu" else blurb=" using first input of $Nu and using first output of $Ny" fi fi # Inform user echo Creating $1_ssk.r $blurb # Remove the old log file rm -f smc2ssk_r.log # Use reduce to accomplish the transformation reduce >smc2ssk_r.log << EOF |
︙ | ︙ | |||
72 73 74 75 76 77 78 | OUT "$1_ssk.r"; %Write out the matrices. write "% - Gain matrix - controller form"; MTT_Matrix := MTTK_c$ MTT_Matrix_name := "MTTK_c"$ | | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | OUT "$1_ssk.r"; %Write out the matrices. write "% - Gain matrix - controller form"; MTT_Matrix := MTTK_c$ MTT_Matrix_name := "MTTK_c"$ MTT_Matrix_n := 1$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "% - Gain matrix - physical form"; MTT_Matrix := MTTK$ MTT_Matrix_name := "MTTK"$ MTT_Matrix_n := 1$ MTT_Matrix_m := MTTNx$ Reduce_Matrix()$ write "END;"; SHUT "$1_ssk.r"; quit; EOF # Now invoke the standard error handling. mtt_error_r smc2ssk_r.log |
Modified mttroot/mtt/bin/trans/ssk2ctf_r from [4f78fae1a2] to [5b4425092f].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 1998/02/09 13:54:34 peterg ## Initial revision ## ############################################################### # Inform user | > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.2 1998/02/09 14:04:00 peterg ## Renamed matrix to cTF; ## ## Revision 1.1 1998/02/09 13:54:34 peterg ## Initial revision ## ############################################################### # Inform user |
︙ | ︙ | |||
45 46 47 48 49 50 51 | %State matrices of the compensator A_d := MTTA - MTTL*MTTC - MTTB*MTTK; B_d := -MTTL; C_d := -MTTK; D_d := 0; %Transfer function | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | %State matrices of the compensator A_d := MTTA - MTTL*MTTC - MTTB*MTTK; B_d := -MTTL; C_d := -MTTK; D_d := 0; %Transfer function MTTcTF := C_d*((s*MTTI - A_d)^(-1))*B_d; %Create the output file OUT "$1_ctf.r"; %Write out the matrices. write "% - Compensator TF"; MTT_Matrix := MTTcTF$ |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/struc_txt2tex from [d9744948f9] to [6003f8f14a].
︙ | ︙ | |||
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 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.2 1997/04/15 11:17:58 peterg # Uses supertabular for long tables. # # Revision 1.1 1997/04/15 09:49:04 peterg # Initial revision # ############################################################### # Inform user echo "Creating $1_struc.tex" rm -f mtt_error #Write some file headers echo "%% Structure file ($1_struc.txt)" > $1_struc.tex echo "%% Generated by MTT at `date`" >> $1_struc.tex | > > > | | | | | | | | | | | | | | | | | | < > | | > | | | < > > | | | 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | # Copyright (c) P.J.Gawthrop, 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.3 1997/12/06 19:10:41 peterg # Reverted to tabular --- from supertabular # # Revision 1.2 1997/04/15 11:17:58 peterg # Uses supertabular for long tables. # # Revision 1.1 1997/04/15 09:49:04 peterg # Initial revision # ############################################################### # Inform user echo "Creating $1_struc.tex" rm -f mtt_error #Write some file headers echo "%% Structure file ($1_struc.txt)" > $1_struc.tex echo "%% Generated by MTT at `date`" >> $1_struc.tex # This is the main transformation using awk sed 's/_/\\_/g' < $1_struc.txt | awk ' function header(what){ print " \\centering"; print " \\tablefirsthead{\\hline %"; print " \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM "} \\\\"; print " \\hline"; print " & Component & System & Repetition \\\\"; print " \\hline}"; print " \\tablehead{\\hline %"; print " \\multicolumn{4}{|c|}{\\bf List of " what "s for system " SYSTEM " (continued)} \\\\"; print " \\hline"; print " & Component & System & Repetition \\\\"; print " \\hline}"; print " \\tabletail{\\hline}"; print " \\begin{supertabular}{|l|l|l|l|}"; } #function header(what){ # print "\\begin{table}[htbp]"; # print " \\centering"; # print " \\begin{tabular}{|l|l|l|l|}"; print " \\hline"; # print " & Component & System & Repetition \\\\"; # print " \\hline"; #} function footer(what){ print " \\hline"; print " \\end{supertabular}"; # print " \\end{tabular}"; # print " \\caption{" what "}"; # print "\\end{table}"; print " \\bigskip"; print " \\bigskip"; } BEGIN{ Which="" } |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/sub2subs from [483c54b40a] to [41189e212e].
︙ | ︙ | |||
10 11 12 13 14 15 16 | # P.J.Gawthrop May 1997 # Copyright (c) P.J.Gawthrop, 1997. # echo the name of the subsystems one level down sh $1\_sub.sh "echo " # Create the corresponding subsystems -- quietly! | | > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # P.J.Gawthrop May 1997 # Copyright (c) P.J.Gawthrop, 1997. # echo the name of the subsystems one level down sh $1\_sub.sh "echo " # Create the corresponding subsystems -- quietly! #(sh $1\_sub.sh "mtt -q " " sub sh") #>/dev/null (sh $1\_sub.sh " cmp2sub_m2sh " " ") >/dev/null # Recursively execute the subsystem files sh $1\_sub.sh "sub2subs " |
︙ | ︙ |
Modified mttroot/mtt/bin/trans/tex2doc from [98af8bc259] to [1616bd5235].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.1 1996/08/18 20:00:20 peter ## Initial revision ## ############################################################### # Inform user echo "Creating $1_$2.doc" | > > > | | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.2 1996/08/30 10:19:11 peter # New path for awk script. # ## Revision 1.1 1996/08/18 20:00:20 peter ## Initial revision ## ############################################################### # Inform user echo "Creating $1_$2.doc" # This is the main transformation using awk awk -f $MTTPATH/trans/awk/tex2doc.awk \ system_name=$1 representation=$2 > $1_$2.doc |