Overview
Comment:Cleared out mttx array ans use mkid instead.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 306da586ddc3c961bb3671bf6fe0f6a513fa825a83b3f33850b868f5d4479e30
User & Date: gawthrop@users.sourceforge.net on 1998-08-27 07:04:44.000
Other Links: branch diff | manifest | tags
Context
1998-08-27
07:06:25
Just genrate xj once. check-in: d0562bdc32 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
07:04:44
Cleared out mttx array ans use mkid instead. check-in: 306da586dd user: gawthrop@users.sourceforge.net tags: origin/master, trunk
06:48:20
Changed mttxx to mttx - in implicit integration smx is called once
with x in the linearisation the same as x in the current state
check-in: da7781f1c7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
10
11
12
13
14
15
16




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

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




## Revision 1.6  1998/08/26 18:25:45  peterg
## SMX now generates both A and Ax
##
## Revision 1.5  1998/08/15 13:51:56  peterg
## smx is now I-Adt NOT A
##
## Revision 1.4  1998/08/13 09:03:35  peterg







>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop, 1991, 1994, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/08/27 06:48:20  peterg
## Changed mttxx to mttx - in implicit integration smx is called once
## with x in the linearisation the same as x in the current state
##
## Revision 1.6  1998/08/26 18:25:45  peterg
## SMX now generates both A and Ax
##
## Revision 1.5  1998/08/15 13:51:56  peterg
## smx is now I-Adt NOT A
##
## Revision 1.4  1998/08/13 09:03:35  peterg
︙︙
58
59
60
61
62
63
64


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
126
127
128
129
130
131
reduce << EOF  >ode2smx_lang.log

lang := $lang;

in "$1_def.r";
in "$1_ode.r";



OFF Echo;

% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'Pascal;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_t;

% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";


%Procedure to write out the result according to the language used.
PROCEDURE WriteElement(name, i, j, element);
BEGIN
  IF (element NEQ 0) THEN
  BEGIN
    IF (lang = r) THEN 
      write name, "(", i, ",", j, ") := ", element;

    IF (lang = m) THEN 
      GENTRAN foo :=: element;

  END
END;

%Set up output according to the language.
 OFF NAT;
 GENTRANOUT "$1_smx.$lang";

% Set up output according to the language.
    IF (lang = r) THEN 
    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;

% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
    xi := MTTX(i,1);
    FOR j := 1:MTTNx DO
    BEGIN
      xj := MTTX(j,1);
      a_ij := df(MTTdx(i,1), xj, 1);
      a_ji := df(MTTdx(j,1), xi, 1);
      IF i=j THEN
      BEGIN
        aa_ij := 1 - mttdt*a_ij;
        aa_ji := aa_ij;
      END
      ELSE
      BEGIN
        aa_ij := -mttdt*a_ij;
        aa_ji := -mttdt*a_ji;
      END;
      IF (aa_ij NEQ 0) THEN
        GENTRAN mtta(i,j) ::=: aa_ij;
      mttAAx_i := mttAAx_i + aa_ij*mkid(mttx,j);
      %%%mttAAtx(i,1) := mttAAtx(i,1) + aa_ji*mkid(mttx,j);
    END;
    IF (mttAAx_i NEQ 0) THEN







>
>














<
<
<
<
<
<
<
<
<
<
<
<
<
<

















|


|

|



|




|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84














85
86
87
88
89
90
91
92
93
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
reduce << EOF  >ode2smx_lang.log

lang := $lang;

in "$1_def.r";
in "$1_ode.r";

clear mttx; % Dont need this now - use mkid instead

OFF Echo;

% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := 'Pascal;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_t;

% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";
















%Set up output according to the language.
 OFF NAT;
 GENTRANOUT "$1_smx.$lang";

% Set up output according to the language.
    IF (lang = r) THEN 
    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;

% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
%%    xi := mkid(mttx,i);
    FOR j := 1:MTTNx DO
    BEGIN
      xj := mkid(mttx,j);
      a_ij := df(MTTdx(i,1), xj, 1);
%%      a_ji := df(MTTdx(j,1), xi, 1);
      IF i=j THEN
      BEGIN
        aa_ij := 1 - mttdt*a_ij;
%%        aa_ji := aa_ij;
      END
      ELSE
      BEGIN
        aa_ij := -mttdt*a_ij;
%%        aa_ji := -mttdt*a_ji;
      END;
      IF (aa_ij NEQ 0) THEN
        GENTRAN mtta(i,j) ::=: aa_ij;
      mttAAx_i := mttAAx_i + aa_ij*mkid(mttx,j);
      %%%mttAAtx(i,1) := mttAAtx(i,1) + aa_ji*mkid(mttx,j);
    END;
    IF (mttAAx_i NEQ 0) THEN
︙︙

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