Differences From Artifact [6933fd7ec1]:

To Artifact [e65d13a9be]:


1
2
3
4

5
6
7
8
9
10
11
1
2
3

4
5
6
7
8
9
10
11



-
+







function structure = cbg2ese(system_name, system_type, system_cr, ...
    system_args, full_name, full_name_repetition, ...
    repetition,...
    structure, structure_file, infofile)
    structure, structure_file,infofilenum)
% Set up globals to count the component inputs and outputs. This relies on
% the named SS (the ports) being in the correct order. Using globals here
% avoids changing the common argument list for all _eqn files for something
% which is only used for named SS components.
global local_u_index
global local_y_index
global at_top_level
19
20
21
22
23
24
25




26
27
28
29
30
31
32
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36







+
+
+
+







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

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.22  1998/07/04 07:10:27  peterg
% %% Don't evaluate alias if no constitutive relationship or args and write
% %% message.
% %%
% %% Revision 1.21  1998/07/03 18:58:58  peterg
% %% Put arg alias stuff within function alias_args
% %% Called recursively to handle arithmetic expressions
% %%
% %% Revision 1.20  1998/07/03 14:39:09  peterg
% %% Added info messages a bit busy now!
% %%
162
163
164
165
166
167
168
169

170
171
172
173
174
175
176

177
178
179
180
181
182
183
166
167
168
169
170
171
172

173
174
175
176
177
178
179

180
181
182
183
184
185
186
187







-
+






-
+







  % Set up the counters for the labelled SS. These are, by definition,
  % encountered first and so the counters will not be messed up by subsystems.
  local_u_index = 0;
  local_y_index = 0;

  if (length(system_args)==0)
    mtt_info(sprintf("No arguments given so no argument aliasing done for system %s(%s)",\
     system_name,system_type),infofile);
     system_name,system_type), infofilenum);
  else
    eval([ "alias = ", alias_name ";"]);
  end;

  if (length(system_cr)==0)
    mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)",\
     system_name,system_type),infofile);
     system_name,system_type), infofilenum);
  else
    eval([ "alias = ", alias_name ";"]);
  end;
  
  for i = 1:n_components
    comp = nozeros(components(i,:));
    bond_list = abs(comp);
217
218
219
220
221
222
223
224

225
226
227
228
229
230
231
221
222
223
224
225
226
227

228
229
230
231
232
233
234
235







-
+







    
    ports = length(bond_list);
    
    if repetitions>1
      port_pairs = ports/2;
      if round(port_pairs)~=port_pairs;
	mtt_info(['Repeated component ', comp_name, ...
	      ' has an odd number of ports - ignoring repetitions']);
	      ' has an odd number of ports - ignoring repetitions'], infofilenum);
	repetitions = 1;
      end;
    end;
    
    if repetitions>1
      odd_bonds = bond_list(1:2:ports-1);
      even_bonds = bond_list(2:2:ports);
255
256
257
258
259
260
261
262

263
264
265
266
267
268
269
259
260
261
262
263
264
265

266
267
268
269
270
271
272
273







-
+







      name_r = full_name_repetition;
      eqn_name = [comp_type, '_eqn']
      
      if exist(eqn_name)~=2 % Try a compound component
	disp('---PUSH---');
	structure = cbg2ese(comp_name, comp_type, cr, args, ...
	    full_name, full_name_repetition, ...
	    k, structure,  structure_file, infofile);
	    k, structure,  structure_file, infofilenum);
	
	% Link up the bonds
	fprintf(ese_file, ...
	    '\n\t%s Equations linking up subsystem %s (%s)\n\n', ...
	    pc, comp_name, comp_type);
	name_comp_name = sprintf('%s_%s_%d', ...
	    full_name_repetition, comp_name, k);

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