Index: mttroot/mtt/bin/trans/m/abg2cbg.m ================================================================== --- mttroot/mtt/bin/trans/m/abg2cbg.m +++ mttroot/mtt/bin/trans/m/abg2cbg.m @@ -17,10 +17,14 @@ # ############################################################### # ## Version control history # ############################################################### # ## $Id$ # ## $Log$ +# ## Revision 1.41 1998/11/20 10:52:28 peterg +# ## Copies port bonds if the port bonds ARE set +# ## -- replaces Copies port bonds if the component bonds are NOT set +# ## # ## Revision 1.40 1998/09/02 11:47:09 peterg # ## Now uses explicit ordered list of ports instead of port.index. # ## Note that subsystems are still treated in arbitrary order. # ## # ## Revision 1.39 1998/08/25 20:06:16 peterg @@ -308,31 +312,38 @@ # Causality indicator total = 2*n_bonds; done = sum(sum(abs(ABG.bonds)))/total*100; - fields=["ports";"subsystems"]; # Do for both ports and subsystems - # ports first for i=1:2 field=deblank(fields(i,:)); if struct_contains(ABG,field); eval(["ABG_field = ABG.",field, ";"]); -field,ABG_field + field,ABG_field + + sum_ok = 0; n_comp = 0; + for [subsystem,name] = ABG_field# Find % status = 0 (causally complete) + eval(["ok = (ABG_field.",name,".status==0);"]); + sum_ok = sum_ok + ok; n_comp ++; + endfor; + Done = sum_ok/n_comp*100 # Outer while loop sets preferred causality ci_index=1; - for [subsystem,name] = ABG_field# Set new status field to -1 - eval(["ABG_field.",name,".status=-1;"]); - endfor; +# for [subsystem,name] = ABG_field# Set new status field to -1 +# eval(["ABG_field.",name,".status=-1;"]); +# endfor; while( ci_index>0) old_done = inf; + old_Done = inf; - while done!=old_done # Inner loop propagates causality - old_done = done; + while Done!=old_Done # Inner loop propagates causality + old_Done = Done; for [subsystem,name] = ABG_field name,subsystem if subsystem.status != 0 # only do this if causality not yet complete comp = subsystem.connections; # Get the bonds on this component bond_list = abs(comp); @@ -401,11 +412,18 @@ ABG.bonds(bond_list,:) = comp_bonds;# Update the full bonds list eval(["ABG_field.",name,".status = subsystem.status;"]); end; end; - + + sum_ok = 0; n_comp = 0; + for [subsystem,name] = ABG_field# Find % status = 0 (causally complete) + eval(["ok = (ABG_field.",name,".status==0);"]); + sum_ok = sum_ok + ok; n_comp ++; + endfor; + + Done = sum_ok/n_comp*100 done = sum(sum(abs(ABG.bonds)))/total*100 #disp(sprintf("Causality is #3.0f#s complete.", done, pc), infofile)); endwhile # done!=old_done @@ -431,13 +449,13 @@ # Print final causality # 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, done, pc), infofile); + full_name, Done, pc), infofile); - if done<100 + if Done<100 mtt_error(sprintf("Unable to complete causality"),errorfile); end; endif # at_top_level