Overview
Comment:Now uses number of components with complete causality to measure
progress of algorithm -- Done.
This replaces bond count -- done.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d7c2bf278ac5372c8a5981ce69a62cdef2c8230c04e3d31c28066b8339f28fa6
User & Date: gawthrop@users.sourceforge.net on 1998-12-03 14:55:40
Other Links: branch diff | manifest | tags
Context
1998-12-03
16:21:27
Initial revision check-in: f9dda3faa0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:55:40
Now uses number of components with complete causality to measure
progress of algorithm -- Done.
This replaces bond count -- done.
check-in: d7c2bf278a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-11-30
10:47:53
Added extra a_a and a_b aliases check-in: cc40783ea6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/abg2cbg.m from [d2cff795a1] to [bdedc69a24].

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.40  1998/09/02 11:47:09  peterg
# ## Now uses explicit ordered list of ports instead of port.index.
# ## Note that subsystems are still treated in arbitrary order.
# ##
# ## Revision 1.39  1998/08/25 20:06:16  peterg
# ## Writes flipped port info
# ##







>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## 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
# ## Now uses explicit ordered list of ports instead of port.index.
# ## Note that subsystems are still treated in arbitrary order.
# ##
# ## Revision 1.39  1998/08/25 20:06:16  peterg
# ## Writes flipped port info
# ##
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
    n_port_bonds=0;
  endif
  
# 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, ";"]);
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
name,subsystem
      	    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);







<






|
>
>
>
>
>
>
>




|
|
|



>

|
|







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
    n_port_bonds=0;
  endif
  
# 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, ";"]);
      field,ABG_field
      
      sum_ok = 0; n_comp = 0;
      for [subsystem,name] = ABG_field# Find % status = 0 (causally complete)
    	eval(["ok = (ABG_field.",name,".status==0);"]);
	sum_ok = sum_ok + ok; n_comp ++;
      endfor;
      Done = sum_ok/n_comp*100
      
# 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;
    	old_Done = inf;
	
    	while Done!=old_Done	# Inner loop propagates causality
	  old_Done = Done;
	  for [subsystem,name] = ABG_field
name,subsystem
      	    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);
399
400
401
402
403
404
405
406







407
408
409
410
411
412
413
	    	comp_bonds_out = comp_bonds
	      end;
	      
	      ABG.bonds(bond_list,:) = comp_bonds;# Update the full bonds list
	      eval(["ABG_field.",name,".status = subsystem.status;"]);
    	    end;
	  end;
	  







	  done = sum(sum(abs(ABG.bonds)))/total*100
				#disp(sprintf("Causality is #3.0f#s complete.", done, pc), infofile));
	  
    	endwhile			# done!=old_done
  	
    	[name,prefered] = getdynamic(ABG_field) # Set causality of a C or I which is not already set
    	if prefered==0







|
>
>
>
>
>
>
>







410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
	    	comp_bonds_out = comp_bonds
	      end;
	      
	      ABG.bonds(bond_list,:) = comp_bonds;# Update the full bonds list
	      eval(["ABG_field.",name,".status = subsystem.status;"]);
    	    end;
	  end;

	  sum_ok = 0; n_comp = 0;
	  for [subsystem,name] = ABG_field# Find % status = 0 (causally complete)
    	    eval(["ok = (ABG_field.",name,".status==0);"]);
	    sum_ok = sum_ok + ok; n_comp ++;
	  endfor;

	  Done = sum_ok/n_comp*100
	  done = sum(sum(abs(ABG.bonds)))/total*100
				#disp(sprintf("Causality is #3.0f#s complete.", done, pc), infofile));
	  
    	endwhile			# done!=old_done
  	
    	[name,prefered] = getdynamic(ABG_field) # Set causality of a C or I which is not already set
    	if prefered==0
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
#  endif;
  
				# Print final causality
				#  final_done =  (sum(status==zeros(n_components,1))/n_components)*100;
  
  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,Flipped);







|

|







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
#  endif;
  
				# Print final causality
				#  final_done =  (sum(status==zeros(n_components,1))/n_components)*100;
  
  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,Flipped);


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]