Differences From Artifact [3e4a5831fd]:

To Artifact [437f2f0d2d]:


12
13
14
15
16
17
18




19
20
21
22
23
24
25
% Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

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




% %% Revision 1.8  1996/08/30  16:36:08  peter
% %% More info written to ese files.
% %%
% %% Revision 1.7  1996/08/30 11:23:13  peter
% %% Argument substitution implemented.
% %%
% %% Revision 1.6  1996/08/27  08:04:52  peterg







>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.9  1996/12/04 21:49:47  peterg
% %% Compares full-name with empty string (instead of testing for zero
% %% length)
% %%
% %% Revision 1.8  1996/08/30  16:36:08  peter
% %% More info written to ese files.
% %%
% %% Revision 1.7  1996/08/30 11:23:13  peter
% %% Argument substitution implemented.
% %%
% %% Revision 1.6  1996/08/27  08:04:52  peterg
48
49
50
51
52
53
54



55
56
57
58
59
60
61
62
63
if nargin<3
  eqnfile = 'stdout';
end;
if nargin<4
  infofile = 'stdout';
end;




% Create the (full) system name
if strcmp(full_name,'')
  full_name = system_name;
  full_name_repetition = system_name;
  system_type = system_name;
else
  full_name = [full_name, '_', system_name];
  full_name_repetition = [full_name_repetition, ...
	'_', system_name, '_', num2str(repetition)];







>
>
>

|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
if nargin<3
  eqnfile = 'stdout';
end;
if nargin<4
  infofile = 'stdout';
end;

% Are we at the top level of the heirarchy?
at_top_level = strcmp(full_name, '');

% Create the (full) system name
if at_top_level
  full_name = system_name;
  full_name_repetition = system_name;
  system_type = system_name;
else
  full_name = [full_name, '_', system_name];
  full_name_repetition = [full_name_repetition, ...
	'_', system_name, '_', num2str(repetition)];
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
	    full_name, full_name_repetition, ...
	    k, structure,  infofile);
	
	% Link up the bonds
	fprintf(filenum, ...
	    '\n\t%s Equations linking up subsystem %s (%s)\n\n', ...
	    pc, comp_name, comp_type);
	% $$$ 	name_comp_name = sprintf('%s_%s_%1.0f', ...
	% $$$ 	    full_name_repetition, comp_name, k);
	name_comp_name = sprintf('%s_%s_%1.0f', ...
	    full_name_repetition, comp_name, k);
	
	for port_number=1:length(bond_list)
	  % Effort
	  if comp_bonds(port_number,1)==1 % Source
	     fprintf(filenum, '%s_MTTu%1.0f := %s;\n', ...







<
<







176
177
178
179
180
181
182


183
184
185
186
187
188
189
	    full_name, full_name_repetition, ...
	    k, structure,  infofile);
	
	% Link up the bonds
	fprintf(filenum, ...
	    '\n\t%s Equations linking up subsystem %s (%s)\n\n', ...
	    pc, comp_name, comp_type);


	name_comp_name = sprintf('%s_%s_%1.0f', ...
	    full_name_repetition, comp_name, k);
	
	for port_number=1:length(bond_list)
	  % Effort
	  if comp_bonds(port_number,1)==1 % Source
	     fprintf(filenum, '%s_MTTu%1.0f := %s;\n', ...
202
203
204
205
206
207
208












209
210
211
212
213
214
215
216
	 end;
	
	disp('---POP---');
      else % its a simple component
	fprintf(filenum, '\n\t%s Equations for component %s (%s), repetition %1.0f\n\n', ...
	    pc, comp_name, comp_type,k);
	












	eval(['structure = ', ...
	      eqn_name, ...
	      '(name_r,bond_list,comp_bonds,direction,cr,args,structure,filenum);' ]);
      end;
    end;
  end;

  fclose(filenum);







>
>
>
>
>
>
>
>
>
>
>
>
|







207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
	 end;
	
	disp('---POP---');
      else % its a simple component
	fprintf(filenum, '\n\t%s Equations for component %s (%s), repetition %1.0f\n\n', ...
	    pc, comp_name, comp_type,k);
	
% Take port SS to be ordinary SS at top level
if at_top_level & strcmp(comp_type, 'SS') 
  effort_attribute = cr;
  flow_attribute = args;
  if strcmp(effort_attribute, 'MTT_port') % Its a numbered port
    effort_attribute = 'external';
    flow_attribute = 'external';
    cr = effort_attribute;
    args = flow_attribute;
  end;
end;

eval(['structure = ', ...
	      eqn_name, ...
	      '(name_r,bond_list,comp_bonds,direction,cr,args,structure,filenum);' ]);
      end;
    end;
  end;

  fclose(filenum);

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