Differences From Artifact [78e9f9a094]:

To Artifact [23f6a7ee0b]:


13
14
15
16
17
18
19



20
21
22
23
24
25
26
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$



% %% Revision 1.17  1997/08/07 16:10:13  peterg
% %% Move the if status ..  to the beginning of the main loop.
% %%
% %% Revision 1.16  1997/08/04 13:11:19  peterg
% %% Only change to component-orientated causality for simple components
% %% NOT for compound components.
% %%







>
>
>







13
14
15
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.18  1997/08/08 08:11:04  peterg
% %% Suppress compoment trace.
% %%
% %% Revision 1.17  1997/08/07 16:10:13  peterg
% %% Move the if status ..  to the beginning of the main loop.
% %%
% %% Revision 1.16  1997/08/04 13:11:19  peterg
% %% Only change to component-orientated causality for simple components
% %% NOT for compound components.
% %%
124
125
126
127
128
129
130

131
132
133
134
135
136
137
  bonds = [];
  status = [];
  return
end;

% Evaluate the system function to get the bonds and number of ports
eval(['[bonds,components,n_ports]=', fun_name, ';']);


% Find number of bonds
[n_bonds,columns] = size(bonds);
if (columns ~= 2)&(n_bonds>0)
  error('Incorrect bonds matrix: must have 2 columns');
end;








>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
  bonds = [];
  status = [];
  return
end;

% Evaluate the system function to get the bonds and number of ports
eval(['[bonds,components,n_ports]=', fun_name, ';']);


% Find number of bonds
[n_bonds,columns] = size(bonds);
if (columns ~= 2)&(n_bonds>0)
  error('Incorrect bonds matrix: must have 2 columns');
end;

156
157
158
159
160
161
162


163

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
               full_name, n_port_bonds, n_ports), infofile);

  else % Copy the port bonds & status
    j = abs(components(1:n_ports,1)); %relevant bond numbers
    bonds(j,:) = port_bonds;
    status(1:n_ports) = port_status;
  end


end;


% Causality indicator
total = 2*n_bonds;
done = sum(sum(abs(bonds)))/total*100;

% Outer while loop sets preferred causality
ci_index=1; 

while( ci_index>0)
  old_done = inf;
  % Inner loop propagates causality
  while done~=old_done
   % disp(sprintf('Causality is %3.0f%s complete.', done, pc));
    old_done = done;
  
    for i = 1:n_components
      if status(i) ~= 0 % only do this if causality not yet complete

	% Get the bonds on this component
	comp = nozeros(components(i,:))
	bond_list = abs(comp)
	direction = sign(comp)'*[1 1]
        n_bonds = length(bond_list);

	% Get the component details
	eval([ '[comp_type,name,cr,arg] = ', system_type, '_cmp(i);' ]);

	% Change name of 0 and 1 components -- matlab doesn't like numbers here
	if strcmp(comp_type,'0')







>
>

>















|




|
|







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
               full_name, n_port_bonds, n_ports), infofile);

  else % Copy the port bonds & status
    j = abs(components(1:n_ports,1)); %relevant bond numbers
    bonds(j,:) = port_bonds;
    status(1:n_ports) = port_status;
  end
else
  n_port_bonds=0;
end;
bonds,port_bonds

% Causality indicator
total = 2*n_bonds;
done = sum(sum(abs(bonds)))/total*100;

% Outer while loop sets preferred causality
ci_index=1; 

while( ci_index>0)
  old_done = inf;
  % Inner loop propagates causality
  while done~=old_done
   % disp(sprintf('Causality is %3.0f%s complete.', done, pc));
    old_done = done;
  
    for i = n_port_bonds+1:n_components
      if status(i) ~= 0 % only do this if causality not yet complete

	% Get the bonds on this component
	comp = nozeros(components(i,:))
	bond_list = abs(comp);
	direction = sign(comp)'*[1 1];
        n_bonds = length(bond_list);

	% Get the component details
	eval([ '[comp_type,name,cr,arg] = ', system_type, '_cmp(i);' ]);

	% Change name of 0 and 1 components -- matlab doesn't like numbers here
	if strcmp(comp_type,'0')

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