Overview
Comment:Now uses fopen + file number
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 539321e0af1e02e1ba542748f014ff8fd04da9aeea8be3d1e41acd238484393b
User & Date: gawthrop@users.sourceforge.net on 1996-12-07 18:21:57
Other Links: branch diff | manifest | tags
Context
1996-12-07
19:23:07
Registered agian. check-in: b1169db925 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
18:21:57
Now uses fopen + file number check-in: 539321e0af user: gawthrop@users.sourceforge.net tags: origin/master, trunk
18:20:11
Replaces null argument by a default and tells user. check-in: 67395c4bd4 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/cbg2ese_m2r from [e0e9130b2d] to [439cd48f13].

12
13
14
15
16
17
18




19
20
21
22
23
24
25

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




# Revision 1.7  1996/08/30  11:29:49  peter
# Added constitutive relationship to argument list.
# Put in explicit argument list to cbg2ese.
#
# Revision 1.6  1996/08/26  13:25:07  peterg
# Corrected error handling.
#







>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

###############################################################
## Version control history
###############################################################
## $Id$
##
## $Log$
## Revision 1.8  1996/12/05 10:05:28  peterg
## Removed the Octave switch: empty_list_elements_ok = 1;
## This is now in .octaverc
##
# Revision 1.7  1996/08/30  11:29:49  peter
# Added constitutive relationship to argument list.
# Put in explicit argument list to cbg2ese.
#
# Revision 1.6  1996/08/26  13:25:07  peterg
# Corrected error handling.
#
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
infofile='mtt_info.txt';
eqnfile="$1_ese.r";
deffile="$1_def.r";

# Remove the old log file
rm -f cbg2ese_m.log
rm -f $1_ese.r
rm -f $1_def.r
rm -f $infofile

touch $infofile

#Inform user
echo Creating $eqnfile
echo Creating $1_def.r

# Use matrix manipulation to accomplish the transformation
$RMATRIX > cbg2ese_m2r.log 2>mtt_error.txt << EOF

infofile = '$infofile';;




system_name = '$1';
system_type = '';
system_cr = '';
system_args = '';
full_name = '';
full_name_repetition = '';

deffile = '$1_def.r';

% Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

structure = zeros(1,5);

structure = cbg2ese(system_name, system_type, system_cr, ...
                     system_args, full_name, full_name_repetition, ...
                     1, structure, infofile);
makedef(structure,deffile);
  
EOF

cat $infofile

cat $1*ese.r - > $1_ese.tmp 2>> mtt_error.txt <<EOF
END;







<
<
<
<









>
>
>
>







<







|
|







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
infofile='mtt_info.txt';
eqnfile="$1_ese.r";
deffile="$1_def.r";

# Remove the old log file
rm -f cbg2ese_m.log
rm -f $1_ese.r





#Inform user
echo Creating $eqnfile
echo Creating $1_def.r

# Use matrix manipulation to accomplish the transformation
$RMATRIX > cbg2ese_m2r.log 2>mtt_error.txt << EOF

infofile = '$infofile';;
infofilenum = fopen(infofile,'w');
deffile = '$1_def.r';
deffilenum = fopen(deffile,'w');

system_name = '$1';
system_type = '';
system_cr = '';
system_args = '';
full_name = '';
full_name_repetition = '';



% Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

structure = zeros(1,5);

structure = cbg2ese(system_name, system_type, system_cr, ...
                     system_args, full_name, full_name_repetition, ...
                     1, structure, infofilenum);
makedef(structure,deffilenum);
  
EOF

cat $infofile

cat $1*ese.r - > $1_ese.tmp 2>> mtt_error.txt <<EOF
END;

Modified mttroot/mtt/bin/trans/m/makedef.m from [078d510b4f] to [00132f1a3a].

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
function makedef(structure,deffile);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$



