Overview
Comment:Reverted to an older version due to untraceable bug in new version
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: e4d0928b1a3a26945014e36f0ce35e2cbe3b993a8e6fb99b483342b8490b79cf
User & Date: gawthrop@users.sourceforge.net on 1998-04-07 05:45:12
Other Links: branch diff | manifest | tags
Context
1998-04-07
08:12:12
Added affine form. check-in: 17fd0d589b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
05:45:12
Reverted to an older version due to untraceable bug in new version check-in: e4d0928b1a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-04-06
08:41:48
Fixed bug due to adding (and then removing) 0 and 1 as port types check-in: 6b64332a2c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/ode2obs_r from [e4a7eab05c] to [18594f298c].

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
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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156





157
158
159

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2obs_r
# Odrinary differential equations to observer function equations
# P.J.Gawthrop 14 June 1991, 8 Aug 1991, 2 April 1992, 14 April 1994, 28 Dec 94,
#		12th July 1995, April 1996
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994, 1995, 1996.

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




## Revision 1.2  1996/08/25 08:38:14  peter
## Error handling added.
##
## Revision 1.1  1996/08/25 08:37:44  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_obs.r

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

# Use reduce to accomplish the transformation
reduce >ode2obs_r.log << EOF





OFF Echo;
OFF Nat;
ON NERO;

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

%Set default values - reset by sympar file.
MTTGPCNy := 2;
MTTGPCNu := 0;

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




%Create the U vector of input derivatives.
MTTNuu := (MTTGPCNu+1)*MTTNu;
MTTNuu1 := MTTGPCNu*MTTNu;
Matrix MTTUU(MTTNuu,1);

FOR i := 1:MTTNu DO
  MTTUU(i,1) := MTTU(i,1);
END;

IF MTTGPCNu>0 THEN
BEGIN
  FOR i := 1:MTTNu DO
    MTTUU(i+MTTNu,1) := MTTdU(i,1);
  END;
END;

MTTU := MTTU;
%  MTTdU := MTTdU; ---- removed temporarily, needs def file change? 
MTTUU := MTTUU;

%Create the Y vector of output derivatives.
MTTNyy := (MTTGPCNy+1)*MTTNy;
Matrix MTTYY(MTTNyy,1);

FOR i := 1:MTTNy DO
  MTTYY(i,1) := MTTY(i,1);
END;

l := MTTNy;
FOR i := 1:MTTGPCNy DO
    FOR j := 1:MTTNy DO
    BEGIN
    l := l+1;
    MTTYY(l,1) := 0;
    FOR k := 1:MTTNx DO %Derivatives wrt x
    BEGIN
      xk := MTTX(k,1);
      MTTYY(l,1) := MTTYY(l,1) + df(MTTYY(l-MTTNy,1), xk, 1)*MTTdX(k,1);
    END;
    IF MTTNuu1>0 THEN
    FOR k := 1:MTTNuu1 DO %Derivatives wrt u
    BEGIN
      uk := MTTUU(k,1);
      MTTYY(l,1) := MTTYY(l,1) + df(MTTYY(l-MTTNy,1), uk, 1)*MTTUU(k+MTTNu,1);
    END;
  END;
END;

%Create O_x - derivative of YY wrt x
Matrix MTTO_x(MTTNyy,MTTNx);
FOR j := 1:MTTNx DO
  BEGIN
  xj := MTTX(j,1);
  FOR i := 1:MTTNyy DO
    BEGIN
    MTTO_x(i,j) := df(MTTYY(i,1), xj);
    END;
  END;

%Create O_u - derivative of YY wrt u (Assumes GPC Nu = 0)
MTTNNu := (MTTGPCNu+1)*MTTNu;
Matrix MTTO_u(MTTNyy,MTTNNu);
FOR j := 1:MTTNNu DO
  BEGIN
  uj := MTTu(j,1);	
  FOR i := 1:MTTNyy DO
    BEGIN
    MTTO_u(i,j) := df(MTTYY(i,1), uj);
    END;
  END;


%Create O_uu - derivative of O_u wrt u (Assumes GPC Nu = 0)
%This is a multi-dimensional matrix kth elements stacked sideways.
Matrix MTTO_uu(MTTNyy,MTTNNu*MTTNNu);
FOR k := 1:MTTNNu DO



  BEGIN
  uk := MTTu(k,1);	
  FOR j := 1:MTTNNu DO
    BEGIN
    FOR i := 1:MTTNyy DO
      BEGIN
      jk := j+(k-1)*MTTNu;
      MTTO_uu(i,jk) := df(MTTO_u(i,j), uk);
      END;
    END;
  END;

%Create O_ux - derivative of O_u wrt x 
%This is a multi-dimensional matrix kth elements stacked sideways.
Matrix MTTO_ux(MTTNyy,MTTNu*MTTNx);
FOR k := 1:MTTNx DO
  BEGIN
  xk := MTTx(k,1);	
  FOR j := 1:MTTNu DO
    BEGIN
    FOR i := 1:MTTNyy DO
      BEGIN
      jk := j+(k-1)*MTTNu;
      MTTO_ux(i,jk) := df(MTTO_u(i,j), xk);
      END;
    END;
  END;








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


MTTYY := MTTYY;
MTTO_x := MTTO_x;
MTTO_u := MTTO_u;
MTTO_uu := MTTO_uu;
MTTO_ux := MTTO_ux;

write ";END;";

SHUT "$1_obs.r";
quit;

EOF

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










|







