11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
+
+
+
+
|
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9 1998/11/18 10:53:38 peterg
## Put in some more "IF MTTNx>0 THEN" to avoid error messages when no
## states.
##
## Revision 1.8 1998/11/10 08:54:34 peterg
## Put in "IF MTTNx>0 THEN" to prevent probs when Nx=0
## -- still a couple of apparent error messages - but answers now
## correct
##
## Revision 1.7 1998/10/05 10:46:15 peterg
## Commented out redundant MTTY := MTTY + MTTEyx*MTTEdX;
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
+
+
+
|
# Remove the old log file
rm -f dae2cse_r.log
# Use reduce to accomplish the transformation
$SYMBOLIC >dae2cse_r.log << EOF
%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";
OFF Echo;
OFF Nat;
ON NERO;
in "$1_def.r";
MTTdxs := MTTdX; %Save the symbolic form of dX
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
+
-
+
-
-
+
-
-
-
+
+
+
+
+
+
-
+
-
-
+
-
+
+
-
-
-
+
+
+
-
-
-
+
+
-
-
+
+
+
+
+
-
-
-
+
-
-
-
-
-
+
+
+
-
-
+
-
-
+
-
-
-
-
+
+
-
-
-
+
+
-
-
+
-
-
-
-
+
-
-
+
-
-
+
+
+
+
+
|
% No algebraic variables left!
MTTNYz := 0;
END; % IF MTTNyz>0
%%Create the _cse.r file
OUT "$1_cse.r";
% State derivative
IF MTTNx>0 THEN
MTT_Matrix := MTTEdX$
BEGIN
write "matrix MTTEdX(", MTTNx, ",1)";
MTT_Matrix_name := "MTTEdX"$
END;
IF MTTNx>0 THEN
MTTEdX := MTTEdX;
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$
% Output
MTT_Matrix := MTTY$
MTT_Matrix_name := "MTTY"$
IF MTTNy>0 THEN
MTT_Matrix_n := MTTNy$
BEGIN
write "matrix MTTY(", MTTNy, ",1)";
MTT_Matrix_m := 1$
END;
Reduce_Matrix()$
% Inputs
MTTY := MTTY;
IF MTTNu>0 THEN
MTT_Matrix := MTTU$
MTT_Matrix_name := "MTTU"$
MTT_Matrix_n := MTTNu$
BEGIN
write "matrix MTTU(", MTTNu, ",1)";
write "matrix MTTdU(", MTTNu, ",1)";
MTT_Matrix_m := 1$
Reduce_Matrix()$
END;
MTTU := MTTU;
MTT_Matrix := MTTdU$
MTT_Matrix_name := "MTTdU"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := 1$
Reduce_Matrix()$
IF MTTNx>0 THEN
BEGIN
write "matrix MTTE(", MTTNx, ",", MTTNx, ")";
% E matrix
END;
IF MTTNx>0 THEN
MTTE := MTTE;
IF MTTNz>0 THEN
MTT_Matrix := MTTE$
MTT_Matrix_name := "MTTE"$
MTT_Matrix_n := MTTNx$
BEGIN
IF MTTNx>0 THEN IF MTTNy>0 THEN
MTT_Matrix_m := MTTNx$
BEGIN
write "matrix MTTEyx(", MTTNy, ",", MTTNx, ")";
Reduce_Matrix()$
END;
IF MTTNx>0 THEN
MTTEyx := MTTEyx;
%%%%% MTTdU := MTTdU;
% Eyx matrix
MTT_Matrix := MTTEyx$
END;
IF MTTNyz>0 THEN
MTT_Matrix_name := "MTTEyx"$
MTT_Matrix_n := MTTNy$
BEGIN
write "matrix MTTYz(", MTTNyz, ",1)";
MTT_Matrix_m := MTTNx$
END
ELSE
BEGIN
write "MTTNYz := 0;";
%Reduce_Matrix()$
MTTYz := 0;
END;
% Yz
MTTYz := MTTYz;
MTT_Matrix := MTTYz$
MTT_Matrix_name := "MTTYz"$
MTT_Matrix_n := MTTNyz$
MTT_Matrix_m := 1$
Reduce_Matrix()$
write ";END;";
SHUT "$1_cse.r";
quit;
EOF
# Now invoke the standard error handling.
mtt_error_r dae2cse_r.log
|