Index: mttroot/mtt/bin/trans/m/abg2cbg.m ================================================================== --- mttroot/mtt/bin/trans/m/abg2cbg.m +++ mttroot/mtt/bin/trans/m/abg2cbg.m @@ -1,9 +1,10 @@ function [port_bonds, status] = abg2cbg(system_name, system_type, full_name, port_bonds, port_bond_direction, port_status, + derivative_causality, typefile, infofile, errorfile) # abg2cbg - acausal to causal bg conversion # # ###################################### @@ -17,10 +18,15 @@ # ############################################################### # ## Version control history # ############################################################### # ## $Id$ # ## $Log$ +# ## Revision 1.42 1998/12/03 14:55:40 peterg +# ## Now uses number of components with complete causality to measure +# ## progress of algorithm -- Done. +# ## This replaces bond count -- done. +# ## # ## 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 @@ -380,10 +386,11 @@ comp_bonds = comp_bonds.*(port_bond_direction*[1 1]); # and convert from component orientated to arrow orientated causality end; [comp_bonds,subsystem.status] = abg2cbg(name, subsystem.type, full_name, comp_bonds, port_bond_direction, port_status, ... + derivative_causality, ... typefile, infofile, errorfile); # # Create a single status from the status vector s # if max(abs(s)) == 0 # Causal # status(i) = 0; # else @@ -432,11 +439,14 @@ ci_index=0; else disp("Set causality of a C or I which is not already set") eval(["ci_bond_index = ABG.",field,".",name,".connections;"]); # Get bonds ci_direction = sign(ci_bond_index); - ci_bond_index = abs(ci_bond_index) + ci_bond_index = abs(ci_bond_index); + if derivative_causality + prefered = -prefered; + end; ABG.bonds(ci_bond_index,1:2) = prefered*ci_direction'*[1 1] eval(["ABG.subsystems.",name,".status=0"]); #set status of the C or I endif endwhile # ( ci_index>0) eval(["ABG.",field," = ABG_field;"]); # Copy back to actual structure