Overview
Comment:Added extra info - current subsystem
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d7b29b20262b686a69dc5856cc636c7dee4a0b624be62e09e7f5a3a8b7c1a401
User & Date: gawthrop@users.sourceforge.net on 1999-11-01 03:17:45
Other Links: branch diff | manifest | tags
Context
1999-11-01
21:20:14
Removed the E matrix from the cse file. check-in: ca241a01ee user: gawthrop@users.sourceforge.net tags: origin/master, trunk
03:17:45
Added extra info - current subsystem check-in: d7b29b2026 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-10-28
05:08:48
Added elseif check-in: 80e1d032bc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/abg2cbg.m from [b751c30fd5] to [0ce9d167d6].

16
17
18
19
20
21
22



23
24
25
26
27
28
29
# [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$



# ## Revision 1.43  1998/12/14 15:19:36  peterg
# ## Added missing "derivative_causality," argument to recursive call of
# ## this function
# ##
# ## Revision 1.42  1998/12/03 14:55:40  peterg
# ## Now uses number of components with complete causality to measure
# ## progress of algorithm -- Done.







>
>
>







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.44  1999/03/11 23:54:11  peterg
# ## Include possibility of vector SS when finding port_bond_index
# ##
# ## Revision 1.43  1998/12/14 15:19:36  peterg
# ## Added missing "derivative_causality," argument to recursive call of
# ## this function
# ##
# ## Revision 1.42  1998/12/03 14:55:40  peterg
# ## Now uses number of components with complete causality to measure
# ## progress of algorithm -- Done.
178
179
180
181
182
183
184


185
186
187
188
189
190
191
# ## Now recursively does causality on subsystems.
# ##
# ## Revision 1.1  1996/08/04 17:55:55  peter
# ## Initial revision
# ##
# ###############################################################



  pc = '%';
  if nargin<1
    system_name = 'no_name';
  end;

  if nargin<4
    port_bonds = [];







>
>







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# ## Now recursively does causality on subsystems.
# ##
# ## Revision 1.1  1996/08/04 17:55:55  peter
# ## Initial revision
# ##
# ###############################################################

  mtt_info(sprintf("\nCompleting causality for subsystem %s", system_name), infofile);

  pc = '%';
  if nargin<1
    system_name = 'no_name';
  end;

  if nargin<4
    port_bonds = [];
277
278
279
280
281
282
283







284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# of the bonds in the encapsulating system -- but not at top level
  Flipped.ports="";Flipped.subs="";Flipped.cons="";
  
  if (n_ports>0)&&(!at_top_level) # Coerce directions
    for i=1:n_ports
      name = deblank(ABG.portlist(i,:)); # Name of this port
      eval(["port = ABG.ports.",name,";"]); # Extract port info







      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"\
			 ,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)
	    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"\
			     ,name,full_name),infofile); # And report
	    endif
	  endfor







>
>
>
>
>
>
>








|







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# of the bonds in the encapsulating system -- but not at top level
  Flipped.ports="";Flipped.subs="";Flipped.cons="";
  
  if (n_ports>0)&&(!at_top_level) # Coerce directions
    for i=1:n_ports
      name = deblank(ABG.portlist(i,:)); # Name of this port
      eval(["port = ABG.ports.",name,";"]); # Extract port info
disp ("----");
i
name
port
port_bond_direction
port.connections

      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"\
			 ,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"\
			     ,name,full_name),infofile); # And report
	    endif
	  endfor
389
390
391
392
393
394
395

396
397
398
399
400
401
402
            	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, ...
							derivative_causality, ...
						    	typefile, infofile, errorfile);
				#	# Create a single status from the status vector s
				#	    if max(abs(s)) == 0 # Causal
				#	      status(i) = 0;







>







401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
            	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;
		
port_bond_direction,comp_bonds
	    	[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;


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