Overview
Comment: | Now does ports as well - fixed string prob by using deblank |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
626aa26982f1f12fd42ed3b8a171df86 |
User & Date: | gawthrop@users.sourceforge.net on 1998-08-25 08:33:29 |
Other Links: | branch diff | manifest | tags |
Context
1998-08-25
| ||
09:15:28 |
Fixed couple of problems with using two copies of the one data stucture: ABG_field and ABG.field Maybe this is conceptually wrong? check-in: 53d7f1424c user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
08:33:29 | Now does ports as well - fixed string prob by using deblank check-in: 626aa26982 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
08:31:42 | Fixed bug - didn't find the ports - use deblank check-in: f359fd304b user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/abg2cbg.m from [dd77400bdc] to [48d9bf68c8].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile) # ############################################################### # ## Version control history # ############################################################### # ## $Id$ # ## $Log$ # ## Revision 1.35 1998/08/24 10:16:32 peterg # ## Coverted to new structure - still needs status sorting. # ## # ## Revision 1.34 1998/08/24 07:35:03 peterg # ## About to go to new abg format. # ## # ## Revision 1.33 1998/07/29 13:36:37 peterg | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile) # ############################################################### # ## Version control history # ############################################################### # ## $Id$ # ## $Log$ # ## Revision 1.36 1998/08/25 06:44:40 peterg # ## Furhter revisions # ## # ## Revision 1.35 1998/08/24 10:16:32 peterg # ## Coverted to new structure - still needs status sorting. # ## # ## Revision 1.34 1998/08/24 07:35:03 peterg # ## About to go to new abg format. # ## # ## Revision 1.33 1998/07/29 13:36:37 peterg |
︙ | ︙ | |||
207 208 209 210 211 212 213 | else [n_subsystems,junk] = size(struct_elements(ABG.subsystems)); endif if struct_contains(ABG,"ports")# Are there any ports? [n_ports,junk] = size(struct_elements(ABG.ports)); port_bond_index=zeros(n_ports,1); | | > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | else [n_subsystems,junk] = size(struct_elements(ABG.subsystems)); endif if struct_contains(ABG,"ports")# Are there any ports? [n_ports,junk] = size(struct_elements(ABG.ports)); port_bond_index=zeros(n_ports,1); for port = ABG.ports # Find indices of the internal # port bonds in correct order port_bond_index(port.index) = port.connections; endfor port_bond_index=abs(port_bond_index); else n_ports = 0; endif |
︙ | ︙ | |||
297 298 299 300 301 302 303 | # bonds,port_bonds # Causality indicator total = 2*n_bonds; done = sum(sum(abs(ABG.bonds)))/total*100; | | | > | | < < | | < < < < | | < | < < | | | < < < | < < < < | | | < | < < | | < | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | # bonds,port_bonds # 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, ";"]); # 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; while( ci_index>0) old_done = inf; while done!=old_done # Inner loop propagates causality old_done = done; for [subsystem,name] = ABG_field 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); direction = sign(comp)'*[1 1]; n_bonds = length(bond_list); if strcmp(subsystem.type,"0") # Change names subsystem.type = "zero"; end; if strcmp(subsystem.type,"1") subsystem.type = "one"; end; cause_name = [subsystem.type, "_cause"];# Component causality procedure name eqn_name = [subsystem.type, "_eqn"]; #Component equation procedure name comp_bonds=[]; # Bonds on this component (arrow-orientated) -- these become the for kk = 1:n_bonds # port bonds on the ith component of this subsystem. comp_bonds(kk,:) = ABG.bonds(bond_list(kk),:); end; if exist(eqn_name)!=2 # Try a compound component # Port status depends on whether the corresponding bonds are # fully causal at this stage. one = ones(n_bonds,1); port_status = (sum(abs(comp_bonds'))'==2*one) - one; port_bond_direction = -sign(subsystem.connections)'; # Direction of bonds if exist(cause_name)==2 # If there is a predefined causality function; use it comp_bonds = comp_bonds.*(port_bond_direction*[1 1]); # Convert from arrow orientated to component orientated causality 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; [comp_bonds,subsystem.status] = abg2cbg(name, subsystem.type, full_name, comp_bonds, port_bond_direction, port_status, ... typefile, infofile, errorfile); # # Create a single status from the status vector s # if max(abs(s)) == 0 # Causal |
︙ | ︙ | |||
441 442 443 444 445 446 447 | if at_top_level mtt_info(sprintf("Final causality of %s is %3.0f%s complete.", ... full_name, done, pc), infofile); if done<100 mtt_error(sprintf("Unable to complete causality"),errorfile); end; | < < < < < < < < < < < < < < < < < < < < < < < < | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | if at_top_level mtt_info(sprintf("Final causality of %s is %3.0f%s complete.", ... full_name, done, pc), infofile); if done<100 mtt_error(sprintf("Unable to complete causality"),errorfile); end; endif # at_top_level disp(["Writing ", full_name]); write_cbg(full_name,system_type,ABG); # Return the port bonds - arrow orientated causality - and the direction status=0; |
︙ | ︙ |