Differences From Artifact [05dc51143e]:

To Artifact [bcdc587034]:


15
16
17
18
19
20
21



22
23
24
25
26
27
28
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.31  1998/07/28 13:15:10  peterg
% %% Vector SS ports included.
% %%
% %% Revision 1.30  1998/07/27 20:29:49  peterg
% %% Had another go at causality ....
% %%   1. Impose external causality onto all port bonds
% %%   2. Set C_cause.m so that it DOESN'T set causality
% %%       -- I_cause is already ok !
% %%
% %% Revision 1.29  1998/07/10 09:01:42  peterg
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
217
218
219
220
221
222
223

224
225
226
227
228
229
230
231







-
+







    % Is the direction different?
    if (sign(components(i,1))~=port_bond_direction(i))
      mtt_info(sprintf("Flip port %i",i),infofile);
      % Flip direction at port
      components(i,1) = - components(i,1);
      % and at the other end
      for j=n_ports+1:n_components
	for k=1:columns
	for k=1:m_components
	  if (abs(components(j,k))==port_bond_index(i))
	    components(j,k) = - components(j,k);
	  end
	end
      end;
      % Flip the bond causalities (these are arrow-orientated)
      bonds(port_bond_index(i),:) = -bonds(port_bond_index(i),:);
383
384
385
386
387
388
389


390
391
392
393
394
395
396
397
398
386
387
388
389
390
391
392
393
394
395

396
397
398
399
400
401
402







+
+

-







    ci_direction = sign(ci_bond_index);
    ci_bond_index = abs(ci_bond_index);
    bonds(ci_bond_index,1:2) = prefered*ci_direction'*[1 1];
  end;
  
end;

status(1:n_ports) = zeros(n_ports,1); # Port status not relevant

% Print final causality
status
final_done =  (sum(status==zeros(n_components,1))/n_components)*100;

if at_top_level
  mtt_info(sprintf('Final causality of %s is %3.0f%s complete.', ...
      full_name, final_done, pc), infofile);

  if final_done<100
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
430
431
432
433
434
435
436

437
438
439
440
441
442
443







-







cbgfilenum = fopen(file_name,'w');
write_cbg(cbgfilenum,full_name,system_type,bonds,status,components);
fclose(cbgfilenum);

% Return the port bonds - arrow orientated causality - and the direction 
if ~at_top_level % Not at top level
  port_bonds = bonds(port_bond_index,:) # Return port bonds
  status(1:n_ports) = zeros(1:n_ports); # Port status not relevant
end;

disp('====================================');
disp(['END: ', full_name, ' (', fun_name, ')']);
disp('====================================');



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