Index: mttroot/mtt/bin/trans/m/abg2cbg.m ================================================================== --- mttroot/mtt/bin/trans/m/abg2cbg.m +++ mttroot/mtt/bin/trans/m/abg2cbg.m @@ -18,10 +18,13 @@ # ############################################################### # ## Version control history # ############################################################### # ## $Id$ # ## $Log$ +# ## Revision 1.44 1999/03/11 23:54:11 peterg +# ## Include possibility of vector SS when finding port_bond_index +# ## # ## Revision 1.43 1998/12/14 15:19:36 peterg # ## Added missing "derivative_causality," argument to recursive call of # ## this function # ## # ## Revision 1.42 1998/12/03 14:55:40 peterg @@ -180,10 +183,12 @@ # ## Revision 1.1 1996/08/04 17:55:55 peter # ## Initial revision # ## # ############################################################### + mtt_info(sprintf("\nCompleting causality for subsystem %s", system_name), infofile); + pc = '%'; if nargin<1 system_name = 'no_name'; end; @@ -279,19 +284,26 @@ if (n_ports>0)&&(!at_top_level) # Coerce directions for i=1:n_ports name = deblank(ABG.portlist(i,:)); # Name of this port eval(["port = ABG.ports.",name,";"]); # Extract port info +disp ("----"); +i +name +port +port_bond_direction +port.connections + if (sign(port.connections)!=port_bond_direction(i)) # Direction different? eval(["ABG.ports.",name,".connections = - port.connections;"]); # Flip direction at port Flipped.ports=[Flipped.ports;name]; # Remember which port has been flipped bond_index=abs(port.connections); # Index of bond on port mtt_info(sprintf("Flip port %s on %s"\ ,name,full_name),infofile); # And report for [subsystem,name] = ABG.subsystems # and at the other end for k=1:length(subsystem.connections) - if (abs(subsystem.connections(k))==bond_index) + if (abs(subsystem.connections(k))==bond_index) # Then flip the connection eval(["ABG.subsystems.",name,".connections(k) = -subsystem.connections(k);"]); Flipped.subs=[Flipped.subs;name]; # Remember which subsystem has been flipped Flipped.cons=[Flipped.cons;k]; # Remember which connection has been flipped mtt_info(sprintf("Flip subsystem %s on %s"\ ,name,full_name),infofile); # And report @@ -391,10 +403,11 @@ eval([ "[comp_bonds] = ", cause_name, "(comp_bonds);" ]); # Evaluate the built-in causality procedure comp_bonds = comp_bonds.*(port_bond_direction*[1 1]); # and convert from component orientated to arrow orientated causality end; +port_bond_direction,comp_bonds [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