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.52 2004/09/07 18:22:53 geraint
## ## Issues a more helpful error message than the cryptic Octave stuff
## ## if there are unconnected ports.
## ##
## ## Revision 1.51 2004/02/20 20:42:40 geraint
## ## Initialize Flipped.cons with [] instead of "".
## ##
|
>
>
>
|
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.53 2009/11/02 16:54:03 geraint
## ## Replaced deprecated functions from Octave 2.1 for Octave 3.0: is_struct -> isstruct, struct_contains -> isfield, struct_elements -> fieldnames, is_complex -> iscomplex, setstr -> char
## ##
## ## Revision 1.52 2004/09/07 18:22:53 geraint
## ## Issues a more helpful error message than the cryptic Octave stuff
## ## if there are unconnected ports.
## ##
## ## Revision 1.51 2004/02/20 20:42:40 geraint
## ## Initialize Flipped.cons with [] instead of "".
## ##
|
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
mtt_error (sprintf ("abg2cbg: port_bond_direction(%d) does not exist.", i));
exit(1);
end
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
endfor # subsystem = ABG.subsystems
ABG.bonds(bond_index,:) = -ABG.bonds(bond_index,:); # Flip the bond causalities
##(these are arrow-orientated)
|
|
|
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
mtt_error (sprintf ("abg2cbg: port_bond_direction(%d) does not exist.", i));
exit(1);
end
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
endfor # subsystem = ABG.subsystems
ABG.bonds(bond_index,:) = -ABG.bonds(bond_index,:); # Flip the bond causalities
##(these are arrow-orientated)
|