Overview
Comment:Now writes out the matrix sizes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0559ac205acb467bcbe2739808929f86862dccbbfadb915caeb9394ffa7b4450
User & Date: gawthrop@users.sourceforge.net on 1999-12-20 06:26:39
Other Links: branch diff | manifest | tags
Context
1999-12-20
09:36:24
*** empty log message *** check-in: 11680ab427 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
06:26:39
Now writes out the matrix sizes check-in: 0559ac205a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
02:08:38
Added second arg option check-in: c1fcfebeb3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/ode2obs_r from [8b50fa41a2] to [117332d406].

11
12
13
14
15
16
17



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

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



## Revision 1.4  1998/04/07 05:45:12  peterg
## Reverted to an older version due to untraceable bug in new version
##
## Revision 1.3  1996/08/25 10:07:05  peter
## Remove a du state ment causaing touble
##      - but needs more work.
##







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/04/07 08:12:12  peterg
## Added affine form.
##
## Revision 1.4  1998/04/07 05:45:12  peterg
## Reverted to an older version due to untraceable bug in new version
##
## Revision 1.3  1996/08/25 10:07:05  peter
## Remove a du state ment causaing touble
##      - but needs more work.
##
167
168
169
170
171
172
173

174
175
176
177
178

179
180

181

182

183

184
185
186
187
188
189

190
191
192
193
194
195
196
197

198








199
200
201
202
203
204
205
%    END;
%  END;


% Try and split the obs function into affine form (O(x,u) = o(x) + h(x)u)
affine := 1;
MTTNuu := (MTTGPCNu+1)*MTTNu;


IF affine=1 THEN
BEGIN
  MATRIX MTTObs_o(MTTNyy,1);
  MATRIX MTTObs_h(MTTNyy,MTTNuu);

  FOR i := 1:MTTNyy DO
  BEGIN

    MTTObs_o(i,1) := MTTYY(i,1);

    FOR j := 1:MTTNuu DO

    BEGIN

      %Expand as polynomial in uj
      coeffs := coeff(MTTObs_o(i,1), MTTu(j,1));
      MTTObs_o(i,1) := first(coeffs);
      IF length(coeffs)>1 THEN
        MTTObs_h(i,j) := second(coeffs);
      IF length(coeffs)>2 THEN affine := 0;

    END;
  END;
END;



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

affine := affine;









mtt_matrix := MTTYY$
mtt_matrix_n := MTTNyy$
mtt_matrix_m := 1$
mtt_matrix_name := "MTTYY"$
reduce_matrix();








>

|
|


>


>

>
|
>

>
|
|


|
|
>


|
<




>
|
>
>
>
>
>
>
>
>







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
%    END;
%  END;


% Try and split the obs function into affine form (O(x,u) = o(x) + h(x)u)
affine := 1;
MTTNuu := (MTTGPCNu+1)*MTTNu;
write "1 affine := ", affine, ";";

%IF (affine=1) THEN
%BEGIN
  MATRIX MTTObs_o(MTTNyy,1);
  MATRIX MTTObs_h(MTTNyy,MTTNuu);
write "2 affine := ", affine, ";";
  FOR i := 1:MTTNyy DO
  BEGIN
write "3 affine := ", affine, ";";
    MTTObs_o(i,1) := MTTYY(i,1);
    k := 0;
    FOR j := 1:MTTNu DO
    FOR jj := 0:MTTGPCNu DO
    BEGIN
      k := k+1;
      %Expand as polynomial in u_j^[jj]
      coeffs := coeff(MTTObs_o(i,1), MTTUU(j,jj+1));
      MTTObs_o(i,1) := first(coeffs);
      IF length(coeffs)>1 THEN
        MTTObs_h(i,k) := second(coeffs);
      IF length(coeffs)>2 THEN 
        affine := -1;
    END;
  END;
%END;



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

IF affine=1 THEN
  write "affine := 1; % The O function is affine in u"
ELSE
  write "affine := 0; % The O function is not affine in u";


write "% The matrix sizes";
write "MTTNyy := ", MTTNyy, ";";
write "MTTNuu := ", MTTNuu, ";";

mtt_matrix := MTTYY$
mtt_matrix_n := MTTNyy$
mtt_matrix_m := 1$
mtt_matrix_name := "MTTYY"$
reduce_matrix();


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