Differences From Artifact [ed924e211c]:
- Executable file mttroot/mtt/bin/trans/mtt_m2p — part of check-in [0bccebd16d] at 1999-02-16 04:38:22 on branch origin/master — Now forces creation of _smx file if METHOD=IMPLICIT in simpar.txt (user: gawthrop@users.sourceforge.net, size: 10164) [annotate] [blame] [check-ins using]
To Artifact [6d1d7edebe]:
- Executable file mttroot/mtt/bin/trans/mtt_m2p — part of check-in [8ea6df6766] at 1999-02-16 21:43:54 on branch origin/master — Revises smx generation. (user: gawthrop@users.sourceforge.net, size: 10293) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
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.24 1998/11/18 16:56:15 peterg ## Now handles comments after IFS ## ## Revision 1.23 1998/11/18 14:38:01 peterg ## Now convert ALL globals to VAR .. the last one isn't repeated now ## ## Revision 1.22 1998/11/17 17:39:45 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.25 1999/02/16 04:38:09 peterg ## Now forces creation of _smx file if METHOD=IMPLICIT in simpar.txt ## ## Revision 1.24 1998/11/18 16:56:15 peterg ## Now handles comments after IFS ## ## Revision 1.23 1998/11/18 14:38:01 peterg ## Now convert ALL globals to VAR .. the last one isn't repeated now ## ## Revision 1.22 1998/11/17 17:39:45 peterg |
| ︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# Set up variables
args=`echo $1 | sed 's/_/ /' | sed 's/\./ /'`
Sys=`echo $args | awk '{print $1}'`
sys=`echo $Sys | awk '{print tolower($1)}'`
rep=`echo $args | awk '{print $2}'`
Sys_rep="$Sys""_""$rep"
Filename="$Sys""_""$rep.p"
filename="$sys""_""$rep.p"
# Inform user
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/;//'`
if [ "$rep" = "simpar" ]; then
| > > < < < < | < | 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 |
# Set up variables
args=`echo $1 | sed 's/_/ /' | sed 's/\./ /'`
Sys=`echo $args | awk '{print $1}'`
sys=`echo $Sys | awk '{print tolower($1)}'`
rep=`echo $args | awk '{print $2}'`
Sys_rep="$Sys""_""$rep"
Sys_smx="$Sys""_smx"
Sys_smxp="$Sys""_smx.p"
Filename="$Sys""_""$rep.p"
filename="$sys""_""$rep.p"
# Inform user
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/;//'`
if [ "$rep" = "simpar" ]; then
mtt $Sys smx p
fi
# Heading
(case $rep in
state)
echo "PROCEDURE $Sys_rep(VAR mttx : StateVector);"
;;
|
| ︙ | ︙ | |||
260 261 262 263 264 265 266 267 268 269 |
for (k=1;k<i;k++) printf(" %s,\n",global[k])
printf("%s : REAL;\n", global[i])
printvar("x",Nx);
printvar("u",Nu);
printvar("y",Ny);
printvar("_t",Nt);
printf("\n{%s sign.p}\n",inc)
printf("{%s mtt_euler.p}\n",inc)
printf("{%s mtt_implicit.p}\n",inc)
| > < | | | | | | | | | | 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 |
for (k=1;k<i;k++) printf(" %s,\n",global[k])
printf("%s : REAL;\n", global[i])
printvar("x",Nx);
printvar("u",Nu);
printvar("y",Ny);
printvar("_t",Nt);
printf("{%s mtt_write.p}\n",inc)
printf("\n{%s sign.p}\n",inc)
printf("{%s mtt_euler.p}\n",inc)
printf("{%s mtt_implicit.p}\n",inc)
printf("{%s zero_matrix.p}\n",inc)
printf("{%s zero_vector.p}\n",inc)
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\n",inc,Sys)
printf("{%s %s_switcha.p}\n\n",inc,Sys)
printf("\n{%s %s_smx.p}\n",inc,Sys)
for (k=1;k<=j;k++) printf("%s\n", comment[k])
printf("\n")
printf("\nBEGIN{%s}\n", Sys_rep)
}
else{
for (k=1;k<=j;k++) printf("%s\n", comment[k])
|
| ︙ | ︙ | |||
343 344 345 346 347 348 349 | sed 's/(\(MTT[ijk0-9],MTT[ijk0-9]\))/\[\1\]/g' |\ sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g' |\ sed 's/switcha(mttAA,/switcha(/g' |\ sed 's/switch(MTTx,/switch(/g' \ >> $Filename # p2c doesn't like mixed case filenames! | | | | > > > > > > > | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
sed 's/(\(MTT[ijk0-9],MTT[ijk0-9]\))/\[\1\]/g' |\
sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g' |\
sed 's/switcha(mttAA,/switcha(/g' |\
sed 's/switch(MTTx,/switch(/g' \
>> $Filename
# p2c doesn't like mixed case filenames!
#if [ "$Filename" != "$filename" ]; then
# echo Creating $filename
# cp -f $Filename $filename
#fi
if [ "$rep" = "ode2odes" ]; then
# Explicitly include files
mtt_pinclude $Filename>junk.p
mv junk.p $Filename
fi
|