>
>
>
>

















>
>
>








|



|

>

>




|

|
|
|
|
|
|
|
|
|
|


|
<




















|
|

|
|




|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|


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

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|



>
>
>
>
>



>
|
|
|
|
|











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
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
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
132
133
134
135
136
137
138



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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
187
188
189
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: ode2obs_r
# Odrinary differential equations to observer function equations
# P.J.Gawthrop 14 June 1991, 8 Aug 1991, 2 April 1992, 14 April 1994, 28 Dec 94,
#               12th July 1995, April 1996
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994, 1995, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1996/08/25 10:07:05  peter
## Remove a du state ment causaing touble
##      - but needs more work.
##
## Revision 1.2  1996/08/25 08:38:14  peter
## Error handling added.
##
## Revision 1.1  1996/08/25 08:37:44  peter
## Initial revision
##
###############################################################

#Inform user
echo Creating $1_obs.r

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

# Use reduce to accomplish the transformation
reduce >ode2obs_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

%Set default values - reset by obspar file.
MTTGPCNy := 2;
MTTGPCNu := 0;

%%in "$1_sympar.r";
in "$1_ode.r";
%%in "$1_simp.r";

in "$1_obspar.r";

%Create the U vector of input derivatives.
MTTNuu := (MTTGPCNu+1)*MTTNu;
MTTNuu1 := MTTGPCNu*MTTNu;


%FOR i := 1:MTTNu DO
%  MTTUU(i,1) := MTTU(i,1);
%END;
%
%IF MTTGPCNu>0 THEN
%BEGIN
%  FOR i := 1:MTTNu DO
%    MTTUU(i+MTTNu,1) := MTTdU(i,1);
%  END;
%END;

MTTU := MTTU;
MTTdU := MTTdU; % ---- removed temporarily, needs def file change? 


%Create the Y vector of output derivatives.
MTTNyy := (MTTGPCNy+1)*MTTNy;
Matrix MTTYY(MTTNyy,1);

FOR i := 1:MTTNy DO
  MTTYY(i,1) := MTTY(i,1);
END;

l := MTTNy;
FOR i := 1:MTTGPCNy DO
    FOR j := 1:MTTNy DO
    BEGIN
    l := l+1;
    MTTYY(l,1) := 0;
    FOR k := 1:MTTNx DO %Derivatives wrt x
    BEGIN
      xk := MTTX(k,1);
      MTTYY(l,1) := MTTYY(l,1) + df(MTTYY(l-MTTNy,1), xk, 1)*MTTdX(k,1);
    END;
    IF MTTGPCNu>0 THEN
    FOR k := 1:MTTGPCNu DO %Derivatives wrt u
    BEGIN
      uk := MTTUU(1,k);
      MTTYY(l,1) := MTTYY(l,1) + df(MTTYY(l,1), uk, 1)*MTTUU(1,k+1);
    END;
  END;
END;

%%Create O_x - derivative of YY wrt x
%Matrix MTTO_x(MTTNyy,MTTNx);
%FOR j := 1:MTTNx DO
%  BEGIN
%  xj := MTTX(j,1);
%  FOR i := 1:MTTNyy DO
%    BEGIN
%    MTTO_x(i,j) := df(MTTYY(i,1), xj);
%    END;
%  END;

%%Create O_u - derivative of YY wrt u (Assumes GPC Nu = 0)
%MTTNNu := (MTTGPCNu+1)*MTTNu;
%Matrix MTTO_u(MTTNyy,MTTNNu);
%FOR j := 1:MTTNNu DO
%  BEGIN
%  uj := MTTu(j,1);     
%  FOR i := 1:MTTNyy DO
%    BEGIN
%    MTTO_u(i,j) := df(MTTYY(i,1), uj);
%    END;
%  END;


%%Create O_uu - derivative of O_u wrt u (Assumes GPC Nu = 0)
%%This is a multi-dimensional matrix kth elements stacked sideways.
%Matrix MTTO_uu(MTTNyy,MTTNNu*MTTNNu);
%FOR k := 1:MTTNNu DO
%  BEGIN
%  uk := MTTu(k,1);     
%  FOR j := 1:MTTNNu DO
%    BEGIN



%    FOR i := 1:MTTNyy DO
%      BEGIN
%      jk := j+(k-1)*MTTNu;
%      MTTO_uu(i,jk) := df(MTTO_u(i,j), uk);
%      END;
%    END;
%  END;

%%Create O_ux - derivative of O_u wrt x 
%%This is a multi-dimensional matrix kth elements stacked sideways.
%Matrix MTTO_ux(MTTNyy,MTTNu*MTTNx);
%FOR k := 1:MTTNx DO
%  BEGIN
%  xk := MTTx(k,1);     
%  FOR j := 1:MTTNu DO
%    BEGIN
%    FOR i := 1:MTTNyy DO
%      BEGIN
%      jk := j+(k-1)*MTTNu;
%      MTTO_ux(i,jk) := df(MTTO_u(i,j), xk);
%      END;
%    END;
%  END;



mtt_matrix := MTTYY$
mtt_matrix_n := MTTNy*MTTGPCNy;
mtt_matrix_m := 1;
mtt_matrix_name := "MTTYY"$

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

reduce_matrix();

%MTTO_x := MTTO_x;
%MTTO_u := MTTO_u;
%MTTO_uu := MTTO_uu;
%MTTO_ux := MTTO_ux;

write ";END;";

SHUT "$1_obs.r";
quit;

EOF

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


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