Index: mttroot/mtt/bin/trans/m/cbg2fig.m ================================================================== --- mttroot/mtt/bin/trans/m/cbg2fig.m +++ mttroot/mtt/bin/trans/m/cbg2fig.m @@ -11,20 +11,24 @@ ## Matlab function cbg_m2fig Causal bond graph: mfile format to fig ## file format The resultant fig file is the original _abg.fig with ## additional causal strokes superimposed. cbg2fig(system_name, ... ## system_type, full_name, ... stroke_length, stroke_thickness, ## stroke_colour, ... comp_font, comp_colour_u, comp_colour_o) - + ## Note this uses geometric info from _rbg.fig - so don't use with + ## -abg switch. ## P.J.Gawthrop May 1996 ## Copyright (c) P.J.Gawthrop, 1996. ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## %% Version control history ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## %% $Id$ ## %% $Log$ + ## %% Revision 1.14 2000/09/14 12:07:15 peterg + ## %% Fixed overwriting of ports. + ## %% ## %% Revision 1.13 2000/09/14 09:12:19 peterg ## %% Fixed stroke orientation bug with bent bonds ## %% Uses new info from the _rbg.m file - 4 new cols in rbonds ## %% ## %% Revision 1.12 2000/09/14 08:07:00 peterg @@ -118,11 +122,11 @@ ## Setup file - append to the fig file filenum = fopen(fig_name, 'a'); ## Get the raw and the processed bonds - eval(['[rbonds,rstrokes,rcomponents] = ', system_type, '_rbg;']); + eval(['[rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = ', system_type, '_rbg;']); eval(["ABG = ", system_type, "_abg;"]); bonds=ABG.bonds; ## Original number of bonds [n_bonds,junk] = size(rbonds); @@ -136,12 +140,15 @@ [Rows,Columns] = size(rcomponents); if (Columns ~= 13) error('Incorrect rcomponents matrix: must have 13 columns'); end; M_components = Columns; + N_rcomponents = Rows; # Number of raw components - [N_components, Columns] = size(CBG.subsystemlist); + [N_rports,junk] = size(port_list); + [N_components, Columns] = size(CBG.subsystemlist); # Number of derived + # components if struct_contains(CBG,'portlist') [N_ports, Columns] = size(CBG.portlist); else N_ports = 0; @@ -237,20 +244,22 @@ stroke_end_2(1), stroke_end_2(2) ); end; end; ## Print all the components - coloured acording to causality. - for i = 1+N_ports:N_ports+N_components + ## Miss out the ports + + for i = N_rports+1:N_rcomponents if i>N_ports # Subsystem comp_name = CBG.subsystemlist(i-N_ports,:); eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]); else comp_name = CBG.portlist(i,:); eval(["comp_status = CBG.ports.", comp_name, ".status;"]); end - + i,comp_name,N_rcomponents,N_rports fig_params = rcomponents(i,3:M_components); coords = rcomponents(i,1:2); if comp_status==-1 # Then under causal fig_params(3) = comp_colour_u;