Overview
Comment:Fixed couple of problems with using two copies of the one data
stucture:

ABG_field and ABG.field

Maybe this is conceptually wrong?

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 53d7f1424c4de6abfb044c7bc172c2093fa62f7d8345042c480de885166c2f27
User & Date: gawthrop@users.sourceforge.net on 1998-08-25 09:15:28
Other Links: branch diff | manifest | tags
Context
1998-08-25
09:22:34
Correctely recognises port SSs its now easy -- they are in there own
field
check-in: 9bb564d123 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
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
Changes

Modified mttroot/mtt/bin/trans/m/abg2cbg.m from [48d9bf68c8] to [d3bc550e93].

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.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







>
>
>







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.37  1998/08/25 08:33:29  peterg
# ## Now does ports as well - fixed string prob by using deblank
# ##
# ## 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
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

  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







>














>







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

  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);

	      if strcmp(subsystem.type,"0") # Change names
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416

417
418
419
420
421
422
423
424
				# and convert from component orientated to arrow orientated causality
            	comp_bonds = comp_bonds.*direction; 
		
	    	comp_bonds_out = comp_bonds
	      end;
	      
	      ABG.bonds(bond_list,:) = comp_bonds;# Update the full bonds list
	      eval(["ABG.subsystems.",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
  	
				# Set causality of a C or I which is not already set
    	[name,prefered] = getdynamic(ABG.subsystems)
    	if prefered==0
	  ci_index=0;
    	else
	  disp("Set causality of a C or I which is not already set")
	  eval(["ci_bond_index = ABG.subsystems.",name,".connections;"]); # Get bonds
	  ci_direction = sign(ci_bond_index);
	  ci_bond_index = abs(ci_bond_index)
	  ABG.bonds(ci_bond_index,1:2) = prefered*ci_direction'*[1 1]
	  eval(["ABG.subsystems.",name,".status=0"]); #set status of the C or I
    	endif
      endwhile			# ( ci_index>0)

    endif				# struct_contains(CBG,field(i,:));
  endfor
#  if n_ports>0
#    status(1:n_ports) = zeros(n_ports,1); # Port status not relevant
#  endif;
  
				# Print final causality
				#  final_done =  (sum(status==zeros(n_components,1))/n_components)*100;







|








|
<




|






>
|







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409

410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
				# and convert from component orientated to arrow orientated causality
            	comp_bonds = comp_bonds.*direction; 
		
	    	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
	  ci_index=0;
    	else
	  disp("Set causality of a C or I which is not already set")
	  eval(["ci_bond_index = ABG.",field,".",name,".connections;"]); # Get bonds
	  ci_direction = sign(ci_bond_index);
	  ci_bond_index = abs(ci_bond_index)
	  ABG.bonds(ci_bond_index,1:2) = prefered*ci_direction'*[1 1]
	  eval(["ABG.subsystems.",name,".status=0"]); #set status of the C or I
    	endif
      endwhile			# ( ci_index>0)
      eval(["ABG.",field," = ABG_field;"]); # Copy back to actual structure
    endif			# struct_contains(CBG,field(i,:));
  endfor
#  if n_ports>0
#    status(1:n_ports) = zeros(n_ports,1); # Port status not relevant
#  endif;
  
				# Print final causality
				#  final_done =  (sum(status==zeros(n_components,1))/n_components)*100;


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