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.53 2009/11/02 16:54:03 geraint + ## ## Replaced deprecated functions from Octave 2.1 for Octave 3.0: is_struct -> isstruct, struct_contains -> isfield, struct_elements -> fieldnames, is_complex -> iscomplex, setstr -> char + ## ## ## ## Revision 1.52 2004/09/07 18:22:53 geraint ## ## Issues a more helpful error message than the cryptic Octave stuff ## ## if there are unconnected ports. ## ## ## ## Revision 1.51 2004/02/20 20:42:40 geraint @@ -324,19 +327,19 @@ end 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"\ + 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) # 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"\ + mtt_info(sprintf("Flip subsystem %s on %s" ... ,name,full_name),infofile); # And report endif endfor endfor # subsystem = ABG.subsystems Index: mttroot/mtt/bin/trans/m/alias_args.m ================================================================== --- mttroot/mtt/bin/trans/m/alias_args.m +++ mttroot/mtt/bin/trans/m/alias_args.m @@ -3,10 +3,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.10 2012/10/15 19:16:03 geraint +## split is obsolete in Octave, replaced with strsplit +## ## Revision 1.9 2009/11/02 16:54:03 geraint ## Replaced deprecated functions from Octave 2.1 for Octave 3.0: is_struct -> isstruct, struct_contains -> isfield, struct_elements -> fieldnames, is_complex -> iscomplex, setstr -> char ## ## Revision 1.8 2001/06/13 16:07:15 gawthrop ## Fixed bug with three separators in a row eg )/( @@ -45,11 +48,11 @@ for i=1:N arg = deblank(Args(i,:)); arg_ = strrep(arg,",","__"); if isfield(alias,arg_) eval(["new_arg = alias.", arg_,";"]); - mtt_info(["Replacing ", arg, "\t by ",\ + mtt_info(["Replacing ", arg, "\t by ", ... new_arg, message],FileID); mtt_save_alias(arg,sys_name); ## printf("%s --> %s\n",arg,new_arg); arg = new_arg; ## else Index: mttroot/mtt/bin/trans/m/cbg2ese.m ================================================================== --- mttroot/mtt/bin/trans/m/cbg2ese.m +++ mttroot/mtt/bin/trans/m/cbg2ese.m @@ -21,10 +21,13 @@ ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ + ## ## Revision 1.54 2009/11/02 16:54:03 geraint + ## ## Replaced deprecated functions from Octave 2.1 for Octave 3.0: is_struct -> isstruct, struct_contains -> isfield, struct_elements -> fieldnames, is_complex -> iscomplex, setstr -> char + ## ## ## ## Revision 1.53 2005/03/21 11:09:47 gawthrop ## ## Now handles bicausal SS component - ## ## ie source-source or sensor-sensor ## ## ## ## Revision 1.52 2004/09/12 22:27:27 geraint @@ -228,15 +231,15 @@ system_type = system_name; else full_name = [full_name, sub_delim, system_name]; if (repetition>1) - full_name_repetition = [full_name_repetition, \ - sub_delim, system_name, sub_delim, \ + full_name_repetition = [full_name_repetition, ... + sub_delim, system_name, sub_delim, ... num2str(repetition)]; else - full_name_repetition = [full_name_repetition, \ + full_name_repetition = [full_name_repetition, ... sub_delim, system_name]; endif end; @@ -291,19 +294,19 @@ ## encountered first and so the counters will not be messed up by subsystems. local_u_index = 0; local_y_index = 0; if (length(system_args)==0) - mtt_info(sprintf("No arguments given so no argument aliasing done for system %s(%s)",\ + mtt_info(sprintf("No arguments given so no argument aliasing done for system %s(%s)", ... system_name,system_type), infofilenum); AliasingArguments=0; else AliasingArguments=1; endif; if (length(system_cr)==0) - mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)",\ + mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)", ... system_name,system_type), infofilenum); AliasingCRs=0; else AliasingCRs=1; endif; @@ -327,19 +330,19 @@ comp_bonds = CBG.bonds(bond_list,:).*direction; ## disp(["---- ", field, " ---"]); if AliasingArguments # Alias the args list if appropriate - message = sprintf("\tfor component %s (%s) within %s",\ + message = sprintf("\tfor component %s (%s) within %s", ... comp_name,subsystem.type,full_name); if isfield(CBG,"alias") subsystem.arg = alias_args(subsystem.arg,CBG.alias,";",message,infofilenum,full_name); endif; endif; if AliasingCRs # Alias the CR list if appropriate - message = sprintf("\tfor component %s (%s) within %s",\ + message = sprintf("\tfor component %s (%s) within %s", ... comp_name,subsystem.type,full_name); if isfield(CBG,"alias") subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name); endif; endif; @@ -416,77 +419,77 @@ "\n\t%s Equations linking up subsystem %s (%s)\n\n", ... pc, comp_name, subsystem.type); if (k>1) name_comp_name = sprintf("%s%s%s%s%d", ... - full_name_repetition, sub_delim, \ + full_name_repetition, sub_delim, ... comp_name, sub_delim, k); else name_comp_name = sprintf("%s%s%s", ... - full_name_repetition, sub_delim, \ + full_name_repetition, sub_delim, ... comp_name); endif - printf("\n\t%s Equations linking up subsystem %s (%s)\n\n",\ + printf("\n\t%s Equations linking up subsystem %s (%s)\n\n", ... pc, comp_name, subsystem.type); u_index = 0; y_index = 0; ## Count the inputs and outputs for port_number=1:length(bond_list) repetition,port_number port_bond_number = bond_list(port_number) -# this_bond_effort_unit = \ +# this_bond_effort_unit = ... # deblank(bond_effort_unit(port_bond_number,:)) -# this_bond_flow_unit = \ +# this_bond_flow_unit = ... # deblank(bond_flow_unit(port_bond_number,:)); # ## Extract the unit/domain stuff # this_port_name = subABG.portlist(port_number,:); -# eval(sprintf("this_port = subABG.ports.%s;", \ +# eval(sprintf("this_port = subABG.ports.%s;", ... # this_port_name)); # if isfield(this_port,"units") -# eval(["effort_unit = \ +# eval(["effort_unit = ... # subABG.ports.",this_port_name,".units.effort;"]); -# eval(["flow_unit = \ +# eval(["flow_unit = ... # subABG.ports.",this_port_name,".units.flow;"]); # else # effort_unit = "none"; # flow_unit = "none"; # endif # ## and check consistency # ## Efforts # if strcmp(this_bond_effort_unit,"null") # set -# bond_effort_unit = \ +# bond_effort_unit = ... # [bond_effort_unit(1:port_bond_number-1,:) # effort_unit # bond_effort_unit(port_bond_number+1:n_bonds,:) # ] # elseif (!strcmp(this_bond_effort_unit,"none") && !strcmp(effort_unit,"none")) # check -# mtt_info(sprintf(unit_info,full_name, effort_unit, \ +# mtt_info(sprintf(unit_info,full_name, effort_unit, ... # this_bond_effort_unit), infofilenum); # if !strcmp(this_bond_effort_unit,effort_unit) -# error_string = sprintf(unit_error, full_name,\ -# effort_unit, \ +# error_string = sprintf(unit_error, full_name, ... +# effort_unit, ... # this_bond_effort_unit); # mtt_error(error_string); # endif # endif # ## Flows # if strcmp(this_bond_flow_unit,"null") # set -# bond_flow_unit = \ +# bond_flow_unit = ... # [bond_flow_unit(1:port_bond_number-1,:) # flow_unit # bond_flow_unit(port_bond_number+1:n_bonds,:) # ] # elseif (!strcmp(this_bond_flow_unit,"none") && !strcmp(flow_unit,"none")) # check -# mtt_info(sprintf(unit_info,full_name, flow_unit, \ +# mtt_info(sprintf(unit_info,full_name, flow_unit, ... # this_bond_flow_unit), infofilenum); # if !strcmp(this_bond_flow_unit,flow_unit) -# error_string = sprintf(unit_error, full_name,\ -# flow_unit, \ +# error_string = sprintf(unit_error, full_name, ... +# flow_unit, ... # this_bond_flow_unit); # mtt_error(error_string); # endif # endif @@ -562,11 +565,11 @@ cause_name = cause2name(-comp_bonds(k,1)); endif fprintf(structure_file, ... "%s\t%i\t%s\t%s%s%s\t%i\t%s\n", ... structure_name(which_index,:), value-k+1, ... - comp_name, full_name_repetition, sub_delim, comp_name, \ + comp_name, full_name_repetition, sub_delim, comp_name, ... repetition, cause_name); endfor; endfor; endif; endif Index: mttroot/mtt/bin/trans/m/ibg2abg.m ================================================================== --- mttroot/mtt/bin/trans/m/ibg2abg.m +++ mttroot/mtt/bin/trans/m/ibg2abg.m @@ -1,8 +1,8 @@ ## -*-octave-*- -function [bonds,components,n_vector_bonds] = \ +function [bonds,components,n_vector_bonds] = ... ibg2abg(name,bonds,infofile,errorfile) ## write useful quantity of data to log struct_levels_to_print(6); @@ -156,29 +156,29 @@ eval(sprintf("comp.%s = bond;", bond_name)); endfor ## attach labels to unlabelled ports if (n_named_ports == 0) - mtt_info(sprintf("Defaulting all ports on junction %s to 'in'", \ + mtt_info(sprintf("Defaulting all ports on junction %s to 'in'", ... comp_name), infofile); for [bond, bond_name] = comp if (index(bond_name, "bond") == 1) bond.label = "in"; endif eval(sprintf("comp.%s = bond;", bond_name)); endfor elseif (n_named_ports == 1) - mtt_info(sprintf("Defaulting all ports on junction %s to %s", \ + mtt_info(sprintf("Defaulting all ports on junction %s to %s", ... comp_name, port_label), infofile); for [bond, bond_name] = comp if (index(bond_name, "bond") == 1) bond.label = port_label; endif eval(sprintf("comp.%s = bond;", bond_name)); endfor elseif (n_named_ports != comp.n_bonds) - mtt_error(sprintf("Junction must have 0,1 or %i port labels", \ + mtt_error(sprintf("Junction must have 0,1 or %i port labels", ... comp.n_bonds), errorfile); endif else ## component is not a junction Index: mttroot/mtt/bin/trans/m/mtt_alias.m ================================================================== --- mttroot/mtt/bin/trans/m/mtt_alias.m +++ mttroot/mtt/bin/trans/m/mtt_alias.m @@ -9,11 +9,11 @@ filenum = -1; # No file number for messages [Name,name] = mtt_subname(fullname); # Split fullname if (length(args)==0) - mtt_info(sprintf("No arguments given so no argument aliasing done for system %s",\ + mtt_info(sprintf("No arguments given so no argument aliasing done for system %s", ... fullname)); return endif ## Info for component and surrounding subsystem Index: mttroot/mtt/bin/trans/m/mtt_component_eqn.m ================================================================== --- mttroot/mtt/bin/trans/m/mtt_component_eqn.m +++ mttroot/mtt/bin/trans/m/mtt_component_eqn.m @@ -1,6 +1,6 @@ -function [known] = mtt_component_eqn (fullname, port, causality, \ +function [known] = mtt_component_eqn (fullname, port, causality, ... known, Cbg) ## function [known] = mtt_component_eqn (fullname, port, causality, known) ## ## Recursively finds the equations giving the signal of specified @@ -72,11 +72,11 @@ else # Get name and find equation name = deblank(cbg.portlist(port,:)); if DEBUG disp("----> lower-level system") endif - known = mtt_component_eqn (mtt_fullname(Name,name), 1, \ + known = mtt_component_eqn (mtt_fullname(Name,name), 1, ... causality, known, cbg); return endif endif @@ -100,11 +100,11 @@ name_port_cause = sprintf("%s_%i_%s",name, port, cause); full_name_port_cause = mtt_fullname(Name,name_port_cause); ## If value is known, don't do anything. if findstr(sprintf(" %s ", full_name_port_cause), known)>0 - eqn = sprintf("%s The %s signal on port %i of %s is known already", \ + eqn = sprintf("%s The %s signal on port %i of %s is known already", ... CD, causality, port, name); return else # Add to list known = sprintf("%s %s", known, full_name_port_cause); endif @@ -136,14 +136,14 @@ ## List of component bond causality (component-orientated causality) comp_bonds = bonds(bond_list,:).*directions; # Component bonds ## What components are at the other ends of the in bonds? ## Effort - [in_e_bonds,in_e_components,in_e_ports,N_e] = mtt_component_inputs \ + [in_e_bonds,in_e_components,in_e_ports,N_e] = mtt_component_inputs ... (name,comp_type,causality,"effort",comp_bonds,connections,cbg); ## Flow - [in_f_bonds,in_f_components,in_f_ports,N_f] = mtt_component_inputs \ + [in_f_bonds,in_f_components,in_f_ports,N_f] = mtt_component_inputs ... (name,comp_type,causality,"flow",comp_bonds,connections,cbg); ##Composite values N_ef = N_e + N_f; @@ -194,11 +194,11 @@ if DEBUG disp("----> higher level system") endif - known = mtt_component_eqn (mtt_fullname(new_Name,in_name), \ + known = mtt_component_eqn (mtt_fullname(new_Name,in_name), ... in_port, causality, known, cbg); LHS = Source_seqn ("external",Name); RHS = varname(NAME, abs(in_bond), i_cause); eqn = sprintf("%s%s%s := %s;", LHS, SD, name, RHS); @@ -211,19 +211,19 @@ endif ## Handle special components if strcmp(comp_type,"0")||strcmp(comp_type,"1") # Junctions - [eqn,insigs,innames] = junction_seqn (comp_type,Name, outsig, \ + [eqn,insigs,innames] = junction_seqn (comp_type,Name, outsig, ... insigs, innames); else # Everything else if exist(sprintf("%s_cause", comp_type)) # Simple component ## Do the equations - [eqn,insigs,innames] = eval(sprintf("%s_seqn (Name, name, cr, \ - arg, outsig, \ - insigs, \ - innames, is_port_output);", \ + [eqn,insigs,innames] = eval(sprintf("%s_seqn (Name, name, cr, ... + arg, outsig, ... + insigs, ... + innames, is_port_output);", ... comp_type)); ## Resolve CR eqn = mtt_resolve_cr(eqn); else # Compound component @@ -241,18 +241,18 @@ if DEBUG disp("----> same-level subsystem") endif - [known] = mtt_component_eqn \ + [known] = mtt_component_eqn ... (mtt_fullname(new_Name,new_name), port, causality, known, cbg); endif endif - comment = \ - sprintf("%s Equation for %s signal on port %i of %s (%s), subsystem %s.", \ + comment = ... + sprintf("%s Equation for %s signal on port %i of %s (%s), subsystem %s.", ... CD, causality, port, name, comp_type, Name); if DEBUG disp(sprintf("%s\n%s",comment, eqn)); endif @@ -274,12 +274,12 @@ if DEBUG disp("----> same-level component") endif - [known] = mtt_component_eqn \ - (mtt_fullname(Name,other_name), other_port, other_causality, \ + [known] = mtt_component_eqn ... + (mtt_fullname(Name,other_name), other_port, other_causality, ... known, cbg); endfor endif ## Write this signal Index: mttroot/mtt/bin/trans/m/mtt_component_inputs.m ================================================================== --- mttroot/mtt/bin/trans/m/mtt_component_inputs.m +++ mttroot/mtt/bin/trans/m/mtt_component_inputs.m @@ -1,6 +1,6 @@ -function [in_bonds,in_components,in_ports,N] = mtt_component_inputs \ +function [in_bonds,in_components,in_ports,N] = mtt_component_inputs ... (name,comp_type, out_causality, causality,comp_bonds,bond_list,cbg) ## usage: [in_bonds,in_components,in_ports,N] = mtt_component_inputs ## (name,comp_type, out_causality, causality,comp_bonds,bond_list,cbg) ## Index: mttroot/mtt/bin/trans/m/mtt_stime.m ================================================================== --- mttroot/mtt/bin/trans/m/mtt_stime.m +++ mttroot/mtt/bin/trans/m/mtt_stime.m @@ -36,14 +36,14 @@ endfor ## Run system and replace NaN by 1e30 -- easier to handle file_name = sprintf("%s_input.dat", system_name); if exist(file_name)==2 # Then use data from this file ... - command = sprintf("./%s_ode2odes.out %s < %s | sed \'s/NAN/Inf/g\' >mtt_out_data.dat\n", \ + command = sprintf("./%s_ode2odes.out %s < %s | sed \'s/NAN/Inf/g\' >mtt_out_data.dat\n", ... system_name, args, file_name); else - command = sprintf("./%s_ode2odes.out %s | sed \'s/NAN/Inf/g\' >mtt_out_data.dat\n", \ + command = sprintf("./%s_ode2odes.out %s | sed \'s/NAN/Inf/g\' >mtt_out_data.dat\n", ... system_name, args); endif system(command); Index: mttroot/mtt/bin/trans/m/printcr.m ================================================================== --- mttroot/mtt/bin/trans/m/printcr.m +++ mttroot/mtt/bin/trans/m/printcr.m @@ -13,10 +13,13 @@ ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ +## ## Revision 1.2 2003/01/07 09:11:53 gawthrop +## ## Octavised +## ## ## ## Revision 1.1 1998/07/25 09:47:43 peterg ## ## Initial revision ## ## ## ############################################################### @@ -29,11 +32,11 @@ ## Find the number of ports ports = length(RHS_cause); ## Print the CR if length(cr) == 0 # No CR given - use unity CR - fprintf(eqnfile, "%s;\n", varname(name,bond_number(outport), \ + fprintf(eqnfile, "%s;\n", varname(name,bond_number(outport), ... RHS_cause(outport))); else # CR exists fprintf(eqnfile, "%s(%s", cr, name); # The CR name and component type if ports>1 # Multi ports - port no. is first arg of CR fprintf(eqnfile, "#1.0f,", outport); Index: mttroot/mtt/bin/trans/m/rbg2abg.m ================================================================== --- mttroot/mtt/bin/trans/m/rbg2abg.m +++ mttroot/mtt/bin/trans/m/rbg2abg.m @@ -1,14 +1,17 @@ -function [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,\ - port_coord,port_name,\ +function [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents, ... + port_coord,port_name, ... infofile,errorfile) ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ + ## ## Revision 1.51 2012/10/15 19:22:44 geraint + ## ## mtt_isunique replaces unique which masks a built-in function. + ## ## ## ## Revision 1.50 2009/11/02 16:54:03 geraint ## ## Replaced deprecated functions from Octave 2.1 for Octave 3.0: is_struct -> isstruct, struct_contains -> isfield, struct_elements -> fieldnames, is_complex -> iscomplex, setstr -> char ## ## ## ## Revision 1.49 2004/07/22 13:18:02 geraint ## ## Minor typo in error message. @@ -349,30 +352,30 @@ endif elseif (unlabelled_ports==2) if port_direction>0 if (++in_bonds>1) - mtt_error(["More than one unlabelled INport on component " \ + mtt_error(["More than one unlabelled INport on component " ... comp_name " (" comp_type ")"],errorfile); else port_name_i = "in"; end else if (++out_bonds>1) - mtt_error(["More than one unlabelled OUTport on component " \ + mtt_error(["More than one unlabelled OUTport on component " ... comp_name " (" comp_type ")"],errorfile); else port_name_i = "out"; end endif else - mtt_error(["More than two unlabelled ports on component " \ + mtt_error(["More than two unlabelled ports on component " ... comp_name " (" comp_type ")"],errorfile); endif - mtt_info(["Defaulting port name [" port_name_i "]\t on component " \ + mtt_info(["Defaulting port name [" port_name_i "]\t on component " ... comp_name " (" comp_type ")" ],infofile); port_name = [port_name; ["[" port_name_i "]"]]; # add to list [port_name_index,junk] = size(port_name); # the corresponding # index port_bond(port_name_index,:) = signed_bond; # add to port bond @@ -386,14 +389,14 @@ ## Replace by alias -- if any eval( ["alias = ", comp_type, '_alias';]); # Get aliases if isstruct(alias) # are there any aliases if isfield(alias,port_name_i) # Is this an alias? eval(["new_port_name_i = alias.",port_name_i]); - mtt_info(["Aliasing name [" port_name_i "]\t on component " \ + mtt_info(["Aliasing name [" port_name_i "]\t on component " ... comp_name " (" comp_type ")\t to [" new_port_name_i "]"],infofile); - port_name = replace_name(port_name, \ - ["[",new_port_name_i,"]"], \ + port_name = replace_name(port_name, ... + ["[",new_port_name_i,"]"], ... port_name_index); endif endif @@ -401,11 +404,11 @@ endif endfor - ## At this point, every port should be labeled (port_name) and \ + ## At this point, every port should be labeled (port_name) and ... ## associated with a bond (port_bond). disp("--- Completed portnames and the corresponding bonds ---") port_name, port_bond @@ -592,11 +595,11 @@ subport_list=""; for p=1:n_comp_ports # Expand any vector ports [subport,n_sub] = split_port(port_list(p,:), ','); # Find the components # of the vector port if n_sub>1 - mtt_info(sprintf("Expanding vector port %s of component type %s",\ + mtt_info(sprintf("Expanding vector port %s of component type %s", ... port_list(p,:), comp_type, infofile)); endif subport_list = [subport_list; subport]; endfor @@ -654,11 +657,11 @@ ##Write out the signed bond list in the correct order unsorted_port_list [n_list,m_list] = size(unsorted_port_list); if n_list!=n_comp_bonds - error(sprintf("Component %s (%s) has %i bonds but %i port labels",\ + error(sprintf("Component %s (%s) has %i bonds but %i port labels", ... comp_name, comp_type, n_comp_bonds, n_list)) endif for j = 1:n_comp_bonds j Index: mttroot/mtt/bin/trans/m/rbg2ibg.m ================================================================== --- mttroot/mtt/bin/trans/m/rbg2ibg.m +++ mttroot/mtt/bin/trans/m/rbg2ibg.m @@ -1,9 +1,9 @@ ## -*-octave-*- -function [bonds] = \ - rbg2ibg(name,rbonds,rstrokes,rcomponents,port_coord,port_name, \ +function [bonds] = ... + rbg2ibg(name,rbonds,rstrokes,rcomponents,port_coord,port_name, ... infofile, errorfile) rbonds rstrokes rcomponents @@ -49,13 +49,13 @@ distance_1 = length2d(other_end_1 - arrow_end); distance_2 = length2d(other_end_2 - arrow_end); which_end = (distance_1 > distance_2) * [1, 1]; one = ones(size(which_end)); - other_end = which_end .* other_end_1 + (one - which_end) .* \ + other_end = which_end .* other_end_1 + (one - which_end) .* ... other_end_2; - arrow_vector = (which_end .* other_end_2 + (one - which_end) .* \ + arrow_vector = (which_end .* other_end_2 + (one - which_end) .* ... other_end_1) - arrow_end; ## Locate bond end nearest each port ## col 1 of port_near_bond contains a signed bond number (+ for arrow ## end) @@ -64,13 +64,13 @@ for i = 1:n_ports near_bond = adjbond(port_coord(i,1:2), arrow_end, other_end); [rows,cols] = size(near_bond); if (rows > 1) error(sprintf ... - ("A port is near to more than one bond at coordinates \ + ("A port is near to more than one bond at coordinates ... %g,%g %s\n", ... - port_coord(i,1)/scale, port_coord(i,2)/scale, \ + port_coord(i,1)/scale, port_coord(i,2)/scale, ... deblank(port_name(i,:)))); endif ## The (signed) bond corresponding to the ith port label port_bond(i,1) = near_bond(1) * sign(1.5 - near_bond(2)); @@ -83,23 +83,23 @@ eval(sprintf('bond_port_head%i = "[]"', i)) eval(sprintf('bond_port_tail%i = "[]"', i)) endfor for i = 1:n_ports if (port_bond(i) > 0) - eval(sprintf('bond_port_head%i = "%s"', port_bond(i), \ + eval(sprintf('bond_port_head%i = "%s"', port_bond(i), ... deblank(port_name(i,:)))) else - eval(sprintf('bond_port_tail%i = "%s"', -port_bond(i), \ + eval(sprintf('bond_port_tail%i = "%s"', -port_bond(i), ... deblank(port_name(i,:)))) endif endfor ## Locate the components at the ends of each bond ## col 1 of comp_near_bond contains component nearest to the arrow end ## col 2 of comp_near_bond contains component nearest other end for i = 1:n_bonds - comp_near_bond(i,:) = adjcomp(arrow_end(i,:), other_end(i,:), \ + comp_near_bond(i,:) = adjcomp(arrow_end(i,:), other_end(i,:), ... rcomponents); endfor comp_near_bond ## Deduce causality from the strokes (if any) @@ -121,18 +121,18 @@ ## Find the nearest bond end [index,distance] = adjbond(stroke(1,:),arrow_end,other_end); if (distance > (2 * stroke_length(i))) info = sprintf('Stroke at (%4.3f,%4.3f) is %4.3f away from the nearest bond\n', ... - stroke(1,1)/scale, stroke(1,2)/scale, \ + stroke(1,1)/scale, stroke(1,2)/scale, ... distance/scale); endif ## Bond end coordinates j = index(1,1); which_end = (index(1,2) == 1); - bond_end = arrow_end(j,:) * which_end + other_end(j,:) * (1 - \ + bond_end = arrow_end(j,:) * which_end + other_end(j,:) * (1 - ... which_end); ## Now decide which bit of the stroke is nearest stroke_index = adjbond(bond_end, stroke, zeros(size(stroke))); @@ -150,13 +150,13 @@ ## Write data for i = 1:n_bonds [hc_type, hc_name] = eval([name, '_cmp(comp_near_bond(i,1))']); [tc_type, tc_name] = eval([name, '_cmp(comp_near_bond(i,2))']); ## components - eval(sprintf("bonds.bond%i.head.component\t= '%s:%s'", i, hc_type, \ + eval(sprintf("bonds.bond%i.head.component\t= '%s:%s'", i, hc_type, ... hc_name)); - eval(sprintf("bonds.bond%i.tail.component\t= '%s:%s'", i, tc_type, \ + eval(sprintf("bonds.bond%i.tail.component\t= '%s:%s'", i, tc_type, ... tc_name)); ## ports eval(sprintf("bonds.bond%i.head.ports\t= bond_port_head%i", i, i)); eval(sprintf("bonds.bond%i.tail.ports\t= bond_port_tail%i", i, i)); ## causality Index: mttroot/mtt/bin/trans/m/subs_arg.m ================================================================== --- mttroot/mtt/bin/trans/m/subs_arg.m +++ mttroot/mtt/bin/trans/m/subs_arg.m @@ -15,10 +15,13 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ +% %% Revision 1.7 2001/07/03 22:59:10 gawthrop +% %% Fixed problems with argument passing for CRs +% %% % %% Revision 1.6 1998/07/27 09:53:44 peterg % %% No change % %% % %% Revision 1.5 1998/07/21 16:43:26 peterg % %% Now writes to an explicit fileID - otherwise we may run out of IDs. @@ -78,13 +81,13 @@ if strcmp(arg_out,'') info = sprintf(message, ... i, comp_name, comp_type, full_name, default); arg_out = default; else - info = sprintf("Replacing $%i \t by %s for component %s (%s) \ + info = sprintf("Replacing $%i \t by %s for component %s (%s) ... within %s", i, arg_out, comp_name, comp_type, full_name); end; mtt_info(info,fileID); args_out = [args_out, arg_out]; end; end; end; Index: mttroot/mtt/bin/trans/m/write_ibg.m ================================================================== --- mttroot/mtt/bin/trans/m/write_ibg.m +++ mttroot/mtt/bin/trans/m/write_ibg.m @@ -11,31 +11,31 @@ format_ce = " %s.bonds.bond%i.causality.effort\t= \"%s\";\n"; format_cf = " %s.bonds.bond%i.causality.flow\t= \"%s\";\n"; fprintf(fid, "## -*-octave-*-\n\n"); fprintf(fid, "function [%s] = %s_ibg\n\n", system_name, system_name); - fprintf(fid, " ## Intermediate bond graph representation of %s\n", \ + fprintf(fid, " ## Intermediate bond graph representation of %s\n", ... system_name); fprintf(fid, " ## Generated by MTT on %s\n", ctime(time)); fprintf(fid, " ## head refers to the harpoon end of a bond\n"); fprintf(fid, " ## tail refers to the other end of a bond\n"); fprintf(fid, " ## causality.? is the end at which ? is imposed\n\n"); for i=1:nbonds fprintf(fid, "\n ## bond %i\n", i); - fprintf(fid, format_hc, system_name, i, \ + fprintf(fid, format_hc, system_name, i, ... eval(sprintf("bonds.bond%i.head.component", i))); - fprintf(fid, format_tc, system_name, i, \ + fprintf(fid, format_tc, system_name, i, ... eval(sprintf("bonds.bond%i.tail.component", i))); - fprintf(fid, format_hp, system_name, i, \ + fprintf(fid, format_hp, system_name, i, ... eval(sprintf("bonds.bond%i.head.ports", i))); - fprintf(fid, format_tp, system_name, i, \ + fprintf(fid, format_tp, system_name, i, ... eval(sprintf("bonds.bond%i.tail.ports", i))); - fprintf(fid, format_ce, system_name, i, \ + fprintf(fid, format_ce, system_name, i, ... eval(sprintf("bonds.bond%i.causality.effort", i))); - fprintf(fid, format_cf, system_name, i, \ + fprintf(fid, format_cf, system_name, i, ... eval(sprintf("bonds.bond%i.causality.flow", i))); endfor; fprintf(fid, "\nendfunction\n"); fclose(fid);