Overview
Comment:Revises smx generation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 8ea6df676614bf9f6290ae67132f09da198fc53c0a73f0baee241fa293275329
User & Date: gawthrop@users.sourceforge.net on 1999-02-16 21:43:54
Other Links: branch diff | manifest | tags
Context
1999-02-16
21:44:38
Revised smx generation check-in: 0d694c4f97 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
21:43:54
Revises smx generation. check-in: 8ea6df6766 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
04:38:22
Now forces creation of _smx file if METHOD=IMPLICIT in simpar.txt check-in: 0bccebd16d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_m2p from [ed924e211c] to [6d1d7edebe].

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
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"


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

    # Check if implicit method and generate smx.p if so
    implicit=`grep -i METHOD $Sys_rep.txt | grep -i -c IMPLICIT`
    if [ "$implicit" = "1"  ]; then
	mtt -q $Sys smx p
    fi
fi

# Heading
(case $rep in
    state)
        echo "PROCEDURE $Sys_rep(VAR mttx : StateVector);"
        ;;







>
>












<
<
<
<
|
<







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
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("\n{%s sign.p}\n",inc)
          printf("{%s mtt_euler.p}\n",inc)
          printf("{%s mtt_implicit.p}\n",inc)
          printf("{%s mtt_write.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])







>



<


|
|
|
|
|
|
|
|
|







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
350
351
352






353
354
355

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










|
|
|
>
>
>
>
>
>



>
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




MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]