Differences From Artifact [3eb92ef302]:

To Artifact [49372aa275]:


23
24
25
26
27
28
29




30
31
32
33
34
35
36

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




% %% Revision 1.12  1997/08/26 07:51:30  peterg
% %% Now counts the local input and outputs by order of appearence rather
% %% than by port number - it therfore handles ports with bicausality correctely.
% %%
% %% Revision 1.11  1997/05/09 08:21:07  peterg
% %% Explicit computation of port number -- avoids str2num
% %%







>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

			
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.13  1997/09/18 13:15:15  peterg
% %% Fixed incorrect error message flagging inappropriate flow outputs
% %% -- used to give the effort rather than the flow in the error message.
% %%
% %% Revision 1.12  1997/08/26 07:51:30  peterg
% %% Now counts the local input and outputs by order of appearence rather
% %% than by port number - it therfore handles ports with bicausality correctely.
% %%
% %% Revision 1.11  1997/05/09 08:21:07  peterg
% %% Explicit computation of port number -- avoids str2num
% %%
91
92
93
94
95
96
97

98
99
100
101
102
103
104
  flow_attribute = 'external';
end;


inputs = structure(3);
outputs = structure(4);
zero_outputs = structure(5);


if strcmp(effort_attribute, 'MTT_port') % Its a named port

% Note: we don't have numbered ports now, so the correct indices are deduced
% by incrementing the two globals: local_u_index and local_y_index
% $$$   % Convert string to number
% $$$   % port_number = abs(flow_attribute)-abs('0');







>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  flow_attribute = 'external';
end;


inputs = structure(3);
outputs = structure(4);
zero_outputs = structure(5);
unknown_inputs = structure(6);

if strcmp(effort_attribute, 'MTT_port') % Its a named port

% Note: we don't have numbered ports now, so the correct indices are deduced
% by incrementing the two globals: local_u_index and local_y_index
% $$$   % Convert string to number
% $$$   % port_number = abs(flow_attribute)-abs('0');
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
190
191
192
193

194
195
196
197
198
199
200
201


% Now do SS which are not ports.
% Effort
if strcmp(effort_attribute, 'external')
  if bonds(1,1)==-1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%d,1);\n', ...
        varname(name, bond_number,1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%d,1) := %s;\n', ...
        outputs, varname(name, bond_number,1));
  end;
elseif strcmp(effort_attribute, 'internal')
  % Do nothing
else % named constant
  if bonds(1,1)==-1 % Source




    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,1), effort_attribute);

  else % Sensor
    if strcmp(effort_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,1));
      fprintf(filenum, '%s := MTTUi%d;\n', ...
	  varname(name, bond_number,-1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output '],STDerr);
    end;
  end;
end;

% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%d,1);\n', varname(name, bond_number,-1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%d,1) := %s;\n', outputs, ...
        varname(name, bond_number,-1));
  end;




elseif strcmp(flow_attribute, 'internal')
  % Do nothing
else % Named constant
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,-1), flow_attribute);
  else % Sensor
    if strcmp(flow_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,-1));
      fprintf(filenum, '%s := MTTUi%d;\n', ...
	  varname(name, bond_number,1), zero_outputs);
    else
      mtt_info([flow_attribute, ' not appropriate for an output '], STDerr);

    end;
  end;
end;


structure(3) = inputs;
structure(4) = outputs;
structure(5) = zero_outputs;








|



|



|
|
>
>
>
>
|
|
>





<
<





|








|

>
>
>
>











<
<

|
>




<



>
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
190
191
192
193
194
195
196
197
198
199
200
201


202
203
204
205
206
207
208

209
210
211
212

% Now do SS which are not ports.
% Effort
if strcmp(effort_attribute, 'external')
  if bonds(1,1)==-1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%d,1);\n', ...
	varname(name, bond_number,1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%d,1) := %s;\n', ...
	outputs, varname(name, bond_number,1));
  end;
elseif strcmp(effort_attribute, 'internal')
  % Do nothing
else 
  if bonds(1,1)==-1 % Named or unknown source
    if strcmp(effort_attribute, 'unknown') % Unknown input
      fprintf(filenum, '%s := MTTUi%d;\n', ...
	  varname(name, bond_number,-1), zero_outputs);
    else
      fprintf(filenum, '%s := %s;\n', ...
	  varname(name, bond_number,1), effort_attribute);
    end;
  else % Sensor
    if strcmp(effort_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,1));


    else
      mtt_info([effort_attribute, ' not appropriate for an output '],STDerr);
    end;
  end;
end;
  
% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%d,1);\n', varname(name, bond_number,-1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%d,1) := %s;\n', outputs, ...
	varname(name, bond_number,-1));
  end;
elseif strcmp(flow_attribute, 'unknown') % Unknown input
  unknown_inputs = unknown_inputs + 1;
  fprintf(filenum, '%s := MTTUi%d;\n', ...
      varname(name, bond_number,-1), unknown_inputs);
elseif strcmp(flow_attribute, 'internal')
  % Do nothing
else % Named constant
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,-1), flow_attribute);
  else % Sensor
    if strcmp(flow_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,-1));


    else
      mtt_info([flow_attribute, ' not appropriate for an output '], ...
	  STDerr);
    end;
  end;
end;


structure(3) = inputs;
structure(4) = outputs;
structure(5) = zero_outputs;
structure(6) = unknown_inputs;

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