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: cse2smx_r
# Constrained-state equation to state matrices with x vector
# Used for implicit integration
# Copyright (C) 2000 by Peter J. Gawthrop
## Modified from eailier version
# Language
if [ -n "$3" ]; then
lang=$3
else
lang="m"
fi
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: cse2smx_r
# Constrained-state equation to state matrices with x vector
# Used for implicit integration
# Copyright (C) 2000 by Peter J. Gawthrop
## Modified from eailier version
# Args
while [ -n "`echo $1 | grep '^-'`" ]; do
case $1 in
-noglobal)
noglobal='-noglobal';
;;
-parameters)
parameters='-parameters';
;;
*)
echo $1 is an unknown option
exit;;
esac
shift
done
# Language
if [ -n "$3" ]; then
lang=$3
else
lang="m"
fi
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
rm -f cse2smx_r.log
rm -f $1_smx.$lang
rm -f $1_smxx.$lang
rm -f $1_smxtx.$lang
rm -f $1_$rep.body
# Use reduce to accomplish the transformation
reduce << EOF >cse2smx_lang.log
lang := $lang;
in "$1_subs.r";
in "$1_def.r";
in "$1_cse.r";
in "$1_cr.r";
|
|
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
rm -f cse2smx_r.log
rm -f $1_smx.$lang
rm -f $1_smxx.$lang
rm -f $1_smxtx.$lang
rm -f $1_$rep.body
# Use reduce to accomplish the transformation
$SYMBOLIC << EOF >cse2smx_lang.log
lang := $lang;
in "$1_subs.r";
in "$1_def.r";
in "$1_cse.r";
in "$1_cr.r";
|
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
END;
%Shut the output according to the language.
GENTRANSHUT "$1_$rep.body";
EOF
if [ "$lang" = "m" ]; then
lang_header $1 $rep m 'mttx,mttu,mttt,mttpar' $out > $1_$rep.m
echo '#====== Start of code ======#' >> $1_$rep.m
cat $1_$rep.body | mtt_p2m >> $1_$rep.m
fi
# Now invoke the standard error handling.
mtt_error_r cse2smx_lang.log
|
|
|
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
END;
%Shut the output according to the language.
GENTRANSHUT "$1_$rep.body";
EOF
if [ "$lang" = "m" ]; then
lang_header $noglobals $parameters $1 $rep m 'mttx,mttu,mttt,mttpar' $out > $1_$rep.m
echo '#====== Start of code ======#' >> $1_$rep.m
cat $1_$rep.body | mtt_p2m >> $1_$rep.m
fi
# Now invoke the standard error handling.
mtt_error_r cse2smx_lang.log
|