Differences From Artifact [5a6470c9cc]:

To Artifact [e2573b8bd0]:


13
14
15
16
17
18
19





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







+
+
+
+
+







% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.23  1998/04/04 10:46:37  peterg
% %% Coerces port bonds to have smae direction as the imposing bonds
% %% _cbg now generates the (coerced) components as welll as the (coerced)
% %% causality.
% %%
% %% Revision 1.22  1997/08/19 10:21:09  peterg
% %% Only copy port cuaslity info if not already set within the
% %% subsystem. I thought I'd done this already ....
% %%
% %% Revision 1.21  1997/08/18 16:25:25  peterg
% %% Minor bug fixes
% %%
163
164
165
166
167
168
169
170
171


172
173
174
175
176
177
178
168
169
170
171
172
173
174


175
176
177
178
179
180
181
182
183







-
-
+
+







if n_components==0 % there is nothing to be done
  return
end;

port_bond_direction

% Coerce the port (SS:[]) component bonds to have the same direction as
% of the bonds in the encapsulating system 
if n_ports>0
% of the bonds in the encapsulating system -- but not at top level
if (n_ports>0)&&(~at_top_level)
  port_bond_index = abs(components(1:n_ports,1)) % relevant bond numbers
  for i=1:n_ports
    % Is the direction different?
    if (sign(components(i,1))~=port_bond_direction(i))
      disp(sprintf("Flip port %i",i));
      % Flip direction at port
      components(i,1) = - components(i,1);
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
262
263
264
265
266
267
268




269
270
271
272
273
274
275







-
-
-
-







      
	% Component causality procedure name
	cause_name = [comp_type, '_cause'];
	
        % Bonds on this component (arrow-orientated) -- these become the
        % port bonds on the ith component of this subsystem.
	
	% a bug in octave 1.92 (??) prevents this from working -- replace by
	% a loop -- but check on V2.0
      	% comp_bonds = bonds(bond_list,:)
	
	comp_bonds=[];
	for kk = 1:n_bonds
	  comp_bonds(kk,:) = bonds(bond_list(kk),:);
	end;
	

      % Invoke  the appropriate causality procedure
290
291
292
293
294
295
296
297

298
299
300
301
302
303
304
291
292
293
294
295
296
297

298
299
300
301
302
303
304
305







-
+







	  if max(s) == 1 % At least one component is overcausal
	    status(i) = 1;
	  else           % no component is overcausal but some are undercausal
	    status(i) = -1;
	  end;
	end;

      else % its a simple component
      else % its a simple component -- or explicit causality defined
	disp(['---', name, ' (', cause_name, ') ---']);
	comp_bonds_in = comp_bonds

	% Convert from arrow orientated to component orientated causality
	comp_bonds = comp_bonds.*direction;
	
        % Evaluate the built-in causality procedure

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