Overview
Comment: | Does the mtt_update function |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
1a6786bd740ba4382996f2af3b0d1467 |
User & Date: | gawthrop@users.sourceforge.net on 1998-07-25 20:06:23 |
Other Links: | branch diff | manifest | tags |
Context
1998-07-25
| ||
20:10:01 | Lower case mttx check-in: f8e5218732 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
20:06:23 | Does the mtt_update function check-in: 1a6786bd74 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
19:16:22 | Sorted out sympar + switch variables - new sympars rep combines both check-in: 655b4b56e5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/mtt_m2p from [b39af5938d] to [8a735f8e01].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Copyright (c) P.J.Gawthrop 1998 ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.5 1998/07/25 15:06:17 peterg ## Added DDT VAR ## ## Revision 1.4 1998/07/25 15:05:54 peterg ## DD ## ## Revision 1.3 1998/07/25 14:03:30 peterg | > > > | 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.6 1998/07/25 16:59:40 peterg ## Give other procedures local i,j vars. ## ## Revision 1.5 1998/07/25 15:06:17 peterg ## Added DDT VAR ## ## Revision 1.4 1998/07/25 15:05:54 peterg ## DD ## ## Revision 1.3 1998/07/25 14:03:30 peterg |
︙ | ︙ | |||
48 49 50 51 52 53 54 | echo Creating $Filename # Find system constants Nx=`grep "MTTNx " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` | < < < < < < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | echo Creating $Filename # Find system constants Nx=`grep "MTTNx " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` Nu=`grep "MTTNu " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` Ny=`grep "MTTNy " <$Sys\_def.r | awk '{print $3}' | sed 's/;//'` # Heading (case $rep in state) echo "PROCEDURE $Sys_rep(VAR mttx : StateVector);" ;; input) echo "PROCEDURE $Sys_rep(VAR mttu : InputVector;" |
︙ | ︙ | |||
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 | ;; ode2odes) echo "PROGRAM $Sys_rep;" echo "TYPE" echo " StateVector =ARRAY[1..$Nx] OF REAL;" echo " InputVector =ARRAY[1..$Nu] OF REAL;" echo " OutputVector =ARRAY[1..$Ny] OF REAL;" echo "VAR" echo " t,LAST,DT,DDT : REAL;" echo " mttx,mttdx : StateVector;" echo " mttu : InputVector;" echo " mtty : OutputVector;" echo " i,j,it,iLast,STEPFACTOR : INTEGER;" echo " METHOD : STRING;" ;; *) echo "PROCEDURE $Sys_rep;" echo "VAR" echo " i,j : INTEGER;" ;; esac) > $Filename cat<<EOF >> $Filename {*** System $Sys, rep $rep, language Pascal, file $Filename ***} {*** Translated by MTT from $Sys_rep.m on `date` ***} EOF | > > > > > > > | > > > > > > > | 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 | ;; ode2odes) echo "PROGRAM $Sys_rep;" echo "TYPE" echo " StateVector =ARRAY[1..$Nx] OF REAL;" echo " InputVector =ARRAY[1..$Nu] OF REAL;" echo " OutputVector =ARRAY[1..$Ny] OF REAL;" echo " IntegrationMethod = (Euler,ImplicitL,Implicit);" echo "VAR" echo " t,LAST,DT,DDT : REAL;" echo " mttx,mttdx : StateVector;" echo " mttu : InputVector;" echo " mtty : OutputVector;" echo " i,j,it,iLast,STEPFACTOR : INTEGER;" echo " METHOD : STRING;" ;; switch) echo "PROCEDURE $Sys_rep(VAR mttxs : StateVector;" echo " mttx : StateVector);" echo "VAR" echo " i,j : INTEGER;" ;; *) echo "PROCEDURE $Sys_rep;" echo "VAR" echo " i,j : INTEGER;" ;; esac) > $Filename cat<<EOF >> $Filename {*** System $Sys, rep $rep, language Pascal, file $Filename ***} {*** Translated by MTT from $Sys_rep.m on `date` ***} EOF #Regexps name="[a-zA-Z0-9]*" fun_name="$Sys\_$name" mttfun_name="mtt_update" space="[ \t]*" spaces="[ \t][ \t]*" non_space="[^ ]*" # Body grep -v '^[ ]*function' < $Sys_rep.m | sed "s/^$space%/#/" |\ awk -F# '{printf("%s",$1) if (NF>1) printf("{* %s *}", $2) printf("\n") }' |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($mttfun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ sed "s/$space\[\($non_space\)\]$spaces=$spaces\($fun_name\)/\2(\1)/" |\ sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)(\([a-zA-Z0-9,]*\))/\2(\1,\3)/" |\ sed "s/$space\($non_space\)$spaces=$spaces\($fun_name\)/\2(\1)/" |\ awk ' BEGIN{ comment_regexp = "{" doing_header = 0 |
︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | printf("t%i : REAL;\n",Nt) printf("{%s %s_simpar.p}\n",inc,sys) printf("{%s %s_numpar.p}\n",inc,sys) printf("{%s %s_state.p}\n",inc,sys) printf("{%s %s_input.p}\n",inc,sys) printf("{%s %s_ode.p}\n",inc,sys) printf("{%s %s_odeo.p}\n",inc,sys) printf("{%s mtt_write.p}\n",inc,sys) } for (k=1;k<=j;k++) printf("%s\n", comment[k]) printf("\n") printf("\nBEGIN\n") doing_header = 0; } if (match($1,comment_regexp)>0){ if (doing_header==1) comment[++j] = $0 else printf("%s\n", $0) } else { if ($1=="if") { | > > > | | 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 | printf("t%i : REAL;\n",Nt) printf("{%s %s_simpar.p}\n",inc,sys) printf("{%s %s_numpar.p}\n",inc,sys) printf("{%s %s_state.p}\n",inc,sys) printf("{%s %s_input.p}\n",inc,sys) printf("{%s %s_ode.p}\n",inc,sys) printf("{%s %s_odeo.p}\n",inc,sys) printf("{%s %s_switch.p}\n",inc,sys) printf("{%s mtt_update.p}\n",inc,sys) printf("{%s mtt_write.p}\n",inc,sys) } for (k=1;k<=j;k++) printf("%s\n", comment[k]) printf("\n") printf("\nBEGIN\n") doing_header = 0; } if (match($1,comment_regexp)>0){ if (doing_header==1) comment[++j] = $0 else printf("%s\n", $0) } else { if ($1=="if") { sub(/==/, "=", $0) printf("%s THEN BEGIN\n", $0) } else{ if ($1=="for"){ sub(/:/," TO ",$0) sub(/=/,":=",$0) printf("%s DO BEGIN\n", $0) } |
︙ | ︙ |