Differences From Artifact [52c4f8c2fd]:

To Artifact [0176f779b9]:


13
14
15
16
17
18
19



20
21
22
23
24
25
26
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

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



% %% Revision 1.14  1996/12/31 16:20:42  peterg
% %% Just write causality information at top level -- it gets a bit
% %% voluminous if written at deeper levels.
% %%
% %% Revision 1.13  1996/12/31 11:49:09  peterg
% %% Don't copy port bond causality if already set -- allows subsystem
% %% causality to be preset directely on named SS.







>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.15  1997/01/05 12:25:59  peterg
% %% More informative message about port bonds incompatible with  ports
% %%
% %% Revision 1.14  1996/12/31 16:20:42  peterg
% %% Just write causality information at top level -- it gets a bit
% %% voluminous if written at deeper levels.
% %%
% %% Revision 1.13  1996/12/31 11:49:09  peterg
% %% Don't copy port bond causality if already set -- allows subsystem
% %% causality to be preset directely on named SS.
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
213
214



215
216

217


218

219
220
221
222
223
224
225
226
227
228
229
230
      if status(i) ~= 0 % only do this if causality not yet complete
	
	% Get the bonds on this component
	comp = nozeros(components(i,:));
	bond_list = abs(comp);
	direction = sign(comp)'*[1 1];

	% Convert from arrow orientated to component orientated causality
	comp_bonds = bonds(bond_list,:).*direction;
	
	% Get the component details
	eval([ '[comp_type,name,cr,arg] = ', system_type, '_cmp(i);' ]);

	% Change name of 0 and 1 components -- matlab doesn't like numbers here
	if strcmp(comp_type,'0')
	  comp_type = 'zero';
	end;
	if strcmp(comp_type,'1')
	  comp_type = 'one';
	end;
      
	% Component causality procedure name
	cause_name = [comp_type, '_cause'];
      



      % Invoke  the appropriate causality procedure
      if exist(cause_name)~=2 % Try a compound component
	[comp_bonds,s] = abg2cbg(name, comp_type, full_name, comp_bonds, ...
	    typefile, infofile);
	
	% Create a single status from the status vector s
	if max(abs(s)) == 0 % Causal
	  status(i) = 0;
	else
	  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



	disp(['---', name, ' (', cause_name, ') ---']);
	% comp_bonds

	eval([ '[comp_bonds,status(i)] = ', cause_name, '(comp_bonds);' ]);


	% comp_bonds

      end;
      
      % Update the full bonds list
      % and convert from component orientated to arrow orientated causality
      bonds(bond_list,:) = comp_bonds.*direction; 
    end;
    end;
    
    done = sum(sum(abs(bonds)))/total*100;
    %  mtt_info(sprintf('Causality is %3.0f%s complete.', done, pc), infofile);
    
  end;







<
<
<













|
>
>
>

















>
>
>

<
>

>
>
|
>



<
|







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
213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
238
      if status(i) ~= 0 % only do this if causality not yet complete
	
	% Get the bonds on this component
	comp = nozeros(components(i,:));
	bond_list = abs(comp);
	direction = sign(comp)'*[1 1];




	% Get the component details
	eval([ '[comp_type,name,cr,arg] = ', system_type, '_cmp(i);' ]);

	% Change name of 0 and 1 components -- matlab doesn't like numbers here
	if strcmp(comp_type,'0')
	  comp_type = 'zero';
	end;
	if strcmp(comp_type,'1')
	  comp_type = 'one';
	end;
      
	% Component causality procedure name
	cause_name = [comp_type, '_cause'];
	
        % Bonds on this component (arrow-orientated)
      	comp_bonds = bonds(bond_list,:);

      % Invoke  the appropriate causality procedure
      if exist(cause_name)~=2 % Try a compound component
	[comp_bonds,s] = abg2cbg(name, comp_type, full_name, comp_bonds, ...
	    typefile, infofile);
	
	% Create a single status from the status vector s
	if max(abs(s)) == 0 % Causal
	  status(i) = 0;
	else
	  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
	% Convert from arrow orientated to component orientated causality
	comp_bonds = comp_bonds.*direction;
	
	disp(['---', name, ' (', cause_name, ') ---']);

        % Evaluate the built-in causality procedure
	eval([ '[comp_bonds,status(i)] = ', cause_name, '(comp_bonds);' ]);

       % and convert from component orientated to arrow orientated causality
       comp_bonds = comp_bonds.*direction; 

      end;
      
      % Update the full bonds list

      bonds(bond_list,:) = comp_bonds; 
    end;
    end;
    
    done = sum(sum(abs(bonds)))/total*100;
    %  mtt_info(sprintf('Causality is %3.0f%s complete.', done, pc), infofile);
    
  end;

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