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
|
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
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
|
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
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## %% Version control history
## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
## %% $Id$
## %% $Log$
## %% Revision 1.6 1996/12/07 18:21:57 peterg
## %% Now uses fopen + file number
## %%
## %% 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);
states = structure(1);
nonstates=structure(2);
inputs=structure(3);
outputs=structure(4);
zero_outputs = structure(5);
internal_inputs = structure(6);
connecting_inputs = structure(7);
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);
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);
fprintf(deffilenum, 'MTTNui := %1.0f;\n', internal_inputs);
fprintf(deffilenum, 'MTTNuc := %1.0f;\n', connecting_inputs);
% 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;
## 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);
endif
if nonstates>0
fprintf(deffilenum, 'matrix MTTz(%1.0f,1);\n', nonstates);
fprintf(deffilenum, 'matrix MTTdz(%1.0f,1);\n', nonstates);
endif
if inputs>0
fprintf(deffilenum, 'matrix MTTu(%1.0f,1);\n', inputs);
fprintf(deffilenum, 'matrix MTTdu(%1.0f,1);\n', inputs);
endif
if outputs>0
fprintf(deffilenum, 'matrix MTTy(%1.0f,1);\n', outputs);
endif
if zero_outputs>0
fprintf(deffilenum, 'matrix MTTyz(%1.0f,1);\n', zero_outputs);
fprintf(deffilenum, 'matrix MTTui(%1.0f,1);\n', zero_outputs);
endif
if internal_inputs>0
fprintf(deffilenum, 'matrix MTTui(%1.0f,1);\n', inputs);
endif
if connecting_inputs>0
fprintf(deffilenum, 'matrix MTTuc(%1.0f,1);\n', connecting_inputs);
endif
% 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 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
endif
% 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;
## 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
endif
% 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;
## Set the y, yz, du, 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);
endfor
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);
endfor
for i=1:inputs
fprintf(deffilenum, 'MTTu(%1.0f,1) := MTTu%1.0f;\n', i, i);
endfor
for i=1:inputs
fprintf(deffilenum, 'MTTdu(%1.0f,1) := MTTdu%1.0f;\n', i, i);
endfor
for i=1:states
fprintf(deffilenum, 'MTTx(%1.0f,1) := MTTx%1.0f;\n', i, i);
endfor
for i=1:nonstates
fprintf(deffilenum, 'MTTdz(%1.0f,1) := MTTdz%1.0f;\n', i, i);
endfor
endfunction
fprintf(deffilenum, 'END;\n');
|