Differences From Artifact [5ebe10ae2a]:

To Artifact [ef5ba91cfc]:


11
12
13
14
15
16
17




18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$




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







>
>
>
>







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

# Remove the old log file
rm -f dae2cse_r.log

# Use reduce to accomplish the transformation
$SYMBOLIC >dae2cse_r.log << EOF




OFF Echo;
OFF Nat;
ON NERO;

in "$1_def.r";
MTTdxs := MTTdX;  %Save the symbolic form of dX








>
>
>







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
  % No algebraic variables left!
  MTTNYz := 0;
END; % IF MTTNyz>0

%%Create the _cse.r file
OUT "$1_cse.r";


IF MTTNx>0 THEN
BEGIN
  write "matrix MTTEdX(", MTTNx, ",1)";
END;
IF MTTNx>0 THEN
  MTTEdX := MTTEdX;





IF MTTNy>0 THEN
BEGIN
  write "matrix MTTY(", MTTNy, ",1)";
END;



MTTY := MTTY;

IF MTTNu>0 THEN
BEGIN
  write "matrix MTTU(", MTTNu, ",1)";
  write "matrix MTTdU(", MTTNu, ",1)";
END;
MTTU := MTTU;





IF MTTNx>0 THEN
BEGIN
  write "matrix MTTE(", MTTNx, ",", MTTNx, ")";
END;
IF MTTNx>0 THEN
  MTTE := MTTE;

IF MTTNz>0 THEN
BEGIN
  IF MTTNx>0 THEN IF MTTNy>0 THEN
  BEGIN
    write "matrix MTTEyx(", MTTNy, ",", MTTNx, ")";
  END;

IF MTTNx>0 THEN
  MTTEyx := MTTEyx;
%%%%%  MTTdU := MTTdU;
END;

IF MTTNyz>0 THEN
  BEGIN
  write "matrix MTTYz(", MTTNyz, ",1)";
  END
ELSE
  BEGIN
  write "MTTNYz := 0;";
  MTTYz := 0;
  END;


  MTTYz := MTTYz;





write ";END;";

SHUT "$1_cse.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r dae2cse_r.log







>
|
<
|
<
|
|
>

>
>
>
|
<
|
<
>

>
|
|
|
<
|
|
<
|
>
>
>
>

<
<
|
<
<
|
|
|
<
|
<
|
<

<
|
|
<
|
|
<
|
<
<
<
|
<
<

>
|
|
>
>
>










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
MTT_Matrix := MTTEdX$ 

MTT_Matrix_name := "MTTEdX"$

MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Reduce_Matrix()$

% Output
MTT_Matrix := MTTY$ 
MTT_Matrix_name := "MTTY"$
MTT_Matrix_n := MTTNy$

MTT_Matrix_m := 1$

Reduce_Matrix()$

% Inputs
MTT_Matrix := MTTU$ 
MTT_Matrix_name := "MTTU"$
MTT_Matrix_n := MTTNu$

MTT_Matrix_m := 1$
Reduce_Matrix()$

MTT_Matrix := MTTdU$ 
MTT_Matrix_name := "MTTdU"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := 1$
Reduce_Matrix()$



% E matrix


MTT_Matrix := MTTE$ 
MTT_Matrix_name := "MTTE"$
MTT_Matrix_n := MTTNx$

MTT_Matrix_m := MTTNx$

Reduce_Matrix()$



% Eyx matrix
MTT_Matrix := MTTEyx$ 

MTT_Matrix_name := "MTTEyx"$
MTT_Matrix_n := MTTNy$

MTT_Matrix_m := MTTNx$



%Reduce_Matrix()$



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

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