Differences From Artifact [5121ef1402]:

To Artifact [ad9199f7e0]:


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







+
+
+







+

















+
+
+
+
+
+
+
+
-
-
+
+







# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/06/21 10:40:58  peterg
## Added fsolve error message.
##
## Revision 1.1  1998/05/23 16:17:14  peterg
## Initial revision
##
###############################################################

# Set up the language specific stuff
language=$2

case $language in
    m)
	ext='m';
	codegenerator='FORTRAN'
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;
    c)
	ext='c';
	codegenerator='C'
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    java)
	ext='java';
	codegenerator='C'
	Lc='/*';
	Rc='*/';
	Lb='[';
	Rb=']';
	;;
    *)
	echo Language $2 not supported - sorry; exit 1
       *)
       echo Language $2 not supported - sorry; exit 1
esac

#Inform user
echo Creating $1_ode.$ext
echo Creating $1_odea.$ext
echo Creating $1_odeo.$ext

111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137







-
+







  mtt_matrix_name := MTTy$
  lang_matrix(); 
  GENTRANSHUT "$1_odeo.$ext.1";

EOF

# Create the ode.$ext function
lang_header $1 ode $ext 'mttx,t' mttdx > $1_ode.$ext
lang_header $1 ode $ext 'mttx,mttu,t' mttdx > $1_ode.$ext

# Algebraic bits
$MATRIX -q  <<EOF  >> $1_ode.$ext
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
if nyz>0
  printf("global mttxx mttt;\n");
150
151
152
153
154
155
156
157

158
159
160
161






162
163
164
165
166
167
168
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







-
+




+
+
+
+
+
+







  printf("\n");
end;

EOF

cat <<EOF >> $1_ode.$ext

% The differential equations
$Lc The differential equations $Rc
EOF

sed 's/mtt_matrix/mttdx/' $1_ode.$ext.1 >> $1_ode.$ext

# Java terminating }
if [ "$language" = "java" ]; then
cat <<EOF     >> $1_ode.$ext
}
EOF
fi


# Create the odea.$ext function
lang_header $1 odea $ext 'mttui' mttyz 'global mttxx mttt; mttx = mttxx; t=mttt;' > $1_odea.$ext

$MATRIX -q  <<EOF  >> $1_odea.$ext
  %System structure
180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
198
199
200
201
202
203
204

205
206
207
208
209
210
211
212







-
+








% The algebraic equations
EOF
sed 's/mtt_matrix/mttyz/' $1_odea.$ext.1 >> $1_odea.$ext


# Create the odeo.$ext function
lang_header $1 odeo $ext 'mttx,t' mtty > $1_odeo.$ext
lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.$ext

$MATRIX -q  <<EOF  >> $1_odeo.$ext
  %System structure
  [nx,ny,nu,nz,nyz] = $1_def;
if nyz>0
  printf("$Lc====== Extract the internal input variables ======$Rc\n");
  for i = 1:nyz
207
208
209
210
211
212
213
214
215
216
217
218
219
220
225
226
227
228
229
230
231

232
233
234
235
236
237







-








cat <<EOF >> $1_odeo.$ext

% The output equations
EOF
sed 's/mtt_matrix/mtty/' $1_odeo.$ext.1 >> $1_odeo.$ext








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