1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
+
+
+
|
function [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,infofile)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.21 1997/09/16 15:14:14 peterg
% %% Added warning if a component has no bonds.
% %%
% %% Revision 1.20 1997/08/18 19:39:48 peterg
% %% Now generates (exampaded) port_bond list correctely
% %%
% %% Revision 1.19 1997/08/14 11:59:47 peterg
% %% Vector ports added!!
% %%
% %% Revision 1.18 1997/08/14 11:01:42 peterg
|
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
+
+
+
+
+
+
+
|
mtt_info(sprintf("Component %s (%s) has no bonds", comp_name,
comp_type),infofile);
end;
% Create the signed list of bonds on this component
one = ones(n_comp_bonds,1);
bond_list = index(:,1); % bond at component
% Check that all bonds are unique -- error if not
if unique(bond_list)==0
mtt_info(sprintf("Component %s (%s) is at both ends of a bond", comp_name,
comp_type),infofile);
end;
bond_end = index(:,2); % which end of bond at component?
direction = -sign(bond_end-1.5*one);
signed_bond_list = bond_list.*direction;
components = add_bond(components,signed_bond_list',i);
end;
components
|
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
|
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
|
comp_type = 'zero';
end
if comp_type=='1'
comp_type = 'one';
end
%Find the port list for this component
if exist([comp_type, '_cause'])==0
eval(['[junk1,junk2,junk3,junk4,junk5,port_list]=', comp_type, '_rbg;']);
else
port_list=comp_ports(comp_type);
end;
% Find the (unsorted) bond list on this component
signed_bond_list = nozeros(components(i,:));
n_comp_bonds = length(signed_bond_list);
direction = sign(signed_bond_list);
%Find the port list for this component
if exist([comp_type, '_cause'])==0
eval(['[junk1,junk2,junk3,junk4,junk5,port_list]=', comp_type, '_rbg;']);
else
port_list=comp_ports(comp_type,n_comp_bonds);
end;
% Check that number of bonds on the component is the same as the number of
% ports
[n_comp_ports,m_comp_ports] = size(port_list);
if (n_comp_ports~=n_comp_bonds) & ...
~(strcmp(comp_type,'zero')|strcmp(comp_type,'one'))
message=sprintf('Component %s (%s) has %1.0f impinging bonds but has %1.0f ports', ...
comp_name,comp_type,n_comp_bonds,n_comp_ports);
|
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
-
+
|
%end;
unsorted_port_list = port_list;
end;
%Two port defaults
if (n_comp_bonds==2)&(n_unsorted_ports==0)
if direction(1)==direction(2) % Wrong way for default
mtt_info(['Two-port ', comp_name, ' (', comp_type, ') does not have though-pointing arrows'], infofile);
mtt_info(['Two-port ', comp_name, ' (', comp_type, ') does not have through-pointing arrows'], infofile);
end;
if direction(1)==1 %in
% mtt_info([comp_name, ' in'],infofile);
unsorted_port_list = ['in';'out'];
else %reverse the order
% mtt_info([comp_name, ' out'],infofile);
unsorted_port_list = ['out';'in'];
|