Differences From Artifact [bdedc69a24]:

To Artifact [1e80d94d7f]:


1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





22
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34




+

















+
+
+
+
+







function [port_bonds, status] = abg2cbg(system_name, system_type, full_name,
					port_bonds,
					port_bond_direction,
					port_status,
					derivative_causality,
					typefile, infofile, errorfile)

# abg2cbg - acausal to causal bg conversion
#
#     ###################################### 
#     ##### Model Transformation Tools #####
#     ######################################
# 
# Matlab function  abg2cbg.m
# Acausal bond graph to causal bond graph: mfile format
# [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.42  1998/12/03 14:55:40  peterg
# ## Now uses number of components with complete causality to measure
# ## progress of algorithm -- Done.
# ## This replaces bond count -- done.
# ##
# ## 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.
378
379
380
381
382
383
384

385
386
387
388
389
390
391
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398







+







		  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, ...
							derivative_causality, ...
						    	typefile, infofile, errorfile);
				#	# Create a single status from the status vector s
				#	    if max(abs(s)) == 0 # Causal
				#	      status(i) = 0;
				#	    else
				#	      if max(s) == 1 # At least one component is overcausal
				#	    	status(i) = 1;
430
431
432
433
434
435
436
437




438
439
440
441
442
443
444
437
438
439
440
441
442
443

444
445
446
447
448
449
450
451
452
453
454







-
+
+
+
+







    	[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)
	  ci_bond_index = abs(ci_bond_index);
	  if derivative_causality
	    prefered = -prefered;
	  end;
	  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

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