% %% Revision 1.4  1996/08/30  19:42:36  peter
% %% Added newline at end of file.
% %%
% %% Revision 1.3  1996/08/24 15:06:22  peter
% %% Write `END;' at end to please reduce.
% %%
% %% Revision 1.2  1996/08/18 20:05:20  peter
% %% Put unded version control
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



filenum = fopen(deffile,'w');

states = structure(1);
nonstates=structure(2);
inputs=structure(3);
outputs=structure(4);
zero_outputs = structure(5);

pc = '%';
% Declare reduce constants;
fprintf(filenum, 'MTTNx := %1.0f;\n', states);
fprintf(filenum, 'MTTNz := %1.0f;\n', nonstates);
fprintf(filenum, 'MTTNu := %1.0f;\n', inputs);
fprintf(filenum, 'MTTNy := %1.0f;\n', outputs);
fprintf(filenum, 'MTTNyz := %1.0f;\n', zero_outputs);

% Declare reduce matrices
fprintf(filenum, '%s Declare reduce matrices\n', pc);
if states>0
  fprintf(filenum, 'matrix MTTx(%1.0f,1);\n', states);
  fprintf(filenum, 'matrix MTTdx(%1.0f,1);\n', states);
end;
if nonstates>0
  fprintf(filenum, 'matrix MTTz(%1.0f,1);\n', nonstates);
  fprintf(filenum, 'matrix MTTdz(%1.0f,1);\n', nonstates);
end;
if inputs>0
  fprintf(filenum, 'matrix MTTu(%1.0f,1);\n', inputs);
end;
if outputs>0
  fprintf(filenum, 'matrix MTTy(%1.0f,1);\n', outputs);
end;
if zero_outputs>0
  fprintf(filenum, 'matrix MTTyz(%1.0f,1);\n', zero_outputs);
  fprintf(filenum, 'matrix MTTui(%1.0f,1);\n', zero_outputs);
end;

% Make an Nx x Nx unit matrix
if states>0
  fprintf(filenum, 'matrix MTTI(%1.0f,%1.0f);\n', states,states);
  for i = 1:states
    fprintf(filenum, 'MTTI(%1.0f,%1.0f) := 1;\n', i, i);
  end
end;

% Make an Nx/2 x Nx/2 unit matrix
if states>1
  fprintf(filenum, 'matrix MTTIm(%1.0f,%1.0f);\n', states/2,states/2);
  for i = 1:states/2
    fprintf(filenum, 'MTTIM(%1.0f,%1.0f) := 1;\n', i, i);
  end
end;

% Set the y, yz, u, x and dx matrices
fprintf(filenum, '%s Set the y, yz, u and x matrices\n', pc);
for i=1:outputs
  fprintf(filenum, 'MTTy(%1.0f,1) := MTTy%1.0f;\n', i, i);
end;
for i=1:zero_outputs
  fprintf(filenum, 'MTTyz(%1.0f,1) := MTTyz%1.0f;\n', i, i);
  fprintf(filenum, 'MTTui(%1.0f,1) := MTTui%1.0f;\n', i, i);
end;
for i=1:inputs
  fprintf(filenum, 'MTTu(%1.0f,1) := MTTu%1.0f;\n', i, i);
end;
for i=1:states
  fprintf(filenum, 'MTTx(%1.0f,1) := MTTx%1.0f;\n', i, i);
end;
for i=1:nonstates
  fprintf(filenum, 'MTTdz(%1.0f,1) := MTTdz%1.0f;\n', i, i);
end;

fprintf(filenum, 'END;\n');
fclose(filenum);
  
|






>
>
>













<
<








|
|
|
|
|


|

|
|


|
|


|


|


|
|




|

|





|

|




|

|


|
|


|


|


|


|
<

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
function makedef(structure,deffilenum);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5  1996/11/09 21:05:44  peterg
% %% Only generates MTTIm when at least 2 states!
% %%
% %% Revision 1.4  1996/08/30  19:42:36  peter
% %% Added newline at end of file.
% %%
% %% Revision 1.3  1996/08/24 15:06:22  peter
% %% Write `END;' at end to please reduce.
% %%
% %% Revision 1.2  1996/08/18 20:05:20  peter
% %% Put unded version control
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





states = structure(1);
nonstates=structure(2);
inputs=structure(3);
outputs=structure(4);
zero_outputs = structure(5);

pc = '%';
% Declare reduce constants;
fprintf(deffilenum, 'MTTNx := %1.0f;\n', states);
fprintf(deffilenum, 'MTTNz := %1.0f;\n', nonstates);
fprintf(deffilenum, 'MTTNu := %1.0f;\n', inputs);
fprintf(deffilenum, 'MTTNy := %1.0f;\n', outputs);
fprintf(deffilenum, 'MTTNyz := %1.0f;\n', zero_outputs);

% Declare reduce matrices
fprintf(deffilenum, '%s Declare reduce matrices\n', pc);
if states>0
  fprintf(deffilenum, 'matrix MTTx(%1.0f,1);\n', states);
  fprintf(deffilenum, 'matrix MTTdx(%1.0f,1);\n', states);
end;
if nonstates>0
  fprintf(deffilenum, 'matrix MTTz(%1.0f,1);\n', nonstates);
  fprintf(deffilenum, 'matrix MTTdz(%1.0f,1);\n', nonstates);
end;
if inputs>0
  fprintf(deffilenum, 'matrix MTTu(%1.0f,1);\n', inputs);
end;
if outputs>0
  fprintf(deffilenum, 'matrix MTTy(%1.0f,1);\n', outputs);
end;
if zero_outputs>0
  fprintf(deffilenum, 'matrix MTTyz(%1.0f,1);\n', zero_outputs);
  fprintf(deffilenum, 'matrix MTTui(%1.0f,1);\n', zero_outputs);
end;

% Make an Nx x Nx unit matrix
if states>0
  fprintf(deffilenum, 'matrix MTTI(%1.0f,%1.0f);\n', states,states);
  for i = 1:states
    fprintf(deffilenum, 'MTTI(%1.0f,%1.0f) := 1;\n', i, i);
  end
end;

% Make an Nx/2 x Nx/2 unit matrix
if states>1
  fprintf(deffilenum, 'matrix MTTIm(%1.0f,%1.0f);\n', states/2,states/2);
  for i = 1:states/2
    fprintf(deffilenum, 'MTTIM(%1.0f,%1.0f) := 1;\n', i, i);
  end
end;

% Set the y, yz, u, x and dx matrices
fprintf(deffilenum, '%s Set the y, yz, u and x matrices\n', pc);
for i=1:outputs
  fprintf(deffilenum, 'MTTy(%1.0f,1) := MTTy%1.0f;\n', i, i);
end;
for i=1:zero_outputs
  fprintf(deffilenum, 'MTTyz(%1.0f,1) := MTTyz%1.0f;\n', i, i);
  fprintf(deffilenum, 'MTTui(%1.0f,1) := MTTui%1.0f;\n', i, i);
end;
for i=1:inputs
  fprintf(deffilenum, 'MTTu(%1.0f,1) := MTTu%1.0f;\n', i, i);
end;
for i=1:states
  fprintf(deffilenum, 'MTTx(%1.0f,1) := MTTx%1.0f;\n', i, i);
end;
for i=1:nonstates
  fprintf(deffilenum, 'MTTdz(%1.0f,1) := MTTdz%1.0f;\n', i, i);
end;

fprintf(deffilenum, 'END;\n');

  


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